# HG changeset patch # User hgs # Date 1286563243 -3600 # Node ID 79dd3e2336a0e73686a51438489ce4cedbc8c9e1 2010wk36_01 diff -r 000000000000 -r 79dd3e2336a0 devsound/a3fsrvstart/group/a3fserverstart.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/a3fsrvstart/group/a3fserverstart.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef A3FSERVERSTART_IBY +#define A3FSERVERSTART_IBY + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// DevSound framework dlls +file=ABI_DIR\BUILD_DIR\mmfaudioserverstart.exe System\Libs\mmfaudioserverstart.exe + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#endif // A3FSERVERSTART_IBY diff -r 000000000000 -r 79dd3e2336a0 devsound/a3fsrvstart/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/a3fsrvstart/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2009 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: +// + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +./a3fserverstart.iby /epoc32/rom/include/a3fserverstart.iby + +PRJ_MMPFILES +../mmpfiles/mmfaudioserverstart.mmp + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// End of file diff -r 000000000000 -r 79dd3e2336a0 devsound/a3fsrvstart/group/multimedia_a3f_serverstart.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/a3fsrvstart/group/multimedia_a3f_serverstart.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,16 @@ +#multimedia_a3f_serverstart.mrp +# +#Copyright (c) Symbian Software Ltd 2008. All rights reserved. +# + +component multimedia_a3f_serverstart + +source \sf\os\mm\devsound\a3fsrvstart + +binary \sf\os\mm\devsound\a3fsrvstart\group all + +exports \sf\os\mm\devsound\a3fsrvstart\group + +notes_source \component_defs\release.src + +ipr E diff -r 000000000000 -r 79dd3e2336a0 devsound/a3fsrvstart/mmpfiles/mmfaudioserverstart.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/a3fsrvstart/mmpfiles/mmfaudioserverstart.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2009 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 // get the UID +#include +TARGET mmfaudioserverstart.exe +CAPABILITY MultimediaDD DRM ProtServ UserEnvironment +TARGETTYPE exe +UNPAGED + +UID KSharedLibraryUidDefine KUidA3fAudioServerUID + +VENDORID 0x70000001 +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +SOURCEPATH ../src/mmfaudioserverstart +SOURCE mmfaudioserverstart.cpp + +LANG SC + +LIBRARY euser.lib +LIBRARY estor.lib +LIBRARY mmfaudioserver.lib + +START WINS +BASEADDRESS 0x4F440000 +END + +// End of File + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/a3fsrvstart/src/mmfaudioserverstart/mmfaudioserverstart.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/a3fsrvstart/src/mmfaudioserverstart/mmfaudioserverstart.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,74 @@ +// Copyright (c) 2007-2009 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 FILES +#include +#include + +// ----------------------------------------------------------------------------- +// MainL +// Just an E32Main and a MainL() +// ----------------------------------------------------------------------------- +// +LOCAL_C void MainL() +/** + * Much simpler, uses the new Rendezvous() call to sync with the client + */ + { + // Leave the hooks in for platform security +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CAudioSvrLoader* server = NULL; + TRAPD(err,server = CAudioSvrLoader::NewL() ); + // Sync with the client + RProcess::Rendezvous(err); + if(err == KErrNone) + { + // enter the active scheduler + sched->Start(); + } + delete server; + server = NULL; + delete sched; + sched = NULL; + } + +// ----------------------------------------------------------------------------- +// E32Main +// Just an E32Main and a MainL() +// ----------------------------------------------------------------------------- +// +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on exit + */ + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(!cleanup) + { + return KErrNoMemory; + } + TRAP_IGNORE(MainL()); + delete cleanup; + cleanup = NULL; + return KErrNone; + } + +// End of file diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,97 @@ + +// Copyright (c) 2007-2010 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: +// + + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// may add platform for OMAP, Helen etc +DEFAULT + +PRJ_EXPORTS + +// Export only if DevSound is built +#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +// Plug-in ECom headers +../inc/plugin/mmfdevsound.hrh /epoc32/include/mmf/plugin/mmfdevsound.hrh +#endif + +../inc/mmfdevsoundcustomcommands.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(mmf/server/mmfdevsoundcustomcommands.h) +../inc/plugin/devsoundplugin.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(mmf/plugin/devsoundplugin.h) + +../src/CustomInterfaces/cmmfdevsoundcibitrateimplementationuid.hrh /epoc32/include/mmf/plugin/cmmfdevsoundcibitrateimplementationuid.hrh +../src/CustomInterfaces/cmmfdevsoundcifileblocklengthimpluid.hrh /epoc32/include/mmf/plugin/cmmfdevsoundcifileblocklengthimpluid.hrh + +// Romkit include files +devsound_pluginsupport.iby /epoc32/rom/include/ + +PRJ_MMPFILES +../mmpfiles/mmfdevsoundcustominterfacebitrate.mmp + +../mmpfiles/mmfdevsoundcifileblocklength.mmp + + +// Only build if DevSound is built +#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +// DevSound +../mmpfiles/sounddevice/MMFDevSound.mmp +#endif + + +// Play back status CI +../mmpfiles/playbackstatusci.mmp +// Acc decoder config CI +../mmpfiles/aacdecoderconfigci.mmp +// G729 decoder intfc CI +../mmpfiles/g729decoderconfigci.mmp +// G729 encoder intfc CI +../mmpfiles/g729encoderconfigci.mmp +// G711 decoder intfc CI +../mmpfiles/g711decoderconfigci.mmp +// G711 encoder intfc CI +../mmpfiles/g711encoderconfigci.mmp +// Audio vibra control CI +../mmpfiles/audiovibracontrolci.mmp +// Sample buffering CI +../mmpfiles/audiobufferprefillci.mmp +// DSP control CI +../mmpfiles/dspcontrolci.mmp +// Speech encoder Config CI +../mmpfiles/speechencoderconfigci.mmp +// Error concealment CI +../mmpfiles/errorconcealmentci.mmp +// Ilbc decoder intfc CI +../mmpfiles/ilbcdecoderconfigci.mmp +// Ilbc encoder intfc CI +../mmpfiles/ilbcencoderconfigci.mmp +// Gsm config CI +../mmpfiles/gsmconfigci.mmp +// Underflow auto stop control CI +../mmpfiles/underflowautostopcontrolci.mmp +// EAAC+ Decoder CI +../mmpfiles/eaacplusdecoderci.mmp +// SBC Encoder CI +../mmpfiles/sbcencoderci.mmp +// Set DRM Protected CI +../mmpfiles/setdrmprotectedci.mmp +// Advanced AAC Encode Settings CI +../mmpfiles/advancedaacencodesettingsci.mmp +// Buffer Frames Configuration CI +../mmpfiles/bufferframesconfigci.mmp +// Get Timestamps CI +../mmpfiles/gettimestampsci.mmp + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/group/devsound_pluginsupport.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/group/devsound_pluginsupport.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,80 @@ +// Copyright (c) 2003-2009 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: +// mmfSoundDev.iby +// +// + +#ifndef DEVSOUND_PLUGINSUPPORT_IBY +#define DEVSOUND_PLUGINSUPPORT_IBY + +// Use these components if building existing DevSound. +#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// media server dev sound dll - framework looks for plugin etc +file=ABI_DIR\BUILD_DIR\MMFDevSound.dll System\Libs\MMFDevSound.dll + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// The playback status Interface implemented on the software codec wrapper device +ECOM_PLUGIN(playbackstatusci.dll, playbackstatusci.rsc) +ECOM_PLUGIN(eaacplusdecoderci.dll, eaacplusdecoderci.rsc) +ECOM_PLUGIN(sbcencoderci.dll, sbcencoderci.rsc) +ECOM_PLUGIN(setdrmprotectedci.dll, setdrmprotectedci.rsc) +ECOM_PLUGIN(advancedaacencodesettingsci.dll, advancedaacencodesettingsci.rsc) +ECOM_PLUGIN(gettimestampsci.dll, gettimestampsci.rsc) +ECOM_PLUGIN(bufferframesconfigci.dll, bufferframesconfigci.rsc) + +// The Aac decoder config Interface implemented on the software codec wrapper device +ECOM_PLUGIN(aacdecoderconfigci.dll, aacdecoderconfigci.rsc) + +// The G729 decoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(g729decoderconfigci.dll, g729decoderconfigci.rsc) + +// The G729 encoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(g729encoderconfigci.dll, g729encoderconfigci.rsc) + +// The Speech encoder configc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(speechencoderconfigci.dll, speechencoderconfigci.rsc) + +// The G711 decoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(g711decoderconfigci.dll, g711decoderconfigci.rsc) + +// The G711 encoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(g711encoderconfigci.dll, g711encoderconfigci.rsc) + +// The Ilbc decoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(ilbcdecoderconfigci.dll, ilbcdecoderconfigci.rsc) + +// The Ilbc encoder intfc Interface implemented on the software codec wrapper device +ECOM_PLUGIN(ilbcencoderconfigci.dll, ilbcencoderconfigci.rsc) + +// The Error concealment Interface implemented on the software codec wrapper device +ECOM_PLUGIN(errorconcealmentci.dll, errorconcealmentci.rsc) + +// The Audio vibra control Interface implemented on the software codec wrapper device +ECOM_PLUGIN(audiovibracontrolci.dll, audiovibracontrolci.rsc) + +// The Audio buffer prefill Interface implemented on the software codec wrapper device +ECOM_PLUGIN(audiobufferprefillci.dll, audiobufferprefillci.rsc) + +// The DSP control Interface implemented on the software codec wrapper device +ECOM_PLUGIN(dspcontrolci.dll, dspcontrolci.rsc) + +// The Gsm config Interface implemented on the software codec wrapper device +ECOM_PLUGIN(gsmconfigci.dll, gsmconfigci.rsc) + +// The Underflow auto stop control Interface implemented on the software codec wrapper device +ECOM_PLUGIN(underflowautostopcontrolci.dll, underflowautostopcontrolci.rsc) + +#endif // DEVSOUND_PLUGINSUPPORT_IBY diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/group/multimedia_mdf_devsound_pluginsupport.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/group/multimedia_mdf_devsound_pluginsupport.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,29 @@ +#multimedia_mdf_devsound_pluginsupport +# +# Copyright (c) 2009 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: +# + +component multimedia_mdf_devsound_pluginsupport + +source \sf\os\mm\devsound\devsoundpluginsupport + +binary \sf\os\mm\devsound\devsoundpluginsupport\group all + +exports \sf\os\mm\devsound\devsoundpluginsupport\group + +notes_source \component_defs\release.src + +ipr E + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/inc/mmfdevsoundcustomcommands.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/inc/mmfdevsoundcustomcommands.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef MMFDEVSOUNDCUSTOMCOMMANDS_H +#define MMFDEVSOUNDCUSTOMCOMMANDS_H + +/** +* @internalTechnology +* @file +*/ + +enum TMMFDevSoundCustomCommand + { + EMMFDevSoundCustomCommandCIOpenSlave, + EMMFDevSoundCustomCommandCICloseSlave, + EMMFDevSoundCustomCommandCISendSlaveSyncCommand, + EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult, + EMMFDevSoundCustomCommandCISendSlaveAsyncCommand, + EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/inc/plugin/devsoundplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/inc/plugin/devsoundplugin.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,527 @@ + +// Copyright (c) 2001-2009 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: +// + +/** + @file + @publishedPartner + @released +*/ + +#ifndef DEVSOUNDPLUGIN_H +#define DEVSOUNDPLUGIN_H + +_LIT8(KDevSoundPluginMatchString, "*"); // ECom insists on something + +/** +Interface class used in the plugin implementation of DevSound. +The CMMFDevSound implementation loads a plugin based on this interface class. +Once this has been constructed, calls to method functions of CMMFDevSound are passed +verbatim to this interface. For further description of required functionality, +see CMMFDevSound. + +@see CMMFDevSound +*/ + +class MMMFDevSoundPlugin + { +public: + /** + This must provide an implementation as defined by CMMFDevSound::~CMMFDevSound() + + @see CMMFDevSound::~CMMFDevSound() + */ + virtual ~MMMFDevSoundPlugin() {} + + /** + This must provide an implementation as defined by + CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + + @param aDevSoundObserver + A reference to DevSound Observer instance. + @param aMode + The mode for which this object will be used. + + @see CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + */ + virtual void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode)=0; + + + /** + This must provide an implementation as defined by + CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + + @param aDevSoundObserver + A reference to DevSound Observer instance. + @param aHWDev + The CMMFHwDevice implementation identifier. + @param aMode + The mode for which this object will be used. + + @see CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + */ + virtual void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode) + + @param aDevSoundObserver + A reference to DevSound Observer instance. + @param aDesiredFourCC + The CMMFHwDevice implementation FourCC code. + @param aMode + The mode for which this object will be used. + + @see CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode) + */ + virtual void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Capabilities() + + @return The device settings. + + @see CMMFDevSound::Capabilities() + */ + virtual TMMFCapabilities Capabilities()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Config() + + @return The device settings. + + @see CMMFDevSound::Config() + */ + virtual TMMFCapabilities Config() const=0; + + /** + This must provide an implementation as defined by CMMFDevSound::SetConfigL(const TMMFCapabilities& aCaps) + + @param aCaps The attribute values to which CMMFDevSound object will be configured to. + + @see CMMFDevSound::SetConfigL(const TMMFCapabilities& aCaps) + */ + virtual void SetConfigL(const TMMFCapabilities& aCaps)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::MaxVolume() + + @return The maximum volume. This value is platform dependent but is always greater than or equal + to one. + + @see CMMFDevSound::MaxVolume() + */ + virtual TInt MaxVolume()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Volume() + + @return The current volume level. + + @see CMMFDevSound::Volume() + */ + virtual TInt Volume()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::SetVolume() + + @param aVolume + The volume setting. This can be any value from 0 to the value + returned by a call to CMMFDevSound::MaxVolume(). If the + volume is not within this range, the volume is automatically set to + minimum or maximum value based on the value that is being passed. + Setting a zero value mutes the sound. Setting the maximum value + results in the loudest possible sound. + + @see CMMFDevSound::SetVolume() + */ + virtual void SetVolume(TInt aVolume)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::MaxGain() + + @return The maximum gain. This value is platform dependent but is always greater than or equal + to one. + + @see CMMFDevSound::MaxGain() + */ + virtual TInt MaxGain()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Gain() + + @return The current gain level. + + @see CMMFDevSound::Gain() + */ + virtual TInt Gain()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::SetGain() + + @param aGain + The gain setting. This can be any value from zero to the value + returned by a call to CMMFDevSound::MaxGain(). If the + volume is not within this range, the gain is automatically set to + minimum or maximum value based on the value that is being passed. + Setting a zero value mutes the sound. Setting the maximum value + results in the loudest possible sound. + @see CMMFDevSound::SetGain() + */ + virtual void SetGain(TInt aGain)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + + @param aLeftPercentage + On return contains the left speaker volume percentage. + @param aRightPercentage + On return contains the right speaker volume percentage. + + @see CMMFDevSound::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + */ + virtual void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + + @param aLeftPercentage + On return contains left speaker volume perecentage. This can be any + value from zero to 100. Setting a zero value mutes the sound on left + speaker. + @param aRightPercentage + On return contains right speaker volume perecentage. This can be any + value from zero to 100. Setting a zero value mutes the sound on + right speaker. + + @see CMMFDevSound::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + */ + virtual void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + + @param aLeftPercentage + On return contains the left microphone gain percentage. + @param aRightPercentage + On return contains the right microphone gain percentage. + + @see CMMFDevSound::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + */ + virtual void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::GetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + + @param aLeftPercentage + The left microphone gain precentage. This can be any value from zero to + 100. Setting a zero value mutes the gain on left microphone. + @param aRightPercentage + The right microphone gain precentage. This can be any value from zero to + 100. Setting a zero value mutes the gain on right microphone. + + @see CMMFDevSound::GetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + */ + virtual void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::PlayInitL() + + @see CMMFDevSound::PlayInitL() + */ + virtual void PlayInitL()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::RecordInitL() + + @see CMMFDevSound::RecordInitL() + */ + virtual void RecordInitL()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::PlayData() + + @see CMMFDevSound::PlayData() + */ + virtual void PlayData()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::RecordData() + + @see CMMFDevSound::RecordData() + */ + virtual void RecordData()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Stop() + + @see CMMFDevSound::Stop() + */ + virtual void Stop()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::Pause() + + @see CMMFDevSound::Pause() + */ + virtual void Pause()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::SamplesRecorded() + + @return The samples recorded. + + @see CMMFDevSound::SamplesRecorded() + */ + virtual TInt SamplesRecorded()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::SamplesPlayed() + + @return The samples played. + + @see CMMFDevSound::SamplesPlayed() + */ + virtual TInt SamplesPlayed()=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + + @param aFrequency + The frequency at which the tone will be played. + @param aDuration + The period over which the tone will be played. A zero value causes + the no tone to be played. + + @see CMMFDevSound::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + */ + virtual void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + + @param aFrequencyOne + The first frequency of dual tone. + @param aFrequencyTwo + The second frequency of dual tone + @param aDuration + The period over which the tone will be played. A zero value causes + the no tone to be played (Verify this with test app). + + @see CMMFDevSound::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + */ + virtual void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::PlayDTMFStringL(const TDesC& aDTMFString) + + @param aDTMFString The DTMF sequence in a descriptor. + + @see CMMFDevSound::PlayDTMFStringL(const TDesC& aDTMFString) + */ + virtual void PlayDTMFStringL(const TDesC& aDTMFString)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::PlayToneSequenceL(const TDesC8& aData) + + @param aData The tone sequence in a descriptor. + + @see CMMFDevSound::PlayToneSequenceL(const TDesC8& aData) + */ + virtual void PlayToneSequenceL(const TDesC8& aData)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::PlayFixedSequenceL(TInt aSequenceNumber) + + @param aSequenceNumber + The index identifying the specific pre-defined tone sequence. Index + values are relative to zero. + This can be any value from zero to the value returned by a call to + FixedSequenceCount() - 1. + The function raises a panic if the sequence number is not within this + range. + + @see CMMFDevSound::PlayFixedSequenceL(TInt aSequenceNumber) + @see FixedSequenceCount() + */ + virtual void PlayFixedSequenceL(TInt aSequenceNumber)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + + @param aRepeatCount + The number of times the tone, together with the trailing silence, + is to be repeated. If this is set to KMdaRepeatForever, then the + tone, together with the trailing silence, is repeated indefinitely + or until Stop() is called. If this is set to zero, then the tone is + not repeated. + @param aRepeatTrailingSilence + An interval of silence which will be played after each tone. + Supported only during tone playing. + + @see CMMFDevSound::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + */ + virtual void SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + + @param aToneOnLength + The period over which the tone will be played. If this is set to + zero, then the tone is not played. + @param aToneOffLength + The period over which the no tone will be played. + @param aPauseLength + The period over which the tone playing will be paused. + + @see CMMFDevSound::(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + */ + virtual void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + + @param aRampDuration + The period over which the volume is to rise. A zero value causes + the tone sample to be played at the normal level for the full + duration of the playback. A value, which is longer than the duration + of the tone sample means that the sample never reaches its normal + volume level. + + @see CMMFDevSound::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + */ + virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + + @param aPrioritySettings + A class type representing the client's priority, priority preference and state. + + @see CMMFDevSound::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + */ + virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::CustomInterface(TUid aInterfaceId) + + @param aInterfaceId + The interface UID, defined with the custom interface. + + @return A pointer to the interface implementation, or NULL if the device does not + implement the interface requested. The return value must be cast to the + correct type by the user.The user should be careful while caching the custom interface pointer, + as in some situations the lower level custom interface pointer may become NULL + + @see CMMFDevSound::CustomInterface(TUid aInterfaceId) + */ + virtual TAny* CustomInterface(TUid aInterfaceId)=0; + + /** + This must provide an implementation as defined by CMMFDevSound::FixedSequenceCount() + + @return The fixed sequence count. This value is implementation dependent but is always greater + than or equal to zero. + + @see CMMFDevSound::FixedSequenceCount() + */ + virtual TInt FixedSequenceCount()=0; + + /** + This must provide an implementation as defined by CMMFDevSound::FixedSequenceName(TInt aSequenceNumber) + + @param aSequenceNumber + The index identifying the specific pre-defined tone sequence. Index values are relative + to zero. This can be any value from zero to the value returned by a call to + FixedSequenceCount() - 1. + The function raises a panic if sequence number is not within this + range. + + @return A reference to a Descriptor containing the fixed sequence name indexed by + aSequenceNumber. + + @see CMMFDevSound::FixedSequenceName(TInt aSequenceNumber) + @see FixedSequenceCount() + */ + virtual const TDesC& FixedSequenceName(TInt aSequenceNumber)=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, + const TMMFPrioritySettings& aPrioritySettings) const + + @param aSupportedDataTypes + The array of supported data types that will be filled in by this function. + The supported data types of the DevSound are in the form of an array + of TFourCC codes. Any existing entries in the array will be overwritten on + calling this function. If no supported data types are found given the priority + settings, then the aSupportedDatatypes array will have zero entries. + @param aPrioritySettings + The priority settings used to determine the supported datatypes. Note this + does not set the priority settings. For input datatypes the iState member + of the priority settings would be expected to be either + EMMFStatePlaying or EMMFStatePlayingRecording. The priority settings may + effect the supported datatypes depending on the audio routing. + + @see CMMFDevSound::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, + const TMMFPrioritySettings& aPrioritySettings) const + */ + virtual void GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const=0; + + /** + This must provide an implementation as defined by + CMMFDevSound::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + + @param aSupportedDataTypes + The array of supported data types that will be filled in by this function. + The supported datatypes of the DevSound are in the form of an array + of TFourCC codes. + Any existing entries in the array will be overwritten on calling this function. + If no supported datatypes are found given the priority settings, then + the aSupportedDatatypes array will have zero entries. + @param aPrioritySettings + The priority settings used to determine the supported data types. Note this + does not set the priority settings. For output data types the iState member + of the priority settings would expected to be either + EMMFStateRecording or EMMFStatePlayingRecording. The priority settings may + effect the supported datatypes depending on the audio routing. + + @see CMMFDevSound::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + */ + virtual void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const=0; + + }; + +#endif // DEVSOUNDPLUGIN_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/inc/plugin/mmfdevsound.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/inc/plugin/mmfdevsound.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef MMFDEVSOUND_HRH +#define MMFDEVSOUND_HRH + +// Standard UIDS +// Uids for complete DevSound implementation as plugin (note not hwdevice) + +#define KMmfUidDevSoundPlugin 0x101FFA51 + +// Reference implementation +#define KMmfUidDevSoundRefPlugin 0x101FFA52 +#define KMmfUidDevSoundRefPluginDll 0x101FFA53 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/aacdecoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/aacdecoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + + +/** +@file + +@SYMPurpose aacdecoderconfigci.dll +*/ + +TARGET aacdecoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceAacDecoderConfigDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE aacdecoderconfigci.cpp + +START RESOURCE aacdecoderconfigci.rss +TARGET aacdecoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/advancedaacencodesettingsci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/advancedaacencodesettingsci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose advancedaacencodesettingsci.dll +*/ + +TARGET advancedaacencodesettingsci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceAdvancedAACEncodeSettingsDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE advancedaacencodesettingsci.cpp + + + +START RESOURCE advancedaacencodesettingsci.rss +TARGET advancedaacencodesettingsci.rsc +END + + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/audiobufferprefillci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/audiobufferprefillci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose audiobufferprefillci.dll +*/ + +TARGET audiobufferprefillci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceSampleBufferingDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE audiobufferprefillci.cpp + +START RESOURCE audiobufferprefillci.rss +TARGET audiobufferprefillci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/audiovibracontrolci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/audiovibracontrolci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose audiovibracontrolci.dll +*/ + +TARGET audiovibracontrolci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceAudioVibraControlDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE audiovibracontrolci.cpp + +START RESOURCE audiovibracontrolci.rss +TARGET audiovibracontrolci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/bufferframesconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/bufferframesconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose bufferframesconfigci.dll +*/ + +TARGET bufferframesconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceBufferFramesConfigDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE bufferframesconfigci.cpp + +START RESOURCE bufferframesconfigci.rss +TARGET bufferframesconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/dspcontrolci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/dspcontrolci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose dspcontrolci.dll +*/ + +TARGET dspcontrolci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceDspControlDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE dspcontrolci.cpp + +START RESOURCE dspcontrolci.rss +TARGET dspcontrolci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/eaacplusdecoderci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/eaacplusdecoderci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose eaacplusdecoderci.dll +*/ + +TARGET eaacplusdecoderci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceEAacPlusDecoderDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE eaacplusdecoderci.cpp + +START RESOURCE eaacplusdecoderci.rss +TARGET eaacplusdecoderci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/errorconcealmentci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/errorconcealmentci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose errorconcealmentci.dll +*/ + +TARGET errorconcealmentci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceErrorConcealmentIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE errorconcealmentci.cpp + +START RESOURCE errorconcealmentci.rss +TARGET errorconcealmentci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/g711decoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/g711decoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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 + +/** +@file + +@SYMPurpose g711decoderconfigci.dll +*/ + +TARGET g711decoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceG711DecoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE g711decoderconfigci.cpp + +START RESOURCE g711decoderconfigci.rss +TARGET g711decoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/g711encoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/g711encoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose g711encoderconfigci.dll +*/ + +TARGET g711encoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceG711EncoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE g711encoderconfigci.cpp + +START RESOURCE g711encoderconfigci.rss +TARGET g711encoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/g729decoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/g729decoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose g729decoderconfigci.dll +*/ + +TARGET g729decoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceG729DecoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE g729decoderconfigci.cpp + +START RESOURCE g729decoderconfigci.rss +TARGET g729decoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/g729encoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/g729encoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose g729encoderconfigci.dll +*/ + +TARGET g729encoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceG729EncoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE g729encoderconfigci.cpp + +START RESOURCE g729encoderconfigci.rss +TARGET g729encoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/gettimestampsci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/gettimestampsci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose gettimestampsci.dll +*/ + +TARGET gettimestampsci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceGetTimestampsDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE gettimestampsci.cpp + +START RESOURCE gettimestampsci.rss +TARGET gettimestampsci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/gsmconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/gsmconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose gsmconfigci.dll +*/ + +TARGET gsmconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceGsmConfigDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE gsmconfigci.cpp + +START RESOURCE gsmconfigci.rss +TARGET gsmconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/ilbcdecoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/ilbcdecoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose ilbcdecoderconfigci.dll +*/ + +TARGET ilbcdecoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceIlbcDecoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE ilbcdecoderconfigci.cpp + +START RESOURCE ilbcdecoderconfigci.rss +TARGET ilbcdecoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/ilbcencoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/ilbcencoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose ilbcencoderconfigci.dll +*/ + +TARGET ilbcencoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceIlbcEncoderIntfcDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE ilbcencoderconfigci.cpp + +START RESOURCE ilbcencoderconfigci.rss +TARGET ilbcencoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/mmfdevsoundcifileblocklength.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/mmfdevsoundcifileblocklength.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 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 "../src/CustomInterfaces/cmmfdevsoundcifileblocklengthimpluid.hrh" + +/** +@file + +@SYMPurpose DevSound custom interface to allow block length to be set +*/ + +TARGET mmfdevsoundcifileblocklength.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN +UNPAGED + +UID 0x10009D8D KMmfUidCIFileBlockLengthDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE cmmfdevsoundcifileblocklength.cpp + + +START RESOURCE 102737FD.rss +#ifdef SYMBIAN_SECURE_ECOM +TARGET mmfdevsoundcifileblocklength.rsc +#endif +END + +USERINCLUDE ../src/CustomInterfaces + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY ecom.lib +LIBRARY estor.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/mmfdevsoundcustominterfacebitrate.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/mmfdevsoundcustominterfacebitrate.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2005-2009 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 "../src/CustomInterfaces/cmmfdevsoundcibitrateimplementationuid.hrh" + +/** +@file + +@SYMPurpose mmfdevsoundcustominterfacebitrate.dll +*/ + +TARGET mmfdevsoundcustominterfacebitrate.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN +UNPAGED + +UID 0x10009D8D KMmfUidCustomInterfaceBitRateDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE cmmfdevsoundcibitrate.cpp + + +START RESOURCE 102070B4.rss +TARGET mmfdevsoundcustominterfacebitrate.rsc +END + + +USERINCLUDE ../src/CustomInterfaces + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY ecom.lib +LIBRARY estor.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/playbackstatusci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/playbackstatusci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose playbackstatusci.dll +*/ + +TARGET playbackstatusci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfacePlayBackStatusDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE playbackstatusci.cpp + +START RESOURCE playbackstatusci.rss +TARGET playbackstatusci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/sbcencoderci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/sbcencoderci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose sbcencoderci.dll +*/ + +TARGET sbcencoderci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceSbcEncoderDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE sbcencoderci.cpp + +START RESOURCE sbcencoderci.rss +TARGET sbcencoderci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/setdrmprotectedci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/setdrmprotectedci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose setdrmprotectedci.dll +*/ + +TARGET setdrmprotectedci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceSetDRMProtectedDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE setdrmprotectedci.cpp + +START RESOURCE setdrmprotectedci.rss +TARGET setdrmprotectedci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/sounddevice/MMFDevSound.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/sounddevice/MMFDevSound.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,54 @@ +// Copyright (c) 2002-2009 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: +// mmfdevsound.dll Audio hardware abstraction library +// +// + +/** + @file +*/ + +TARGET mmfdevsound.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID 0x1000008D 0x100058CC +VENDORID 0x70000001 +UNPAGED + +SOURCEPATH ../../src/SoundDevice + +SOURCE SoundDevice.cpp +SOURCE SoundDeviceBody.cpp + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib + +USERINCLUDE ../../src/SoundDevice +USERINCLUDE ../../inc // access mmf files in local area + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef EABI +DEFFILE /epoc32/include/def/eabi/mmfdevsound.def +#elif defined X86GCC +// X86GCC def file will be generated from corresponding EABI def file if it does not exist +DEFFILE /epoc32/include/def/bx86gcc/mmfdevsound.def +#elif defined WINSCW +DEFFILE /epoc32/include/def/bwins/mmfdevsound.def +#endif + +nostrictdef + +noexportlibrary diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/speechencoderconfigci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/speechencoderconfigci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose speechencoderconfigci.dll +*/ + +TARGET speechencoderconfigci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceSpeechEncoderConfigDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE speechencoderconfigci.cpp + +START RESOURCE speechencoderconfigci.rss +TARGET speechencoderconfigci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/mmpfiles/underflowautostopcontrolci.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/mmpfiles/underflowautostopcontrolci.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2010 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 + +/** +@file + +@SYMPurpose underflowautostopcontrolci.dll +*/ + +TARGET underflowautostopcontrolci.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN + +UID 0x10009D8D KMmfUidCustomInterfaceUnderflowAutoStopCtrlDll +VENDORID 0x70000001 + +SOURCEPATH ../src/CustomInterfaces + +SOURCE underflowautostopcontrolci.cpp + +START RESOURCE underflowautostopcontrolci.rss +TARGET underflowautostopcontrolci.rsc +END + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/102070B4.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/102070B4.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2004-2009 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 +#include +#include "cmmfdevsoundcibitrateimplementationuid.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceBitRateDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; // Mux + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceBitRateMux; + version_no = 1; + display_name = "BitRate Mux"; + default_data = "101f7dd5" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; // DeMux + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceBitRateDeMux; + version_no = 1; + display_name = "BitRate DeMux"; + default_data = "102070b6" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/102737FD.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/102737FD.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2009 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 +#include +#include "cmmfdevsoundcifileblocklengthimpluid.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + + dll_uid = KMmfUidCIFileBlockLengthDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; // Mux + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCIFileBlockLengthMux; + version_no = 3; + display_name = "FileBlockLength Mux"; + default_data = "10273806"; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; // DeMux + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCIFileBlockLengthDeMux; + version_no = 3; + display_name = "FileBlockLength DeMux"; + default_data = "102737fe"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,463 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "aacdecoderconfigci.h" + + +// MUX // + +TInt CMMFAacDecoderConfigMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceAacDecoderConfigDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFAacDecoderConfigMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFAacDecoderConfigMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFAacDecoderConfigMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFAacDecoderConfigMux::NewL() + { + CMMFAacDecoderConfigMux* self = new (ELeave) CMMFAacDecoderConfigMux; + return self; + } + + +TAny* CMMFAacDecoderConfigMux::CustomInterface(TUid /*aInterfaceId*/) + { + MAacDecoderConfig* interface = this; + return interface; + } + + +CMMFAacDecoderConfigMux::CMMFAacDecoderConfigMux() : +iRemoteHandle(-1) + { + } + + +CMMFAacDecoderConfigMux::~CMMFAacDecoderConfigMux() + { + } + + +// from MAacDecoderConfig +TInt CMMFAacDecoderConfigMux::SetAudioConfig(TAudioConfig& aAudioConfig) + { + TInt result = -1; + + if (iRemoteHandle > 0) + { + // send the status in the sync command + TPckgBuf audioConfig(aAudioConfig); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIAacDecoderConfigSetAudioConfig, + audioConfig); + } + + return result; + } + + +// from MAacDecoderConfig +TInt CMMFAacDecoderConfigMux::GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs) + { + TInt result = KErrNone; + + if (iRemoteHandle == -1) + { + return KErrBadHandle; + } + + // first clear out the array + aSupportedAudioConfigs.Reset(); + + // now fetch the count from the server + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfig, + KNullDesC8); + + // if count is negative then the server side left with an error + if (count < 0) + { + result = KErrNotReady; + } + + // no point getting the data if the count is zero + if ( (count != 0) && (result == KErrNone) ) + { + // allocate a temporary buffer to hold the audio configuration + HBufC8* buf = NULL; + TRAP(result, buf = HBufC8::NewL(count * sizeof(TAudioConfig))); + + if (result != KErrNone) + { + return result; + } + + TPtr8 ptr = buf->Des(); + + // fetch the audio configurations - but send over the received count to be sure + TPckgBuf countBuf(count); + iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfigArray, + countBuf, + ptr); + + if (result != KErrNone) + { + return result; + } + + // stream data into the pointer + RDesReadStream stream(ptr); + + TInt err = KErrNone; + for (TInt i = 0; i < count; i++) + { + TAudioConfig audioConfig; + + TRAP(result, audioConfig.iAudioObjectType = static_cast(stream.ReadInt32L()); + + err = aSupportedAudioConfigs.Append(audioConfig)); + + if ( (err != KErrNone) || (result != KErrNone) ) + { + // note we don't destroy array because we don't own it + // but we do reset it if it is incomplete + aSupportedAudioConfigs.Reset(); + result = KErrCorrupt; + } + } + + stream.Close(); + stream.Release(); + delete buf; + } + + return result; + } + + + +// DEMUX // + +TInt CMMFAacDecoderConfigDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFAacDecoderConfigDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFAacDecoderConfigDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFAacDecoderConfigDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFAacDecoderConfigDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFAacDecoderConfigDeMux::RefreshL() + { + // refetch the aac decoder config custom interface if we already have a target + if (iTarget) + { + iInterfaceAacDecoderConfig = static_cast (iTarget->CustomInterface(KUidAacDecoderConfig)); + + if (!iInterfaceAacDecoderConfig) + { + iInterfaceAacDecoderConfig = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFAacDecoderConfigDeMux::NewL() + { + CMMFAacDecoderConfigDeMux* self = new (ELeave) CMMFAacDecoderConfigDeMux; + return self; + } + + +CMMFAacDecoderConfigDeMux::CMMFAacDecoderConfigDeMux() + { + } + + +CMMFAacDecoderConfigDeMux::~CMMFAacDecoderConfigDeMux() + { + iSupportedAudioConfigs.Reset(); + iSupportedAudioConfigs.Close(); + } + + +TInt CMMFAacDecoderConfigDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Aac Decoder Config Hw Device custom interface + iInterfaceAacDecoderConfig = static_cast (iTarget->CustomInterface(KUidAacDecoderConfig)); + + if (!iInterfaceAacDecoderConfig) + { + iInterfaceAacDecoderConfig = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFAacDecoderConfigDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFAacDecoderConfigDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIAacDecoderConfigSetAudioConfig: + { + TPckgBuf audioConfig; + iUtility->ReadFromInputDesL(aMessage, &audioConfig); + + result = DoSetAudioConfigL(audioConfig()); + + break; + } + case EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfig: + { + // reset the current AudioConfig array + iSupportedAudioConfigs.Reset(); + result = DoGetSupportedAudioConfigsL(iSupportedAudioConfigs); + + // send back the array count + TInt count = iSupportedAudioConfigs.Count(); + result = count; + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFAacDecoderConfigDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfigArray: + { + + DoCopyAudioConfigsBufferToClientL(aMessage); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFAacDecoderConfigDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFAacDecoderConfigDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Aac Decoder Config custom interface implementation +TInt CMMFAacDecoderConfigDeMux::DoSetAudioConfigL(MAacDecoderConfig::TAudioConfig& aAudioConfig) + { + TInt result = KErrNotFound; + + if (iInterfaceAacDecoderConfig) + { + result = iInterfaceAacDecoderConfig->SetAudioConfig(aAudioConfig); + } + + return result; + } + + +// Aac Decoder Config custom interface implementation +TInt CMMFAacDecoderConfigDeMux::DoGetSupportedAudioConfigsL(RArray& aSupportedAudioConfigs) + { + TInt result = KErrNotFound; + + if (iInterfaceAacDecoderConfig) + { + result = iInterfaceAacDecoderConfig->GetSupportedAudioConfigs(aSupportedAudioConfigs); + } + + return result; + } + + +// Aac Decoder Config custom interface implementation +void CMMFAacDecoderConfigDeMux::DoCopyAudioConfigsBufferToClientL(const RMmfIpcMessage& aMessage) + { + if (!iInterfaceAacDecoderConfig) + { + User::Leave(KErrNotReady); + } + + // check our count is the same as the client's + TPckgBuf countBuffer; + iUtility->ReadFromInputDesL(aMessage, &countBuffer); + + TInt count = countBuffer(); + if (count != iSupportedAudioConfigs.Count()) + { + User::Leave(KErrCorrupt); + } + + // send back the array - the client has the count already + const TInt KBufExpandSize8 = 8; //two TInt's + CBufFlat* dataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); + CleanupStack::PushL(dataCopyBuffer); + RBufWriteStream stream; + stream.Open(*dataCopyBuffer); + CleanupClosePushL(stream); + + for (TInt i = 0; i < count; i++) + { + stream.WriteInt32L(iSupportedAudioConfigs[i].iAudioObjectType); + } + + // write the data to the supplied descriptor buffer + TPtr8 ptrBuf = dataCopyBuffer->Ptr(0); + iUtility->WriteToOutputDesL(aMessage, ptrBuf); + stream.Close(); + + CleanupStack::PopAndDestroy(2, dataCopyBuffer); // dataCopyBuffer, stream + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAacDecoderConfigMux, CMMFAacDecoderConfigMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAacDecoderConfigDeMux, CMMFAacDecoderConfigDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,256 @@ +// Copyright (c) 2007-2009 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: +// Implementation of aac decoder config custom interface pair +// +// + +#ifndef AACDECODERCONFIGCI_H +#define AACDECODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIAacDecoderConfigCommands + { + EMMFDevSoundCIAacDecoderConfigSetAudioConfig = 0, + EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfig = 1, + EMMFDevSoundCIAacDecoderConfigGetSupportedAudioConfigArray + }; + + +/** +Implementation of the Aac decoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFAacDecoderConfigMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MAacDecoderConfig + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MAacDecoderConfig + //@see MAacDecoderConfig + virtual TInt SetAudioConfig(TAudioConfig& aAudioConfig); + //@see MAacDecoderConfig + virtual TInt GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs); + +protected: + CMMFAacDecoderConfigMux(); + ~CMMFAacDecoderConfigMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Aac decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFAacDecoderConfigDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFAacDecoderConfigDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFAacDecoderConfigDeMux(); + CMMFAacDecoderConfigDeMux(); + + // from mirror MAacDecoderConfig method. + TInt DoSetAudioConfigL(MAacDecoderConfig::TAudioConfig& aAudioConfig); + TInt DoGetSupportedAudioConfigsL(RArray& aSupportedAudioConfigs); + +private: + void DoCopyAudioConfigsBufferToClientL(const RMmfIpcMessage& aMessage); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MAacDecoderConfig* iInterfaceAacDecoderConfig; + RArray iSupportedAudioConfigs; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/aacdecoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceAacDecoderConfigDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAacDecoderConfigMux; + version_no = 1; + display_name = "Aac decoder config Mux"; + default_data = "102825fd" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAacDecoderConfigDeMux; + version_no = 1; + display_name = "Aac decoder config DeMux"; + default_data = "102825bc" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,369 @@ +// Copyright (c) 2007-2009 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 +#include +#include + +#include "advancedaacencodesettingsci.h" + + +// MUX // +/*****************************************************************************/ + +TInt CMMFAdvancedAACEncodeSettingsMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceAdvancedAACEncodeSettingsDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFAdvancedAACEncodeSettingsMux::NewL() + { + CMMFAdvancedAACEncodeSettingsMux* self = new (ELeave) CMMFAdvancedAACEncodeSettingsMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFAdvancedAACEncodeSettingsMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFAdvancedAACEncodeSettings* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFAdvancedAACEncodeSettingsMux::CMMFAdvancedAACEncodeSettingsMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFAdvancedAACEncodeSettingsMux::~CMMFAdvancedAACEncodeSettingsMux() + { + } + +/*****************************************************************************/ +// from MMMFAdvancedAACEncodeSettings +TInt CMMFAdvancedAACEncodeSettingsMux::SetAACEncodeBitrateMode(TAACBitrateMode aBitrateMode) + { + TInt result = KErrNotReady; + + if (iRemoteHandle > 0) + { + // send the bitrate mode in the sync command + TPckgBuf mode(aBitrateMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIAdvancedAACEncodeSettings, + mode); + } + return result; + } + +TInt CMMFAdvancedAACEncodeSettingsMux::GetAACEncodeBitrateMode(TAACBitrateMode& aBitrateMode) + { + TInt result = KErrNotReady; + + if (iRemoteHandle > 0) + { + // send the bitrate mode in the sync command + TPckgBuf mode;//(aBitrateMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIAdvancedAACEncodeGetSettings, + KNullDesC8, + mode); + if (result == KErrNone) + { + aBitrateMode = mode(); + } + } + return result; + } + +// DEMUX // +/*****************************************************************************/ +TInt CMMFAdvancedAACEncodeSettingsDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::RefreshL() + { + // refetch the custom interface if we already have a target + if (iTarget) + { + MMMFAdvancedAACEncodeSettings* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidAdvancedAACEncoderSettings)); + + if (!ptr) + { + iInterfaceAdvAACEncodeSettings = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceAdvAACEncodeSettings = ptr; + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFAdvancedAACEncodeSettingsDeMux::NewL() + { + CMMFAdvancedAACEncodeSettingsDeMux* self = new (ELeave) CMMFAdvancedAACEncodeSettingsDeMux; + return self; + } + +/*****************************************************************************/ +CMMFAdvancedAACEncodeSettingsDeMux::CMMFAdvancedAACEncodeSettingsDeMux() + { + } + +/*****************************************************************************/ +CMMFAdvancedAACEncodeSettingsDeMux::~CMMFAdvancedAACEncodeSettingsDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFAdvancedAACEncodeSettingsDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Hw Device custom interface + MMMFAdvancedAACEncodeSettings* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidAdvancedAACEncoderSettings)); + + if (!ptr) + { + iInterfaceAdvAACEncodeSettings = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceAdvAACEncodeSettings = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFAdvancedAACEncodeSettingsDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TInt retVal = KErrNone; + + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIAdvancedAACEncodeSettings: + { + TPckgBuf mode; + iUtility->ReadFromInputDesL(aMessage, &mode); + + retVal = DoSetAACEncodeBitrateMode(mode()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +TInt CMMFAdvancedAACEncodeSettingsDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TInt retVal = KErrNone; + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIAdvancedAACEncodeGetSettings: + { + MMMFAdvancedAACEncodeSettings::TAACBitrateMode mode; + retVal = DoGetAACEncodeBitrateMode(mode); + + if (retVal == KErrNone) + { + TPckgBuf pckg(mode); + iUtility->WriteToOutputDesL(aMessage, pckg); + } + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFAdvancedAACEncodeSettingsDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// Play Back Status custom interface implementation +TInt CMMFAdvancedAACEncodeSettingsDeMux::DoSetAACEncodeBitrateMode(MMMFAdvancedAACEncodeSettings:: + TAACBitrateMode aBitrateMode) + { + if (!iInterfaceAdvAACEncodeSettings) + { + return KErrNotReady; + } + else + { + return iInterfaceAdvAACEncodeSettings->SetAACEncodeBitrateMode(aBitrateMode); + } + } + +TInt CMMFAdvancedAACEncodeSettingsDeMux::DoGetAACEncodeBitrateMode(MMMFAdvancedAACEncodeSettings:: + TAACBitrateMode& aBitrateMode) + { + if (!iInterfaceAdvAACEncodeSettings) + { + return KErrNotReady; + } + else + { + return iInterfaceAdvAACEncodeSettings->GetAACEncodeBitrateMode(aBitrateMode); + } + } + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAdvancedAACEncodeSettingsMux, CMMFAdvancedAACEncodeSettingsMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAdvancedAACEncodeSettingsDeMux, CMMFAdvancedAACEncodeSettingsDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,258 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef ADVANCEDAACENCODESETTINGSCI_H +#define ADVANCEDAACENCODESETTINGSCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCIAdvancedAACEncodeSettignsCommands + { + EMMFDevSoundCIAdvancedAACEncodeSettings = 0, + EMMFDevSoundCIAdvancedAACEncodeGetSettings + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFAdvancedAACEncodeSettingsMux + * + * implementation of the Play back status custom interface pair + */ +class CMMFAdvancedAACEncodeSettingsMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFAdvancedAACEncodeSettings + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @leave This method may leave with one of the system-wide error codes. + @return The pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFAdvancedAACEncodeSettings + /** + @see MMMFAdvancedAACEncodeSettings + */ + virtual TInt SetAACEncodeBitrateMode(TAACBitrateMode aBitrateMode); + /** + @see MMMFAdvancedAACEncodeSettings + */ + virtual TInt GetAACEncodeBitrateMode(TAACBitrateMode& aBitrateMode); + +protected: + CMMFAdvancedAACEncodeSettingsMux(); + ~CMMFAdvancedAACEncodeSettingsMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFAdvancedAACEncodeSettingsDeMux DeMux side of pair + */ + +class CMMFAdvancedAACEncodeSettingsDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFAdvancedAACEncodeSettingsDeMux class + @leave This method may leave with one of the system-wide error codes. + @return A pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFAdvancedAACEncodeSettingsDeMux(); + CMMFAdvancedAACEncodeSettingsDeMux(); + + // mirrors MMMFAdvancedAACEncodeSettings method. + TInt DoSetAACEncodeBitrateMode(MMMFAdvancedAACEncodeSettings::TAACBitrateMode aBitrateMode); + TInt DoGetAACEncodeBitrateMode(MMMFAdvancedAACEncodeSettings::TAACBitrateMode& aBitrateMode); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MMMFAdvancedAACEncodeSettings* iInterfaceAdvAACEncodeSettings; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/advancedaacencodesettingsci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2007-2009 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 +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceAdvancedAACEncodeSettingsDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAdvancedAACEncodeSettingsMux; + version_no = 1; + display_name = "Mux"; + default_data = "102825fe" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAdvancedAACEncodeSettingsDeMux; + version_no = 1; + display_name = "DeMux"; + default_data = "102825d2" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,417 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "audiobufferprefillci.h" + + +// MUX // + +TInt CMMFSampleBufferingMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceSampleBufferingDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFSampleBufferingMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFSampleBufferingMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFSampleBufferingMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFSampleBufferingMux::NewL() + { + CMMFSampleBufferingMux* self = new (ELeave) CMMFSampleBufferingMux; + return self; + } + + +TAny* CMMFSampleBufferingMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFSampleBuffering* interface = this; + return interface; + } + + +CMMFSampleBufferingMux::CMMFSampleBufferingMux() : +iRemoteHandle(-1) + { + } + + +CMMFSampleBufferingMux::~CMMFSampleBufferingMux() + { + } + + +// from MMMFSampleBuffering +TInt CMMFSampleBufferingMux::MmsbEnableSampleBufferingBeforePlayback() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIEnableSampleBufferingBeforePlayback, + KNullDesC8); + } + + return result; + } + + +// from MMMFSampleBuffering +TInt CMMFSampleBufferingMux::MmsbDisableSampleBufferingBeforePlayback() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIDisableSampleBufferingBeforePlayback, + KNullDesC8); + } + + return result; + } + + +// from MMMFSampleBuffering +void CMMFSampleBufferingMux::MmsbNotifyPlayStarted(TRequestStatus& aStatus) + { + if (iRemoteHandle > 0) + { + // package the handle and command, and send in the Async command + iCmdPkg().iHandle = iRemoteHandle; + iCmdPkg().iCommand = EMMFDevSoundCINotifyPlayStarted; + + // any return code other than zero is an error + iUtility->SendSlaveAsyncCommand(iCmdPkg, aStatus, KNullDesC8); + } + } + + +// from MMMFSampleBuffering +void CMMFSampleBufferingMux::MmsbCancelNotifyPlayStarted() + { + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + TInt result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCICancelNotifyPlayStarted, + KNullDesC8); + } + } + + + +// DEMUX // + +TInt CMMFSampleBufferingDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFSampleBufferingDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFSampleBufferingDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFSampleBufferingDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFSampleBufferingDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFSampleBufferingDeMux::RefreshL() + { + // refetch the Sample Buffering custom interface if we already have a target + if (iTarget) + { + iInterfaceSampleBuffering = static_cast (iTarget->CustomInterface(KUidSampleBuffering )); + + if (!iInterfaceSampleBuffering) + { + iInterfaceSampleBuffering = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFSampleBufferingDeMux::NewL() + { + CMMFSampleBufferingDeMux* self = new (ELeave) CMMFSampleBufferingDeMux; + return self; + } + + +CMMFSampleBufferingDeMux::CMMFSampleBufferingDeMux() : CActive(CActive::EPriorityStandard) + { + CActiveScheduler::Add(this); + } + + +CMMFSampleBufferingDeMux::~CMMFSampleBufferingDeMux() + { + Cancel(); + } + + +TInt CMMFSampleBufferingDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Sample Buffering Hw Device custom interface + iInterfaceSampleBuffering = static_cast (iTarget->CustomInterface(KUidSampleBuffering)); + + if (!iInterfaceSampleBuffering) + { + iInterfaceSampleBuffering = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFSampleBufferingDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFSampleBufferingDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIEnableSampleBufferingBeforePlayback: + { + result = DoMmsbEnableSampleBufferingBeforePlaybackL(); + break; + } + case EMMFDevSoundCIDisableSampleBufferingBeforePlayback: + { + result = DoMmsbDisableSampleBufferingBeforePlaybackL(); + break; + } + case EMMFDevSoundCICancelNotifyPlayStarted: + { + DoMmsbCancelNotifyPlayStartedL(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFSampleBufferingDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + + +void CMMFSampleBufferingDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetAsyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCINotifyPlayStarted: + { + DoMmsbNotifyPlayStartedL(aMessage); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + } + + +void CMMFSampleBufferingDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Sample Buffering custom interface implementation +TInt CMMFSampleBufferingDeMux::DoMmsbEnableSampleBufferingBeforePlaybackL() + { + TInt result = KErrNotFound; + + if (iInterfaceSampleBuffering) + { + result = iInterfaceSampleBuffering->MmsbEnableSampleBufferingBeforePlayback(); + } + + return result; + } + + +// Sample Buffering custom interface implementation +TInt CMMFSampleBufferingDeMux::DoMmsbDisableSampleBufferingBeforePlaybackL() + { + TInt result = KErrNotFound; + + if (iInterfaceSampleBuffering) + { + result = iInterfaceSampleBuffering->MmsbDisableSampleBufferingBeforePlayback(); + } + + return result; + } + + +// Sample Buffering custom interface implementation +void CMMFSampleBufferingDeMux::DoMmsbNotifyPlayStartedL(const RMmfIpcMessage& aMessage) + { + if (iInterfaceSampleBuffering) + { + // make a copy of the received message before jumping to the plugin. + // It will be used on the reply to the client. + iStoredMessage = aMessage; + + iInterfaceSampleBuffering->MmsbNotifyPlayStarted(iStatus); + + // check not already active + ASSERT(!IsActive()); + + SetActive(); + } + } + + +// Sample Buffering custom interface implementation +void CMMFSampleBufferingDeMux::DoMmsbCancelNotifyPlayStartedL() + { + if (iInterfaceSampleBuffering) + { + iInterfaceSampleBuffering->MmsbCancelNotifyPlayStarted(); + } + } + + +// active object handling functions +void CMMFSampleBufferingDeMux::RunL() + { + TInt err = iStatus.Int(); + + // complete the client request + iStoredMessage.Complete(err); + } + + +void CMMFSampleBufferingDeMux::DoCancel() + { + } + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSampleBufferingMux, CMMFSampleBufferingMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSampleBufferingDeMux, CMMFSampleBufferingDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,264 @@ +// Copyright (c) 2007-2009 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: +// Implementation of audio buffer prefill custom interface pair +// +// + +#ifndef AUDIOBUFFERPREFILLCI_H +#define AUDIOBUFFERPREFILLCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCISampleBufferingCommands + { + EMMFDevSoundCIEnableSampleBufferingBeforePlayback, + EMMFDevSoundCIDisableSampleBufferingBeforePlayback, + EMMFDevSoundCINotifyPlayStarted, + EMMFDevSoundCICancelNotifyPlayStarted + }; + + +/** +Implementation of the Audio buffer prefill custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFSampleBufferingMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFSampleBuffering + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFSampleBuffering + //@see MMMFSampleBuffering + virtual TInt MmsbEnableSampleBufferingBeforePlayback(); + //@see MMMFSampleBuffering + virtual TInt MmsbDisableSampleBufferingBeforePlayback(); + //@see MMMFSampleBuffering + virtual void MmsbNotifyPlayStarted(TRequestStatus& aStatus); + //@see MMMFSampleBuffering + virtual void MmsbCancelNotifyPlayStarted(); + +protected: + CMMFSampleBufferingMux(); + ~CMMFSampleBufferingMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + +private: + TMMFDevSoundCustomInterfaceCommandPackage iCmdPkg; + }; + + +/** +Implementation of the Audio buffer prefill custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFSampleBufferingDeMux : public CActive, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFSampleBufferingDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + + // from CActive + virtual void RunL(); + virtual void DoCancel(); + +protected: + ~CMMFSampleBufferingDeMux(); + CMMFSampleBufferingDeMux(); + + // from mirror MMMFSampleBuffering method. + TInt DoMmsbEnableSampleBufferingBeforePlaybackL(); + TInt DoMmsbDisableSampleBufferingBeforePlaybackL(); + void DoMmsbNotifyPlayStartedL(const RMmfIpcMessage& aMessage); + void DoMmsbCancelNotifyPlayStartedL(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MMMFSampleBuffering* iInterfaceSampleBuffering; + RMmfIpcMessage iStoredMessage; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiobufferprefillci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceSampleBufferingDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSampleBufferingMux; + version_no = 1; + display_name = "Audio buffer prefill Mux"; + default_data = "10282609" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSampleBufferingDeMux; + version_no = 1; + display_name = "Audio buffer prefill DeMux"; + default_data = "102825c5" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,319 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "audiovibracontrolci.h" + + +// MUX // + +TInt CMMFAudioVibraControlMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceAudioVibraControlDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFAudioVibraControlMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFAudioVibraControlMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFAudioVibraControlMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFAudioVibraControlMux::NewL() + { + CMMFAudioVibraControlMux* self = new (ELeave) CMMFAudioVibraControlMux; + return self; + } + + +TAny* CMMFAudioVibraControlMux::CustomInterface(TUid /*aInterfaceId*/) + { + MAudioVibraControl* interface = this; + return interface; + } + + +CMMFAudioVibraControlMux::CMMFAudioVibraControlMux() : + iRemoteHandle(-1) + { + } + + +CMMFAudioVibraControlMux::~CMMFAudioVibraControlMux() + { + } + + +// from MAudioVibraControl +TInt CMMFAudioVibraControlMux::StartVibra() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIAudioVibraControlStartVibra, + KNullDesC8); + } + + return result; + } + + +// from MAudioVibraControl +TInt CMMFAudioVibraControlMux::StopVibra() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIAudioVibraControlStopVibra, + KNullDesC8); + } + + return result; + } + + + +// DEMUX // + +TInt CMMFAudioVibraControlDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFAudioVibraControlDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFAudioVibraControlDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFAudioVibraControlDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFAudioVibraControlDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFAudioVibraControlDeMux::RefreshL() + { + // refetch the Audio vibra control custom interface if we already have a target + if (iTarget) + { + iInterfaceAudioVibraControl = static_cast (iTarget->CustomInterface(KUidAudioVibraControl)); + + if (!iInterfaceAudioVibraControl) + { + iInterfaceAudioVibraControl = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFAudioVibraControlDeMux::NewL() + { + CMMFAudioVibraControlDeMux* self = new (ELeave) CMMFAudioVibraControlDeMux; + return self; + } + + +CMMFAudioVibraControlDeMux::CMMFAudioVibraControlDeMux() + { + } + + +CMMFAudioVibraControlDeMux::~CMMFAudioVibraControlDeMux() + { + } + + +TInt CMMFAudioVibraControlDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Audio vibra control Hw Device custom interface + iInterfaceAudioVibraControl = static_cast (iTarget->CustomInterface(KUidAudioVibraControl)); + + if (!iInterfaceAudioVibraControl) + { + iInterfaceAudioVibraControl = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFAudioVibraControlDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFAudioVibraControlDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIAudioVibraControlStartVibra: + { + result = DoStartVibraL(); + break; + } + case EMMFDevSoundCIAudioVibraControlStopVibra: + { + result = DoStopVibraL(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFAudioVibraControlDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + + +void CMMFAudioVibraControlDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFAudioVibraControlDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +TInt CMMFAudioVibraControlDeMux::DoStartVibraL() + { + TInt result = KErrNotFound; + + if (iInterfaceAudioVibraControl) + { + result = iInterfaceAudioVibraControl->StartVibra(); + } + + return result; + } + + +TInt CMMFAudioVibraControlDeMux::DoStopVibraL() + { + TInt result = KErrNotFound; + + if (iInterfaceAudioVibraControl) + { + result = iInterfaceAudioVibraControl->StopVibra(); + } + + return result; + } + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAudioVibraControlMux, CMMFAudioVibraControlMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceAudioVibraControlDeMux, CMMFAudioVibraControlDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,251 @@ +// Copyright (c) 2007-2009 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: +// Implementation of audio vibra control custom interface pair +// +// + +#ifndef AUDIOVIBRACONTROLCI_H +#define AUDIOVIBRACONTROLCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIAudioVibraControlCommands + { + EMMFDevSoundCIAudioVibraControlStartVibra, + EMMFDevSoundCIAudioVibraControlStopVibra + }; + + +/** +Implementation of the Audio vibra control custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFAudioVibraControlMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MAudioVibraControl + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MAudioVibraControl + //@see MAudioVibraControl + virtual TInt StartVibra(); + //@see MAudioVibraControl + virtual TInt StopVibra(); + +protected: + CMMFAudioVibraControlMux(); + ~CMMFAudioVibraControlMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Audio vibra control custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFAudioVibraControlDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFAudioVibraControlDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFAudioVibraControlDeMux(); + CMMFAudioVibraControlDeMux(); + + // from mirror MAudioVibraControl method. + TInt DoStartVibraL(); + TInt DoStopVibraL(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MAudioVibraControl* iInterfaceAudioVibraControl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/audiovibracontrolci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceAudioVibraControlDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAudioVibraControlMux; + version_no = 1; + display_name = "Audio Vibra Control Mux"; + default_data = "10282608" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceAudioVibraControlDeMux; + version_no = 1; + display_name = "Audio Vibra Control DeMux"; + default_data = "102825c3" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,360 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "bufferframesconfigci.h" + +// Helper class to pass data over process boundary +class TFrameInfo + { +public: + TInt iFrameCount; + TInt iSamplesPerFrame; + }; + +// MUX // +/*****************************************************************************/ + +TInt CMMFBufferFramesConfigMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceBufferFramesConfigDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFBufferFramesConfigMux::NewL() + { + CMMFBufferFramesConfigMux* self = new (ELeave) CMMFBufferFramesConfigMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFBufferFramesConfigMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFBufferFramesConfig* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFBufferFramesConfigMux::CMMFBufferFramesConfigMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFBufferFramesConfigMux::~CMMFBufferFramesConfigMux() + { + } + +/*****************************************************************************/ +// from MMMFBufferFramesConfig +TInt CMMFBufferFramesConfigMux::MmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) + { + if (iRemoteHandle > 0) + { + TFrameInfo info; + info.iFrameCount = aFrameCount; + info.iSamplesPerFrame = aSamplesPerFrame; + + TPckgBuf pckgBuf(info); + // send the frame information in the sync command + // any return code other than zero is an error + return iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIInputBufferFramesConfig, + pckgBuf); + } + else + { + return KErrNotReady; + } + } + +TInt CMMFBufferFramesConfigMux::MmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) + { + if (iRemoteHandle > 0) + { + TFrameInfo info; + info.iFrameCount = aFrameCount; + info.iSamplesPerFrame = aSamplesPerFrame; + + TPckgBuf pckgBuf(info); + // send the frame information in the sync command + // any return code other than zero is an error + return iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIOutputBufferFramesConfig, + pckgBuf); + } + else + { + return KErrNotReady; + } + } + + + +// DEMUX // +/*****************************************************************************/ +TInt CMMFBufferFramesConfigDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::RefreshL() + { + // refetch the buffer frames configuration custom interface if we already have a target + if (iTarget) + { + MMMFBufferFramesConfig* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidBufferFramesConfig)); + + if (!ptr) + { + iInterfaceBufferFramesConfig = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceBufferFramesConfig = ptr; + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFBufferFramesConfigDeMux::NewL() + { + CMMFBufferFramesConfigDeMux* self = new (ELeave) CMMFBufferFramesConfigDeMux; + return self; + } + +/*****************************************************************************/ +CMMFBufferFramesConfigDeMux::CMMFBufferFramesConfigDeMux() + { + } + +/*****************************************************************************/ +CMMFBufferFramesConfigDeMux::~CMMFBufferFramesConfigDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFBufferFramesConfigDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the buffer frames configuration Hw Device custom interface + MMMFBufferFramesConfig* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidBufferFramesConfig)); + + if (!ptr) + { + iInterfaceBufferFramesConfig = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceBufferFramesConfig = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFBufferFramesConfigDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + TInt retVal = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIInputBufferFramesConfig: + { + TPckgBuf info; + iUtility->ReadFromInputDesL(aMessage, &info); + + retVal = DoMmbfcSetNumberOfFramesPerInputBuffer(info().iFrameCount, info().iSamplesPerFrame); + break; + } + case EMMFDevSoundCIOutputBufferFramesConfig: + { + TPckgBuf info; + iUtility->ReadFromInputDesL(aMessage, &info); + retVal = DoMmbfcSetNumberOfFramesPerOutputBuffer(info().iFrameCount, info().iSamplesPerFrame); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +TInt CMMFBufferFramesConfigDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFBufferFramesConfigDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// Buffer frames config custom interface implementation +TInt CMMFBufferFramesConfigDeMux::DoMmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, + TInt aSamplesPerFrame) + { + if (!iInterfaceBufferFramesConfig) + { + return KErrNotReady; + } + else + { + return iInterfaceBufferFramesConfig->MmbfcSetNumberOfFramesPerInputBuffer(aFrameCount, + aSamplesPerFrame); + } + } + +TInt CMMFBufferFramesConfigDeMux::DoMmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, + TInt aSamplesPerFrame) + { + if (!iInterfaceBufferFramesConfig) + { + return KErrNotReady; + } + else + { + return iInterfaceBufferFramesConfig->MmbfcSetNumberOfFramesPerOutputBuffer(aFrameCount, + aSamplesPerFrame); + } + } + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceBufferFramesConfigMux, CMMFBufferFramesConfigMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceBufferFramesConfigDeMux, CMMFBufferFramesConfigDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,243 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef BUFFERFRAMESCONFIGCI_H +#define BUFFERFRAMESCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCIBufferFramesConfigCommands + { + EMMFDevSoundCIInputBufferFramesConfig = 0, + EMMFDevSoundCIOutputBufferFramesConfig + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFBufferFramesConfigMux + * + * implementation of the Play back status custom interface pair + */ +class CMMFBufferFramesConfigMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFBufferFramesConfig + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFBufferFramesConfig + /** + @see MMMFBufferFramesConfig + */ + virtual TInt MmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + + /** + @see MMMFBufferFramesConfig + */ + virtual TInt MmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + +protected: + CMMFBufferFramesConfigMux(); + ~CMMFBufferFramesConfigMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** + * DeMux side of pair + */ + +class CMMFBufferFramesConfigDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFBufferFramesConfigDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFBufferFramesConfigDeMux(); + CMMFBufferFramesConfigDeMux(); + + // mirrors MMMFBufferFramesConfig method. + TInt DoMmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + TInt DoMmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MMMFBufferFramesConfig* iInterfaceBufferFramesConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/bufferframesconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2007-2009 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 +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceBufferFramesConfigDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceBufferFramesConfigMux; + version_no = 1; + display_name = "Buffer Frames Config Mux"; + default_data = "1028260d"; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceBufferFramesConfigDeMux; + version_no = 1; + display_name = "Buffer Frames Config DeMux"; + default_data = "102825ed"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrate.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,459 @@ +/* +* 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 "cmmfdevsoundcibitrateimplementationuid.hrh" + +#include +#include +#include + +#include "cmmfdevsoundcibitrate.h" + +// __________________________________________________________________________ +// Implementation + +////////////////////////////////////////// MUX ///////////////////// + +TInt CMMFDevSoundCIBitRateMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceBitRateDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +void CMMFDevSoundCIBitRateMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle != -1) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +void CMMFDevSoundCIBitRateMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + +void CMMFDevSoundCIBitRateMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFDevSoundCIBitRateMux::NewL() + { + CMMFDevSoundCIBitRateMux* self = new (ELeave) CMMFDevSoundCIBitRateMux; + return self; + } + +TAny* CMMFDevSoundCIBitRateMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFDevSoundCustomInterfaceBitRate* interface = this; + return interface; + } + +CMMFDevSoundCIBitRateMux::CMMFDevSoundCIBitRateMux() : + iRemoteHandle(-1) + { + } + +CMMFDevSoundCIBitRateMux::~CMMFDevSoundCIBitRateMux() + { + } + +// from MMMFDevSoundCustomInterfaceBitRate +void CMMFDevSoundCIBitRateMux::GetSupportedBitRatesL(RArray& aSupportedBitRates) + { + if (iRemoteHandle == -1) + { + User::Leave(KErrNotReady); + } + + // first clear out the array + aSupportedBitRates.Reset(); + + // now fetch the count from the server + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIBitRateGetSupportedBitRates, KNullDesC8); + + // if count is negative then the server side left with an error + if (count < 0) + { + User::Leave(count); + } + + // no point getting the data if the count is zero + if (count != 0) + { + // allocate a temporary buffer to hold the bitrates + HBufC8* buf = HBufC8::NewLC(count * sizeof(TInt32)); + TPtr8 ptr = buf->Des(); + + // fetch the bitrates - but send over the received count to be sure + TPckgBuf countBuf(count); + User::LeaveIfError(iUtility->SendSlaveSyncCommandResult( + iRemoteHandle, + EMMFDevSoundCIBitRateGetSupportedBitRatesArray, + countBuf, ptr)); + + // stream data into the pointer + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + + TInt err = KErrNone; + for (TInt i = 0; i < count; i++) + { + // note we don't destroy array because we don't own it + // but we do reset it as it is incomplete + err = aSupportedBitRates.Append(stream.ReadInt32L()); + if (err != KErrNone) + { + aSupportedBitRates.Reset(); + User::Leave(KErrCorrupt); + } + } + + CleanupStack::PopAndDestroy(2, buf);// stream, buf + } + } + +TInt CMMFDevSoundCIBitRateMux::BitRateL() + { + if (iRemoteHandle == -1) + { + User::Leave(KErrNotReady); + } + + // send EMMFDevSoundCIBitRateBitRate command to slave + TInt bitrate = 0; + bitrate = iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIBitRateBitRate, KNullDesC8); + + // if bitrate is negative then remote side left with an error + if (bitrate < 0) + { + User::Leave(bitrate); + } + + return bitrate; + } + +void CMMFDevSoundCIBitRateMux::SetBitRateL(TInt aBitRate) + { + if (iRemoteHandle == -1) + { + User::Leave(KErrNotReady); + } + + // send the bitrate in the sync command + TPckgBuf bitBuffer(aBitRate); + + // any return code other than zero is an error + User::LeaveIfError(iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIBitRateSetBitRate, bitBuffer)); + } + +/////////////////////////////////////// DEMUX ////////////////////// + + +TInt CMMFDevSoundCIBitRateDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +void CMMFDevSoundCIBitRateDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +void CMMFDevSoundCIBitRateDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + +void CMMFDevSoundCIBitRateDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +void CMMFDevSoundCIBitRateDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +void CMMFDevSoundCIBitRateDeMux::RefreshL() + { + // refetch the bitrate custom interface if we already have a target + if (iTarget) + { + MMMFDevSoundCustomInterfaceBitRate* ptr = NULL; + ptr = static_cast (iTarget->CustomInterface(KUidCustomInterfaceDevSoundBitRate)); + + if (!ptr) + { + iBitRateInterface = NULL; + User::Leave(KErrNotSupported); + } + else + { + iBitRateInterface = ptr; + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDevSoundCIBitRateDeMux::NewL() + { + CMMFDevSoundCIBitRateDeMux* self = new (ELeave) CMMFDevSoundCIBitRateDeMux; + return self; + } + +CMMFDevSoundCIBitRateDeMux::CMMFDevSoundCIBitRateDeMux() + { + + } + +CMMFDevSoundCIBitRateDeMux::~CMMFDevSoundCIBitRateDeMux() + { + iBitRateArray.Reset(); + iBitRateArray.Close(); + } + + +TInt CMMFDevSoundCIBitRateDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the bitrate custom interface + MMMFDevSoundCustomInterfaceBitRate* ptr = NULL; + ptr = static_cast (iTarget->CustomInterface(KUidCustomInterfaceDevSoundBitRate)); + + if (!ptr) + { + iBitRateInterface = NULL; + User::Leave(KErrNotSupported); + } + else + { + iBitRateInterface = ptr; + } + return KErrNone; + } + +void CMMFDevSoundCIBitRateDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFDevSoundCIBitRateDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + TInt retVal = -1; + + switch (data.iCommand) + { + case EMMFDevSoundCIBitRateBitRate: + { + retVal = DoBitRateL(); + break; + } + case EMMFDevSoundCIBitRateSetBitRate: + { + // we know that offset 2 contains a TInt + TPckgBuf bitBuffer; + iUtility->ReadFromInputDesL(aMessage, &bitBuffer); + + DoSetBitRateL(bitBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIBitRateGetSupportedBitRates: + { + // reset the current bitrate array + iBitRateArray.Reset(); + DoGetSupportedBitRatesL(iBitRateArray); + + // send back the array count + TInt count = iBitRateArray.Count(); + retVal = count; + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return retVal; + } + +TInt CMMFDevSoundCIBitRateDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIBitRateGetSupportedBitRatesArray: + { + DoCopyBitRateBufferToClientL(aMessage); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return KErrNone; + } + +void CMMFDevSoundCIBitRateDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +void CMMFDevSoundCIBitRateDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +// bitrate custom interface implementation +void CMMFDevSoundCIBitRateDeMux::DoGetSupportedBitRatesL(RArray& aSupportedBitRates) + { + if (!iBitRateInterface) + { + User::Leave(KErrNotReady); + } + + iBitRateInterface->GetSupportedBitRatesL(aSupportedBitRates); + } + + +void CMMFDevSoundCIBitRateDeMux::DoCopyBitRateBufferToClientL(const RMmfIpcMessage& aMessage) + { + if (!iBitRateInterface) + { + User::Leave(KErrNotReady); + } + + // check our count is the same as the client's + TPckgBuf countBuffer; + iUtility->ReadFromInputDesL(aMessage, &countBuffer); + + TInt count = countBuffer(); + if (count != iBitRateArray.Count()) + { + User::Leave(KErrCorrupt); + } + + // send back the array - the client has the count already + const TInt KBufExpandSize8 = 8; //two TInt's + CBufFlat* dataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); + CleanupStack::PushL(dataCopyBuffer); + RBufWriteStream stream; + stream.Open(*dataCopyBuffer); + CleanupClosePushL(stream); + + for (TInt i = 0; i < count; i++) + { + stream.WriteInt32L(iBitRateArray[i]); + } + + // write the data to the supplied descriptor buffer + TPtr8 ptrBuf = dataCopyBuffer->Ptr(0); + iUtility->WriteToOutputDesL(aMessage, ptrBuf); + stream.Close(); + + CleanupStack::PopAndDestroy(2); // iDataCopyBuffer, stream + } + + +TInt CMMFDevSoundCIBitRateDeMux::DoBitRateL() + { + if (!iBitRateInterface) + { + User::Leave(KErrNotReady); + } + return iBitRateInterface->BitRateL(); + } + +void CMMFDevSoundCIBitRateDeMux::DoSetBitRateL(TInt aBitRate) + { + if (!iBitRateInterface) + { + User::Leave(KErrNotReady); + } + + // set the bitrate + iBitRateInterface->SetBitRateL(aBitRate); + } + + + +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceBitRateMux, CMMFDevSoundCIBitRateMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceBitRateDeMux, CMMFDevSoundCIBitRateDeMux::NewL), + }; + + +// +// ImplementationGroupProxy +// +//////////////////////////////////////////////////////////////////////////////// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrate.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,235 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef CMMFDEVSOUNDCIBITRATE_H +#define CMMFDEVSOUNDCIBITRATE_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ + +enum TMMFDevSoundCIBitRateCommands + { + EMMFDevSoundCIBitRateBitRate = 0, + EMMFDevSoundCIBitRateSetBitRate, + EMMFDevSoundCIBitRateGetSupportedBitRates, + EMMFDevSoundCIBitRateGetSupportedBitRatesArray + }; + +/** + * CMMFDevSoundCIBitRate + * + * implementation of the BitRate custom interface pair + */ +class CMMFDevSoundCIBitRateMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFDevSoundCustomInterfaceBitRate + { +public: + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CMMFDevSoundCIBitRateMux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + +protected: + // from MMMFDevSoundCustomInterfaceBitRate + virtual void GetSupportedBitRatesL(RArray& aSupportedBitRates); + virtual TInt BitRateL(); + virtual void SetBitRateL(TInt aBitRate); + + CMMFDevSoundCIBitRateMux(); + ~CMMFDevSoundCIBitRateMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** + * DeMux side of pair + */ + +class CMMFDevSoundCIBitRateDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFDevSoundCIBitRateDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + */ + virtual void RefreshL(); + + // from MMMFDeMuxInterface + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFDevSoundCIBitRateDeMux(); + CMMFDevSoundCIBitRateDeMux(); + + // implementation of bitrate custom interface + void DoGetSupportedBitRatesL(RArray& aSupportedBitRates); + void DoCopyBitRateBufferToClientL(const RMmfIpcMessage& aMessage); + TInt DoBitRateL(); + void DoSetBitRateL(TInt aBitRate); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + MMMFDevSoundCustomInterfaceBitRate* iBitRateInterface; + TUid iKey; + + // array for bitrates + RArray iBitRateArray; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrateimplementationuid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcibitrateimplementationuid.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2005-2009 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: +// + +/** + @file + @internalTechnology +*/ + +#ifndef __CMMFDEVSOUNDCIBITRATEIMPLEMENTATIONUID_HRH__ +#define __CMMFDEVSOUNDCIBITRATEIMPLEMENTATIONUID_HRH__ + +// These are the ECOM Implementation UIDs for the Bitrate Custom Interface + +#define KMmfUidCustomInterfaceBitRateDll 0x102070b4 + +// The below interface is currently defined but has been supplied by a +// licensee. If this is deemed to be a problem then use 0x102070b5 instead +#define KMmfUidCustomInterfaceBitRateMux 0x101F7DD5 + +#define KMmfUidCustomInterfaceBitRateDeMux 0x102070b6 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklength.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklength.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,294 @@ +// Copyright (c) 2006-2009 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 "cmmfdevsoundcifileblocklengthimpluid.hrh" + +#include +#include +#include +#include + +#include "cmmfdevsoundcifileblocklength.h" + +// __________________________________________________________________________ +// Implementation + +// MUX // + +TInt CMMFDevSoundCIFileBlockLengthMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCIFileBlockLengthDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +void CMMFDevSoundCIFileBlockLengthMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle != -1) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +void CMMFDevSoundCIFileBlockLengthMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + +void CMMFDevSoundCIFileBlockLengthMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFDevSoundCIFileBlockLengthMux::NewL() + { + CMMFDevSoundCIFileBlockLengthMux* self = new (ELeave) CMMFDevSoundCIFileBlockLengthMux; + return self; + } + +TAny* CMMFDevSoundCIFileBlockLengthMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFDevSoundCustomInterfaceFileBlockLength* interface = this; + return interface; + } + +CMMFDevSoundCIFileBlockLengthMux::CMMFDevSoundCIFileBlockLengthMux() : + iRemoteHandle(-1) + { + } + +CMMFDevSoundCIFileBlockLengthMux::~CMMFDevSoundCIFileBlockLengthMux() + { + } + +// from MMMFDevSoundCustomInterfaceFileBlockLength + +void CMMFDevSoundCIFileBlockLengthMux::SetFileBlockLength(TUint aBlockAlign) + { + if (iRemoteHandle == -1) + { + return; + } + + // send the BlockAlign in the sync command + TPckgBuf blockAlignBuffer(aBlockAlign); + + iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIBlockLengthSetFileBlockLength, blockAlignBuffer); + } + +// DEMUX // + + +TInt CMMFDevSoundCIFileBlockLengthDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +void CMMFDevSoundCIFileBlockLengthDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::RefreshL() + { + // refetch the fileblocklength custom interface if we already have a target + if (iTarget) + { + MMMFDevSoundCustomInterfaceFileBlockLength* ptr = NULL; + ptr = static_cast(iTarget->CustomInterface(KUidCustomInterfaceDevSoundFileBlockLength)); + + if (!ptr) + { + iFileBlockLengthInterface = NULL; + User::Leave(KErrNotSupported); + } + else + { + iFileBlockLengthInterface = ptr; + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDevSoundCIFileBlockLengthDeMux::NewL() + { + CMMFDevSoundCIFileBlockLengthDeMux* self = new (ELeave) CMMFDevSoundCIFileBlockLengthDeMux; + return self; + } + +CMMFDevSoundCIFileBlockLengthDeMux::CMMFDevSoundCIFileBlockLengthDeMux() + { + } + +CMMFDevSoundCIFileBlockLengthDeMux::~CMMFDevSoundCIFileBlockLengthDeMux() + { + } + + +TInt CMMFDevSoundCIFileBlockLengthDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the fileblocklength custom interface + MMMFDevSoundCustomInterfaceFileBlockLength* ptr = NULL; + ptr = static_cast (iTarget->CustomInterface(KUidCustomInterfaceDevSoundFileBlockLength)); + + if (!ptr) + { + iFileBlockLengthInterface = NULL; + User::Leave(KErrNotSupported); + } + else + { + iFileBlockLengthInterface = ptr; + } + return KErrNone; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFDevSoundCIFileBlockLengthDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + TInt retVal = -1; + + switch (data.iCommand) + { + case EMMFDevSoundCIBlockLengthSetFileBlockLength: + { + // we know that offset 2 contains a TInt + TPckgBuf blockAlignBuffer; + iUtility->ReadFromInputDesL(aMessage, &blockAlignBuffer); + + DoSetFileBlockLengthL(blockAlignBuffer()); + retVal = KErrNone; + break; + } + + default: + { + User::Leave(KErrNotSupported); + } + } + + return retVal; + } + +TInt CMMFDevSoundCIFileBlockLengthDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNotSupported; + } + +void CMMFDevSoundCIFileBlockLengthDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +void CMMFDevSoundCIFileBlockLengthDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +void CMMFDevSoundCIFileBlockLengthDeMux::DoSetFileBlockLengthL(TUint aBlockAlign) + { + if (!iFileBlockLengthInterface) + { + User::Leave(KErrNotReady); + } + + // set the block length + iFileBlockLengthInterface->SetFileBlockLength(aBlockAlign); + } + + + +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCIFileBlockLengthMux, CMMFDevSoundCIFileBlockLengthMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCIFileBlockLengthDeMux, CMMFDevSoundCIFileBlockLengthDeMux::NewL), + }; + + +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +#ifndef EKA2 +/** DLL Entry point */ +GLDEF_C TInt E32Dll(TDllReason /*aReason*/) + { + return(KErrNone); + } +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklength.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklength.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,220 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef CMMFDEVSOUNDCIFILEBLOCKLENGTH_H +#define CMMFDEVSOUNDCIFILEBLOCKLENGTH_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include + + +enum TMMFDevSoundCIBlockLengthCommands + { + EMMFDevSoundCIBlockLengthSetFileBlockLength = 0 + }; + +/** + * CMMFDevSoundCIFileBlockLengthMux + * + * implementation of the FileBlockLength custom interface pair + */ +class CMMFDevSoundCIFileBlockLengthMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFDevSoundCustomInterfaceFileBlockLength + { +public: + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CMMFDevSoundCIFileBlockLengthMux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + +protected: + // from MMMFDevSoundCustomInterfaceFileBlockLength + virtual void SetFileBlockLength(TUint aBlockAlign); + + CMMFDevSoundCIFileBlockLengthMux(); + ~CMMFDevSoundCIFileBlockLengthMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** + * DeMux side of pair + */ + +class CMMFDevSoundCIFileBlockLengthDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFDevSoundCIFileBlockLengthDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + */ + virtual void RefreshL(); + + // from MMMFDeMuxInterface + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFDevSoundCIFileBlockLengthDeMux(); + CMMFDevSoundCIFileBlockLengthDeMux(); + + // implementation of FileBlockLength custom interface + void DoSetFileBlockLengthL(TUint aBlockAlign); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + MMMFDevSoundCustomInterfaceFileBlockLength* iFileBlockLengthInterface; + TUid iKey; + + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklengthimpluid.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/cmmfdevsoundcifileblocklengthimpluid.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef __CMMFDEVSOUNDCIFILEBLOCKLENGTHIMPLUID_HRH__ +#define __CMMFDEVSOUNDCIFILEBLOCKLENGTHIMPLUID_HRH__ + +// These are the ECOM Implementation UIDs for the File Block Length Custom Interface + +#define KMmfUidCIFileBlockLengthDll 0x102737fd + +#define KMmfUidCIFileBlockLengthMux 0x10273806 + +#define KMmfUidCIFileBlockLengthDeMux 0x102737fe + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,407 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "dspcontrolci.h" + + +// MUX // + +TInt CMMFDspControlMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceDspControlDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFDspControlMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFDspControlMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFDspControlMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFDspControlMux::NewL() + { + CMMFDspControlMux* self = new (ELeave) CMMFDspControlMux; + return self; + } + + +TAny* CMMFDspControlMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFDSPControl* interface = this; + return interface; + } + + +CMMFDspControlMux::CMMFDspControlMux() : + iRemoteHandle(-1) + { + } + + +CMMFDspControlMux::~CMMFDspControlMux() + { + } + + +// from MMMFDSPControl +TInt CMMFDspControlMux::MmdspcGetAudioPlaybackInfo (TInt64& aSamplesPlayed, + TInt64& aSystemTime, + TUint& aBytesDecoderConsumed, + TUint& aBytesDecoderDecoded) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value + TPckgBuf returnVal; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIDspCtrlGetAudioPlaybackInfo, + KNullDesC8, + returnVal); + + // assign returned value to the individual parameter. Do nothing if there is an error + if(result == KErrNone) + { + aSamplesPlayed = returnVal().iSamplesPlayed; + aSystemTime = returnVal().iSystemTime; + aBytesDecoderConsumed = returnVal().iBytesDecoderConsumed; + aBytesDecoderDecoded = returnVal().iBytesDecoderDecoded; + } + } + + return result; + } + + +// from MMMFDSPControl +TInt CMMFDspControlMux::MmdspcAcceptRecordBuffersInvalidFollowingStop() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIDspCtrlAcceptRecordBuffersInvalidFollowingStop, + KNullDesC8); + } + + return result; + } + + +// from MMMFDSPControl +TInt CMMFDspControlMux::MmdspcAcceptPlaybackBuffersInvalidFollowingStop() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIDspCtrlAcceptPlaybackBuffersInvalidFollowingStop, + KNullDesC8); + } + + return result; + } + + + +// DEMUX // + +TInt CMMFDspControlDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFDspControlDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFDspControlDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFDspControlDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFDspControlDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFDspControlDeMux::RefreshL() + { + // refetch the DSP Control custom interface if we already have a target + if (iTarget) + { + iInterfaceDspControl = static_cast (iTarget->CustomInterface(KUidDSPControl)); + + if (!iInterfaceDspControl) + { + iInterfaceDspControl = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDspControlDeMux::NewL() + { + CMMFDspControlDeMux* self = new (ELeave) CMMFDspControlDeMux; + return self; + } + + +CMMFDspControlDeMux::CMMFDspControlDeMux() + { + } + + +CMMFDspControlDeMux::~CMMFDspControlDeMux() + { + } + + +TInt CMMFDspControlDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the DSP Control Hw Device custom interface + iInterfaceDspControl = static_cast (iTarget->CustomInterface(KUidDSPControl)); + + if (!iInterfaceDspControl) + { + iInterfaceDspControl = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFDspControlDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFDspControlDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIDspCtrlAcceptRecordBuffersInvalidFollowingStop: + { + result = DoMmdspcAcceptRecordBuffersInvalidFollowingStopL(); + + break; + } + case EMMFDevSoundCIDspCtrlAcceptPlaybackBuffersInvalidFollowingStop: + { + result = DoMmdspcAcceptPlaybackBuffersInvalidFollowingStopL(); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFDspControlDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIDspCtrlGetAudioPlaybackInfo: + { + TPckgBuf pckData; + + iUtility->ReadFromInputDesL(aMessage, &pckData); + + result = DoMmdspcGetAudioPlaybackInfoL(pckData().iSamplesPlayed, + pckData().iSystemTime, + pckData().iBytesDecoderConsumed, + pckData().iBytesDecoderDecoded); + + TPckgBuf des(pckData()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFDspControlDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFDspControlDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +TInt CMMFDspControlDeMux::DoMmdspcAcceptRecordBuffersInvalidFollowingStopL() + { + TInt result = KErrNotFound; + + if (iInterfaceDspControl) + { + result = iInterfaceDspControl->MmdspcAcceptRecordBuffersInvalidFollowingStop(); + } + + return result; + } + + +TInt CMMFDspControlDeMux::DoMmdspcAcceptPlaybackBuffersInvalidFollowingStopL() + { + TInt result = KErrNotFound; + + if (iInterfaceDspControl) + { + result = iInterfaceDspControl->MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + } + + return result; + } + + +TInt CMMFDspControlDeMux::DoMmdspcGetAudioPlaybackInfoL(TInt64& aSamplesPlayed, + TInt64& aSystemTime, + TUint& aBytesDecoderConsumed, + TUint& aBytesDecoderDecoded) + { + TInt result = KErrNotFound; + + if (iInterfaceDspControl) + { + result = iInterfaceDspControl->MmdspcGetAudioPlaybackInfo(aSamplesPlayed, + aSystemTime, + aBytesDecoderConsumed, + aBytesDecoderDecoded); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceDspControlMux, CMMFDspControlMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceDspControlDeMux, CMMFDspControlDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,272 @@ +// Copyright (c) 2007-2009 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: +// Implementation of DSP control custom interface pair +// +// + +#ifndef DSPCONTROLCI_H +#define DSPCONTROLCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIDspControlCommands + { + EMMFDevSoundCIDspCtrlGetAudioPlaybackInfo, + EMMFDevSoundCIDspCtrlAcceptRecordBuffersInvalidFollowingStop, + EMMFDevSoundCIDspCtrlAcceptPlaybackBuffersInvalidFollowingStop + }; + +/** +class to hold the paramenters to MmdspcGetAudioPlaybackInfo for message passing +@internalComponent +@prototype +@file +*/ +class TAudioPlaybackInfo + { +public: + TInt64 iSamplesPlayed; + TInt64 iSystemTime; + TUint iBytesDecoderConsumed; + TUint iBytesDecoderDecoded; + }; + +/** +Implementation of the DSP control custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFDspControlMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFDSPControl + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFDSPControl + //@see MMMFDSPControl + virtual TInt MmdspcGetAudioPlaybackInfo(TInt64& aSamplesPlayed, + TInt64& aSystemTime, + TUint& aBytesDecoderConsumed, + TUint& aBytesDecoderDecoded); + //@see MMMFDSPControl + virtual TInt MmdspcAcceptRecordBuffersInvalidFollowingStop(); + //@see MMMFDSPControl + virtual TInt MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + +protected: + CMMFDspControlMux(); + ~CMMFDspControlMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the DSP control custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFDspControlDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFDspControlDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFDspControlDeMux(); + CMMFDspControlDeMux(); + + // from mirror MMMFDSPControl method. + TInt DoMmdspcGetAudioPlaybackInfoL(TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT); + TInt DoMmdspcAcceptRecordBuffersInvalidFollowingStopL(); + TInt DoMmdspcAcceptPlaybackBuffersInvalidFollowingStopL(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MMMFDSPControl* iInterfaceDspControl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/dspcontrolci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceDspControlDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceDspControlMux; + version_no = 1; + display_name = "DSP Control Mux"; + default_data = "1028260a" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceDspControlDeMux; + version_no = 1; + display_name = "DSP Control DeMux"; + default_data = "102825c7" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,621 @@ +// Copyright (c) 2007-2009 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 +#include +#include + +#include "eaacplusdecoderci.h" + + +// MUX // +/*****************************************************************************/ + +TInt CMMFEAacPlusDecoderMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceEAacPlusDecoderDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFEAacPlusDecoderMux::NewL() + { + CMMFEAacPlusDecoderMux* self = new (ELeave) CMMFEAacPlusDecoderMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFEAacPlusDecoderMux::CustomInterface(TUid /*aInterfaceId*/) + { + MEAacPlusDecoderIntfc* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFEAacPlusDecoderMux::CMMFEAacPlusDecoderMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFEAacPlusDecoderMux::~CMMFEAacPlusDecoderMux() + { + } + +/*****************************************************************************/ +// from MEAacPlusDecoderIntfc +void CMMFEAacPlusDecoderMux::SetInputSamplingFrequency(TUint aInputSamplingFrequency) + { + if (iRemoteHandle > 0) + { + // send the frequency in the sync command + TPckgBuf freqBuffer(aInputSamplingFrequency); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderSetInputSamplingFrequency, + freqBuffer); + } + } + +void CMMFEAacPlusDecoderMux::SetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType) + { + if (iRemoteHandle > 0) + { + // send the object type in the sync command + TPckgBuf objTypeBuffer(aAudioObjectType); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderSetAudioObjectType, + objTypeBuffer); + } + } + +void CMMFEAacPlusDecoderMux::SetNumOfChannels(TUint aNumOfChannels) + { + if (iRemoteHandle > 0) + { + // send the number of channels in the sync command + TPckgBuf numBuffer(aNumOfChannels); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderSetNumOfChannels, + numBuffer); + } + } + +void CMMFEAacPlusDecoderMux::SetSbr(TBool aSbrEnabled) + { + if (iRemoteHandle > 0) + { + // send the SBR enabled flag in the sync command + TPckgBuf flagBuffer(aSbrEnabled); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderSetSbr, + flagBuffer); + } + } + +void CMMFEAacPlusDecoderMux::SetDownSampledMode(TBool aDsmEnabled) + { + if (iRemoteHandle > 0) + { + // send the DSM enabled flag in the sync command + TPckgBuf flagBuffer(aDsmEnabled); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderSetDownSampledMode, + flagBuffer); + } + } + +TInt CMMFEAacPlusDecoderMux::ApplyConfig() + { + TInt retVal = KErrNotReady; + if (iRemoteHandle > 0) + { + retVal = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderApplyConfig, + KNullDesC8); + } + return retVal; + } + +TInt CMMFEAacPlusDecoderMux::GetInputSamplingFrequency(TUint& aInputSamplingFrequency) + { + TInt result = KErrNotReady; + + if (iRemoteHandle > 0) + { + TPckgBuf freqBuffer; + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderGetInputSamplingFrequency, + KNullDesC8, + freqBuffer); + aInputSamplingFrequency = freqBuffer(); + } + + return result; + } + +TInt CMMFEAacPlusDecoderMux::GetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType) + { + TInt result = KErrNotReady; + + if (iRemoteHandle > 0) + { + TPckgBuf objTypeBuffer; + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderGetAudioObjectType, + KNullDesC8, + objTypeBuffer); + aAudioObjectType = objTypeBuffer(); + } + + return result; + } + +TInt CMMFEAacPlusDecoderMux::GetNumOfChannels(TUint& aNumOfChannels) + { + TInt result = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf channelsBuffer; + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderGetNumOfChannels, + KNullDesC8, + channelsBuffer); + aNumOfChannels = channelsBuffer(); + } + + return result; + } + +TInt CMMFEAacPlusDecoderMux::GetSbr(TBool& aSbrEnabled) + { + TInt result = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf flagBuffer; + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderGetSbr, + KNullDesC8, + flagBuffer); + aSbrEnabled = flagBuffer(); + } + + return result; + } + +TInt CMMFEAacPlusDecoderMux::GetDownSampledMode(TBool& aDsmEnabled) + { + TInt result = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf flagBuffer; + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIEAacPlusDecoderGetDownSampledMode, + KNullDesC8, + flagBuffer); + aDsmEnabled = flagBuffer(); + } + + return result; + } + +// DEMUX // +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::RefreshL() + { + // refetch the EAAC+ decoder custom interface if we already have a target + if (iTarget) + { + iInterfaceEAacPlusDecoder = static_cast (iTarget->CustomInterface(KUidEAacPlusDecoderIntfc)); + if (!iInterfaceEAacPlusDecoder) + { + User::Leave(KErrNotSupported); + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFEAacPlusDecoderDeMux::NewL() + { + CMMFEAacPlusDecoderDeMux* self = new (ELeave) CMMFEAacPlusDecoderDeMux; + return self; + } + +/*****************************************************************************/ +CMMFEAacPlusDecoderDeMux::CMMFEAacPlusDecoderDeMux() + { + } + +/*****************************************************************************/ +CMMFEAacPlusDecoderDeMux::~CMMFEAacPlusDecoderDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the EAAC+ decoder Hw Device custom interface + iInterfaceEAacPlusDecoder = static_cast (iTarget->CustomInterface(KUidEAacPlusDecoderIntfc)); + + if (!iInterfaceEAacPlusDecoder) + { + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFEAacPlusDecoderDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + TInt retVal = -1; + switch (data.iCommand) + { + case EMMFDevSoundCIEAacPlusDecoderSetInputSamplingFrequency: + { + TPckgBuf freqBuffer; + iUtility->ReadFromInputDesL(aMessage, &freqBuffer); + DoSetInputSamplingFrequency(freqBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIEAacPlusDecoderSetAudioObjectType: + { + TPckgBuf audioObjectTypeBuffer; + iUtility->ReadFromInputDesL(aMessage, &audioObjectTypeBuffer); + DoSetAudioObjectType(audioObjectTypeBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIEAacPlusDecoderSetNumOfChannels: + { + TPckgBuf numChannelsBuffer; + iUtility->ReadFromInputDesL(aMessage, &numChannelsBuffer); + DoSetNumOfChannels(numChannelsBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIEAacPlusDecoderSetSbr: + { + TPckgBuf flagBuffer; + iUtility->ReadFromInputDesL(aMessage, &flagBuffer); + DoSetSbr(flagBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIEAacPlusDecoderSetDownSampledMode: + { + TPckgBuf flagBuffer; + iUtility->ReadFromInputDesL(aMessage, &flagBuffer); + DoSetDownSampledMode(flagBuffer()); + retVal = KErrNone; + break; + } + case EMMFDevSoundCIEAacPlusDecoderApplyConfig: + { + retVal = DoApplyConfig(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + }; + + return retVal; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + TInt retVal = -1; + switch (data.iCommand) + { + case EMMFDevSoundCIEAacPlusDecoderGetInputSamplingFrequency: + { + TPckgBuf freqBuf; + retVal = DoGetInputSamplingFrequency(freqBuf()); + iUtility->WriteToOutputDesL(aMessage, freqBuf); + break; + } + case EMMFDevSoundCIEAacPlusDecoderGetAudioObjectType: + { + TPckgBuf objTypeBuf; + retVal = DoGetAudioObjectType(objTypeBuf()); + iUtility->WriteToOutputDesL(aMessage, objTypeBuf); + break; + } + case EMMFDevSoundCIEAacPlusDecoderGetNumOfChannels: + { + TPckgBuf channelsBuf; + retVal = DoGetNumOfChannels(channelsBuf()); + iUtility->WriteToOutputDesL(aMessage, channelsBuf); + break; + } + case EMMFDevSoundCIEAacPlusDecoderGetSbr: + { + TPckgBuf flagBuf; + retVal = DoGetSbr(flagBuf()); + iUtility->WriteToOutputDesL(aMessage, flagBuf); + break; + } + case EMMFDevSoundCIEAacPlusDecoderGetDownSampledMode: + { + TPckgBuf flagBuf; + retVal = DoGetDownSampledMode(flagBuf()); + iUtility->WriteToOutputDesL(aMessage, flagBuf); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return retVal; + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// EAAC+ Decoder custom interface implementation +void CMMFEAacPlusDecoderDeMux::DoSetInputSamplingFrequency(TUint aInputSamplingFrequency) + { + if (iInterfaceEAacPlusDecoder) + { + iInterfaceEAacPlusDecoder->SetInputSamplingFrequency(aInputSamplingFrequency); + } + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType) + { + if (iInterfaceEAacPlusDecoder) + { + iInterfaceEAacPlusDecoder->SetAudioObjectType(aAudioObjectType); + } + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSetNumOfChannels(TUint aNumOfChannels) + { + if (iInterfaceEAacPlusDecoder) + { + iInterfaceEAacPlusDecoder->SetNumOfChannels(aNumOfChannels); + } + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSetSbr(TBool aSbrEnabled) + { + if (iInterfaceEAacPlusDecoder) + { + iInterfaceEAacPlusDecoder->SetSbr(aSbrEnabled); + } + } + +/*****************************************************************************/ +void CMMFEAacPlusDecoderDeMux::DoSetDownSampledMode(TBool aDsmEnabled) + { + if (iInterfaceEAacPlusDecoder) + { + iInterfaceEAacPlusDecoder->SetDownSampledMode(aDsmEnabled); + } + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoApplyConfig() + { + // Initialise the return value to an error that reflects the plugin's not ready + TInt retVal = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + retVal = iInterfaceEAacPlusDecoder->ApplyConfig(); + } + return retVal; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoGetInputSamplingFrequency(TUint& aInputSamplingFrequency) + { + TInt ret = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + ret = iInterfaceEAacPlusDecoder->GetInputSamplingFrequency(aInputSamplingFrequency); + } + return ret; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoGetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType) + { + TInt err = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + err = iInterfaceEAacPlusDecoder->GetAudioObjectType(aAudioObjectType); + } + return err; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoGetNumOfChannels(TUint& aNumOfChannels) + { + TInt err = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + err = iInterfaceEAacPlusDecoder->GetNumOfChannels(aNumOfChannels); + } + return err; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoGetSbr(TBool& aSbrEnabled) + { + TInt err = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + err = iInterfaceEAacPlusDecoder->GetSbr(aSbrEnabled); + } + return err; + } + +/*****************************************************************************/ +TInt CMMFEAacPlusDecoderDeMux::DoGetDownSampledMode(TBool& aDsmEnabled) + { + TInt err = KErrNotReady; + if (iInterfaceEAacPlusDecoder) + { + err = iInterfaceEAacPlusDecoder->GetDownSampledMode(aDsmEnabled); + } + return err; + } + +/*****************************************************************************/ + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceEAacPlusDecoderMux, CMMFEAacPlusDecoderMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceEAacPlusDecoderDeMux, CMMFEAacPlusDecoderDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,314 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef EAACPLUSDECODERCI_H +#define EAACPLUSDECODERCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + Enum to represent the methods called by this custom interface + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCIEAacPlusDecoderCommands + { + EMMFDevSoundCIEAacPlusDecoderSetInputSamplingFrequency = 0, + EMMFDevSoundCIEAacPlusDecoderSetAudioObjectType, + EMMFDevSoundCIEAacPlusDecoderSetNumOfChannels, + EMMFDevSoundCIEAacPlusDecoderSetSbr, + EMMFDevSoundCIEAacPlusDecoderSetDownSampledMode, + EMMFDevSoundCIEAacPlusDecoderApplyConfig, + EMMFDevSoundCIEAacPlusDecoderGetInputSamplingFrequency, + EMMFDevSoundCIEAacPlusDecoderGetAudioObjectType, + EMMFDevSoundCIEAacPlusDecoderGetNumOfChannels, + EMMFDevSoundCIEAacPlusDecoderGetSbr, + EMMFDevSoundCIEAacPlusDecoderGetDownSampledMode + }; + + +/** + CMMFEAacPlusDecoderMux - implementation of the EAAC+ Decoder custom interface pair + @internalComponent + @prototype + @file + */ +class CMMFEAacPlusDecoderMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MEAacPlusDecoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @leave This method may leave with one of the system-wide error codes. + @return The pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MEAacPlusDecoderIntfc + /** + @see MEAacPlusDecoderIntfc + */ + virtual void SetInputSamplingFrequency(TUint aInputSamplingFrequency); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual void SetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual void SetNumOfChannels(TUint aNumOfChannels); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual void SetSbr(TBool aSbrEnabled); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual void SetDownSampledMode(TBool aDsmEnabled); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt ApplyConfig(); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt GetInputSamplingFrequency ( TUint& aInputSamplingFrequency ); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt GetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt GetNumOfChannels ( TUint& aNumOfChannels ); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt GetSbr (TBool& aSbrEnabled); + + /** + @see MEAacPlusDecoderIntfc + */ + virtual TInt GetDownSampledMode (TBool& aDsmEnabled); + +protected: + CMMFEAacPlusDecoderMux(); + ~CMMFEAacPlusDecoderMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + +/** + CMMFEAacPlusDecoderDeMux - DeMux side of pair + @internalComponent + @prototype + @file + */ +class CMMFEAacPlusDecoderDeMux : public CBase, public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFEAacPlusDecoderDeMux class + @leave This method may leave with one of the system-wide error codes. + @return A pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFEAacPlusDecoderDeMux(); + CMMFEAacPlusDecoderDeMux(); + + // mirrors MEAacPlusDecoderIntfc methods. + void DoSetInputSamplingFrequency(TUint aInputSamplingFrequency); + void DoSetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType); + void DoSetNumOfChannels(TUint aNumOfChannels); + void DoSetSbr(TBool aSbrEnabled); + void DoSetDownSampledMode(TBool aDsmEnabled); + TInt DoApplyConfig(); + TInt DoGetInputSamplingFrequency(TUint& aInputSamplingFrequency); + TInt DoGetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType); + TInt DoGetNumOfChannels(TUint& aNumOfChannels); + TInt DoGetSbr(TBool& aSbrEnabled); + TInt DoGetDownSampledMode(TBool& aDsmEnabled); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MEAacPlusDecoderIntfc* iInterfaceEAacPlusDecoder; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/eaacplusdecoderci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceEAacPlusDecoderDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceEAacPlusDecoderMux; + version_no = 1; + display_name = "EAAC+ Decoder Mux"; + default_data = "102825ff" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceEAacPlusDecoderDeMux; + version_no = 1; + display_name = "EAAC+ Decoder DeMux"; + default_data = "1027381d"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,401 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "errorconcealmentci.h" + + +// MUX // + +TInt CMMFErrorConcealmentIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceErrorConcealmentIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFErrorConcealmentIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFErrorConcealmentIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFErrorConcealmentIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFErrorConcealmentIntfcMux::NewL() + { + CMMFErrorConcealmentIntfcMux* self = new (ELeave) CMMFErrorConcealmentIntfcMux; + return self; + } + + +TAny* CMMFErrorConcealmentIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFErrorConcealmentIntfc* interface = this; + return interface; + } + + +CMMFErrorConcealmentIntfcMux::CMMFErrorConcealmentIntfcMux() : + iRemoteHandle(-1) + { + } + + +CMMFErrorConcealmentIntfcMux::~CMMFErrorConcealmentIntfcMux() + { + } + + +// from MErrorConcealmentIntfc +TInt CMMFErrorConcealmentIntfcMux::ConcealErrorForNextBuffer() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIErrorConcealmentIntfcConcealErrorForNextBuffer, + KNullDesC8); + } + + return result; + } + + +// from MErrorConcealmentIntfc +TInt CMMFErrorConcealmentIntfcMux::SetFrameMode(TBool aFrameModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the cng in the sync command + TPckgBuf frameModeOn(aFrameModeOn); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIErrorConcealmentIntfcSetFrameMode, + frameModeOn); + } + + return result; + } + + +// from MErrorConcealmentIntfc +TInt CMMFErrorConcealmentIntfcMux::FrameModeRqrdForEC(TBool& aFrameModeRqrd) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retFrameModeRqrd; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIErrorConcealmentIntfcFrameModeRqrdForEC, + KNullDesC8, + retFrameModeRqrd); + + // assign return values to aFrameModeRqrd. Do nothing if there is an error + if(result == KErrNone) + { + aFrameModeRqrd = retFrameModeRqrd(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFErrorConcealmentIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFErrorConcealmentIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFErrorConcealmentIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFErrorConcealmentIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFErrorConcealmentIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFErrorConcealmentIntfcDeMux::RefreshL() + { + // refetch the Error Concealment intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceErrorConcealmentIntfc = static_cast (iTarget->CustomInterface(KUidErrorConcealmentIntfc)); + + if (!iInterfaceErrorConcealmentIntfc) + { + iInterfaceErrorConcealmentIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFErrorConcealmentIntfcDeMux::NewL() + { + CMMFErrorConcealmentIntfcDeMux* self = new (ELeave) CMMFErrorConcealmentIntfcDeMux; + return self; + } + + +CMMFErrorConcealmentIntfcDeMux::CMMFErrorConcealmentIntfcDeMux() + { + } + + +CMMFErrorConcealmentIntfcDeMux::~CMMFErrorConcealmentIntfcDeMux() + { + } + + +TInt CMMFErrorConcealmentIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Error Concealment intfc Hw Device custom interface + iInterfaceErrorConcealmentIntfc = static_cast (iTarget->CustomInterface(KUidErrorConcealmentIntfc)); + + if (!iInterfaceErrorConcealmentIntfc) + { + iInterfaceErrorConcealmentIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFErrorConcealmentIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFErrorConcealmentIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIErrorConcealmentIntfcConcealErrorForNextBuffer: + { + result = DoConcealErrorForNextBufferL(); + + break; + } + case EMMFDevSoundCIErrorConcealmentIntfcSetFrameMode: + { + TPckgBuf frameModeOn; + iUtility->ReadFromInputDesL(aMessage, &frameModeOn); + + result = DoSetFrameModeL(frameModeOn()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFErrorConcealmentIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIErrorConcealmentIntfcFrameModeRqrdForEC: + { + TPckgBuf frameModeRqrd; + + iUtility->ReadFromInputDesL(aMessage, &frameModeRqrd); + + result = DoFrameModeRqrdForECL(frameModeRqrd()); + + TPckgBuf des(frameModeRqrd()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFErrorConcealmentIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFErrorConcealmentIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Error Concealment intfc custom interface implementation +TInt CMMFErrorConcealmentIntfcDeMux::DoConcealErrorForNextBufferL() + { + TInt result = KErrNotFound; + + if (iInterfaceErrorConcealmentIntfc) + { + result = iInterfaceErrorConcealmentIntfc->ConcealErrorForNextBuffer(); + } + + return result; + } + + +// Error Concealment intfc custom interface implementation +TInt CMMFErrorConcealmentIntfcDeMux::DoSetFrameModeL(TBool aFrameModeRqrd) + { + TInt result = KErrNotFound; + + if (iInterfaceErrorConcealmentIntfc) + { + result = iInterfaceErrorConcealmentIntfc->SetFrameMode(aFrameModeRqrd); + } + + return result; + } + + +// Error Concealment intfc custom interface implementation +TInt CMMFErrorConcealmentIntfcDeMux::DoFrameModeRqrdForECL(TBool& aFrameModeRqrd) + { + TInt result = KErrNotFound; + + if (iInterfaceErrorConcealmentIntfc) + { + result = iInterfaceErrorConcealmentIntfc->FrameModeRqrdForEC(aFrameModeRqrd); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceErrorConcealmentIntfcMux, CMMFErrorConcealmentIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceErrorConcealmentIntfcDeMux, CMMFErrorConcealmentIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,255 @@ +// Copyright (c) 2007-2009 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: +// Implementation of error concealment custom interface pair +// +// + +#ifndef ERRORCONCEALMENTCI_H +#define ERRORCONCEALMENTCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIErrorConcealmentIntfcCommands + { + EMMFDevSoundCIErrorConcealmentIntfcConcealErrorForNextBuffer, + EMMFDevSoundCIErrorConcealmentIntfcSetFrameMode, + EMMFDevSoundCIErrorConcealmentIntfcFrameModeRqrdForEC + }; + + +/** +Implementation of the error concealment custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFErrorConcealmentIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFErrorConcealmentIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return The pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MErrorConcealmentIntfc + //@see MErrorConcealmentIntfc + virtual TInt ConcealErrorForNextBuffer(); + //@see MErrorConcealmentIntfc + virtual TInt SetFrameMode(TBool aFrameModeOn); + //@see MErrorConcealmentIntfc + virtual TInt FrameModeRqrdForEC(TBool& aFrameModeRqrd); + +protected: + CMMFErrorConcealmentIntfcMux(); + ~CMMFErrorConcealmentIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the G729 Decoder custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFErrorConcealmentIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFErrorConcealmentIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFErrorConcealmentIntfcDeMux(); + CMMFErrorConcealmentIntfcDeMux(); + + // from mirror MErrorConcealmentIntfc method. + TInt DoConcealErrorForNextBufferL(); + TInt DoSetFrameModeL(TBool aFrameModeOn); + TInt DoFrameModeRqrdForECL(TBool& aFrameModeRqrd); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MMMFErrorConcealmentIntfc* iInterfaceErrorConcealmentIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/errorconcealmentci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceErrorConcealmentIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceErrorConcealmentIntfcMux; + version_no = 1; + display_name = "Error Concealment Mux"; + default_data = "10282607"; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceErrorConcealmentIntfcDeMux; + version_no = 1; + display_name = "Error Concealment DeMux"; + default_data = "102825e0"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,552 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "g711decoderconfigci.h" + + +// MUX // + +TInt CMMFG711DecoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceG711DecoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFG711DecoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG711DecoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG711DecoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFG711DecoderIntfcMux::NewL() + { + CMMFG711DecoderIntfcMux* self = new (ELeave) CMMFG711DecoderIntfcMux; + return self; + } + + +TAny* CMMFG711DecoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MG711DecoderIntfc* interface = this; + return interface; + } + + +CMMFG711DecoderIntfcMux::CMMFG711DecoderIntfcMux() : +iRemoteHandle(-1) + { + } + + +CMMFG711DecoderIntfcMux::~CMMFG711DecoderIntfcMux() + { + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::SetDecoderMode(TDecodeMode aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the decodeMode in the sync command + TPckgBuf decodeMode(aDecodeMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcSetDecoderMode, + decodeMode); + } + + return result; + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::GetDecoderMode(TDecodeMode& aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the decodeMode in the sync command + TPckgBuf retDecodeMode; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcGetDecoderMode, + KNullDesC8, + retDecodeMode); + + // assign return values to aDecodeMode. Do nothing if there is an error + if(result == KErrNone) + { + aDecodeMode = retDecodeMode(); + } + } + + return result; + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::SetComfortNoiseGeneration(TBool aCng) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the cng in the sync command + TPckgBuf cng(aCng); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcSetComfortNoiseGeneration, + cng); + } + + return result; + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::GetComfortNoiseGeneration(TBool& aCng) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retCng; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcGetComfortNoiseGeneration, + KNullDesC8, + retCng); + + // assign return values to aCng. Do nothing if there is an error + if(result == KErrNone) + { + aCng = retCng(); + } + } + + return result; + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::SetPacketLossConcealment(TBool aPlc) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the plc in the sync command + TPckgBuf plc(aPlc); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcSetPacketLossConcealment, + plc); + } + + return result; + } + + +// from MG711DecoderIntfc +TInt CMMFG711DecoderIntfcMux::GetPacketLossConcealment(TBool& aPlc) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the plc in the sync command + TPckgBuf retPlc; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIG711DecoderIntfcGetPacketLossConcealment, + KNullDesC8, + retPlc); + + // assign return values to aPlc. Do nothing if there is an error + if(result == KErrNone) + { + aPlc = retPlc(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFG711DecoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFG711DecoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG711DecoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG711DecoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFG711DecoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFG711DecoderIntfcDeMux::RefreshL() + { + // refetch the G711 decoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceG711DecoderIntfc = static_cast (iTarget->CustomInterface(KUidG711DecoderIntfc)); + + if (!iInterfaceG711DecoderIntfc) + { + iInterfaceG711DecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFG711DecoderIntfcDeMux::NewL() + { + CMMFG711DecoderIntfcDeMux* self = new (ELeave) CMMFG711DecoderIntfcDeMux; + return self; + } + + +CMMFG711DecoderIntfcDeMux::CMMFG711DecoderIntfcDeMux() + { + } + + +CMMFG711DecoderIntfcDeMux::~CMMFG711DecoderIntfcDeMux() + { + } + + +TInt CMMFG711DecoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the G711 decoder intfc Hw Device custom interface + iInterfaceG711DecoderIntfc = static_cast (iTarget->CustomInterface(KUidG711DecoderIntfc)); + + if (!iInterfaceG711DecoderIntfc) + { + iInterfaceG711DecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFG711DecoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG711DecoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG711DecoderIntfcSetDecoderMode: + { + TPckgBuf decodeMode; + iUtility->ReadFromInputDesL(aMessage, &decodeMode); + + result = DoSetDecoderModeL(decodeMode()); + + break; + } + case EMMFDevSoundCIG711DecoderIntfcSetComfortNoiseGeneration: + { + TPckgBuf cng; + iUtility->ReadFromInputDesL(aMessage, &cng); + + result = DoSetComfortNoiseGenerationL(cng()); + break; + } + case EMMFDevSoundCIG711DecoderIntfcSetPacketLossConcealment: + { + TPckgBuf plc; + iUtility->ReadFromInputDesL(aMessage, &plc); + + result = DoSetPacketLossConcealmentL(plc()); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG711DecoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG711DecoderIntfcGetDecoderMode: + { + TPckgBuf decodeMode; + iUtility->ReadFromInputDesL(aMessage, &decodeMode); + + result = DoGetDecoderModeL(decodeMode()); + + TPckgBuf des(decodeMode()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + case EMMFDevSoundCIG711DecoderIntfcGetComfortNoiseGeneration: + { + TPckgBuf cng; + iUtility->ReadFromInputDesL(aMessage, &cng); + + result = DoGetComfortNoiseGenerationL(cng()); + + TPckgBuf des(cng()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + case EMMFDevSoundCIG711DecoderIntfcGetPacketLossConcealment: + { + TPckgBuf plc; + iUtility->ReadFromInputDesL(aMessage, &plc); + + result = DoGetPacketLossConcealmentL(plc()); + + TPckgBuf des(plc()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFG711DecoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFG711DecoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoSetDecoderModeL(MG711DecoderIntfc::TDecodeMode aDecodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->SetDecoderMode(aDecodeMode); + } + + return result; + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoGetDecoderModeL(MG711DecoderIntfc::TDecodeMode& aDecodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->GetDecoderMode(aDecodeMode); + } + + return result; + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoSetComfortNoiseGenerationL(TBool aCng) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->SetComfortNoiseGeneration(aCng); + } + + return result; + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoGetComfortNoiseGenerationL(TBool& aCng) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->GetComfortNoiseGeneration(aCng); + } + + return result; + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoSetPacketLossConcealmentL(TBool aPlc) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->SetPacketLossConcealment(aPlc); + } + + return result; + } + + +// G711 decoder intfc custom interface implementation +TInt CMMFG711DecoderIntfcDeMux::DoGetPacketLossConcealmentL(TBool& aPlc) + { + TInt result = KErrNotFound; + + if (iInterfaceG711DecoderIntfc) + { + result = iInterfaceG711DecoderIntfc->GetPacketLossConcealment(aPlc); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG711DecoderIntfcMux, CMMFG711DecoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG711DecoderIntfcDeMux, CMMFG711DecoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,264 @@ +// Copyright (c) 2007-2009 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: +// Implementation of g711 decoder config custom interface pair +// +// + +#ifndef G711DECODERCONFIGCI_H +#define G711DECODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIG711DecoderIntfcCommands + { + EMMFDevSoundCIG711DecoderIntfcSetDecoderMode, + EMMFDevSoundCIG711DecoderIntfcGetDecoderMode, + EMMFDevSoundCIG711DecoderIntfcSetComfortNoiseGeneration, + EMMFDevSoundCIG711DecoderIntfcGetComfortNoiseGeneration, + EMMFDevSoundCIG711DecoderIntfcSetPacketLossConcealment, + EMMFDevSoundCIG711DecoderIntfcGetPacketLossConcealment + }; + + +/** +Implementation of the g711 decoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFG711DecoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MG711DecoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return The pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MG711DecoderIntfc + //@see MG711DecoderIntfc + virtual TInt SetDecoderMode(TDecodeMode aDecodeMode); + //@see MG711DecoderIntfc + virtual TInt GetDecoderMode(TDecodeMode& aDecodeMode); + //@see MG711DecoderIntfc + virtual TInt SetComfortNoiseGeneration(TBool aCng); + //@see MG711DecoderIntfc + virtual TInt GetComfortNoiseGeneration(TBool& aCng); + //@see MG711DecoderIntfc + virtual TInt SetPacketLossConcealment(TBool aPlc); + //@see MG711DecoderIntfc + virtual TInt GetPacketLossConcealment(TBool& aPlc); + +protected: + CMMFG711DecoderIntfcMux(); + ~CMMFG711DecoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the G711 Decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFG711DecoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFG711DecoderIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFG711DecoderIntfcDeMux(); + CMMFG711DecoderIntfcDeMux(); + + // from mirror MG711DecoderIntfc method. + TInt DoSetDecoderModeL(MG711DecoderIntfc::TDecodeMode aDecodeMode); + TInt DoGetDecoderModeL(MG711DecoderIntfc::TDecodeMode& aDecodeMode); + TInt DoSetComfortNoiseGenerationL(TBool aCng); + TInt DoGetComfortNoiseGenerationL(TBool& aCng); + TInt DoSetPacketLossConcealmentL(TBool aPlc); + TInt DoGetPacketLossConcealmentL(TBool& aPlc); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MG711DecoderIntfc* iInterfaceG711DecoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711decoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceG711DecoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG711DecoderIntfcMux; + version_no = 1; + display_name = "G711 Decoder Mux"; + default_data = "10282601" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG711DecoderIntfcDeMux; + version_no = 1; + display_name = "G711 Decoder DeMux"; + default_data = "102825d8" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,405 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "g711encoderconfigci.h" + + +// MUX // + +TInt CMMFG711EncoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceG711EncoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFG711EncoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG711EncoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG711EncoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFG711EncoderIntfcMux::NewL() + { + CMMFG711EncoderIntfcMux* self = new (ELeave) CMMFG711EncoderIntfcMux; + return self; + } + + +TAny* CMMFG711EncoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MG711EncoderIntfc* interface = this; + return interface; + } + + +CMMFG711EncoderIntfcMux::CMMFG711EncoderIntfcMux() : +iRemoteHandle(-1) + { + } + + +CMMFG711EncoderIntfcMux::~CMMFG711EncoderIntfcMux() + { + } + + +// from MG711EncoderIntfc +TInt CMMFG711EncoderIntfcMux::SetEncoderMode(TEncodeMode aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the encodeMode in the sync command + TPckgBuf encodeMode(aEncodeMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG711EncoderIntfcSetEncoderMode, + encodeMode); + } + + return result; + } + + +// from MG711EncoderIntfc +TInt CMMFG711EncoderIntfcMux::SetVadMode (TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the vadMondeOn in the sync command + TPckgBuf vadModeOn(aVadModeOn); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG711EncoderIntfcSetVadMode, + vadModeOn); + } + + return result; + } + + +// from MG711EncoderIntfc +TInt CMMFG711EncoderIntfcMux::GetVadMode (TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retVadModeOn; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIG711EncoderIntfcGetVadMode, + KNullDesC8, + retVadModeOn); + + // assign return values to aVadModeOn. Do nothing if there is an error + if(result == KErrNone) + { + aVadModeOn = retVadModeOn(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFG711EncoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFG711EncoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG711EncoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG711EncoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFG711EncoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFG711EncoderIntfcDeMux::RefreshL() + { + // refetch the G711 encoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceG711EncoderIntfc = static_cast (iTarget->CustomInterface(KUidG711EncoderIntfc)); + + if (!iInterfaceG711EncoderIntfc) + { + iInterfaceG711EncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFG711EncoderIntfcDeMux::NewL() + { + CMMFG711EncoderIntfcDeMux* self = new (ELeave) CMMFG711EncoderIntfcDeMux; + return self; + } + + +CMMFG711EncoderIntfcDeMux::CMMFG711EncoderIntfcDeMux() + { + } + + +CMMFG711EncoderIntfcDeMux::~CMMFG711EncoderIntfcDeMux() + { + } + + +TInt CMMFG711EncoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the G711 encoder intfc Hw Device custom interface + iInterfaceG711EncoderIntfc = static_cast (iTarget->CustomInterface(KUidG711EncoderIntfc)); + + if (!iInterfaceG711EncoderIntfc) + { + iInterfaceG711EncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFG711EncoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG711EncoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG711EncoderIntfcSetEncoderMode: + { + TPckgBuf encodeMode; + iUtility->ReadFromInputDesL(aMessage, &encodeMode); + + result = DoSetEncoderMode(encodeMode()); + + break; + } + case EMMFDevSoundCIG711EncoderIntfcSetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoSetVadMode(vadModeOn()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG711EncoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG711EncoderIntfcGetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoGetVadMode(vadModeOn()); + + TPckgBuf des(vadModeOn()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFG711EncoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFG711EncoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// G711 encoder intfc custom interface implementation +TInt CMMFG711EncoderIntfcDeMux::DoSetEncoderMode(MG711EncoderIntfc::TEncodeMode aEncodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceG711EncoderIntfc) + { + result = iInterfaceG711EncoderIntfc->SetEncoderMode(aEncodeMode); + } + + return result; + } + + +// G711 encoder intfc custom interface implementation +TInt CMMFG711EncoderIntfcDeMux::DoSetVadMode(TBool aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceG711EncoderIntfc) + { + result = iInterfaceG711EncoderIntfc->SetVadMode(aVadModeOn); + } + + return result; + } + + +// G711 encoder intfc custom interface implementation +TInt CMMFG711EncoderIntfcDeMux::DoGetVadMode(TBool& aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceG711EncoderIntfc) + { + result = iInterfaceG711EncoderIntfc->GetVadMode(aVadModeOn); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG711EncoderIntfcMux, CMMFG711EncoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG711EncoderIntfcDeMux, CMMFG711EncoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,253 @@ +// Copyright (c) 2007-2009 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: +// Implementation of g711 encoder config custom interface pair +// +// + +#ifndef G711ENCODERCONFIGCI_H +#define G711ENCODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIG711EncoderIntfcCommands + { + EMMFDevSoundCIG711EncoderIntfcSetEncoderMode = 0, + EMMFDevSoundCIG711EncoderIntfcSetVadMode = 1, + EMMFDevSoundCIG711EncoderIntfcGetVadMode = 2 + }; + + +/** +Implementation of the g711 encoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFG711EncoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MG711EncoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return The pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MG711EncoderIntfc + //@see MG711EncoderIntfc + virtual TInt SetEncoderMode (TEncodeMode aEncodeMode); + //@see MG711EncoderIntfc + virtual TInt SetVadMode (TBool aVadModeOn); + //@see MG711EncoderIntfc + virtual TInt GetVadMode (TBool& aVadModeOn); + + +protected: + CMMFG711EncoderIntfcMux(); + ~CMMFG711EncoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the G711 Decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFG711EncoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFG711EncoderIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFG711EncoderIntfcDeMux(); + CMMFG711EncoderIntfcDeMux(); + + // from mirror MG711EncoderIntfc method. + TInt DoSetEncoderMode (MG711EncoderIntfc::TEncodeMode aEncodeMode); + TInt DoSetVadMode (TBool aVadModeOn); + TInt DoGetVadMode (TBool& aVadModeOn); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MG711EncoderIntfc* iInterfaceG711EncoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g711encoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceG711EncoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG711EncoderIntfcMux; + version_no = 1; + display_name = "G711 Encoder Mux"; + default_data = "10282602" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG711EncoderIntfcDeMux; + version_no = 1; + display_name = "G711 Encoder DeMux"; + default_data = "102825da" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,286 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "g729decoderconfigci.h" + + +// MUX // + +TInt CMMFG729DecoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceG729DecoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFG729DecoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG729DecoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG729DecoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFG729DecoderIntfcMux::NewL() + { + CMMFG729DecoderIntfcMux* self = new (ELeave) CMMFG729DecoderIntfcMux; + return self; + } + + +TAny* CMMFG729DecoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MG729DecoderIntfc* interface = this; + return interface; + } + + +CMMFG729DecoderIntfcMux::CMMFG729DecoderIntfcMux() : + iRemoteHandle(-1) + { + } + + +CMMFG729DecoderIntfcMux::~CMMFG729DecoderIntfcMux() + { + } + + +// from MG729DecoderIntfc +TInt CMMFG729DecoderIntfcMux::BadLsfNextBuffer() + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG729DecoderIntfcBadLsfNextBuffer, + KNullDesC8); + } + + return result; + } + + + +// DEMUX // + +TInt CMMFG729DecoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFG729DecoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG729DecoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG729DecoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFG729DecoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFG729DecoderIntfcDeMux::RefreshL() + { + // refetch the G729 decoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceG729DecoderIntfc = static_cast (iTarget->CustomInterface(KUidG729DecoderIntfc)); + + if (!iInterfaceG729DecoderIntfc) + { + iInterfaceG729DecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFG729DecoderIntfcDeMux::NewL() + { + CMMFG729DecoderIntfcDeMux* self = new (ELeave) CMMFG729DecoderIntfcDeMux; + return self; + } + + +CMMFG729DecoderIntfcDeMux::CMMFG729DecoderIntfcDeMux() + { + } + + +CMMFG729DecoderIntfcDeMux::~CMMFG729DecoderIntfcDeMux() + { + } + + +TInt CMMFG729DecoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the G729 decoder intfc Hw Device custom interface + iInterfaceG729DecoderIntfc = static_cast (iTarget->CustomInterface(KUidG729DecoderIntfc)); + + if (!iInterfaceG729DecoderIntfc) + { + iInterfaceG729DecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFG729DecoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG729DecoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG729DecoderIntfcBadLsfNextBuffer: + { + result = DoBadLsfNextBufferL(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFG729DecoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + + +void CMMFG729DecoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFG729DecoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +TInt CMMFG729DecoderIntfcDeMux::DoBadLsfNextBufferL() + { + TInt result = KErrNotFound; + + if (iInterfaceG729DecoderIntfc) + { + result = iInterfaceG729DecoderIntfc->BadLsfNextBuffer(); + } + + return result; + } + + +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG729DecoderIntfcMux, CMMFG729DecoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG729DecoderIntfcDeMux, CMMFG729DecoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,247 @@ +// Copyright (c) 2007-2009 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: +// Implementation of g729 decoder config custom interface pair +// +// + +#ifndef G729DECODERCONFIGCI_H +#define G729DECODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIG729DecoderIntfcCommands + { + EMMFDevSoundCIG729DecoderIntfcBadLsfNextBuffer + }; + + +/** +Implementation of the G729 Decoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFG729DecoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MG729DecoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return The pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MG729DecoderIntfc + //@see MG729DecoderIntfc + virtual TInt BadLsfNextBuffer(); + +protected: + CMMFG729DecoderIntfcMux(); + ~CMMFG729DecoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the G729 Decoder custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFG729DecoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFG729DecoderIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFG729DecoderIntfcDeMux(); + CMMFG729DecoderIntfcDeMux(); + + // from mirror MG729DecoderIntfc method. + TInt DoBadLsfNextBufferL(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MG729DecoderIntfc* iInterfaceG729DecoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729decoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceG729DecoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG729DecoderIntfcMux; + version_no = 1; + display_name = "G729 Decoder Mux"; + default_data = "10282603" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG729DecoderIntfcDeMux; + version_no = 1; + display_name = "G729 Decoder DeMux"; + default_data = "102825bf" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,359 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "g729encoderconfigci.h" + + +// MUX // + +TInt CMMFG729EncoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceG729EncoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFG729EncoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG729EncoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG729EncoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFG729EncoderIntfcMux::NewL() + { + CMMFG729EncoderIntfcMux* self = new (ELeave) CMMFG729EncoderIntfcMux; + return self; + } + + +TAny* CMMFG729EncoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MG729EncoderIntfc* interface = this; + return interface; + } + + +CMMFG729EncoderIntfcMux::CMMFG729EncoderIntfcMux() : + iRemoteHandle(-1) + { + } + + +CMMFG729EncoderIntfcMux::~CMMFG729EncoderIntfcMux() + { + } + + +// from MG729EncoderIntfc +TInt CMMFG729EncoderIntfcMux::SetVadMode (TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the vadMode in the sync command + TPckgBuf vadModeOn(aVadModeOn); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIG729EncoderIntfcSetVadMode, + vadModeOn); + } + + return result; + } + + +// from MG729EncoderIntfc +TInt CMMFG729EncoderIntfcMux::GetVadMode (TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + //holds the returned value + TPckgBuf retVadModeOn; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIG729EncoderIntfcGetVadMode, + KNullDesC8, + retVadModeOn); + + // assign return values to aVadModeOn. Do nothing if there is an error + if(result == KErrNone) + { + aVadModeOn = retVadModeOn(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFG729EncoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFG729EncoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFG729EncoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFG729EncoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFG729EncoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFG729EncoderIntfcDeMux::RefreshL() + { + // refetch the G729 encoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceG729EncoderIntfc = static_cast (iTarget->CustomInterface(KUidG729EncoderIntfc)); + + if (!iInterfaceG729EncoderIntfc) + { + iInterfaceG729EncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFG729EncoderIntfcDeMux::NewL() + { + CMMFG729EncoderIntfcDeMux* self = new (ELeave) CMMFG729EncoderIntfcDeMux; + return self; + } + + +CMMFG729EncoderIntfcDeMux::CMMFG729EncoderIntfcDeMux() + { + } + + +CMMFG729EncoderIntfcDeMux::~CMMFG729EncoderIntfcDeMux() + { + } + + +TInt CMMFG729EncoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the G729 encoder intfc Hw Device custom interface + iInterfaceG729EncoderIntfc = static_cast (iTarget->CustomInterface(KUidG729EncoderIntfc)); + + if (!iInterfaceG729EncoderIntfc) + { + iInterfaceG729EncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFG729EncoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFG729EncoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG729EncoderIntfcSetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoSetVadModeL(vadModeOn()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFG729EncoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIG729EncoderIntfcGetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoGetVadModeL(vadModeOn()); + + TPckgBuf des(vadModeOn()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFG729EncoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFG729EncoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +TInt CMMFG729EncoderIntfcDeMux::DoSetVadModeL(TBool aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceG729EncoderIntfc) + { + result = iInterfaceG729EncoderIntfc->SetVadMode(aVadModeOn); + } + + return result; + } + + +TInt CMMFG729EncoderIntfcDeMux::DoGetVadModeL(TBool& aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceG729EncoderIntfc) + { + result = iInterfaceG729EncoderIntfc->GetVadMode(aVadModeOn); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG729EncoderIntfcMux, CMMFG729EncoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceG729EncoderIntfcDeMux, CMMFG729EncoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,251 @@ +// Copyright (c) 2007-2009 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: +// Implementation of g729 encoder custom interface pair +// +// + +#ifndef G729ENCODERCONFIGCI_H +#define G729ENCODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the methods called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIG729EncoderIntfcCommands + { + EMMFDevSoundCIG729EncoderIntfcSetVadMode, + EMMFDevSoundCIG729EncoderIntfcGetVadMode + }; + + +/** +Implementation of the G729 Encoder custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFG729EncoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MG729EncoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MG729EncoderIntfc + //@see MG729EncoderIntfc + virtual TInt SetVadMode(TBool aVadModeOn); + //@see MG729EncoderIntfc + virtual TInt GetVadMode(TBool& aVadModeOn); + +protected: + CMMFG729EncoderIntfcMux(); + ~CMMFG729EncoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the G729 Encoder custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFG729EncoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFG729EncoderIntfcDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFG729EncoderIntfcDeMux(); + CMMFG729EncoderIntfcDeMux(); + + // from mirror MG729EncoderIntfc method. + TInt DoSetVadModeL(TBool aVadModeOn); + TInt DoGetVadModeL(TBool& aVadModeOn); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MG729EncoderIntfc* iInterfaceG729EncoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/g729encoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceG729EncoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG729EncoderIntfcMux; + version_no = 1; + display_name = "G729 Encoder Mux"; + default_data = "10282604" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceG729EncoderIntfcDeMux; + version_no = 1; + display_name = "G729 Encoder DeMux"; + default_data = "102825c1" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,367 @@ +// Copyright (c) 2007-2009 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 +#include +#include + +#include "gettimestampsci.h" + +class TPositionTimestamp + { +public: + TTimeIntervalMicroSeconds iBufferPosition; + TTime iTimestamp; + }; + +// MUX // +/*****************************************************************************/ + +TInt CMMFGetTimestampsMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceGetTimestampsDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFGetTimestampsMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFGetTimestampsMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFGetTimestampsMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFGetTimestampsMux::NewL() + { + CMMFGetTimestampsMux* self = new (ELeave) CMMFGetTimestampsMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFGetTimestampsMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFGetTimestamps* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFGetTimestampsMux::CMMFGetTimestampsMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFGetTimestampsMux::~CMMFGetTimestampsMux() + { + } + +/*****************************************************************************/ +// from MMMFGetTimestamps +TInt CMMFGetTimestampsMux::MmgtSetRecordSystemTimestampsEnabled(TBool aEnable) + { + if (iRemoteHandle > 0) + { + // send the enable flag in the sync command + TPckgBuf flag(aEnable); + + // any return code other than zero is an error + return iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCIGetTimestampsEnable, flag); + } + else + { + return KErrNotReady; + } + } + +TInt CMMFGetTimestampsMux::MmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp) const + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // send the position and timestamp in the sync command + TPositionTimestamp value; + value.iBufferPosition = aBufferPosition; + value.iTimestamp = aTimestamp; + TPckgBuf pckgBuffer(value); + + // any return code other than zero is an error + err = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, EMMFDevSoundCIGetTimestampsForBuffer, + pckgBuffer, pckgBuffer); + aTimestamp = pckgBuffer().iTimestamp; + } + + return err; + } + + + +// DEMUX // +/*****************************************************************************/ +TInt CMMFGetTimestampsDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::RefreshL() + { + // refetch the play back status custom interface if we already have a target + if (iTarget) + { + MMMFGetTimestamps* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidGetTimestamps)); + + if (!ptr) + { + iInterfaceGetTimestamps = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceGetTimestamps = ptr; + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFGetTimestampsDeMux::NewL() + { + CMMFGetTimestampsDeMux* self = new (ELeave) CMMFGetTimestampsDeMux; + return self; + } + +/*****************************************************************************/ +CMMFGetTimestampsDeMux::CMMFGetTimestampsDeMux() + { + } + +/*****************************************************************************/ +CMMFGetTimestampsDeMux::~CMMFGetTimestampsDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFGetTimestampsDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Playback status Hw Device custom interface + MMMFGetTimestamps* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidGetTimestamps)); + + if (!ptr) + { + iInterfaceGetTimestamps = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceGetTimestamps = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFGetTimestampsDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + TInt retVal = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIGetTimestampsEnable: + { + TPckgBuf flag; + iUtility->ReadFromInputDesL(aMessage, &flag); + retVal = DoMmgtSetRecordSystemTimestampsEnabled(flag()); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +TInt CMMFGetTimestampsDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + TInt retVal = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIGetTimestampsForBuffer: + { + TPckgBuf value; + iUtility->ReadFromInputDesL(aMessage, &value); + retVal = DoMmgtGetSystemTimestampForBuffer(value().iBufferPosition, value().iTimestamp); + iUtility->WriteToOutputDesL(aMessage, value); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFGetTimestampsDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// Get Timestamp custom interface implementation +TInt CMMFGetTimestampsDeMux::DoMmgtSetRecordSystemTimestampsEnabled(TBool aEnable) + { + if (!iInterfaceGetTimestamps) + { + return KErrNotReady; + } + else + { + return iInterfaceGetTimestamps->MmgtSetRecordSystemTimestampsEnabled(aEnable); + } + } + +TInt CMMFGetTimestampsDeMux::DoMmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp) + { + if (!iInterfaceGetTimestamps) + { + return KErrNotReady; + } + else + { + return iInterfaceGetTimestamps->MmgtGetSystemTimestampForBuffer(aBufferPosition, aTimestamp); + } + } +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceGetTimestampsMux, CMMFGetTimestampsMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceGetTimestampsDeMux, CMMFGetTimestampsDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,262 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef GETTIMESTAMPSCI_H +#define GETTIMESTAMPSCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCIGetTimestampsCommands + { + EMMFDevSoundCIGetTimestampsEnable = 0, + EMMFDevSoundCIGetTimestampsForBuffer + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFGetTimestampsMux + * + * implementation of the Get Timestamps status custom interface pair + */ +class CMMFGetTimestampsMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFGetTimestamps + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @leave This method may leave with one of the system-wide error codes. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return The pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFGetTimestamps + /** + @see MMMFGetTimestamps + */ + virtual TInt MmgtSetRecordSystemTimestampsEnabled(TBool aEnable); + + /** + @see MMMFGetTimestamps + */ + virtual TInt MmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp) const; + +protected: + CMMFGetTimestampsMux(); + ~CMMFGetTimestampsMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFGetTimestampsDeMux - DeMux side of pair + */ + +class CMMFGetTimestampsDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFGetTimestampsDeMux class + @leave This method may leave with one of the system-wide error codes. + @return A pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFGetTimestampsDeMux(); + CMMFGetTimestampsDeMux(); + + // mirrors MMMFGetTimestamps method. + TInt DoMmgtSetRecordSystemTimestampsEnabled(TBool aEnable); + TInt DoMmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp); +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MMMFGetTimestamps* iInterfaceGetTimestamps; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gettimestampsci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceGetTimestampsDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceGetTimestampsMux; + version_no = 1; + display_name = "Get Timestamps Mux"; + default_data = "1028260e" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceGetTimestampsDeMux; + version_no = 1; + display_name = "Get Timestamps DeMux"; + default_data = "102825eb" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,358 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "gsmconfigci.h" + + +// MUX // + +TInt CMMFGsmConfigMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceGsmConfigDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFGsmConfigMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFGsmConfigMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFGsmConfigMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFGsmConfigMux::NewL() + { + CMMFGsmConfigMux* self = new (ELeave) CMMFGsmConfigMux; + return self; + } + + +TAny* CMMFGsmConfigMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFGsmConfig* interface = this; + return interface; + } + + +CMMFGsmConfigMux::CMMFGsmConfigMux() : +iRemoteHandle(-1) + { + } + + +CMMFGsmConfigMux::~CMMFGsmConfigMux() + { + } + + +// from MMMFGsmConfig +TInt CMMFGsmConfigMux::SetConversionFormat(TMMFGsmConversionFormat aConvFormat) + { + TInt result = KErrGeneral; + + if (iRemoteHandle > 0) + { + // send the convFormat in the sync command + TPckgBuf convFormat(aConvFormat); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIGsmConfigSetConversionFormat, + convFormat); + } + + return result; + } + + +// from MMMFGsmConfig +TInt CMMFGsmConfigMux::ConversionFormat(TMMFGsmConversionFormat& aConvFormat) const + { + TInt result = KErrGeneral; + + if (iRemoteHandle > 0) + { + // send the retConvFormat in the sync command + TPckgBuf retConvFormat; + + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIGsmConfigGetConversionFormat, + KNullDesC8, + retConvFormat); + + // assign return values to aConvFormat. Do nothing if there is an error + if(result == KErrNone) + { + aConvFormat = retConvFormat(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFGsmConfigDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFGsmConfigDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFGsmConfigDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFGsmConfigDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFGsmConfigDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFGsmConfigDeMux::RefreshL() + { + // refetch the Gsm config custom interface if we already have a target + if (iTarget) + { + iInterfaceGsmConfig = static_cast (iTarget->CustomInterface(KUidGsmConfig)); + + if (!iInterfaceGsmConfig) + { + iInterfaceGsmConfig = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFGsmConfigDeMux::NewL() + { + CMMFGsmConfigDeMux* self = new (ELeave) CMMFGsmConfigDeMux; + return self; + } + + +CMMFGsmConfigDeMux::CMMFGsmConfigDeMux() + { + } + + +CMMFGsmConfigDeMux::~CMMFGsmConfigDeMux() + { + } + + +TInt CMMFGsmConfigDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Gsm Config Hw Device custom interface + iInterfaceGsmConfig = static_cast (iTarget->CustomInterface(KUidGsmConfig)); + + if (!iInterfaceGsmConfig) + { + iInterfaceGsmConfig = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFGsmConfigDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFGsmConfigDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIGsmConfigSetConversionFormat: + { + TPckgBuf convFormat; + iUtility->ReadFromInputDesL(aMessage, &convFormat); + + result = DoSetConversionFormatL(convFormat()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFGsmConfigDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIGsmConfigGetConversionFormat: + { + TPckgBuf convFormat; + iUtility->ReadFromInputDesL(aMessage, &convFormat); + + result = DoConversionFormatL(convFormat()); + + TPckgBuf des(convFormat()); + iUtility->WriteToOutputDesL(aMessage, des); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFGsmConfigDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFGsmConfigDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Gsm Config custom interface implementation +TInt CMMFGsmConfigDeMux::DoSetConversionFormatL(MMMFGsmConfig::TMMFGsmConversionFormat aConvFormat) + { + TInt result = KErrNotFound; + + if (iInterfaceGsmConfig) + { + result = iInterfaceGsmConfig->SetConversionFormat(aConvFormat); + } + + return result; + } + + +// Gsm Config custom interface implementation +TInt CMMFGsmConfigDeMux::DoConversionFormatL(MMMFGsmConfig::TMMFGsmConversionFormat& aConvFormat) const + { + TInt result = KErrNotFound; + + if (iInterfaceGsmConfig) + { + result = iInterfaceGsmConfig->ConversionFormat(aConvFormat); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceGsmConfigMux, CMMFGsmConfigMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceGsmConfigDeMux, CMMFGsmConfigDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,254 @@ +// Copyright (c) 2007-2009 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: +// Implementation of aac decoder config custom interface pair +// +// + +#ifndef GSMCONFIGCI_H +#define GSMCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIGsmConfigCommands + { + EMMFDevSoundCIGsmConfigSetConversionFormat, + EMMFDevSoundCIGsmConfigGetConversionFormat + }; + + +/** +Implementation of the Gsm config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFGsmConfigMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFGsmConfig + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFGsmConfig + //@see MMMFGsmConfig + virtual TInt SetConversionFormat(TMMFGsmConversionFormat aConvFormat); + //@see MMMFGsmConfig + virtual TInt ConversionFormat(TMMFGsmConversionFormat& aConvFormat) const; + +protected: + CMMFGsmConfigMux(); + ~CMMFGsmConfigMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Aac decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFGsmConfigDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFGsmConfigDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFGsmConfigDeMux(); + CMMFGsmConfigDeMux(); + + // from mirror MMMFGsmConfig method. + TInt DoSetConversionFormatL(MMMFGsmConfig::TMMFGsmConversionFormat aConvFormat); + TInt DoConversionFormatL(MMMFGsmConfig::TMMFGsmConversionFormat& aConvFormat) const; + +private: + void DoCopyAudioConfigsBufferToClientL(const RMmfIpcMessage& aMessage); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MMMFGsmConfig* iInterfaceGsmConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/gsmconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceGsmConfigDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceGsmConfigMux; + version_no = 1; + display_name = "Gsm config Mux"; + default_data = "102825fc" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceGsmConfigDeMux; + version_no = 1; + display_name = "Gsm config DeMux"; + default_data = "1028261c" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,405 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "ilbcdecoderconfigci.h" + + +// MUX // + +TInt CMMFIlbcDecoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceIlbcDecoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFIlbcDecoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFIlbcDecoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFIlbcDecoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFIlbcDecoderIntfcMux::NewL() + { + CMMFIlbcDecoderIntfcMux* self = new (ELeave) CMMFIlbcDecoderIntfcMux; + return self; + } + + +TAny* CMMFIlbcDecoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MIlbcDecoderIntfc* interface = this; + return interface; + } + + +CMMFIlbcDecoderIntfcMux::CMMFIlbcDecoderIntfcMux() : +iRemoteHandle(-1) + { + } + + +CMMFIlbcDecoderIntfcMux::~CMMFIlbcDecoderIntfcMux() + { + } + + +// from MIlbcDecoderIntfc +TInt CMMFIlbcDecoderIntfcMux::SetDecoderMode(TDecodeMode aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the decodeMode in the sync command + TPckgBuf decodeMode(aDecodeMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIIlbcDecoderIntfcSetDecoderMode, + decodeMode); + } + + return result; + } + + +// from MIlbcDecoderIntfc +TInt CMMFIlbcDecoderIntfcMux::SetComfortNoiseGeneration(TBool aCng) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the cng in the sync command + TPckgBuf cng(aCng); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIIlbcDecoderIntfcSetComfortNoiseGeneration, + cng); + } + + return result; + } + + +// from MIlbcDecoderIntfc +TInt CMMFIlbcDecoderIntfcMux::GetComfortNoiseGeneration(TBool& aCng) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retCng; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIIlbcDecoderIntfcGetComfortNoiseGeneration, + KNullDesC8, + retCng); + + // assign return values to aCng. Do nothing if there is an error + if(result == KErrNone) + { + aCng = retCng(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFIlbcDecoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFIlbcDecoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFIlbcDecoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFIlbcDecoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFIlbcDecoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFIlbcDecoderIntfcDeMux::RefreshL() + { + // refetch the Ilbc decoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceIlbcDecoderIntfc = static_cast (iTarget->CustomInterface(KUidIlbcDecoderIntfc)); + + if (!iInterfaceIlbcDecoderIntfc) + { + iInterfaceIlbcDecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFIlbcDecoderIntfcDeMux::NewL() + { + CMMFIlbcDecoderIntfcDeMux* self = new (ELeave) CMMFIlbcDecoderIntfcDeMux; + return self; + } + + +CMMFIlbcDecoderIntfcDeMux::CMMFIlbcDecoderIntfcDeMux() + { + } + + +CMMFIlbcDecoderIntfcDeMux::~CMMFIlbcDecoderIntfcDeMux() + { + } + + +TInt CMMFIlbcDecoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Ilbc decoder intfc Hw Device custom interface + iInterfaceIlbcDecoderIntfc = static_cast (iTarget->CustomInterface(KUidIlbcDecoderIntfc)); + + if (!iInterfaceIlbcDecoderIntfc) + { + iInterfaceIlbcDecoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFIlbcDecoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFIlbcDecoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIIlbcDecoderIntfcSetDecoderMode: + { + TPckgBuf decodeMode; + iUtility->ReadFromInputDesL(aMessage, &decodeMode); + + result = DoSetDecoderMode(decodeMode()); + + break; + } + case EMMFDevSoundCIIlbcDecoderIntfcSetComfortNoiseGeneration: + { + TPckgBuf cng; + iUtility->ReadFromInputDesL(aMessage, &cng); + + result = DoSetComfortNoiseGenerationL(cng()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFIlbcDecoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIIlbcDecoderIntfcGetComfortNoiseGeneration: + { + TPckgBuf cng; + iUtility->ReadFromInputDesL(aMessage, &cng); + + result = DoGetComfortNoiseGenerationL(cng()); + + TPckgBuf des(cng()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFIlbcDecoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFIlbcDecoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Ilbc decoder intfc custom interface implementation +TInt CMMFIlbcDecoderIntfcDeMux::DoSetDecoderMode(MIlbcDecoderIntfc::TDecodeMode aDecodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcDecoderIntfc) + { + result = iInterfaceIlbcDecoderIntfc->SetDecoderMode(aDecodeMode); + } + + return result; + } + + +// Ilbc decoder intfc custom interface implementation +TInt CMMFIlbcDecoderIntfcDeMux::DoSetComfortNoiseGenerationL(TBool aCng) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcDecoderIntfc) + { + result = iInterfaceIlbcDecoderIntfc->SetComfortNoiseGeneration(aCng); + } + + return result; + } + + +// Ilbc decoder intfc custom interface implementation +TInt CMMFIlbcDecoderIntfcDeMux::DoGetComfortNoiseGenerationL(TBool& aCng) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcDecoderIntfc) + { + result = iInterfaceIlbcDecoderIntfc->GetComfortNoiseGeneration(aCng); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceIlbcDecoderIntfcMux, CMMFIlbcDecoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceIlbcDecoderIntfcDeMux, CMMFIlbcDecoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,250 @@ +// Copyright (c) 2007-2009 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: +// Implementation of Ilbc decoder config custom interface pair +// +// + +#ifndef ILBCDECODERCONFIGCI_H +#define ILBCDECODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIIlbcDecoderIntfcCommands + { + EMMFDevSoundCIIlbcDecoderIntfcSetDecoderMode, + EMMFDevSoundCIIlbcDecoderIntfcSetComfortNoiseGeneration, + EMMFDevSoundCIIlbcDecoderIntfcGetComfortNoiseGeneration + }; + + +/** +Implementation of the Ilbc decoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFIlbcDecoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MIlbcDecoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MIlbcDecoderIntfc + //@see MIlbcDecoderIntfc + virtual TInt SetDecoderMode(TDecodeMode aDecodeMode); + //@see MIlbcDecoderIntfc + virtual TInt SetComfortNoiseGeneration(TBool aCng); + //@see MIlbcDecoderIntfc + virtual TInt GetComfortNoiseGeneration(TBool& aCng); + +protected: + CMMFIlbcDecoderIntfcMux(); + ~CMMFIlbcDecoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Ilbc Decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFIlbcDecoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFIlbcDecoderIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFIlbcDecoderIntfcDeMux(); + CMMFIlbcDecoderIntfcDeMux(); + + // from mirror MIlbcDecoderIntfc method. + TInt DoSetDecoderMode (MIlbcDecoderIntfc::TDecodeMode aDecodeMode); + TInt DoSetComfortNoiseGenerationL(TBool aCng); + TInt DoGetComfortNoiseGenerationL(TBool& aCng); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MIlbcDecoderIntfc* iInterfaceIlbcDecoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcdecoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceIlbcDecoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceIlbcDecoderIntfcMux; + version_no = 1; + display_name = "Ilbc Decoder Mux"; + default_data = "10282605" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceIlbcDecoderIntfcDeMux; + version_no = 1; + display_name = "Ilbc Decoder DeMux"; + default_data = "102825dc" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,460 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "ilbcencoderconfigci.h" + + +// MUX // + +TInt CMMFIlbcEncoderIntfcMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceIlbcEncoderIntfcDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFIlbcEncoderIntfcMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFIlbcEncoderIntfcMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFIlbcEncoderIntfcMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFIlbcEncoderIntfcMux::NewL() + { + CMMFIlbcEncoderIntfcMux* self = new (ELeave) CMMFIlbcEncoderIntfcMux; + return self; + } + + +TAny* CMMFIlbcEncoderIntfcMux::CustomInterface(TUid /*aInterfaceId*/) + { + MIlbcEncoderIntfc* interface = this; + return interface; + } + + +CMMFIlbcEncoderIntfcMux::CMMFIlbcEncoderIntfcMux() : + iRemoteHandle(-1) + { + } + + +CMMFIlbcEncoderIntfcMux::~CMMFIlbcEncoderIntfcMux() + { + } + + +// from MIlbcEncoderIntfc +TInt CMMFIlbcEncoderIntfcMux::SetEncoderMode(TEncodeMode aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send encodeMode in the sync command. + TPckgBuf encodeMode(aEncodeMode); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIIlbcEncoderIntfcSetEncoderMode, + encodeMode); + } + + return result; + } + + +// from MIlbcEncoderIntfc +TInt CMMFIlbcEncoderIntfcMux::GetEncoderMode(TEncodeMode& aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send encodeMode in the sync command. + TPckgBuf retEncodeMode; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIIlbcEncoderIntfcGetEncoderMode, + KNullDesC8, + retEncodeMode); + + // assign return values to aEncodeMode. Do nothing if there is an error + if(result == KErrNone) + { + aEncodeMode = retEncodeMode(); + } + } + + return result; + } + + +// from MIlbcEncoderIntfc +TInt CMMFIlbcEncoderIntfcMux::SetVadMode (TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send vadModeOn in the sync command. + TPckgBuf vadModeOn(aVadModeOn); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIIlbcEncoderIntfcSetVadMode, + vadModeOn); + } + + return result; + } + + +// from MIlbcEncoderIntfc +TInt CMMFIlbcEncoderIntfcMux::GetVadMode (TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retVadModeOn; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIIlbcEncoderIntfcGetVadMode, + KNullDesC8, + retVadModeOn); + + // assign return values to aVadModeOn. Do nothing if there is an error + if(result == KErrNone) + { + aVadModeOn = retVadModeOn(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFIlbcEncoderIntfcDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFIlbcEncoderIntfcDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFIlbcEncoderIntfcDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFIlbcEncoderIntfcDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFIlbcEncoderIntfcDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFIlbcEncoderIntfcDeMux::RefreshL() + { + // refetch the Ilbc encoder intfc custom interface if we already have a target + if (iTarget) + { + iInterfaceIlbcEncoderIntfc = static_cast (iTarget->CustomInterface(KUidIlbcEncoderIntfc)); + + if (!iInterfaceIlbcEncoderIntfc) + { + iInterfaceIlbcEncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFIlbcEncoderIntfcDeMux::NewL() + { + CMMFIlbcEncoderIntfcDeMux* self = new (ELeave) CMMFIlbcEncoderIntfcDeMux; + return self; + } + + +CMMFIlbcEncoderIntfcDeMux::CMMFIlbcEncoderIntfcDeMux() + { + } + + +CMMFIlbcEncoderIntfcDeMux::~CMMFIlbcEncoderIntfcDeMux() + { + } + + +TInt CMMFIlbcEncoderIntfcDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Ilbc encoder intfc Hw Device custom interface + iInterfaceIlbcEncoderIntfc = static_cast (iTarget->CustomInterface(KUidIlbcEncoderIntfc)); + + if (!iInterfaceIlbcEncoderIntfc) + { + iInterfaceIlbcEncoderIntfc = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFIlbcEncoderIntfcDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFIlbcEncoderIntfcDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIIlbcEncoderIntfcSetEncoderMode: + { + TPckgBuf encodeMode; + iUtility->ReadFromInputDesL(aMessage, &encodeMode); + + result = DoSetEncoderModeL(encodeMode()); + + break; + } + case EMMFDevSoundCIIlbcEncoderIntfcSetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoSetVadModeL(vadModeOn()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFIlbcEncoderIntfcDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIIlbcEncoderIntfcGetEncoderMode: + { + TPckgBuf encodeMode; + iUtility->ReadFromInputDesL(aMessage, &encodeMode); + + result = DoGetEncoderModeL(encodeMode()); + + TPckgBuf des(encodeMode()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + case EMMFDevSoundCIIlbcEncoderIntfcGetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoGetVadModeL(vadModeOn()); + + TPckgBuf des(vadModeOn()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFIlbcEncoderIntfcDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFIlbcEncoderIntfcDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Ilbc encoder intfc custom interface implementation +TInt CMMFIlbcEncoderIntfcDeMux::DoSetEncoderModeL(MIlbcEncoderIntfc::TEncodeMode aEncodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcEncoderIntfc) + { + result = iInterfaceIlbcEncoderIntfc->SetEncoderMode(aEncodeMode); + } + + return result; + } + + +// Ilbc encoder intfc custom interface implementation +TInt CMMFIlbcEncoderIntfcDeMux::DoGetEncoderModeL(MIlbcEncoderIntfc::TEncodeMode& aEncodeMode) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcEncoderIntfc) + { + result = iInterfaceIlbcEncoderIntfc->GetEncoderMode(aEncodeMode); + } + + return result; + } + + +// Ilbc encoder intfc custom interface implementation +TInt CMMFIlbcEncoderIntfcDeMux::DoSetVadModeL(TBool aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcEncoderIntfc) + { + result = iInterfaceIlbcEncoderIntfc->SetVadMode(aVadModeOn); + } + + return result; + } + + +// Ilbc encoder intfc custom interface implementation +TInt CMMFIlbcEncoderIntfcDeMux::DoGetVadModeL(TBool& aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceIlbcEncoderIntfc) + { + result = iInterfaceIlbcEncoderIntfc->GetVadMode(aVadModeOn); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceIlbcEncoderIntfcMux, CMMFIlbcEncoderIntfcMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceIlbcEncoderIntfcDeMux, CMMFIlbcEncoderIntfcDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,254 @@ +// Copyright (c) 2007-2009 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: +// Implementation of Ilbc encoder config custom interface pair +// +// + +#ifndef ILBCENCODERCONFIGCI_H +#define ILBCENCODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIIlbcEncoderIntfcCommands + { + EMMFDevSoundCIIlbcEncoderIntfcSetEncoderMode, + EMMFDevSoundCIIlbcEncoderIntfcGetEncoderMode, + EMMFDevSoundCIIlbcEncoderIntfcSetVadMode, + EMMFDevSoundCIIlbcEncoderIntfcGetVadMode + }; + + +/** +Implementation of the Ilbc encoder config custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFIlbcEncoderIntfcMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MIlbcEncoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MIlbcEncoderIntfc + //@see MIlbcEncoderIntfc + virtual TInt SetEncoderMode(TEncodeMode aEncodeMode); + //@see MIlbcEncoderIntfc + virtual TInt GetEncoderMode(TEncodeMode& aEncodeMode); + //@see MIlbcEncoderIntfc + virtual TInt SetVadMode(TBool aVadModeOn); + //@see MIlbcEncoderIntfc + virtual TInt GetVadMode(TBool& aVadModeOn); + +protected: + CMMFIlbcEncoderIntfcMux(); + ~CMMFIlbcEncoderIntfcMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Ilbc Decoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFIlbcEncoderIntfcDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFIlbcEncoderIntfcDeMux class + @return A pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return The result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFIlbcEncoderIntfcDeMux(); + CMMFIlbcEncoderIntfcDeMux(); + + // from mirror MIlbcEncoderIntfc method. + TInt DoSetEncoderModeL(MIlbcEncoderIntfc::TEncodeMode aEncodeMode); + TInt DoGetEncoderModeL(MIlbcEncoderIntfc::TEncodeMode& aEncodeMode); + TInt DoSetVadModeL(TBool aVadModeOn); + TInt DoGetVadModeL(TBool& aVadModeOn); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MIlbcEncoderIntfc* iInterfaceIlbcEncoderIntfc; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/ilbcencoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceIlbcEncoderIntfcDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceIlbcEncoderIntfcMux; + version_no = 1; + display_name = "Ilbc Encoder Mux"; + default_data = "10282606" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceIlbcEncoderIntfcDeMux; + version_no = 1; + display_name = "Ilbc Encoder DeMux"; + default_data = "102825de" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,373 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "playbackstatusci.h" + + +// MUX // +/*****************************************************************************/ + +TInt CMMFPlayBackStatusMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfacePlayBackStatusDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFPlayBackStatusMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFPlayBackStatusMux::NewL() + { + CMMFPlayBackStatusMux* self = new (ELeave) CMMFPlayBackStatusMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFPlayBackStatusMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFPlaybackStatus* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFPlayBackStatusMux::CMMFPlayBackStatusMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFPlayBackStatusMux::~CMMFPlayBackStatusMux() + { + } + +/*****************************************************************************/ +// from MMMFPlaybackStatus +TInt CMMFPlayBackStatusMux::MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus) + { + TInt err = KErrNone; + if (iRemoteHandle > 0) + { + // send the status in the sync command + TPckgBuf status(aStatus); + + TPckgBuf retStatus; + + // any return code other than zero is an error + err = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIPlayBackStatus, + status, + retStatus); + // assign return values to aStatus. Do nothing if there is an error + if(err == KErrNone) + { + aStatus = retStatus(); + } + } + return err; + } + +TInt CMMFPlayBackStatusMux::MmpsRequestLossOfSyncNotification() + { + TInt err = KErrNone; + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + err = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIPlayBackStatusReqSyncLossNotification, + KNullDesC8); + } + return err; + } + +TInt CMMFPlayBackStatusMux::MmpsCancelLossOfSyncNotification() + { + TInt err = KErrNone; + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + err = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIPlayBackStatusCancelSyncLossNotification, + KNullDesC8); + } + return err; + } + + +// DEMUX // +/*****************************************************************************/ +TInt CMMFPlayBackStatusDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::RefreshL() + { + // refetch the play back status custom interface if we already have a target + if (iTarget) + { + iInterfacePlayBackStatus = static_cast(iTarget-> + CustomInterface(KUidPlaybackStatus)); + + if (!iInterfacePlayBackStatus) + { + User::Leave(KErrNotSupported); + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFPlayBackStatusDeMux::NewL() + { + CMMFPlayBackStatusDeMux* self = new (ELeave) CMMFPlayBackStatusDeMux; + return self; + } + +/*****************************************************************************/ +CMMFPlayBackStatusDeMux::CMMFPlayBackStatusDeMux() + { + } + +/*****************************************************************************/ +CMMFPlayBackStatusDeMux::~CMMFPlayBackStatusDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFPlayBackStatusDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Playback status Hw Device custom interface + MMMFPlaybackStatus* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidPlaybackStatus)); + + if (!ptr) + { + iInterfacePlayBackStatus = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfacePlayBackStatus = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFPlayBackStatusDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + iUtility->GetSyncMessageDataL(aMessage, data); + + TInt err = KErrNone; + switch(data.iCommand) + { + case EMMFDevSoundCIPlayBackStatusReqSyncLossNotification: + { + err = DoMmpsRequestLossOfSyncNotification(); + break; + } + case EMMFDevSoundCIPlayBackStatusCancelSyncLossNotification: + { + err = DoMmpsCancelLossOfSyncNotification(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return err; + } + +/*****************************************************************************/ +TInt CMMFPlayBackStatusDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIPlayBackStatus: + { + TPckgBuf status; + iUtility->ReadFromInputDesL(aMessage, &status); + + DoMmpsGetPlaybackStatusInformation(status()); + + TPckgBuf des(status()); + iUtility->WriteToOutputDesL(aMessage, des); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFPlayBackStatusDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// Play Back Status custom interface implementation +TInt CMMFPlayBackStatusDeMux::DoMmpsGetPlaybackStatusInformation(MMMFPlaybackStatus::TMMFPlaybackStatus& aStatus) + { + TInt err = KErrNotReady; + if (iInterfacePlayBackStatus) + { + err = iInterfacePlayBackStatus->MmpsGetPlaybackStatusInformation(aStatus); + } + return err; + } + +TInt CMMFPlayBackStatusDeMux::DoMmpsRequestLossOfSyncNotification() + { + TInt err = KErrNotReady; + if (iInterfacePlayBackStatus) + { + err = iInterfacePlayBackStatus->MmpsRequestLossOfSyncNotification(); + } + return err; + } + +TInt CMMFPlayBackStatusDeMux::DoMmpsCancelLossOfSyncNotification() + { + TInt err = KErrNotReady; + if (iInterfacePlayBackStatus) + { + err = iInterfacePlayBackStatus->MmpsCancelLossOfSyncNotification(); + } + return err; + } + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfacePlayBackStatusMux, CMMFPlayBackStatusMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfacePlayBackStatusDeMux, CMMFPlayBackStatusDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,262 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef PLAYBACKSTATUSCI_H +#define PLAYBACKSTATUSCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCIPlayBackStatusCommands + { + EMMFDevSoundCIPlayBackStatus = 0, + EMMFDevSoundCIPlayBackStatusReqSyncLossNotification, + EMMFDevSoundCIPlayBackStatusCancelSyncLossNotification + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFPlayBackStatusMux + * + * implementation of the Play back status custom interface pair + */ +class CMMFPlayBackStatusMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFPlaybackStatus + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @leave This method may leave with one of the system-wide error codes. + @return The pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFPlaybackStatus + /** + @see MMMFPlaybackStatus + */ + virtual TInt MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus); + + /** + @see MMMFPlaybackStatus + */ + virtual TInt MmpsRequestLossOfSyncNotification(); + + /** + @see MMMFPlaybackStatus + */ + virtual TInt MmpsCancelLossOfSyncNotification(); + +protected: + CMMFPlayBackStatusMux(); + ~CMMFPlayBackStatusMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + +/** + * CMMFPlayBackStatusDeMux + * + * Implementation of the DeMux side of pair + */ +class CMMFPlayBackStatusDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFPlayBackStatusDeMux class + @leave This method may leave with one of the system-wide error codes. + @return A pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return A handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFPlayBackStatusDeMux(); + CMMFPlayBackStatusDeMux(); + + // from mirror MMMFPlaybackStatus method. + TInt DoMmpsGetPlaybackStatusInformation(MMMFPlaybackStatus::TMMFPlaybackStatus& aStatus); + TInt DoMmpsRequestLossOfSyncNotification(); + TInt DoMmpsCancelLossOfSyncNotification(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MMMFPlaybackStatus* iInterfacePlayBackStatus; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/playbackstatusci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfacePlayBackStatusDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfacePlayBackStatusMux; + version_no = 1; + display_name = "Play back Status Mux"; + default_data = "10273811" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfacePlayBackStatusDeMux; + version_no = 1; + display_name = "Play back status DeMux"; + default_data = "10273813" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1216 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "sbcencoderci.h" + +class TBitpoolRange + { +public: + TUint iMin; + TUint iMax; + }; + + +// MUX // +/*****************************************************************************/ + +TInt CMMFSbcEncoderMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceSbcEncoderDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFSbcEncoderMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFSbcEncoderMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFSbcEncoderMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFSbcEncoderMux::NewL() + { + CMMFSbcEncoderMux* self = new (ELeave) CMMFSbcEncoderMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFSbcEncoderMux::CustomInterface(TUid /*aInterfaceId*/) + { + MSbcEncoderIntfc* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFSbcEncoderMux::CMMFSbcEncoderMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFSbcEncoderMux::~CMMFSbcEncoderMux() + { + } + +/*****************************************************************************/ +// from MSbcEncoderIntfc +TInt CMMFSbcEncoderMux::GetSupportedBitpoolRange(TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TBitpoolRange range; + range.iMax = 0; + range.iMin = 0; + TPckgBuf rangeBuffer(range); + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedBitpoolRange, + KNullDesC8, + rangeBuffer); + if (err == KErrNone) + { + aMinSupportedBitpoolSize = rangeBuffer().iMin; + aMaxSupportedBitpoolSize = rangeBuffer().iMax; + } + } + return err; + } + +void CMMFSbcEncoderMux::SetSamplingFrequency(TUint aSamplingFrequency) + { + if (iRemoteHandle > 0) + { + // send the frequency in the sync command + TPckgBuf freqBuffer(aSamplingFrequency); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetSamplingFrequency, + freqBuffer); + } + } + +void CMMFSbcEncoderMux::SetChannelMode (TSbcChannelMode aChannelMode) + { + if (iRemoteHandle > 0) + { + // send the channel mode in the sync command + TPckgBuf channelModeBuffer(aChannelMode); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetChannelMode, + channelModeBuffer); + } + } + +void CMMFSbcEncoderMux::SetNumOfSubbands ( TUint aNumOfSubbands ) + { + if (iRemoteHandle > 0) + { + // send the number of subbands in the sync command + TPckgBuf numBuffer(aNumOfSubbands); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetSubbands, + numBuffer); + } + } + +void CMMFSbcEncoderMux::SetNumOfBlocks ( TUint aNumOfBlocks ) + { + if (iRemoteHandle > 0) + { + // send the number of blocks in the sync command + TPckgBuf blocksBuffer(aNumOfBlocks); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetBlocks, + blocksBuffer); + } + } + +void CMMFSbcEncoderMux::SetAllocationMethod (TSbcAllocationMethod aAllocationMethod ) + { + if (iRemoteHandle > 0) + { + // send the allocation method in the sync command + TPckgBuf allocMethodBuffer(aAllocationMethod); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetAllocationMethod, + allocMethodBuffer); + } + } + +void CMMFSbcEncoderMux::SetBitpoolSize (TUint aBitpoolSize ) + { + if (iRemoteHandle > 0) + { + // send the bitpool size in the sync command + TPckgBuf sizeBuffer(aBitpoolSize); + // No way of reporting an error message so ignore the return value from SendSlaveSyncCommand + iUtility->SendSlaveSyncCommand( iRemoteHandle, + EMMFDevSoundCISbcEncoderSetBitpoolSize, + sizeBuffer); + } + } + +TInt CMMFSbcEncoderMux::ApplyConfig() + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + err = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderApplyConfig, + KNullDesC8); + } + return err; + } + +TInt CMMFSbcEncoderMux::GetSamplingFrequency(TUint& aSamplingFrequency) + { + TInt err = KErrNotReady; + + if (iRemoteHandle > 0) + { + TPckgBuf freqBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSamplingFrequency, + KNullDesC8, + freqBuffer); + if (err == KErrNone) + { + aSamplingFrequency = freqBuffer(); + } + } + + return err; + } + +TInt CMMFSbcEncoderMux::GetNumOfSubbands (TUint& aNumOfSubbands ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf sizeBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSubbands, + KNullDesC8, + sizeBuffer); + if (err == KErrNone) + { + aNumOfSubbands = sizeBuffer(); + } + } + return err; + } + +TInt CMMFSbcEncoderMux::GetNumOfBlocks (TUint& aNumOfBlocks ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf blocksBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetBlocks, + KNullDesC8, + blocksBuffer); + if (err == KErrNone) + { + aNumOfBlocks = blocksBuffer(); + } + } + return err; + } + +TInt CMMFSbcEncoderMux::GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf allocMethodBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetAllocationMethod, + KNullDesC8, + allocMethodBuffer); + if (err == KErrNone) + { + aAllocationMethod = allocMethodBuffer(); + } + } + return err; + } + +TInt CMMFSbcEncoderMux::GetBitpoolSize (TUint& aBitpoolSize ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf sizeBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetBitpoolSize, + KNullDesC8, + sizeBuffer); + if (err == KErrNone) + { + aBitpoolSize = sizeBuffer(); + } + } + + return err; + } + +TInt CMMFSbcEncoderMux::GetChannelMode(TSbcChannelMode& aChannelMode) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + TPckgBuf channelModeBuffer; + err = iUtility->SendSlaveSyncCommandResult( iRemoteHandle, + EMMFDevSoundCISbcEncoderGetChannelMode, + KNullDesC8, + channelModeBuffer); + if (err == KErrNone) + { + aChannelMode = channelModeBuffer(); + } + } + + return err; + } + +/********************************************************************************/ +TInt CMMFSbcEncoderMux::GetSupportedSamplingFrequencies (RArray& aSamplingFrequencies ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // Clear the array + aSamplingFrequencies.Reset(); + // Fetch the count + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesCount, + KNullDesC8); + if (count < 0) + { + err = count; + } + else if (count > 0) + { + TRAP(err, DoGetTUintArrayL( aSamplingFrequencies, + count, + EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesArray)); + } + else + { + // count == 0, nothing to do and no error... + err = KErrNone; + } + } + return err; + } + +/********************************************************************************/ +TInt CMMFSbcEncoderMux::GetSupportedChannelModes (RArray& aChannelModes ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // Clear the array + aChannelModes.Reset(); + // Fetch the count + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedChannelModesCount, + KNullDesC8); + if (count < 0) + { + err = count; + } + else if (count > 0) + { + TRAP(err, DoGetChannelModesArrayL(aChannelModes, count)); + } + else + { + // count == 0, nothing to do and no error... + err = KErrNone; + } + } + return err; + } + +void CMMFSbcEncoderMux::DoGetChannelModesArrayL(RArray& aChannelModes, TInt aCount) + { + // allocate a temporary buffer to hold the channel modes + HBufC8* buf = HBufC8::NewLC(aCount * sizeof(TSbcChannelMode)); + TPtr8 ptr = buf->Des(); + + // fetch the channel modes - but send over the received count to be sure + TPckgBuf countBuf(aCount); + User::LeaveIfError(iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedChannelModesArray, + countBuf, ptr)); + + // stream data into the pointer + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + TInt err = KErrNone; + TSbcChannelMode mode; + for (TInt i = 0; i < aCount; i++) + { + // note we don't destroy array because we don't own it + // but we do reset it as it is incomplete + mode = static_cast(stream.ReadInt32L()); + err = aChannelModes.Append(mode); + if (err != KErrNone) + { + aChannelModes.Reset(); + User::Leave(KErrCorrupt); + } + } + + CleanupStack::PopAndDestroy(2, buf);// stream, buf + } + +/********************************************************************************/ +TInt CMMFSbcEncoderMux::GetSupportedNumOfSubbands (RArray& aNumOfSubbands ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // Clear the array + aNumOfSubbands.Reset(); + // Fetch the count + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedSubbandsCount, + KNullDesC8); + if (count < 0) + { + err = count; + } + else if (count > 0) + { + TRAP(err, DoGetTUintArrayL(aNumOfSubbands, count, EMMFDevSoundCISbcEncoderGetSupportedSubbandsArray)); + } + else + { + // count == 0, nothing to do and no error... + err = KErrNone; + } + } + + return err; + } + +/********************************************************************************/ +TInt CMMFSbcEncoderMux::GetSupportedAllocationMethods (RArray& aAllocationMethods ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // Clear the array + aAllocationMethods.Reset(); + // Fetch the count + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsCount, + KNullDesC8); + if (count < 0) + { + err = count; + } + else if (count > 0) + { + TRAP(err, DoGetAllocMethodsArrayL(aAllocationMethods, count)); + } + else + { + // count == 0, nothing to do and no error... + err = KErrNone; + } + } + + return err; + } + +void CMMFSbcEncoderMux::DoGetAllocMethodsArrayL(RArray& aAllocationMethods, TInt aCount) + { + // allocate a temporary buffer to hold the allocation methods + HBufC8* buf = HBufC8::NewLC(aCount * sizeof(TSbcAllocationMethod)); + TPtr8 ptr = buf->Des(); + + // fetch the allocation methods - but send over the received count to be sure + TPckgBuf countBuf(aCount); + User::LeaveIfError(iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsArray, + countBuf, ptr)); + // stream data into the pointer + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + TInt err = KErrNone; + TSbcAllocationMethod mode; + for (TInt i = 0; i < aCount; i++) + { + // note we don't destroy array because we don't own it + // but we do reset it as it is incomplete + mode = static_cast(stream.ReadInt32L()); + err = aAllocationMethods.Append(mode); + if (err != KErrNone) + { + aAllocationMethods.Reset(); + User::Leave(KErrCorrupt); + } + } + + CleanupStack::PopAndDestroy(2, buf);// stream, buf + } + +/********************************************************************************/ +TInt CMMFSbcEncoderMux::GetSupportedNumOfBlocks (RArray& aNumOfBlocks ) + { + TInt err = KErrNotReady; + if (iRemoteHandle > 0) + { + // Clear the array + aNumOfBlocks.Reset(); + // Fetch the count + TInt count = -1; + count = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISbcEncoderGetSupportedBlocksCount, + KNullDesC8); + if (count < 0) + { + err = count; + } + else if (count > 0) + { + TRAP(err, DoGetTUintArrayL(aNumOfBlocks, count, EMMFDevSoundCISbcEncoderGetSupportedBlocksArray)); + } + else + { + // count == 0, nothing to do and no error... + err = KErrNone; + } + } + + return err; + } + +void CMMFSbcEncoderMux::DoGetTUintArrayL(RArray& aArray, + TInt aCount, + TMMFDevSoundCISbcEncoderCommands aCommand) + { + // allocate a temporary buffer to hold the number of blocks + HBufC8* buf = HBufC8::NewLC(aCount * sizeof(TInt32)); + TPtr8 ptr = buf->Des(); + + // fetch the array data for the given command - but send over the received count to be sure + TPckgBuf countBuf(aCount); + User::LeaveIfError(iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + aCommand, + countBuf, ptr)); + + // stream data into the pointer + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + TInt err = KErrNone; + for (TInt i = 0; i < aCount; i++) + { + err = aArray.Append(stream.ReadUint32L()); + if (err != KErrNone) + { + // note we don't destroy array because we don't own it + // but we do reset it as it is incomplete + aArray.Reset(); + User::Leave(KErrCorrupt); + } + } + + CleanupStack::PopAndDestroy(2, buf);// stream, buf + } + + +// DEMUX // +/*****************************************************************************/ +TInt CMMFSbcEncoderDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::RefreshL() + { + // refetch the SBC encoder custom interface if we already have a target + if (iTarget) + { + MSbcEncoderIntfc* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidSbcEncoderIntfc)); + + if (!ptr) + { + iInterfaceSbcEncoder = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceSbcEncoder = ptr; + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFSbcEncoderDeMux::NewL() + { + CMMFSbcEncoderDeMux* self = new (ELeave) CMMFSbcEncoderDeMux; + return self; + } + +/*****************************************************************************/ +CMMFSbcEncoderDeMux::CMMFSbcEncoderDeMux() + { + } + +/*****************************************************************************/ +CMMFSbcEncoderDeMux::~CMMFSbcEncoderDeMux() + { + // Clear up all the arrays. + iSamplingFrequencies.Reset(); + iSamplingFrequencies.Close(); + iChannelModes.Reset(); + iChannelModes.Close(); + iNumOfSubbands.Reset(); + iNumOfSubbands.Close(); + iAllocationMethods.Reset(); + iAllocationMethods.Close(); + iNumOfBlocks.Reset(); + iNumOfBlocks.Close(); + } + +/*****************************************************************************/ +TInt CMMFSbcEncoderDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the SBD encoder Hw Device custom interface + MSbcEncoderIntfc* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidSbcEncoderIntfc)); + + if (!ptr) + { + iInterfaceSbcEncoder = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceSbcEncoder = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFSbcEncoderDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + TInt retVal = KErrNone; + switch (data.iCommand) + { + case EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesCount: + { + iSamplingFrequencies.Reset(); + User::LeaveIfError(DoGetSupportedSamplingFrequencies(iSamplingFrequencies)); + retVal = iSamplingFrequencies.Count(); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedBlocksCount: + { + iNumOfBlocks.Reset(); + User::LeaveIfError(DoGetSupportedNumOfBlocks(iNumOfBlocks)); + retVal = iNumOfBlocks.Count(); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedSubbandsCount: + { + iNumOfSubbands.Reset(); + User::LeaveIfError(DoGetSupportedNumOfSubbands(iNumOfSubbands)); + retVal = iNumOfSubbands.Count(); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedChannelModesCount: + { + iChannelModes.Reset(); + User::LeaveIfError(DoGetSupportedChannelModes(iChannelModes)); + retVal = iChannelModes.Count(); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsCount: + { + iAllocationMethods.Reset(); + User::LeaveIfError(DoGetSupportedAllocationMethods(iAllocationMethods)); + retVal = iAllocationMethods.Count(); + break; + } + case EMMFDevSoundCISbcEncoderSetSamplingFrequency: + { + TPckgBuf freqBuffer; + iUtility->ReadFromInputDesL(aMessage, &freqBuffer); + DoSetSamplingFrequency(freqBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderSetChannelMode: + { + TPckgBuf channelBuffer; + iUtility->ReadFromInputDesL(aMessage, &channelBuffer); + DoSetChannelMode(channelBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderSetSubbands: + { + TPckgBuf valueBuffer; + iUtility->ReadFromInputDesL(aMessage, &valueBuffer); + DoSetNumOfSubbands(valueBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderSetBlocks: + { + TPckgBuf valueBuffer; + iUtility->ReadFromInputDesL(aMessage, &valueBuffer); + DoSetNumOfBlocks(valueBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderSetBitpoolSize: + { + TPckgBuf valueBuffer; + iUtility->ReadFromInputDesL(aMessage, &valueBuffer); + DoSetBitpoolSize(valueBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderSetAllocationMethod: + { + TPckgBuf allocationMethodBuffer; + iUtility->ReadFromInputDesL(aMessage, &allocationMethodBuffer); + DoSetAllocationMethod(allocationMethodBuffer()); + break; + } + case EMMFDevSoundCISbcEncoderApplyConfig: + { + retVal = DoApplyConfig(); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + }; + + return retVal; + } + +/*****************************************************************************/ +TInt CMMFSbcEncoderDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + TInt retVal = KErrNone; + switch (data.iCommand) + { + case EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesArray: + { + // The array will already have been populated by the time this is called + // but we can check that the count passed in matches that of the array + DoWriteArrayToClientL(aMessage, iSamplingFrequencies); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedSubbandsArray: + { + // The array will already have been populated by the time this is called + // but we can check that the count passed in matches that of the array + DoWriteArrayToClientL(aMessage, iNumOfSubbands); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedBlocksArray: + { + // The array will already have been populated by the time this is called + // but we can check that the count passed in matches that of the array + DoWriteArrayToClientL(aMessage, iNumOfBlocks); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedChannelModesArray: + { + // The array will already have been populated by the time this is called + // but we can check that the count passed in matches that of the array + // Pass ETrue to write out the channel modes array + DoWriteArrayToClientL(aMessage, ETrue); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsArray: + { + // The array will already have been populated by the time this is called + // but we can check that the count passed in matches that of the array + // Pass EFalse for the alloc method array. + DoWriteArrayToClientL(aMessage, EFalse); + break; + } + case EMMFDevSoundCISbcEncoderGetSupportedBitpoolRange: + { + TPckgBuf rangeBuf; + DoGetSupportedBitpoolRange(rangeBuf().iMin, rangeBuf().iMax); + iUtility->WriteToOutputDesL(aMessage, rangeBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetSamplingFrequency: + { + TPckgBuf valueBuf; + DoGetSamplingFrequency(valueBuf()); + iUtility->WriteToOutputDesL(aMessage, valueBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetChannelMode: + { + TPckgBuf channelBuf; + DoGetChannelMode(channelBuf()); + iUtility->WriteToOutputDesL(aMessage, channelBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetSubbands: + { + TPckgBuf valueBuf; + DoGetNumOfSubbands(valueBuf()); + iUtility->WriteToOutputDesL(aMessage, valueBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetBlocks: + { + TPckgBuf valueBuf; + DoGetNumOfBlocks(valueBuf()); + iUtility->WriteToOutputDesL(aMessage, valueBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetAllocationMethod: + { + TPckgBuf allocationMethodBuf; + DoGetAllocationMethod(allocationMethodBuf()); + iUtility->WriteToOutputDesL(aMessage, allocationMethodBuf); + break; + } + case EMMFDevSoundCISbcEncoderGetBitpoolSize: + { + TPckgBuf valueBuf; + DoGetBitpoolSize(valueBuf()); + iUtility->WriteToOutputDesL(aMessage, valueBuf); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return retVal; + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFSbcEncoderDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// SBC Encoder custom interface implementation +TInt CMMFSbcEncoderDeMux::DoGetSupportedSamplingFrequencies(RArray& aSamplingFrequencies) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedSamplingFrequencies(aSamplingFrequencies); + } + return err; + } + +TInt CMMFSbcEncoderDeMux::DoGetSupportedNumOfSubbands (RArray& aNumOfSubbands ) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedNumOfSubbands(aNumOfSubbands); + } + return err; + } + +TInt CMMFSbcEncoderDeMux::DoGetSupportedNumOfBlocks (RArray& aNumOfBlocks ) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedNumOfBlocks(aNumOfBlocks); + } + return err; + } + +TInt CMMFSbcEncoderDeMux::DoGetSupportedChannelModes (RArray& aChannelModes ) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedChannelModes(aChannelModes); + } + return err; + } + +TInt CMMFSbcEncoderDeMux::DoGetSupportedAllocationMethods (RArray& aAllocationMethods ) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedAllocationMethods(aAllocationMethods); + } + return err; + } + +TInt CMMFSbcEncoderDeMux::DoGetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize) + { + TInt err = KErrNotReady; + if (iInterfaceSbcEncoder) + { + err = iInterfaceSbcEncoder->GetSupportedBitpoolRange(aMinSupportedBitpoolSize, aMaxSupportedBitpoolSize); + } + return err; + } + +void CMMFSbcEncoderDeMux::DoSetSamplingFrequency (TUint aSamplingFrequency ) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetSamplingFrequency(aSamplingFrequency); + } + } + +void CMMFSbcEncoderDeMux::DoSetChannelMode (MSbcEncoderIntfc::TSbcChannelMode aChannelMode ) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetChannelMode(aChannelMode); + } + } + +void CMMFSbcEncoderDeMux::DoSetNumOfSubbands (TUint aNumOfSubbands) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetNumOfSubbands(aNumOfSubbands); + } + } + +void CMMFSbcEncoderDeMux::DoSetNumOfBlocks (TUint aNumOfBlocks) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetNumOfBlocks(aNumOfBlocks); + } + } + +void CMMFSbcEncoderDeMux::DoSetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod aAllocationMethod) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetAllocationMethod(aAllocationMethod); + } + } + +void CMMFSbcEncoderDeMux::DoSetBitpoolSize (TUint aBitpoolSize) + { + if (iInterfaceSbcEncoder) + { + iInterfaceSbcEncoder->SetBitpoolSize(aBitpoolSize); + } + } + +TInt CMMFSbcEncoderDeMux::DoApplyConfig() + { + TInt retVal = KErrNotReady; + if (iInterfaceSbcEncoder) + { + retVal = iInterfaceSbcEncoder->ApplyConfig(); + } + return retVal; + } + +TInt CMMFSbcEncoderDeMux::DoGetSamplingFrequency(TUint& aSamplingFrequency) + { + TInt ret = KErrNotReady; + if (iInterfaceSbcEncoder) + { + ret = iInterfaceSbcEncoder->GetSamplingFrequency(aSamplingFrequency); + } + return ret; + } + +TInt CMMFSbcEncoderDeMux::DoGetChannelMode (MSbcEncoderIntfc::TSbcChannelMode& aChannelMode ) + { + if (!iInterfaceSbcEncoder) + { + return KErrNotReady; + } + else + { + return iInterfaceSbcEncoder->GetChannelMode(aChannelMode); + } + } + +TInt CMMFSbcEncoderDeMux::DoGetNumOfSubbands (TUint& aNumOfSubbands ) + { + if (!iInterfaceSbcEncoder) + { + return KErrNotReady; + } + else + { + return iInterfaceSbcEncoder->GetNumOfSubbands(aNumOfSubbands); + } + } + +TInt CMMFSbcEncoderDeMux::DoGetNumOfBlocks (TUint& aNumOfBlocks ) + { + if (!iInterfaceSbcEncoder) + { + return KErrNotReady; + } + else + { + return iInterfaceSbcEncoder->GetNumOfBlocks(aNumOfBlocks); + } + } + +TInt CMMFSbcEncoderDeMux::DoGetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod& aAllocationMethod ) + { + if (!iInterfaceSbcEncoder) + { + return KErrNotReady; + } + else + { + return iInterfaceSbcEncoder->GetAllocationMethod(aAllocationMethod); + } + } + +TInt CMMFSbcEncoderDeMux::DoGetBitpoolSize(TUint& aBitpoolSize) + { + if (!iInterfaceSbcEncoder) + { + return KErrNotReady; + } + else + { + return iInterfaceSbcEncoder->GetBitpoolSize(aBitpoolSize); + } + } + +// This is a utility method used by each of the TUint parametered methods to write their arrays +// back to the client (using aMessage) +void CMMFSbcEncoderDeMux::DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, RArray& aArray) + { + // The message already contains the array count so retrieve it + // and verify that nothing's awry. + TPckgBuf countBuf; + iUtility->ReadFromInputDesL(aMessage, &countBuf); + TInt count = countBuf(); + if (count != aArray.Count()) + { + User::Leave(KErrCorrupt); + } + // Create a suitably sized buffer + HBufC8* buf = HBufC8::NewLC(count * sizeof(TUint)); + TPtr8 ptr = buf->Des(); + RDesWriteStream stream(ptr); + CleanupClosePushL(stream); + // Stream the array data + for (TInt i = 0; i < count; i++) + { + stream.WriteUint32L(aArray[i]); + } + // Commit the data to the stream + stream.CommitL(); + // Write the buffer back to the mux + iUtility->WriteToOutputDesL(aMessage, *buf); + CleanupStack::PopAndDestroy(2, buf); // stream, buf + } + +void CMMFSbcEncoderDeMux::DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, TBool aWriteChannelModeArray) + { + // The message already contains the array count so retrieve it + // and verify that nothing's awry. + TPckgBuf countBuf; + iUtility->ReadFromInputDesL(aMessage, &countBuf); + TInt count = countBuf(); + TInt arrayCount = 0; + + if (aWriteChannelModeArray) + { + arrayCount = iChannelModes.Count(); + } + else + { + arrayCount = iAllocationMethods.Count(); + } + + if (count != arrayCount) + { + User::Leave(KErrCorrupt); + } + + // Create a suitably sized buffer + HBufC8* buf = HBufC8::NewLC(count * sizeof(TUint)); + TPtr8 ptr = buf->Des(); + RDesWriteStream stream(ptr); + CleanupClosePushL(stream); + // Stream the array data + if (aWriteChannelModeArray) + { + for (TInt i = 0; i < count; i++) + { + stream.WriteUint32L(iChannelModes[i]); + } + + } + else + { + for (TInt i = 0; i < count; i++) + { + stream.WriteUint32L(iAllocationMethods[i]); + } + } + + // Commit the data to the stream + stream.CommitL(); + // Write the buffer back to the mux + iUtility->WriteToOutputDesL(aMessage, *buf); + CleanupStack::PopAndDestroy(2, buf); // stream, buf + } + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSbcEncoderMux, CMMFSbcEncoderMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSbcEncoderDeMux, CMMFSbcEncoderDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,394 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef SBCENCODERCI_H +#define SBCENCODERCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + Enum to represent the methods called by this custom interface + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCISbcEncoderCommands + { + EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesCount = 0, + EMMFDevSoundCISbcEncoderGetSupportedSamplingFrequenciesArray, + EMMFDevSoundCISbcEncoderGetSupportedChannelModesCount, + EMMFDevSoundCISbcEncoderGetSupportedChannelModesArray, + EMMFDevSoundCISbcEncoderGetSupportedSubbandsCount, + EMMFDevSoundCISbcEncoderGetSupportedSubbandsArray, + EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsCount, + EMMFDevSoundCISbcEncoderGetSupportedAllocationMethodsArray, + EMMFDevSoundCISbcEncoderGetSupportedBlocksCount, + EMMFDevSoundCISbcEncoderGetSupportedBlocksArray, + EMMFDevSoundCISbcEncoderGetSupportedBitpoolRange, + EMMFDevSoundCISbcEncoderSetSamplingFrequency, + EMMFDevSoundCISbcEncoderSetChannelMode, + EMMFDevSoundCISbcEncoderSetSubbands, + EMMFDevSoundCISbcEncoderSetBlocks, + EMMFDevSoundCISbcEncoderSetAllocationMethod, + EMMFDevSoundCISbcEncoderSetBitpoolSize, + EMMFDevSoundCISbcEncoderApplyConfig, + EMMFDevSoundCISbcEncoderGetSamplingFrequency, + EMMFDevSoundCISbcEncoderGetChannelMode, + EMMFDevSoundCISbcEncoderGetSubbands, + EMMFDevSoundCISbcEncoderGetBlocks, + EMMFDevSoundCISbcEncoderGetAllocationMethod, + EMMFDevSoundCISbcEncoderGetBitpoolSize + }; + + +/** + CMMFSbcEncoderMux implementation of the SBC encoder custom interface pair + @internalComponent + @prototype + @file + */ +class CMMFSbcEncoderMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MSbcEncoderIntfc + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return The custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @leave This method may leave with one of the system-wide error codes. + @return The pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MSbcEncoderIntfc + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedSamplingFrequencies(RArray& aSamplingFrequencies); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedChannelModes(RArray& aChannelModes); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedNumOfSubbands(RArray& aNumOfSubbands); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedAllocationMethods(RArray& aAllocationMethods); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedNumOfBlocks(RArray& aNumOfBlocks); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSupportedBitpoolRange(TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetSamplingFrequency(TUint aSamplingFrequency); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetChannelMode(TSbcChannelMode aChannelMode); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetNumOfSubbands(TUint aNumOfSubbands); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetNumOfBlocks(TUint aNumOfBlocks); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetAllocationMethod(TSbcAllocationMethod aAllocationMethod); + + /** + @see MSbcEncoderIntfc + */ + virtual void SetBitpoolSize(TUint aBitpoolSize); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt ApplyConfig(); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetSamplingFrequency(TUint& aSamplingFrequency); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetChannelMode(TSbcChannelMode& aChannelMode); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetNumOfSubbands(TUint& aNumOfSubbands); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetNumOfBlocks(TUint& aNumOfBlocks); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetAllocationMethod(TSbcAllocationMethod& aAllocationMethod); + + /** + @see MSbcEncoderIntfc + */ + virtual TInt GetBitpoolSize(TUint& aBitpoolSize); + +protected: + CMMFSbcEncoderMux(); + ~CMMFSbcEncoderMux(); + +private: + void DoGetTUintArrayL(RArray& aArray, TInt aCount, TMMFDevSoundCISbcEncoderCommands aCommand); + void DoGetChannelModesArrayL(RArray& aChannelModes, TInt aCount); + void DoGetAllocMethodsArrayL(RArray& aAllocationMethods, TInt aCount); + void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + +/** + CMMFSbcEncoderDeMux - DeMux side of pair + @internalComponent + @prototype + @file + */ +class CMMFSbcEncoderDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFSbcEncoderDeMux class + @leave This method may leave with one of the system-wide error codes. + @return A pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + @return The result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFSbcEncoderDeMux(); + CMMFSbcEncoderDeMux(); + + // mirrors MSbcEncoderIntfc methods. + TInt DoGetSupportedSamplingFrequencies (RArray& aSamplingFrequencies ); + TInt DoGetSupportedChannelModes (RArray& aChannelModes ); + TInt DoGetSupportedNumOfSubbands (RArray& aNumOfSubbands ); + TInt DoGetSupportedAllocationMethods (RArray& aAllocationMethods ); + TInt DoGetSupportedNumOfBlocks (RArray& aNumOfBlocks ); + TInt DoGetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize); + void DoSetSamplingFrequency (TUint aSamplingFrequency ); + void DoSetChannelMode (MSbcEncoderIntfc::TSbcChannelMode aChannelMode ); + void DoSetNumOfSubbands (TUint aNumOfSubbands ); + void DoSetNumOfBlocks (TUint aNumOfBlocks ); + void DoSetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod aAllocationMethod ); + void DoSetBitpoolSize (TUint aBitpoolSize ); + TInt DoApplyConfig(); + TInt DoGetSamplingFrequency (TUint& aSamplingFrequency ); + TInt DoGetChannelMode (MSbcEncoderIntfc::TSbcChannelMode& aChannelMode ); + TInt DoGetNumOfSubbands (TUint& aNumOfSubbands ); + TInt DoGetNumOfBlocks (TUint& aNumOfBlocks ); + TInt DoGetAllocationMethod (MSbcEncoderIntfc::TSbcAllocationMethod& aAllocationMethod ); + TInt DoGetBitpoolSize (TUint& aBitpoolSize ); + +private: + void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, RArray& aArray); + void DoWriteArrayToClientL(const RMmfIpcMessage& aMessage, TBool aWriteChannelModeArray); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MSbcEncoderIntfc* iInterfaceSbcEncoder; + +private: + RArray iSamplingFrequencies; + RArray iNumOfSubbands; + RArray iNumOfBlocks; + RArray iAllocationMethods; + RArray iChannelModes; + }; + +#endif // SBCENCODERCI_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/sbcencoderci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceSbcEncoderDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSbcEncoderMux; + version_no = 1; + display_name = "SBC Encoder Mux"; + default_data = "10282600" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSbcEncoderDeMux; + version_no = 1; + display_name = "SBC Encoder DeMux"; + default_data = "102825ce"; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,306 @@ +// Copyright (c) 2007-2009 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 +#include +#include + +#include "setdrmprotectedci.h" + + +// MUX // +/*****************************************************************************/ + +TInt CMMFSetDRMProtectedMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceSetDRMProtectedDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iDestructorKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFSetDRMProtectedMux::NewL() + { + CMMFSetDRMProtectedMux* self = new (ELeave) CMMFSetDRMProtectedMux; + return self; + } + +/*****************************************************************************/ +TAny* CMMFSetDRMProtectedMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFSetDRMProtected* interface = this; + return interface; + } + +/*****************************************************************************/ +CMMFSetDRMProtectedMux::CMMFSetDRMProtectedMux() : + iRemoteHandle(-1) + { + } + +/*****************************************************************************/ +CMMFSetDRMProtectedMux::~CMMFSetDRMProtectedMux() + { + } + +/*****************************************************************************/ +// from MMMFSetDRMProtected +TInt CMMFSetDRMProtectedMux::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected) + { + if (iRemoteHandle > 0) + { + // send the DRM protected flag in the sync command + TPckgBuf flag(aDRMProtected); + + // any return code other than zero is an error + return iUtility->SendSlaveSyncCommand(iRemoteHandle, EMMFDevSoundCISetDRMProtected, flag); + } + else + { + return KErrNotReady; + } + } + + + +// DEMUX // +/*****************************************************************************/ +TInt CMMFSetDRMProtectedDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::Release() + { + TUid key = iDestructorKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iDestructorKey = aDestructorKey; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::RefreshL() + { + // refetch the DRM protected custom interface if we already have a target + if (iTarget) + { + MMMFSetDRMProtected* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidSetDRMProtected)); + + if (!ptr) + { + iInterfaceSetDRMProtected = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceSetDRMProtected = ptr; + } + } + } + +/*****************************************************************************/ +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFSetDRMProtectedDeMux::NewL() + { + CMMFSetDRMProtectedDeMux* self = new (ELeave) CMMFSetDRMProtectedDeMux; + return self; + } + +/*****************************************************************************/ +CMMFSetDRMProtectedDeMux::CMMFSetDRMProtectedDeMux() + { + } + +/*****************************************************************************/ +CMMFSetDRMProtectedDeMux::~CMMFSetDRMProtectedDeMux() + { + } + +/*****************************************************************************/ +TInt CMMFSetDRMProtectedDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Playback status Hw Device custom interface + MMMFSetDRMProtected* ptr = NULL; + + ptr = static_cast (iTarget->CustomInterface(KUidSetDRMProtected)); + + if (!ptr) + { + iInterfaceSetDRMProtected = NULL; + User::Leave(KErrNotSupported); + } + else + { + iInterfaceSetDRMProtected = ptr; + } + return KErrNone; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + +/*****************************************************************************/ +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFSetDRMProtectedDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + + TInt retVal = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCISetDRMProtected: + { + TPckgBuf flag; + iUtility->ReadFromInputDesL(aMessage, &flag); + retVal = DoMmsdpMarkDataAsDRMProtected(flag()); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return retVal; + } + +/*****************************************************************************/ +TInt CMMFSetDRMProtectedDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +void CMMFSetDRMProtectedDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + +/*****************************************************************************/ +// Set DRM protected custom interface implementation +TInt CMMFSetDRMProtectedDeMux::DoMmsdpMarkDataAsDRMProtected(TBool aDRMProtected) + { + if (!iInterfaceSetDRMProtected) + { + return KErrNotReady; + } + else + { + return iInterfaceSetDRMProtected->MmsdpMarkDataAsDRMProtected(aDRMProtected); + } + } + +/*****************************************************************************/ +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSetDRMProtectedMux, CMMFSetDRMProtectedMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSetDRMProtectedDeMux, CMMFSetDRMProtectedDeMux::NewL), + }; + +/*****************************************************************************/ +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,242 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef SETDRMPROTECTEDCI_H +#define SETDRMPROTECTEDCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** + @internalComponent + @prototype + @file + */ +enum TMMFDevSoundCISetDRMProtectedCommands + { + EMMFDevSoundCISetDRMProtected = 0 + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFSetDRMProtectedMux + * + * implementation of the Play back status custom interface pair + */ +class CMMFSetDRMProtectedMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFSetDRMProtected + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return One of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFSetDRMProtected + /** + @see MMMFSetDRMProtected + */ + virtual TInt MmsdpMarkDataAsDRMProtected(TBool aDRMProtected); + +protected: + CMMFSetDRMProtectedMux(); + ~CMMFSetDRMProtectedMux(); + +protected: + TUid iDestructorKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** + @internalComponent + @prototype + @file + */ + +/** + * CMMFSetDRMProtectedDeMux - DeMux side of pair + */ + +class CMMFSetDRMProtectedDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFSetDRMProtectedDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote demux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFSetDRMProtectedDeMux(); + CMMFSetDRMProtectedDeMux(); + + // mirrors MMMFSetDRMProtected method. + TInt DoMmsdpMarkDataAsDRMProtected(TBool aDRMProtected); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iDestructorKey; + MMMFSetDRMProtected* iInterfaceSetDRMProtected; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/setdrmprotectedci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceSetDRMProtectedDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSetDRMProtectedMux; + version_no = 1; + display_name = "Set DRM Protected Mux"; + default_data = "1028260c" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSetDRMProtectedDeMux; + version_no = 1; + display_name = "Set DRM Protected DeMux"; + default_data = "102825cf" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,360 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "speechencoderconfigci.h" + + +// MUX // + +TInt CMMFSpeechEncoderConfigMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceSpeechEncoderConfigDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFSpeechEncoderConfigMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFSpeechEncoderConfigMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFSpeechEncoderConfigMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFSpeechEncoderConfigMux::NewL() + { + CMMFSpeechEncoderConfigMux* self = new (ELeave) CMMFSpeechEncoderConfigMux; + return self; + } + + +TAny* CMMFSpeechEncoderConfigMux::CustomInterface(TUid /*aInterfaceId*/) + { + MSpeechEncoderConfig* interface = this; + return interface; + } + + +CMMFSpeechEncoderConfigMux::CMMFSpeechEncoderConfigMux() : +iRemoteHandle(-1) + { + } + + +CMMFSpeechEncoderConfigMux::~CMMFSpeechEncoderConfigMux() + { + } + + +// from MSpeechEncoderConfig +TInt CMMFSpeechEncoderConfigMux::SetVadMode (TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // send the VadModeOn in the sync command + TPckgBuf vadModeOn(aVadModeOn); + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCISpeechEncoderConfigSetVadMode, + vadModeOn); + } + + return result; + } + + +// from MSpeechEncoderConfig +TInt CMMFSpeechEncoderConfigMux::GetVadMode (TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iRemoteHandle > 0) + { + // holds the returned value. + TPckgBuf retVadModeOn; + + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCISpeechEncoderConfigGetVadMode, + KNullDesC8, + retVadModeOn); + + // assign return values to aVadModeOn. Do nothing if there is an error + if(result == KErrNone) + { + aVadModeOn = retVadModeOn(); + } + } + + return result; + } + + + +// DEMUX // + +TInt CMMFSpeechEncoderConfigDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFSpeechEncoderConfigDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFSpeechEncoderConfigDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFSpeechEncoderConfigDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFSpeechEncoderConfigDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFSpeechEncoderConfigDeMux::RefreshL() + { + // refetch the Speech Encoder Config custom interface if we already have a target + if (iTarget) + { + iInterfaceSpeechEncoderConfig = static_cast (iTarget->CustomInterface(KUidSpeechEncoderConfig)); + + if (!iInterfaceSpeechEncoderConfig) + { + iInterfaceSpeechEncoderConfig = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFSpeechEncoderConfigDeMux::NewL() + { + CMMFSpeechEncoderConfigDeMux* self = new (ELeave) CMMFSpeechEncoderConfigDeMux; + return self; + } + + +CMMFSpeechEncoderConfigDeMux::CMMFSpeechEncoderConfigDeMux() + { + } + + +CMMFSpeechEncoderConfigDeMux::~CMMFSpeechEncoderConfigDeMux() + { + } + + +TInt CMMFSpeechEncoderConfigDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the Speech Encoder Config Hw Device custom interface + iInterfaceSpeechEncoderConfig = static_cast (iTarget->CustomInterface(KUidSpeechEncoderConfig)); + + if (!iInterfaceSpeechEncoderConfig) + { + iInterfaceSpeechEncoderConfig = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFSpeechEncoderConfigDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFSpeechEncoderConfigDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCISpeechEncoderConfigSetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoSetVadModeL(vadModeOn()); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +TInt CMMFSpeechEncoderConfigDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNone; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCISpeechEncoderConfigGetVadMode: + { + TPckgBuf vadModeOn; + iUtility->ReadFromInputDesL(aMessage, &vadModeOn); + + result = DoGetVadModeL(vadModeOn()); + + TPckgBuf des(vadModeOn()); + iUtility->WriteToOutputDesL(aMessage, des); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +void CMMFSpeechEncoderConfigDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFSpeechEncoderConfigDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +// Speech Encoder Config custom interface implementation +TInt CMMFSpeechEncoderConfigDeMux::DoSetVadModeL(TBool aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceSpeechEncoderConfig) + { + result = iInterfaceSpeechEncoderConfig->SetVadMode(aVadModeOn); + } + + return result; + } + + +// Speech Encoder Config custom interface implementation +TInt CMMFSpeechEncoderConfigDeMux::DoGetVadModeL(TBool& aVadModeOn) + { + TInt result = KErrNotFound; + + if (iInterfaceSpeechEncoderConfig) + { + result = iInterfaceSpeechEncoderConfig->GetVadMode(aVadModeOn); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSpeechEncoderConfigMux, CMMFSpeechEncoderConfigMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceSpeechEncoderConfigDeMux, CMMFSpeechEncoderConfigDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,251 @@ +// Copyright (c) 2007-2009 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: +// Implementation of speech encoder config custom interface pair +// +// + +#ifndef SPEECHENCODERCONFIGCI_H +#define SPEECHENCODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCISpeechEncoderConfigCommands + { + EMMFDevSoundCISpeechEncoderConfigSetVadMode, + EMMFDevSoundCISpeechEncoderConfigGetVadMode + }; + + +/** +Implementation of the Speech encoder config custom interface Mux +@internalComponent +@prototype +@file + */ +class CMMFSpeechEncoderConfigMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MSpeechEncoderConfig + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MSpeechEncoderConfig + //@see MSpeechEncoderConfig + virtual TInt SetVadMode (TBool aVadModeOn); + //@see MSpeechEncoderConfig + virtual TInt GetVadMode (TBool& aVadModeOn); + +protected: + CMMFSpeechEncoderConfigMux(); + ~CMMFSpeechEncoderConfigMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Speech encoder config custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFSpeechEncoderConfigDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFSpeechEncoderConfigDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFSpeechEncoderConfigDeMux(); + CMMFSpeechEncoderConfigDeMux(); + + // from mirror MSpeechEncoderConfig method. + TInt DoSetVadModeL(TBool aVadModeOn); + TInt DoGetVadModeL(TBool& aVadModeOn); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MSpeechEncoderConfig* iInterfaceSpeechEncoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/speechencoderconfigci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceSpeechEncoderConfigDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSpeechEncoderConfigMux; + version_no = 1; + display_name = "Speech Encoder Config Mux"; + default_data = "102825fb" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceSpeechEncoderConfigDeMux; + version_no = 1; + display_name = "Speech Encoder Config DeMux"; + default_data = "102825d6" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,289 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include + +#include "underflowautostopcontrolci.h" + + +// MUX // + +TInt CMMFUnderflowAutoStopControlMux::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KMmfUidCustomInterfaceUnderflowAutoStopCtrlDeMux}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFUnderflowAutoStopControlMux::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFUnderflowAutoStopControlMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFUnderflowAutoStopControlMux::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFUnderflowAutoStopControlMux::NewL() + { + CMMFUnderflowAutoStopControlMux* self = new (ELeave) CMMFUnderflowAutoStopControlMux; + return self; + } + + +TAny* CMMFUnderflowAutoStopControlMux::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFUnderflowAutoStopControl* interface = this; + return interface; + } + + +CMMFUnderflowAutoStopControlMux::CMMFUnderflowAutoStopControlMux() : + iRemoteHandle(-1) + { + } + + +CMMFUnderflowAutoStopControlMux::~CMMFUnderflowAutoStopControlMux() + { + } + + +// from MMMFUnderflowAutoStopControl +TInt CMMFUnderflowAutoStopControlMux::MmuascTurnOffUnderflowAutoStop () + { + TInt result = KErrGeneral; + + if (iRemoteHandle > 0) + { + // any return code other than zero is an error + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIUnderflowAutoStopCtrlTurnOffUnderflowAutoStop, + KNullDesC8); + } + + return result; + } + + + +// DEMUX // + +TInt CMMFUnderflowAutoStopControlDeMux::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFUnderflowAutoStopControlDeMux::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFUnderflowAutoStopControlDeMux::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFUnderflowAutoStopControlDeMux::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFUnderflowAutoStopControlDeMux::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the utility + iUtility = aCustomUtility; + } + + +void CMMFUnderflowAutoStopControlDeMux::RefreshL() + { + // refetch the UnderflowAutoStop Control custom interface if we already have a target + if (iTarget) + { + iInterfaceUnderflowAutoStopCtrl = static_cast (iTarget->CustomInterface(KUidUnderflowAutoStopControl)); + + if (!iInterfaceUnderflowAutoStopCtrl) + { + iInterfaceUnderflowAutoStopCtrl = NULL; + User::Leave(KErrNotSupported); + } + } + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFUnderflowAutoStopControlDeMux::NewL() + { + CMMFUnderflowAutoStopControlDeMux* self = new (ELeave) CMMFUnderflowAutoStopControlDeMux; + return self; + } + + +CMMFUnderflowAutoStopControlDeMux::CMMFUnderflowAutoStopControlDeMux() + { + } + + +CMMFUnderflowAutoStopControlDeMux::~CMMFUnderflowAutoStopControlDeMux() + { + } + + +TInt CMMFUnderflowAutoStopControlDeMux::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // fetch the UnderflowAutoStop Control Hw Device custom interface + iInterfaceUnderflowAutoStopCtrl = static_cast (iTarget->CustomInterface(KUidUnderflowAutoStopControl)); + + if (!iInterfaceUnderflowAutoStopCtrl) + { + iInterfaceUnderflowAutoStopCtrl = NULL; + User::Leave(KErrNotSupported); + } + + return KErrNone; + } + + +void CMMFUnderflowAutoStopControlDeMux::DoCloseSlaveL(TInt /*aHandle*/) + { + // nothing to do + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFUnderflowAutoStopControlDeMux::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrGeneral; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIUnderflowAutoStopCtrlTurnOffUnderflowAutoStop: + { + result = DoMmuascTurnOffUnderflowAutoStopL(); + + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + + return result; + } + + +// original RMessage is supplied so that remote demux plugin can extract necessary details +// using DeMux utility +TInt CMMFUnderflowAutoStopControlDeMux::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + return KErrNone; + } + + +void CMMFUnderflowAutoStopControlDeMux::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFUnderflowAutoStopControlDeMux::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +TInt CMMFUnderflowAutoStopControlDeMux::DoMmuascTurnOffUnderflowAutoStopL() + { + TInt result = KErrNotFound; + + if (iInterfaceUnderflowAutoStopCtrl) + { + result = iInterfaceUnderflowAutoStopCtrl->MmuascTurnOffUnderflowAutoStop(); + } + + return result; + } + + +// +// ImplementationTable +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceUnderflowAutoStopCtrlMux, CMMFUnderflowAutoStopControlMux::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCustomInterfaceUnderflowAutoStopCtrlDeMux, CMMFUnderflowAutoStopControlDeMux::NewL), + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,246 @@ +// Copyright (c) 2007-2009 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: +// Implementation of Underflow auto stop control custom interface pair +// +// + +#ifndef UNDERFLOWAUTOSTOPCONTROLCI_H +#define UNDERFLOWAUTOSTOPCONTROLCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIUnderflowAutoStopControlCommands + { + EMMFDevSoundCIUnderflowAutoStopCtrlTurnOffUnderflowAutoStop + }; + +/** +Implementation of the Underflow auto stop control custom interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFUnderflowAutoStopControlMux : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFUnderflowAutoStopControl + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + // from MMMFUnderflowAutoStopControl + //@see MMMFUnderflowAutoStopControl + virtual TInt MmuascTurnOffUnderflowAutoStop(); + +protected: + CMMFUnderflowAutoStopControlMux(); + ~CMMFUnderflowAutoStopControlMux(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the Underflow auto stop control custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFUnderflowAutoStopControlDeMux : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFUnderflowAutoStopControlDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + ~CMMFUnderflowAutoStopControlDeMux(); + CMMFUnderflowAutoStopControlDeMux(); + + // from mirror MmuascTurnOffUnderflowAutoStop method. + TInt DoMmuascTurnOffUnderflowAutoStopL(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + MMMFUnderflowAutoStopControl* iInterfaceUnderflowAutoStopCtrl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/CustomInterfaces/underflowautostopcontrolci.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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 +#include + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidCustomInterfaceUnderflowAutoStopCtrlDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceUnderflowAutoStopCtrlMux; + version_no = 1; + display_name = "Underflow Auto Stop Control Mux"; + default_data = "1028260b" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCustomInterfaceUnderflowAutoStopCtrlDeMux; + version_no = 1; + display_name = "Underflow Auto Stop Control DeMux"; + default_data = "1028261e" ; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/sounddevice/SoundDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/sounddevice/SoundDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,804 @@ +// Copyright (c) 2001-2009 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 +#include "SoundDeviceBody.h" + +/* + * + * Default Constructor. + * + * + */ +CMMFDevSound::CMMFDevSound() + { + } + +/* + * -doxygen comments moved to header- + * + * Destructor. + * + * Deletes all objects and releases all resource owned by this + * instance. + * + */ +EXPORT_C CMMFDevSound::~CMMFDevSound() + { + delete iBody; + } + +/* + * -doxygen comments moved to header- + * + * Constructs, and returns a pointer to, a new CMMFDevSound object. + * + * Leaves on failure. + * + */ +EXPORT_C CMMFDevSound* CMMFDevSound::NewL() + { + CMMFDevSound* self = new (ELeave) CMMFDevSound; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/* + * -doxygen comments moved to header- + * + * Second phase constructor. + * + */ +void CMMFDevSound::ConstructL() + { + iBody = CBody::NewL(); + } + +/* + * -doxygen comments moved to header- + * + * Initializes CMMFDevSound object to play and record PCM16 raw audio data + * with sampling rate of 8 KHz. + * + * On completion of Initialization, calls InitializeComplete() on + * aDevSoundObserver. + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +EXPORT_C void CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + + { + iBody->InitializeL(aDevSoundObserver,aMode); + } + +/* + * -doxygen comments moved to header- + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device aHWDev. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aHWDev" + * CMMFHwDevice implementation identifier. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +EXPORT_C void CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + { + iBody->InitializeL(aDevSoundObserver, aHWDev, aMode); + } + +/* + * -doxygen comments moved to header- + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device supporting FourCC aDesiredFourCC. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aDesiredFourCC" + * CMMFHwDevice implementation FourCC. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +EXPORT_C void CMMFDevSound::InitializeL(MDevSoundObserver& aDevSoundObserver, + TFourCC aDesiredFourCC, TMMFState aMode) + { + iBody->InitializeL(aDevSoundObserver, aDesiredFourCC, aMode); + } + +/* + * -doxygen comments moved to header- + * + * Returns the supported Audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +EXPORT_C TMMFCapabilities CMMFDevSound::Capabilities() + { + return iBody->Capabilities(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the current audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +EXPORT_C TMMFCapabilities CMMFDevSound::Config() const + { + return iBody->Config(); + } + +/* + * -doxygen comments moved to header- + * + * Configure CMMFDevSound object for the settings in aConfig. + * + * Use this to set sampling rate, Encoding and Mono/Stereo. + * + * @param "aConfig" + * Attribute values to which CMMFDevSound object will be configured to. + * + */ +EXPORT_C void CMMFDevSound::SetConfigL(const TMMFCapabilities& aConfig) + { + iBody->SetConfigL(aConfig); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the maximum volume. + * + * This is the maximum value which can be passed to CMMFDevSound::SetVolume. + * + * @return "TInt" + * The maximum volume. This value is platform dependent but is always + * greater than or equal to one. + * + */ +EXPORT_C TInt CMMFDevSound::MaxVolume() + { + return iBody->MaxVolume(); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the current volume. + * + * @return "TInt" + * The current volume level. + * + */ +EXPORT_C TInt CMMFDevSound::Volume() + { + return iBody->Volume(); + } + +/* + * -doxygen comments moved to header- + * + * Changes the current playback volume to a specified value. + * + * The volume can be changed before or during playback and is effective + * immediately. + * + * @param "aVolume" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMMFDevSound::MaxVolume(). If the + * volume is not within this range, the volume is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +EXPORT_C void CMMFDevSound::SetVolume(TInt aVolume) + { + iBody->SetVolume(aVolume); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the maximum gain. + * + * This is the maximum value which can be passed to CMMFDevSound::SetGain. + * + * @return "TInt" + * The maximum gain. This value is platform dependent but is always + * greater than or equal to one. + * + */ +EXPORT_C TInt CMMFDevSound::MaxGain() + { + return iBody->MaxGain(); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the current gain. + * + * @return "TInt" + * The current gain level. + * + */ +EXPORT_C TInt CMMFDevSound::Gain() + { + return iBody->Gain(); + } + +/* + * -doxygen comments moved to header- + * + * Changes the current recording gain to a specified value. + * + * The gain can be changed before or during recording and is effective + * immediately. + * + * @param "TInt aGain" + * The gain setting. This can be any value from zero to the value + * returned by a call to CMMFDevSound::MaxGain(). If the + * volume is not within this range, the gain is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +EXPORT_C void CMMFDevSound::SetGain(TInt aGain) + { + iBody->SetGain(aGain); + } + +/* + * -doxygen comments moved to header- + * + * Returns the speaker balance set for playing. + * + * Leaves on failure. + * + * @param "aLeftPrecentage" + * On return contains the left speaker volume percentage. + * + * @param "aRightPercentage" + * On return contains the right speaker volume percentage. + * + */ +EXPORT_C void CMMFDevSound::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iBody->GetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Sets the speaker balance for playing. + * + * The speaker balance can be changed before or during playback and is + * effective immediately. + * + * @param "aLeftPercentage" + * On return contains left speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on left + * speaker. + * + * @param "aRightPercentage" + * On return contains right speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on + * right speaker. + * + */ +EXPORT_C void CMMFDevSound::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iBody->SetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Returns the microphone gain balance set for recording. + * + * Leaves on failure. + * + * @param "aLeftPercentage" + * On return contains the left microphone gain percentage. + * + * @param "aRightPercentage" + * On return contains the right microphone gain percentage. + * + */ +EXPORT_C void CMMFDevSound::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iBody->GetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Sets the microphone gain balance for recording. + * + * The microphone gain balance can be changed before or during recording and + * is effective immediately. + * + * @param "aLeftPercentage" + * Left microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on left microphone. + * + * @param "aRightPercentage" + * Right microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on right microphone. + * + */ +EXPORT_C void CMMFDevSound::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iBody->SetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start play process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, PlayError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() + * method will be called with a buffer reference. After reading data into the + * buffer reference passed, the client should call PlayData() to play data. + * + * The amount of data that can be played is specified in + * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this + * size will be ignored. + * + * Leaves on failure. + * + */ +EXPORT_C void CMMFDevSound::PlayInitL() + { + iBody->PlayInitL(); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start record process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, RecordError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() + * method will be called with a buffer reference. This buffer contains recorded + * or encoded data. After processing data in the buffer reference passed, the + * client should call RecordData() to continue recording process. + * + * The amount of data that is available is specified in + * CMMFBuffer::RequestSize(). + * + * Leaves on failure. + * + */ +EXPORT_C void CMMFDevSound::RecordInitL() + { + iBody->RecordInitL(); + } + +/* + * -doxygen comments moved to header- + * + * Plays data in the buffer at the current volume. The client should fill + * the buffer with audio data before calling this method. The Observer gets + * reference to buffer along with callback BufferToBeFilled(). When playing of + * the audio sample is complete, successfully or otherwise, the method + * PlayError() on observer is called. + * + */ +EXPORT_C void CMMFDevSound::PlayData() + { + iBody->PlayData(); + } + +/* + * -doxygen comments moved to header- + * + * Contine the process of recording. Once the buffer is filled with recorded + * data, the Observer gets reference to buffer along with callback + * BufferToBeEmptied(). After processing the buffer (copying over to a + * different buffer or writing to file) the client should call this + * method to continue recording process. + * + */ +EXPORT_C void CMMFDevSound::RecordData() + { + iBody->RecordData(); + } + +/* + * -doxygen comments moved to header- + * + * Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +EXPORT_C void CMMFDevSound::Stop() + { + iBody->Stop(); + } + +/* + * -doxygen comments moved to header- + * + * Temporarily Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +EXPORT_C void CMMFDevSound::Pause() + { + iBody->Pause(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the sample recorded so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +EXPORT_C TInt CMMFDevSound::SamplesRecorded() + { + return iBody->SamplesRecorded(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the sample played so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +EXPORT_C TInt CMMFDevSound::SamplesPlayed() + { + return iBody->SamplesPlayed(); + } + + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing tone. Tone is played with + * frequency and for duration specified. + * + * Leaves on failure. + * + * @param "aFrequency" + * Frequency at with the tone will be played. + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + * + */ +EXPORT_C void CMMFDevSound::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + { + iBody->PlayToneL(aFrequency, aDuration); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing a dual tone. + * The tone consists of two sine waves of different frequencies summed together + * Dual Tone is played with specified frequencies and for specified duration. + * + * @param "aFrequencyOne" + * First frequency of dual tone + * + * @param "aFrequencyTwo" + * Second frequency of dual tone + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + */ +EXPORT_C void CMMFDevSound::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + iBody->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing DTMF string aDTMFString. + * + * Leaves on failure. + * + * @param "aDTMFString" + * DTMF sequence in a descriptor. + * + */ +EXPORT_C void CMMFDevSound::PlayDTMFStringL(const TDesC& aDTMFString) + { + iBody->PlayDTMFStringL(aDTMFString); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing tone sequence. + * + * Leaves on failure. + * + * @param "TDesC8& aData" + * Tone sequence in a descriptor. + * + */ +EXPORT_C void CMMFDevSound::PlayToneSequenceL(const TDesC8& aData) + { + iBody->PlayToneSequenceL(aData); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing the specified pre-defined tone + * sequence. + * + * Leaves on failure. + * + * @param "aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * @see FixedSequenceCount() + * + */ +EXPORT_C void CMMFDevSound::PlayFixedSequenceL(TInt aSequenceNumber) + { + iBody->PlayFixedSequenceL(aSequenceNumber); + } + +/* + * -doxygen comments moved to header- + * + * Defines the number of times the audio is to be repeated during the tone + * playback operation. + * + * A period of silence can follow each playing of tone. The tone playing can + * be repeated indefinitely. + * + * @param " aRepeatCount" + * The number of times the tone, together with the trailing silence, + * is to be repeated. If this is set to KMdaRepeatForever, then the + * tone, together with the trailing silence, is repeated indefinitely + * or until Stop() is called. If this is set to zero, then the tone is + * not repeated. + * + * Supported only during tone playing. + * + */ +EXPORT_C void CMMFDevSound::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + { + iBody->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); + } + +/* + * -doxygen comments moved to header- + * + * Defines the duration of tone on, tone off and tone pause to be used during the + * DTMF tone playback operation. + * + * Supported only during tone playing. + * + * @param "aToneOnLength" + * The period over which the tone will be played. If this is set to + * zero, then the tone is not played. + * + * @param "aToneOffLength" + * The period over which the no tone will be played. + * + * @param "aPauseLength" + * The period over which the tone playing will be paused. + * + */ +EXPORT_C void CMMFDevSound::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + { + iBody->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength); + } + +/* + * -doxygen comments moved to header- + * + * Defines the period over which the volume level is to rise smoothly from + * nothing to the normal volume level. + * + * @param "aRampDuration" + * The period over which the volume is to rise. A zero value causes + * the tone sample to be played at the normal level for the full + * duration of the playback. A value, which is longer than the duration + * of the tone sample, that the sample never reaches its normal + * volume level. + * + * + */ +EXPORT_C void CMMFDevSound::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + iBody->SetVolumeRamp(aRampDuration); + } + +/* + * -doxygen comments moved to header- + * + * Defines the priority settings that should be used for this instance. + * + * @param "aPrioritySettings" + * An class type representing the client's priority, priority + * preference and state. + * + */ +EXPORT_C void CMMFDevSound::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + iBody->SetPrioritySettings(aPrioritySettings); + } + +EXPORT_C TAny* CMMFDevSound::CustomInterface(TUid aInterface) + { + return iBody->CustomInterface(aInterface); + } + +/* + * -doxygen comments moved to header- + * + * Returns the number of available pre-defined tone sequences. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * @return "TInt" + * The fixed sequence count. This value is implementation dependent + * but is always greater than or equal to zero. + * + */ +EXPORT_C TInt CMMFDevSound::FixedSequenceCount() + { + return iBody->FixedSequenceCount(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the name assigned to a specific pre-defined tone sequence. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * The function raises a panic if sequence number specified invalid. + * + * @return "TDesC&" + * A reference to a Descriptor containing the fixed sequence + * name indexed by aSequenceNumber. + * + * @param "aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + * @see FixedSequenceCount() + * + */ +EXPORT_C const TDesC& CMMFDevSound::FixedSequenceName(TInt aSequenceNumber) + { + return iBody->FixedSequenceName(aSequenceNumber); + } + + +/* + * -doxygen comments in header- + */ +EXPORT_C void CMMFDevSound::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes,const TMMFPrioritySettings& aPrioritySettings) const + { + iBody->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + + +/* + * -doxygen comments in header- + */ +EXPORT_C void CMMFDevSound::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + { + iBody->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + + +/******************************************************************************** + * Non Exported public functions ends here * + ********************************************************************************/ + +/****************************************************************************** + * Function Name: E32Dll + * + * Description: Entry point for applications. + * + ******************************************************************************/ + +enum TDllReason {}; +EXPORT_C TInt E32Dll(TDllReason /*aReason*/) + { + return KErrNone; + } + +// CMMFDevSoundEventHandler::NewL() has been declared in export table +// but since it is the only class method to be so, and .h is in source +// it is not actually usable. Just declare the following to keep linker happy + +// Need dummy abstract type - this is not the real class +class RMMFAudioPolicyProxy; + +class CMMFDevSoundEventHandler : public CActive + { +public: + IMPORT_C static CMMFDevSoundEventHandler* NewL(RMMFAudioPolicyProxy*); +private: + CMMFDevSoundEventHandler(); + }; + +EXPORT_C CMMFDevSoundEventHandler* CMMFDevSoundEventHandler::NewL(RMMFAudioPolicyProxy*) + { + _LIT(KModule, "DevSound"); + User::Panic(KModule, 1000); + return NULL; + } + +// default constructor - keep compilers happy +CMMFDevSoundEventHandler::CMMFDevSoundEventHandler(): + CActive(0) + { + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2001-2009 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 "SoundDeviceBody.h" +#include +#include +#include +#include + + +/* + * Default Constructor. + */ +CMMFDevSound::CBody::CBody() + { + } + +/* + * -doxygen comments moved to header- + * + * Destructor. + * + * Deletes all objects and releases all resource owned by this + * instance. + * + */ +CMMFDevSound::CBody::~CBody() + { + delete iPlugin; + REComSession::DestroyedImplementation(iDestructorKey); + REComSession::FinalClose(); + } + +/* + * -doxygen comments moved to header- + * + * Constructs, and returns a pointer to, a new CMMFDevSound::CBody object. + * + * Leaves on failure. + * + */ +CMMFDevSound::CBody* CMMFDevSound::CBody::NewL() + { + CBody* self = new (ELeave) CBody; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/* + * -doxygen comments moved to header- + * + * Second phase constructor. + * + */ +void CMMFDevSound::CBody::ConstructL() + { + TUid interfaceUid = {KMmfUidDevSoundPlugin}; + iPlugin = + static_cast + (MmPluginUtils::CreateImplementationL(interfaceUid, iDestructorKey, KDevSoundPluginMatchString, KRomOnlyResolverUid)); + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,101 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef SOUNDDEVICEBODY_H +#define SOUNDDEVICEBODY_H + +#include +#include + +class MMMFDevSoundPlugin; + +/** +@internalComponent + +This is the Body for CMMFDevSound. For descriptions of methods, see +MMFDevSound itself. +*/ +NONSHARABLE_CLASS( CMMFDevSound::CBody ) : public CBase + { +public: + + /** + Factory function - returning instance of class. + Leaves on failure. + */ + static CBody* NewL(); + + /** + Destructor. + + Deletes all objects and releases all resource owned by this + instance. + */ + ~CBody(); + + // public functions forwarded from CMMFDevSound + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode); + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode); + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); + TMMFCapabilities Capabilities(); + TMMFCapabilities Config() const; + void SetConfigL(const TMMFCapabilities& aCaps); + TInt MaxVolume(); + TInt Volume(); + void SetVolume(TInt aVolume); + TInt MaxGain(); + TInt Gain(); + void SetGain(TInt aGain); + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + void PlayInitL(); + void RecordInitL(); + void PlayData(); + void RecordData(); + void Stop(); + void Pause(); + TInt SamplesRecorded(); + TInt SamplesPlayed(); + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + void PlayDTMFStringL(const TDesC& aDTMFString); + void PlayToneSequenceL(const TDesC8& aData); + void PlayFixedSequenceL(TInt aSequenceNumber); + void SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength); + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + TAny* CustomInterface(TUid aInterfaceId); + TInt FixedSequenceCount(); + const TDesC& FixedSequenceName(TInt aSequenceNumber); + void GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; + void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; +protected: + + CBody(); + void ConstructL(); + + MMMFDevSoundPlugin* iPlugin; + TUid iDestructorKey; + }; + +#include "SoundDeviceBody.inl" + +#endif // SOUNDDEVICEBODY_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundpluginsupport/src/sounddevice/SoundDeviceBody.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,710 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef SOUNDDEVICEBODY_INL +#define SOUNDDEVICEBODY_INL + +#include + +/* + * -doxygen comments moved to header- + * + * Initializes CMMFDevSound::CBody object to play and record PCM16 raw audio data + * with sampling rate of 8 KHz. + * + * On completion of Initialization, calls InitializeComplete() on + * aDevSoundObserver. + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +inline void CMMFDevSound::CBody::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + + { + iPlugin->InitializeL(aDevSoundObserver,aMode); + } + +/* + * -doxygen comments moved to header- + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device aHWDev. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aHWDev" + * CMMFHwDevice implementation identifier. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +inline void CMMFDevSound::CBody::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + { + iPlugin->InitializeL(aDevSoundObserver, aHWDev, aMode); + } + +/* + * -doxygen comments moved to header- + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device supporting FourCC aDesiredFourCC. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "aDesiredFourCC" + * CMMFHwDevice implementation FourCC. + * + * @param "aMode" + * Mode for which this object will be used. + * + */ +inline void CMMFDevSound::CBody::InitializeL(MDevSoundObserver& aDevSoundObserver, + TFourCC aDesiredFourCC, TMMFState aMode) + { + iPlugin->InitializeL(aDevSoundObserver, aDesiredFourCC, aMode); + } + +/* + * -doxygen comments moved to header- + * + * Returns the supported Audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSound::CBody::Capabilities() + { + return iPlugin->Capabilities(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the current audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSound::CBody::Config() const + { + return iPlugin->Config(); + } + +/* + * -doxygen comments moved to header- + * + * Configure CMMFDevSound::CBody object for the settings in aConfig. + * + * Use this to set sampling rate, Encoding and Mono/Stereo. + * + * @param "aConfig" + * Attribute values to which CMMFDevSound::CBody object will be configured to. + * + */ +inline void CMMFDevSound::CBody::SetConfigL(const TMMFCapabilities& aConfig) + { + iPlugin->SetConfigL(aConfig); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the maximum volume. + * + * This is the maximum value which can be passed to CMMFDevSound::CBody::SetVolume. + * + * @return "TInt" + * The maximum volume. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSound::CBody::MaxVolume() + { + return iPlugin->MaxVolume(); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the current volume. + * + * @return "TInt" + * The current volume level. + * + */ +inline TInt CMMFDevSound::CBody::Volume() + { + return iPlugin->Volume(); + } + +/* + * -doxygen comments moved to header- + * + * Changes the current playback volume to a specified value. + * + * The volume can be changed before or during playback and is effective + * immediately. + * + * @param "aVolume" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMMFDevSound::CBody::MaxVolume(). If the + * volume is not within this range, the volume is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +inline void CMMFDevSound::CBody::SetVolume(TInt aVolume) + { + iPlugin->SetVolume(aVolume); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the maximum gain. + * + * This is the maximum value which can be passed to CMMFDevSound::CBody::SetGain. + * + * @return "TInt" + * The maximum gain. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSound::CBody::MaxGain() + { + return iPlugin->MaxGain(); + } + +/* + * -doxygen comments moved to header- + * + * Returns an integer representing the current gain. + * + * @return "TInt" + * The current gain level. + * + */ +inline TInt CMMFDevSound::CBody::Gain() + { + return iPlugin->Gain(); + } + +/* + * -doxygen comments moved to header- + * + * Changes the current recording gain to a specified value. + * + * The gain can be changed before or during recording and is effective + * immediately. + * + * @param "TInt aGain" + * The gain setting. This can be any value from zero to the value + * returned by a call to CMMFDevSound::CBody::MaxGain(). If the + * volume is not within this range, the gain is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +inline void CMMFDevSound::CBody::SetGain(TInt aGain) + { + iPlugin->SetGain(aGain); + } + +/* + * -doxygen comments moved to header- + * + * Returns the speaker balance set for playing. + * + * Leaves on failure. + * + * @param "aLeftPrecentage" + * On return contains the left speaker volume percentage. + * + * @param "aRightPercentage" + * On return contains the right speaker volume percentage. + * + */ +inline void CMMFDevSound::CBody::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iPlugin->GetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Sets the speaker balance for playing. + * + * The speaker balance can be changed before or during playback and is + * effective immediately. + * + * @param "aLeftPercentage" + * On return contains left speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on left + * speaker. + * + * @param "aRightPercentage" + * On return contains right speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on + * right speaker. + * + */ +inline void CMMFDevSound::CBody::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iPlugin->SetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Returns the microphone gain balance set for recording. + * + * Leaves on failure. + * + * @param "aLeftPercentage" + * On return contains the left microphone gain percentage. + * + * @param "aRightPercentage" + * On return contains the right microphone gain percentage. + * + */ +inline void CMMFDevSound::CBody::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iPlugin->GetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Sets the microphone gain balance for recording. + * + * The microphone gain balance can be changed before or during recording and + * is effective immediately. + * + * @param "aLeftPercentage" + * Left microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on left microphone. + * + * @param "aRightPercentage" + * Right microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on right microphone. + * + */ +inline void CMMFDevSound::CBody::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iPlugin->SetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start play process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, PlayError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() + * method will be called with a buffer reference. After reading data into the + * buffer reference passed, the client should call PlayData() to play data. + * + * The amount of data that can be played is specified in + * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this + * size will be ignored. + * + * Leaves on failure. + * + */ +inline void CMMFDevSound::CBody::PlayInitL() + { + iPlugin->PlayInitL(); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start record process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, RecordError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() + * method will be called with a buffer reference. This buffer contains recorded + * or encoded data. After processing data in the buffer reference passed, the + * client should call RecordData() to continue recording process. + * + * The amount of data that is available is specified in + * CMMFBuffer::RequestSize(). + * + * Leaves on failure. + * + */ +inline void CMMFDevSound::CBody::RecordInitL() + { + iPlugin->RecordInitL(); + } + +/* + * -doxygen comments moved to header- + * + * Plays data in the buffer at the current volume. The client should fill + * the buffer with audio data before calling this method. The Observer gets + * reference to buffer along with callback BufferToBeFilled(). When playing of + * the audio sample is complete, successfully or otherwise, the method + * PlayError() on observer is called. + * + */ +inline void CMMFDevSound::CBody::PlayData() + { + iPlugin->PlayData(); + } + +/* + * -doxygen comments moved to header- + * + * Contine the process of recording. Once the buffer is filled with recorded + * data, the Observer gets reference to buffer along with callback + * BufferToBeEmptied(). After processing the buffer (copying over to a + * different buffer or writing to file) the client should call this + * method to continue recording process. + * + */ +inline void CMMFDevSound::CBody::RecordData() + { + iPlugin->RecordData(); + } + +/* + * -doxygen comments moved to header- + * + * Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +inline void CMMFDevSound::CBody::Stop() + { + iPlugin->Stop(); + } + +/* + * -doxygen comments moved to header- + * + * Temporarily Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +inline void CMMFDevSound::CBody::Pause() + { + iPlugin->Pause(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the sample recorded so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +inline TInt CMMFDevSound::CBody::SamplesRecorded() + { + return iPlugin->SamplesRecorded(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the sample played so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +inline TInt CMMFDevSound::CBody::SamplesPlayed() + { + return iPlugin->SamplesPlayed(); + } + + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing tone. Tone is played with + * frequency and for duration specified. + * + * Leaves on failure. + * + * @param "aFrequency" + * Frequency at with the tone will be played. + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + * + */ +inline void CMMFDevSound::CBody::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + { + iPlugin->PlayToneL(aFrequency, aDuration); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing a dual tone. + * The tone consists of two sine waves of different frequencies summed together + * Dual Tone is played with specified frequencies and for specified duration. + * + * @param "aFrequencyOne" + * First frequency of dual tone + * + * @param "aFrequencyTwo" + * Second frequency of dual tone + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + */ +inline void CMMFDevSound::CBody::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + iPlugin->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing DTMF string aDTMFString. + * + * Leaves on failure. + * + * @param "aDTMFString" + * DTMF sequence in a descriptor. + * + */ +inline void CMMFDevSound::CBody::PlayDTMFStringL(const TDesC& aDTMFString) + { + iPlugin->PlayDTMFStringL(aDTMFString); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing tone sequence. + * + * Leaves on failure. + * + * @param "TDesC8& aData" + * Tone sequence in a descriptor. + * + */ +inline void CMMFDevSound::CBody::PlayToneSequenceL(const TDesC8& aData) + { + iPlugin->PlayToneSequenceL(aData); + } + +/* + * -doxygen comments moved to header- + * + * Initializes audio device and start playing the specified pre-defined tone + * sequence. + * + * Leaves on failure. + * + * @param "aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * @see FixedSequenceCount() + * + */ +inline void CMMFDevSound::CBody::PlayFixedSequenceL(TInt aSequenceNumber) + { + iPlugin->PlayFixedSequenceL(aSequenceNumber); + } + +/* + * -doxygen comments moved to header- + * + * Defines the number of times the audio is to be repeated during the tone + * playback operation. + * + * A period of silence can follow each playing of tone. The tone playing can + * be repeated indefinitely. + * + * @param " aRepeatCount" + * The number of times the tone, together with the trailing silence, + * is to be repeated. If this is set to KMdaRepeatForever, then the + * tone, together with the trailing silence, is repeated indefinitely + * or until Stop() is called. If this is set to zero, then the tone is + * not repeated. + * + * Supported only during tone playing. + * + */ +inline void CMMFDevSound::CBody::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + { + iPlugin->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); + } + +/* + * -doxygen comments moved to header- + * + * Defines the duration of tone on, tone off and tone pause to be used during the + * DTMF tone playback operation. + * + * Supported only during tone playing. + * + * @param "aToneOnLength" + * The period over which the tone will be played. If this is set to + * zero, then the tone is not played. + * + * @param "aToneOffLength" + * The period over which the no tone will be played. + * + * @param "aPauseLength" + * The period over which the tone playing will be paused. + * + */ +inline void CMMFDevSound::CBody::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + { + iPlugin->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength); + } + +/* + * -doxygen comments moved to header- + * + * Defines the period over which the volume level is to rise smoothly from + * nothing to the normal volume level. + * + * @param "aRampDuration" + * The period over which the volume is to rise. A zero value causes + * the tone sample to be played at the normal level for the full + * duration of the playback. A value, which is longer than the duration + * of the tone sample, that the sample never reaches its normal + * volume level. + * + * + */ +inline void CMMFDevSound::CBody::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + iPlugin->SetVolumeRamp(aRampDuration); + } + +/* + * -doxygen comments moved to header- + * + * Defines the priority settings that should be used for this instance. + * + * @param "aPrioritySettings" + * An class type representing the client's priority, priority + * preference and state. + * + */ +inline void CMMFDevSound::CBody::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + iPlugin->SetPrioritySettings(aPrioritySettings); + } + +inline TAny* CMMFDevSound::CBody::CustomInterface(TUid aInterface) + { + return iPlugin->CustomInterface(aInterface); + } + +/* + * -doxygen comments moved to header- + * + * Returns the number of available pre-defined tone sequences. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * @return "TInt" + * The fixed sequence count. This value is implementation dependent + * but is always greater than or equal to zero. + * + */ +inline TInt CMMFDevSound::CBody::FixedSequenceCount() + { + return iPlugin->FixedSequenceCount(); + } + +/* + * -doxygen comments moved to header- + * + * Returns the name assigned to a specific pre-defined tone sequence. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * The function raises a panic if sequence number specified invalid. + * + * @return "TDesC&" + * A reference to a Descriptor containing the fixed sequence + * name indexed by aSequenceNumber. + * + * @param "aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + * @see FixedSequenceCount() + * + */ +inline const TDesC& CMMFDevSound::CBody::FixedSequenceName(TInt aSequenceNumber) + { + return iPlugin->FixedSequenceName(aSequenceNumber); + } + + +/* + * -doxygen comments in header- + */ +inline void CMMFDevSound::CBody::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes,const TMMFPrioritySettings& aPrioritySettings) const + { + iPlugin->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + + +/* + * -doxygen comments in header- + */ +inline void CMMFDevSound::CBody::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + { + iPlugin->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + +#endif // SOUNDDEVICEBODY_INL diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFAUDIOPOLICY.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFAUDIOPOLICY.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CAudioPolicy@@SAPAV1@PAVCMMFAudioPolicyServer@@@Z @ 1 NONAME ; class CAudioPolicy * CAudioPolicy::NewL(class CMMFAudioPolicyServer *) + ?StartThread@CMMFAudioPolicyServer@@SAHPAX@Z @ 2 NONAME ; int CMMFAudioPolicyServer::StartThread(void *) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFAUDIOPOLICYPROXY.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFAUDIOPOLICYPROXY.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,18 @@ +EXPORTS + ?CancelReceiveEvents@RMMFAudioPolicyProxy@@QAEHXZ @ 1 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::CancelReceiveEvents(void) + ?GetPlayFormat@RMMFAudioPolicyProxy@@QAEHAAV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 2 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::GetPlayFormat(class TPckgBuf &) + ?GetPlayFormatsSupported@RMMFAudioPolicyProxy@@QAEHAAV?$TPckgBuf@VTSoundFormatsSupported@RMdaDevSound@@@@@Z @ 3 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::GetPlayFormatsSupported(class TPckgBuf &) + ?GetRecordFormat@RMMFAudioPolicyProxy@@QAEHAAV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 4 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::GetRecordFormat(class TPckgBuf &) + ?GetRecordFormatsSupported@RMMFAudioPolicyProxy@@QAEHAAV?$TPckgBuf@VTSoundFormatsSupported@RMdaDevSound@@@@@Z @ 5 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::GetRecordFormatsSupported(class TPckgBuf &) + ?LaunchRequests@RMMFAudioPolicyProxy@@QAEHXZ @ 6 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::LaunchRequests(void) + ?MakeRequest@RMMFAudioPolicyProxy@@QAEXAAVTMMFAudioPolicyPrioritySettings@@@Z @ 7 NONAME ; public: void __thiscall RMMFAudioPolicyProxy::MakeRequest(class TMMFAudioPolicyPrioritySettings &) + ?Open@RMMFAudioPolicyProxy@@QAEHAAVRServer2@@@Z @ 8 NONAME ; int RMMFAudioPolicyProxy::Open(class RServer2 &) + ?ReceiveEvents@RMMFAudioPolicyProxy@@QAEXAAV?$TPckgBuf@VTMMFAudioPolicyEvent@@@@AAVTRequestStatus@@@Z @ 9 NONAME ; public: void __thiscall RMMFAudioPolicyProxy::ReceiveEvents(class TPckgBuf &,class TRequestStatus &) + ?SetDevSoundInfo@RMMFAudioPolicyProxy@@QAEHAAVTMMFDevSoundInfo@@@Z @ 10 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::SetDevSoundInfo(class TMMFDevSoundInfo &) + ?UpdateState@RMMFAudioPolicyProxy@@QAEHAAVTMMFAudioPolicyPrioritySettings@@@Z @ 11 NONAME ; public: int __thiscall RMMFAudioPolicyProxy::UpdateState(class TMMFAudioPolicyPrioritySettings &) + ?CancelRequestResourceNotification@RMMFAudioPolicyProxy@@QAEHVTUid@@@Z @ 12 NONAME ; int RMMFAudioPolicyProxy::CancelRequestResourceNotification(class TUid) + ?RequestResourceNotification@RMMFAudioPolicyProxy@@QAEHVTUid@@ABVTDesC8@@@Z @ 13 NONAME ; int RMMFAudioPolicyProxy::RequestResourceNotification(class TUid, class TDesC8 const &) + ?StopNotification@RMMFAudioPolicyProxy@@QAEHXZ @ 14 NONAME ; int RMMFAudioPolicyProxy::StopNotification(void) + ?IsRegisteredResourceNotification@RMMFAudioPolicyProxy@@QAEHVTUid@@@Z @ 15 NONAME ; int RMMFAudioPolicyProxy::IsRegisteredResourceNotification(class TUid) + ?CreateServer@RMMFAudioPolicyProxy@@QAEHAAVRServer2@@@Z @ 16 NONAME ; int RMMFAudioPolicyProxy::CreatePolicyServer(class RServer2 &) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFAUDIOSERVERPROXY.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFAUDIOSERVERPROXY.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?GetDevSoundSessionHandle@RMMFAudioServerProxy@@QAEHXZ @ 1 NONAME ; int RMMFAudioServerProxy::GetDevSoundSessionHandle(void) + ?Open@RMMFAudioServerProxy@@QAEHXZ @ 2 NONAME ; public: int __thiscall RMMFAudioServerProxy::Open(void) + ?SetDevSoundInfo@RMMFAudioServerProxy@@QAEHXZ @ 3 NONAME ; public: int __thiscall RMMFAudioServerProxy::SetDevSoundInfo(void) diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFDEVSOUNDPROXY.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFDEVSOUNDPROXY.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +EXPORTS + ?BufferToBeEmptiedData@RMMFDevSoundProxy@@QAEHAAV?$TPckgBuf@VTMMFDevSoundProxyHwBuf@@@@@Z @ 1 NONAME ; int RMMFDevSoundProxy::BufferToBeEmptiedData(class TPckgBuf &) + ?BufferToBeFilledData@RMMFDevSoundProxy@@QAEHAAV?$TPckgBuf@VTMMFDevSoundProxyHwBuf@@@@@Z @ 2 NONAME ; int RMMFDevSoundProxy::BufferToBeFilledData(class TPckgBuf &) + ?CancelRegisterAsClient@RMMFDevSoundProxy@@QAEHVTUid@@@Z @ 3 NONAME ; int RMMFDevSoundProxy::CancelRegisterAsClient(class TUid) + ?Capabilities@RMMFDevSoundProxy@@QAE?AVTMMFCapabilities@@XZ @ 4 NONAME ; class TMMFCapabilities RMMFDevSoundProxy::Capabilities(void) + ?Close@RMMFDevSoundProxy@@QAEXXZ @ 5 NONAME ; void RMMFDevSoundProxy::Close(void) + ?Config@RMMFDevSoundProxy@@QAE?AVTMMFCapabilities@@XZ @ 6 NONAME ; class TMMFCapabilities RMMFDevSoundProxy::Config(void) + ?CustomInterface@RMMFDevSoundProxy@@QAEPAXVTUid@@@Z @ 7 NONAME ; void * RMMFDevSoundProxy::CustomInterface(class TUid) + ?FixedSequenceCount@RMMFDevSoundProxy@@QAEHXZ @ 8 NONAME ; int RMMFDevSoundProxy::FixedSequenceCount(void) + ?FixedSequenceName@RMMFDevSoundProxy@@QAEABVTDesC16@@H@Z @ 9 NONAME ; class TDesC16 const & RMMFDevSoundProxy::FixedSequenceName(int) + ?Gain@RMMFDevSoundProxy@@QAEHXZ @ 10 NONAME ; int RMMFDevSoundProxy::Gain(void) + ?GetPlayBalanceL@RMMFDevSoundProxy@@QAEXAAH0@Z @ 11 NONAME ; void RMMFDevSoundProxy::GetPlayBalanceL(int &, int &) + ?GetRecordBalanceL@RMMFDevSoundProxy@@QAEXAAH0@Z @ 12 NONAME ; void RMMFDevSoundProxy::GetRecordBalanceL(int &, int &) + ?GetRecordedBufferL@RMMFDevSoundProxy@@QAEHAAVCMMFDataBuffer@@@Z @ 13 NONAME ; int RMMFDevSoundProxy::GetRecordedBufferL(class CMMFDataBuffer &) + ?GetResourceNotificationData@RMMFDevSoundProxy@@QAEHVTUid@@AAVTDes8@@@Z @ 14 NONAME ; int RMMFDevSoundProxy::GetResourceNotificationData(class TUid, class TDes8 &) + ?GetSupportedInputDataTypesL@RMMFDevSoundProxy@@QAEXAAV?$RArray@VTFourCC@@@@ABVTMMFPrioritySettings@@@Z @ 15 NONAME ; void RMMFDevSoundProxy::GetSupportedInputDataTypesL(class RArray &, class TMMFPrioritySettings const &) + ?GetSupportedOutputDataTypesL@RMMFDevSoundProxy@@QAEXAAV?$RArray@VTFourCC@@@@ABVTMMFPrioritySettings@@@Z @ 16 NONAME ; void RMMFDevSoundProxy::GetSupportedOutputDataTypesL(class RArray &, class TMMFPrioritySettings const &) + ?InitializeL@RMMFDevSoundProxy@@QAEHVTFourCC@@W4TMMFState@@@Z @ 17 NONAME ; int RMMFDevSoundProxy::InitializeL(class TFourCC, enum TMMFState) + ?InitializeL@RMMFDevSoundProxy@@QAEHVTUid@@W4TMMFState@@@Z @ 18 NONAME ; int RMMFDevSoundProxy::InitializeL(class TUid, enum TMMFState) + ?InitializeL@RMMFDevSoundProxy@@QAEHW4TMMFState@@@Z @ 19 NONAME ; int RMMFDevSoundProxy::InitializeL(enum TMMFState) + ?MaxGain@RMMFDevSoundProxy@@QAEHXZ @ 20 NONAME ; int RMMFDevSoundProxy::MaxGain(void) + ?MaxVolume@RMMFDevSoundProxy@@QAEHXZ @ 21 NONAME ; int RMMFDevSoundProxy::MaxVolume(void) + ?Open@RMMFDevSoundProxy@@QAEHAAVRHandleBase@@@Z @ 22 NONAME ; int RMMFDevSoundProxy::Open(class RHandleBase &) + ?Pause@RMMFDevSoundProxy@@QAEXXZ @ 23 NONAME ; void RMMFDevSoundProxy::Pause(void) + ?PlayDTMFStringL@RMMFDevSoundProxy@@QAEXABVTDesC16@@@Z @ 24 NONAME ; void RMMFDevSoundProxy::PlayDTMFStringL(class TDesC16 const &) + ?PlayData@RMMFDevSoundProxy@@QAEXXZ @ 25 NONAME ; void RMMFDevSoundProxy::PlayData(void) + ?PlayDualToneL@RMMFDevSoundProxy@@QAEXHHABVTTimeIntervalMicroSeconds@@@Z @ 26 NONAME ; void RMMFDevSoundProxy::PlayDualToneL(int, int, class TTimeIntervalMicroSeconds const &) + ?PlayFixedSequenceL@RMMFDevSoundProxy@@QAEXH@Z @ 27 NONAME ; void RMMFDevSoundProxy::PlayFixedSequenceL(int) + ?PlayInitL@RMMFDevSoundProxy@@QAEXXZ @ 28 NONAME ; void RMMFDevSoundProxy::PlayInitL(void) + ?PlayToneL@RMMFDevSoundProxy@@QAEXHABVTTimeIntervalMicroSeconds@@@Z @ 29 NONAME ; void RMMFDevSoundProxy::PlayToneL(int, class TTimeIntervalMicroSeconds const &) + ?PlayToneSequenceL@RMMFDevSoundProxy@@QAEXABVTDesC8@@@Z @ 30 NONAME ; void RMMFDevSoundProxy::PlayToneSequenceL(class TDesC8 const &) + ?RecordData@RMMFDevSoundProxy@@QAEXXZ @ 31 NONAME ; void RMMFDevSoundProxy::RecordData(void) + ?RecordInitL@RMMFDevSoundProxy@@QAEXXZ @ 32 NONAME ; void RMMFDevSoundProxy::RecordInitL(void) + ?RegisterAsClient@RMMFDevSoundProxy@@QAEHVTUid@@ABVTDesC8@@@Z @ 33 NONAME ; int RMMFDevSoundProxy::RegisterAsClient(class TUid, class TDesC8 const &) + ?SamplesPlayed@RMMFDevSoundProxy@@QAEHXZ @ 34 NONAME ; int RMMFDevSoundProxy::SamplesPlayed(void) + ?SamplesRecorded@RMMFDevSoundProxy@@QAEHXZ @ 35 NONAME ; int RMMFDevSoundProxy::SamplesRecorded(void) + ?SetBuffer@RMMFDevSoundProxy@@QAEXPAVCMMFDataBuffer@@@Z @ 36 NONAME ; void RMMFDevSoundProxy::SetBuffer(class CMMFDataBuffer *) + ?SetConfigL@RMMFDevSoundProxy@@QAEHABVTMMFCapabilities@@@Z @ 37 NONAME ; int RMMFDevSoundProxy::SetConfigL(class TMMFCapabilities const &) + ?SetDTMFLengths@RMMFDevSoundProxy@@QAEXAAVTTimeIntervalMicroSeconds32@@00@Z @ 38 NONAME ; void RMMFDevSoundProxy::SetDTMFLengths(class TTimeIntervalMicroSeconds32 &, class TTimeIntervalMicroSeconds32 &, class TTimeIntervalMicroSeconds32 &) + ?SetDevSoundInfo@RMMFDevSoundProxy@@QAEHXZ @ 39 NONAME ; int RMMFDevSoundProxy::SetDevSoundInfo(void) + ?SetGain@RMMFDevSoundProxy@@QAEHH@Z @ 40 NONAME ; int RMMFDevSoundProxy::SetGain(int) + ?SetPlayBalanceL@RMMFDevSoundProxy@@QAEXHH@Z @ 41 NONAME ; void RMMFDevSoundProxy::SetPlayBalanceL(int, int) + ?SetPrioritySettings@RMMFDevSoundProxy@@QAEXABVTMMFPrioritySettings@@@Z @ 42 NONAME ; void RMMFDevSoundProxy::SetPrioritySettings(class TMMFPrioritySettings const &) + ?SetRecordBalanceL@RMMFDevSoundProxy@@QAEXHH@Z @ 43 NONAME ; void RMMFDevSoundProxy::SetRecordBalanceL(int, int) + ?SetToneRepeats@RMMFDevSoundProxy@@QAEXHABVTTimeIntervalMicroSeconds@@@Z @ 44 NONAME ; void RMMFDevSoundProxy::SetToneRepeats(int, class TTimeIntervalMicroSeconds const &) + ?SetVolume@RMMFDevSoundProxy@@QAEHH@Z @ 45 NONAME ; int RMMFDevSoundProxy::SetVolume(int) + ?SetVolumeRamp@RMMFDevSoundProxy@@QAEXABVTTimeIntervalMicroSeconds@@@Z @ 46 NONAME ; void RMMFDevSoundProxy::SetVolumeRamp(class TTimeIntervalMicroSeconds const &) + ?Stop@RMMFDevSoundProxy@@QAEXXZ @ 47 NONAME ; void RMMFDevSoundProxy::Stop(void) + ?Volume@RMMFDevSoundProxy@@QAEHXZ @ 48 NONAME ; int RMMFDevSoundProxy::Volume(void) + ?WillResumePlay@RMMFDevSoundProxy@@QAEHXZ @ 49 NONAME ; int RMMFDevSoundProxy::WillResumePlay(void) + ?AsyncCustomCommand@RMMFDevSoundProxy@@QAEXVTUid@@AAVTRequestStatus@@ABVTDesC8@@2PAVTDes8@@@Z @ 50 NONAME ; void RMMFDevSoundProxy::AsyncCustomCommand(class TUid, class TRequestStatus &, class TDesC8 const &, class TDesC8 const &, class TDes8 *) + ?SyncCustomCommand@RMMFDevSoundProxy@@QAEHVTUid@@ABVTDesC8@@1PAVTDes8@@@Z @ 51 NONAME ; int RMMFDevSoundProxy::SyncCustomCommand(class TUid, class TDesC8 const &, class TDesC8 const &, class TDes8 *) + ?EmptyBuffers@RMMFDevSoundProxy@@QAEHXZ @ 52 NONAME ; int RMMFDevSoundProxy::EmptyBuffers(void) + ??0RMMFDevSoundProxy@@QAE@XZ @ 53 NONAME ; RMMFDevSoundProxy::RMMFDevSoundProxy(void) + ?SetClientThreadInfo@RMMFDevSoundProxy@@QAEHAAVTThreadId@@@Z @ 54 NONAME ; int RMMFDevSoundProxy::SetClientThreadInfo(class TThreadId &) + ?GetTimePlayed@RMMFDevSoundProxy@@QAEHAAVTTimeIntervalMicroSeconds@@@Z @ 55 NONAME ; int RMMFDevSoundProxy::GetTimePlayed(class TTimeIntervalMicroSeconds &) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFDEVSOUNDSERVER.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFDEVSOUNDSERVER.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + ?NewL@CMMFDevSoundServer@@SAPAV1@PAVCMMFAudioServer@@AAVTProcessId@@@Z @ 1 NONAME ; class CMMFDevSoundServer * CMMFDevSoundServer::NewL(class CMMFAudioServer *, class TProcessId &) + ?StartThread@CMMFDevSoundServer@@SAHPAX@Z @ 2 NONAME ; int CMMFDevSoundServer::StartThread(void *) + ?KDevsoundServerPriority@@3HB @ 3 NONAME ; int const KDevsoundServerPriority + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/MMFSWCODECWRAPPER.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/MMFSWCODECWRAPPER.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,15 @@ +EXPORTS + ??0CMMFSwCodecWrapper@@IAE@XZ @ 1 NONAME ; protected: __thiscall CMMFSwCodecWrapper::CMMFSwCodecWrapper(void) + ??1CMMFSwCodecWrapper@@UAE@XZ @ 2 NONAME ; public: virtual __thiscall CMMFSwCodecWrapper::~CMMFSwCodecWrapper(void) + ?CustomInterface@CMMFSwCodecWrapper@@MAEPAXVTUid@@@Z @ 3 NONAME ; protected: virtual void * __thiscall CMMFSwCodecWrapper::CustomInterface(class TUid) + ?Init@CMMFSwCodecWrapper@@MAEHAAVTHwDeviceInitParams@@@Z @ 4 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::Init(class THwDeviceInitParams &) + ?Pause@CMMFSwCodecWrapper@@MAEHXZ @ 5 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::Pause(void) + ?SetConfig@CMMFSwCodecWrapper@@MAEHAAVTTaskConfig@@@Z @ 6 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::SetConfig(class TTaskConfig &) + ?Start@CMMFSwCodecWrapper@@MAEHW4TDeviceFunc@@W4TDeviceFlow@@@Z @ 7 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::Start(enum TDeviceFunc,enum TDeviceFlow) + ?Stop@CMMFSwCodecWrapper@@MAEHXZ @ 8 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::Stop(void) + ?ThisHwBufferEmptied@CMMFSwCodecWrapper@@MAEHAAVCMMFBuffer@@@Z @ 9 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::ThisHwBufferEmptied(class CMMFBuffer &) + ?ThisHwBufferFilled@CMMFSwCodecWrapper@@MAEHAAVCMMFBuffer@@@Z @ 10 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::ThisHwBufferFilled(class CMMFBuffer &) + ?DeleteCodec@CMMFSwCodecWrapper@@MAEHXZ @ 11 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::DeleteCodec(void) + ?StopAndDeleteCodec@CMMFSwCodecWrapper@@MAEHXZ @ 12 NONAME ; protected: virtual int __thiscall CMMFSwCodecWrapper::StopAndDeleteCodec(void) + ?SetVbrFlag@CMMFSwCodecWrapper@@IAEXXZ @ 13 NONAME ; void CMMFSwCodecWrapper::SetVbrFlag(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/bwins/mmfswaudiodevice.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/bwins/mmfswaudiodevice.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?CreateL@MAudioInput@@SAPAV1@AAVMAudioInputObserver@@@Z @ 1 NONAME ; class MAudioInput * MAudioInput::CreateL(class MAudioInputObserver &) + ??0TAudioInputParams@@QAE@XZ @ 2 NONAME ; TAudioInputParams::TAudioInputParams(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/MmfAudioPolicy.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/MmfAudioPolicy.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,12 @@ +EXPORTS + _ZN12CAudioPolicy4NewLEP21CMMFAudioPolicyServer @ 1 NONAME + _ZN21CMMFAudioPolicyServer11StartThreadEPv @ 2 NONAME + _ZTI10CMdaHwInfo @ 3 NONAME ; ## + _ZTI22CMMFAudioPolicySession @ 4 NONAME ; ## + _ZTI28CMMFAudioPolicyEventReceiver @ 5 NONAME ; ## + _ZTV10CMdaHwInfo @ 6 NONAME ; ## + _ZTV22CMMFAudioPolicySession @ 7 NONAME ; ## + _ZTV28CMMFAudioPolicyEventReceiver @ 8 NONAME ; ## + _ZTIN21CMMFAudioPolicyServer18CNotificationTimerE @ 9 NONAME ; ## + _ZTVN21CMMFAudioPolicyServer18CNotificationTimerE @ 10 NONAME ; ## + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/MmfAudioPolicyProxy.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/MmfAudioPolicyProxy.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,18 @@ +EXPORTS + _ZN20RMMFAudioPolicyProxy11MakeRequestER31TMMFAudioPolicyPrioritySettings @ 1 NONAME + _ZN20RMMFAudioPolicyProxy11UpdateStateER31TMMFAudioPolicyPrioritySettings @ 2 NONAME + _ZN20RMMFAudioPolicyProxy13GetPlayFormatER8TPckgBufIN12RMdaDevSound19TCurrentSoundFormatEE @ 3 NONAME + _ZN20RMMFAudioPolicyProxy13ReceiveEventsER8TPckgBufI20TMMFAudioPolicyEventER14TRequestStatus @ 4 NONAME + _ZN20RMMFAudioPolicyProxy14LaunchRequestsEv @ 5 NONAME + _ZN20RMMFAudioPolicyProxy15GetRecordFormatER8TPckgBufIN12RMdaDevSound19TCurrentSoundFormatEE @ 6 NONAME + _ZN20RMMFAudioPolicyProxy15SetDevSoundInfoER16TMMFDevSoundInfo @ 7 NONAME + _ZN20RMMFAudioPolicyProxy19CancelReceiveEventsEv @ 8 NONAME + _ZN20RMMFAudioPolicyProxy23GetPlayFormatsSupportedER8TPckgBufIN12RMdaDevSound22TSoundFormatsSupportedEE @ 9 NONAME + _ZN20RMMFAudioPolicyProxy25GetRecordFormatsSupportedER8TPckgBufIN12RMdaDevSound22TSoundFormatsSupportedEE @ 10 NONAME + _ZN20RMMFAudioPolicyProxy4OpenER8RServer2 @ 11 NONAME + _ZN20RMMFAudioPolicyProxy16StopNotificationEv @ 12 NONAME + _ZN20RMMFAudioPolicyProxy27RequestResourceNotificationE4TUidRK6TDesC8 @ 13 NONAME + _ZN20RMMFAudioPolicyProxy33CancelRequestResourceNotificationE4TUid @ 14 NONAME + _ZN20RMMFAudioPolicyProxy32IsRegisteredResourceNotificationE4TUid @ 15 NONAME + _ZN20RMMFAudioPolicyProxy12CreateServerER8RServer2 @ 16 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/MmfAudioServerProxy.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/MmfAudioServerProxy.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + _ZN20RMMFAudioServerProxy15SetDevSoundInfoEv @ 1 NONAME + _ZN20RMMFAudioServerProxy24GetDevSoundSessionHandleEv @ 2 NONAME + _ZN20RMMFAudioServerProxy4OpenEv @ 3 NONAME + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/MmfDevSoundProxy.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/MmfDevSoundProxy.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +EXPORTS + _ZN17RMMFDevSoundProxy10RecordDataEv @ 1 NONAME + _ZN17RMMFDevSoundProxy10SetConfigLERK16TMMFCapabilities @ 2 NONAME + _ZN17RMMFDevSoundProxy11InitializeLE4TUid9TMMFState @ 3 NONAME + _ZN17RMMFDevSoundProxy11InitializeLE7TFourCC9TMMFState @ 4 NONAME + _ZN17RMMFDevSoundProxy11InitializeLE9TMMFState @ 5 NONAME + _ZN17RMMFDevSoundProxy11RecordInitLEv @ 6 NONAME + _ZN17RMMFDevSoundProxy12CapabilitiesEv @ 7 NONAME + _ZN17RMMFDevSoundProxy13PlayDualToneLEiiRK25TTimeIntervalMicroSeconds @ 8 NONAME + _ZN17RMMFDevSoundProxy13SamplesPlayedEv @ 9 NONAME + _ZN17RMMFDevSoundProxy13SetVolumeRampERK25TTimeIntervalMicroSeconds @ 10 NONAME + _ZN17RMMFDevSoundProxy14SetDTMFLengthsER27TTimeIntervalMicroSeconds32S1_S1_ @ 11 NONAME + _ZN17RMMFDevSoundProxy14SetToneRepeatsEiRK25TTimeIntervalMicroSeconds @ 12 NONAME + _ZN17RMMFDevSoundProxy14WillResumePlayEv @ 13 NONAME + _ZN17RMMFDevSoundProxy15CustomInterfaceE4TUid @ 14 NONAME + _ZN17RMMFDevSoundProxy15GetPlayBalanceLERiS0_ @ 15 NONAME + _ZN17RMMFDevSoundProxy15PlayDTMFStringLERK7TDesC16 @ 16 NONAME + _ZN17RMMFDevSoundProxy15SamplesRecordedEv @ 17 NONAME + _ZN17RMMFDevSoundProxy15SetDevSoundInfoEv @ 18 NONAME + _ZN17RMMFDevSoundProxy15SetPlayBalanceLEii @ 19 NONAME + _ZN17RMMFDevSoundProxy16RegisterAsClientE4TUidRK6TDesC8 @ 20 NONAME + _ZN17RMMFDevSoundProxy17FixedSequenceNameEi @ 21 NONAME + _ZN17RMMFDevSoundProxy17GetRecordBalanceLERiS0_ @ 22 NONAME + _ZN17RMMFDevSoundProxy18GetRecordedBufferLER14CMMFDataBuffer @ 23 NONAME + _ZN17RMMFDevSoundProxy17PlayToneSequenceLERK6TDesC8 @ 24 NONAME + _ZN17RMMFDevSoundProxy17SetRecordBalanceLEii @ 25 NONAME + _ZN17RMMFDevSoundProxy18FixedSequenceCountEv @ 26 NONAME + _ZN17RMMFDevSoundProxy18PlayFixedSequenceLEi @ 27 NONAME + _ZN17RMMFDevSoundProxy19SetPrioritySettingsERK20TMMFPrioritySettings @ 28 NONAME + _ZN17RMMFDevSoundProxy20BufferToBeFilledDataER8TPckgBufI22TMMFDevSoundProxyHwBufE @ 29 NONAME + _ZN17RMMFDevSoundProxy21BufferToBeEmptiedDataER8TPckgBufI22TMMFDevSoundProxyHwBufE @ 30 NONAME + _ZN17RMMFDevSoundProxy22CancelRegisterAsClientE4TUid @ 31 NONAME + _ZN17RMMFDevSoundProxy27GetResourceNotificationDataE4TUidR5TDes8 @ 32 NONAME + _ZN17RMMFDevSoundProxy27GetSupportedInputDataTypesLER6RArrayI7TFourCCERK20TMMFPrioritySettings @ 33 NONAME + _ZN17RMMFDevSoundProxy28GetSupportedOutputDataTypesLER6RArrayI7TFourCCERK20TMMFPrioritySettings @ 34 NONAME + _ZN17RMMFDevSoundProxy4GainEv @ 35 NONAME + _ZN17RMMFDevSoundProxy4OpenER11RHandleBase @ 36 NONAME + _ZN17RMMFDevSoundProxy4StopEv @ 37 NONAME + _ZN17RMMFDevSoundProxy5CloseEv @ 38 NONAME + _ZN17RMMFDevSoundProxy5PauseEv @ 39 NONAME + _ZN17RMMFDevSoundProxy6ConfigEv @ 40 NONAME + _ZN17RMMFDevSoundProxy6VolumeEv @ 41 NONAME + _ZN17RMMFDevSoundProxy7MaxGainEv @ 42 NONAME + _ZN17RMMFDevSoundProxy7SetGainEi @ 43 NONAME + _ZN17RMMFDevSoundProxy8PlayDataEv @ 44 NONAME + _ZN17RMMFDevSoundProxy9MaxVolumeEv @ 45 NONAME + _ZN17RMMFDevSoundProxy9PlayInitLEv @ 46 NONAME + _ZN17RMMFDevSoundProxy9PlayToneLEiRK25TTimeIntervalMicroSeconds @ 47 NONAME + _ZN17RMMFDevSoundProxy9SetBufferEP14CMMFDataBuffer @ 48 NONAME + _ZN17RMMFDevSoundProxy9SetVolumeEi @ 49 NONAME + _ZN17RMMFDevSoundProxy17SyncCustomCommandE4TUidRK6TDesC8S3_P5TDes8 @ 50 NONAME + _ZN17RMMFDevSoundProxy18AsyncCustomCommandE4TUidR14TRequestStatusRK6TDesC8S5_P5TDes8 @ 51 NONAME + _ZN17RMMFDevSoundProxy12EmptyBuffersEv @ 52 NONAME + _ZN17RMMFDevSoundProxyC1Ev @ 53 NONAME + _ZN17RMMFDevSoundProxyC2Ev @ 54 NONAME + _ZN17RMMFDevSoundProxy19SetClientThreadInfoER9TThreadId @ 55 NONAME + _ZN17RMMFDevSoundProxy13GetTimePlayedER25TTimeIntervalMicroSeconds @ 56 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/MmfDevSoundServer.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/MmfDevSoundServer.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,23 @@ +EXPORTS + _ZN18CMMFDevSoundServer11StartThreadEPv @ 1 NONAME + _ZN18CMMFDevSoundServer4NewLEP15CMMFAudioServerR10TProcessId @ 2 NONAME + _ZTI17TMdaDTMFGenerator @ 3 NONAME ; ## + _ZTI17TMdaToneGenerator @ 4 NONAME ; ## + _ZTI19CMMFDevSoundSession @ 5 NONAME ; ## + _ZTI19CMMFDevSoundUtility @ 6 NONAME ; ## + _ZTI21TMdaDualToneGenerator @ 7 NONAME ; ## + _ZTI21TMdaSequenceGenerator @ 8 NONAME ; ## + _ZTI23TMdaSimpleToneGenerator @ 9 NONAME ; ## + _ZTI24CMMFDevSoundEventHandler @ 10 NONAME ; ## + _ZTIN18CMMFDevSoundServer22CDelayDevSoundShutDownE @ 11 NONAME ; ## + _ZTV17TMdaDTMFGenerator @ 12 NONAME ; ## + _ZTV17TMdaToneGenerator @ 13 NONAME ; ## + _ZTV19CMMFDevSoundSession @ 14 NONAME ; ## + _ZTV19CMMFDevSoundUtility @ 15 NONAME ; ## + _ZTV21TMdaDualToneGenerator @ 16 NONAME ; ## + _ZTV21TMdaSequenceGenerator @ 17 NONAME ; ## + _ZTV23TMdaSimpleToneGenerator @ 18 NONAME ; ## + _ZTV24CMMFDevSoundEventHandler @ 19 NONAME ; ## + _ZTVN18CMMFDevSoundServer22CDelayDevSoundShutDownE @ 20 NONAME ; ## + KDevsoundServerPriority @ 21 NONAME DATA 4 + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/mmfswaudiodevice.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/mmfswaudiodevice.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,5 @@ +EXPORTS + _ZN17TAudioInputParamsC1Ev @ 1 NONAME + _ZN17TAudioInputParamsC2Ev @ 2 NONAME + _ZN11MAudioInput7CreateLER19MAudioInputObserver @ 3 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/eabi/mmfswcodecwrapper.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/eabi/mmfswcodecwrapper.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,43 @@ +EXPORTS + _ZN18CMMFSwCodecWrapper15CustomInterfaceE4TUid @ 1 NONAME + _ZN18CMMFSwCodecWrapper18ThisHwBufferFilledER10CMMFBuffer @ 2 NONAME + _ZN18CMMFSwCodecWrapper19ThisHwBufferEmptiedER10CMMFBuffer @ 3 NONAME + _ZN18CMMFSwCodecWrapper4InitER19THwDeviceInitParams @ 4 NONAME + _ZN18CMMFSwCodecWrapper4StopEv @ 5 NONAME + _ZN18CMMFSwCodecWrapper5PauseEv @ 6 NONAME + _ZN18CMMFSwCodecWrapper5StartE11TDeviceFunc11TDeviceFlow @ 7 NONAME + _ZN18CMMFSwCodecWrapper9SetConfigER11TTaskConfig @ 8 NONAME + _ZN18CMMFSwCodecWrapper18StopAndDeleteCodecEv @ 9 NONAME + _ZN18CMMFSwCodecWrapperC2Ev @ 10 NONAME + _ZN18CMMFSwCodecWrapperD0Ev @ 11 NONAME + _ZN18CMMFSwCodecWrapperD1Ev @ 12 NONAME + _ZN18CMMFSwCodecWrapperD2Ev @ 13 NONAME + _ZTI18CMMFSwCodecWrapper @ 14 NONAME ; ## + _ZTV18CMMFSwCodecWrapper @ 15 NONAME ; ## + _ZN18CMMFSwCodecWrapper11DeleteCodecEv @ 16 NONAME + _ZTI15CDataPathPlayer @ 17 NONAME ; ## + _ZTI17CDataPathRecorder @ 18 NONAME ABSENT ; ## + _ZTI18CMMFSwCodecUtility @ 19 NONAME ; ## + _ZTI19CMMFSwCodecDataPath @ 20 NONAME ; ## + _ZTI20TPlayCustomInterface @ 21 NONAME ; ## + _ZTI22TRecordCustomInterface @ 22 NONAME ; ## + _ZTI23CMMFSwCodecPlayDataPath @ 23 NONAME ; ## + _ZTI25CMMFSwCodecRecordDataPath @ 24 NONAME ; ## + _ZTI26CMMFSwCodecConvertDataPath @ 25 NONAME ; ## + _ZTI26CSoundDevPlayErrorReceiver @ 26 NONAME ; ## + _ZTI28CSoundDevRecordErrorReceiver @ 27 NONAME ABSENT ; ## + _ZTIN26CMMFSwCodecConvertDataPath18CDataPathConverterE @ 28 NONAME ; ## + _ZTV15CDataPathPlayer @ 29 NONAME ; ## + _ZTV17CDataPathRecorder @ 30 NONAME ABSENT ; ## + _ZTV18CMMFSwCodecUtility @ 31 NONAME ; ## + _ZTV19CMMFSwCodecDataPath @ 32 NONAME ; ## + _ZTV20TPlayCustomInterface @ 33 NONAME ; ## + _ZTV22TRecordCustomInterface @ 34 NONAME ; ## + _ZTV23CMMFSwCodecPlayDataPath @ 35 NONAME ; ## + _ZTV25CMMFSwCodecRecordDataPath @ 36 NONAME ; ## + _ZTV26CMMFSwCodecConvertDataPath @ 37 NONAME ; ## + _ZTV26CSoundDevPlayErrorReceiver @ 38 NONAME ; ## + _ZTV28CSoundDevRecordErrorReceiver @ 39 NONAME ABSENT ; ## + _ZTVN26CMMFSwCodecConvertDataPath18CDataPathConverterE @ 40 NONAME ; ## + _ZN18CMMFSwCodecWrapper10SetVbrFlagEv @ 41 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,66 @@ + +// Copyright (c) 2007-2009 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: +// + +PRJ_PLATFORMS +// specify the platforms your component needs to be built for here +// may add platform for OMAP, Helen etc +DEFAULT + +PRJ_EXPORTS + + +// mmfswcodecwrapper +../inc/SwCodecWrapper/mmfSwCodecWrapper.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(mmf/server/mmfswcodecwrapper.h) +../inc/SwCodecWrapper/mmfSwCodecWrappercustomInterfacesUIDs.hrh /epoc32/include/mmf/server/mmfswcodecwrappercustominterfacesuids.hrh + +../inc/plugin/mmfHwDeviceImplementationUIDs.hrh /epoc32/include/mmf/plugin/mmfhwdeviceimplementationuids.hrh +../inc/plugin/mmfSBCCodecImplementationUIDs.hrh /epoc32/include/mmf/plugin/mmfsbccodecimplementationuids.hrh + +// Romkit include files +devsound_refplugin.iby /epoc32/rom/include/ + + +PRJ_MMPFILES + +// Only build for DevSound +#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +../mmpfiles/platsec/sounddevice/mmfdevsoundrefplugin.mmp +../mmpfiles/platsec/client/mmfaudioserverproxy.mmp +../mmpfiles/platsec/client/mmfdevsoundproxy.mmp +../mmpfiles/platsec/server/mmfdevsoundserver.mmp +../mmpfiles/platsec/server/mmfaudioserver.mmp +../mmpfiles/server/MmfAudioPolicyProxy.mmp +../mmpfiles/platsec/server/mmfaudiopolicy.mmp +#endif + +//Sw Codec Wrapper +../mmpfiles/swcodecwrapper/mmfswaudiodevice.mmp +../mmpfiles/swcodecwrapper/mmfswcodecwrapper.mmp + +// SBC encoder +../mmpfiles/codec/SBCEncoder.mmp + +//audio 'software' hw device plugins +../mmpfiles/plugin/mmfAudioHwDevices.mmp +../mmpfiles/plugin/Gsm610HwDevices.mmp + +PRJ_TESTMMPFILES + +//Audio Test Tone Controller +../mmpfiles/controller/MmfAudioToneController.mmp + +PRJ_TESTEXPORTS +mmfaudiotonetestcontroller.iby /epoc32/rom/include/ \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/group/devsound_refplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/group/devsound_refplugin.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2003-2009 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: +// mmfSoundDev.iby +// +// + +#ifndef DEVSOUND_REFPLUGIN_IBY +#define DEVSOUND_REFPLUGIN_IBY + +// Use these components if building existing DevSound. +#ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// The reference plugin, which is a facade for everything below +ECOM_PLUGIN(MMFDevSoundRefPlugin.dll,101FFA53.rsc) + +// media server server dll +file=ABI_DIR\BUILD_DIR\MmfAudioPolicy.dll System\Libs\MmfAudioPolicy.dll +file=ABI_DIR\BUILD_DIR\MmfAudioPolicyProxy.dll System\Libs\MmfAudioPolicyProxy.dll + +file=ABI_DIR\BUILD_DIR\MmfAudioServer.exe System\Libs\MmfAudioServer.exe +file=ABI_DIR\BUILD_DIR\MmfDevSoundServer.dll System\Libs\MmfDevSoundServer.dll +file=ABI_DIR\BUILD_DIR\MmfAudioServerProxy.dll System\Libs\MmfAudioServerProxy.dll +file=ABI_DIR\BUILD_DIR\MmfDevSoundProxy.dll System\Libs\MmfDevSoundProxy.dll + +// tone controller fixed sequence resource +data=ZRESOURCE\DevSound\FixedSequence.rsc Resource\DevSound\FixedSequence.rsc + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +//sw codec wrapper dll +file=ABI_DIR\BUILD_DIR\MMFSwCodecWrapper.dll System\Libs\MMFSwCodecWrapper.dll +file=ABI_DIR\BUILD_DIR\mmfswaudiodevice.dll System\Libs\mmfswaudiodevice.dll + +//'software codec' CMMFHwDevice plugins +ECOM_PLUGIN(mmfaudiohwdevices.dll,101fd9ef.rsc) +ECOM_PLUGIN(gsm610hwdev.dll,101fd9f0.rsc) + +// The Bitrate Custom Interface implemented on the PCM16 H/W device +ECOM_PLUGIN(MMFDevSoundCustomInterfaceBitRate.dll, 102070B4.rsc) +ECOM_PLUGIN(MMFDevSoundCIFileBlockLength.dll, 102737FD.rsc) + +#endif // DEVSOUND_REFPLUGIN_IBY diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/group/mmfaudiotonetestcontroller.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/group/mmfaudiotonetestcontroller.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,22 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef MMFAUDIOTONETESTCONTROLLER.IBY +#define MMFAUDIOTONETESTCONTROLLER.IBY + +ECOM_PLUGIN(mmfaudiotonetestcontroller.dll,2002C398.rsc) + +#endif //MMFAUDIOTONETESTCONTROLLER.IBY + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/group/multimedia_mdf_devsound_refplugin.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/group/multimedia_mdf_devsound_refplugin.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +#multimedia_mdf_devsound_refplugin.mrp +# +# Copyright (c) 2009 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: +# + +component multimedia_mdf_devsound_refplugin + +source \sf\os\mm\devsound\devsoundrefplugin + +binary \sf\os\mm\devsound\devsoundrefplugin\group all + +exports \sf\os\mm\devsound\devsoundrefplugin\group + +notes_source \component_defs\release.src + +ipr E diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/inc/SwCodecWrapper/mmfSwCodecWrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/inc/SwCodecWrapper/mmfSwCodecWrapper.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,271 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECWRAPPER_H__ +#define __MMFSWCODECWRAPPER_H__ + +#include +#include + +class CMMFSwCodecDataPath; //forward reference + +/** +@publishedAll +@released + +Class for a software codec used by the CMMFSwCodecWrapper class to make the CMMFSwCodec a +CMMFHwDevice plugin. The CMMFSwCodec processes source data in a certain fourCC coding type and +converts it to a destination buffer of another fourCC coding type. + +A CMMFSwCodec object would usually not be instantiated directly +but instead would be instantiated via the CMMFSwCodecWrapper class's Codec() +method. + +The processing of the data is handled by the codecs ProcessL() member. +The intention is that the source buffer for conversion is converted to the appropriate coding type +in the destination buffer. The size of the buffers passed in are determined by SourceBufferSize() +and SinkBufferSize() methods. The buffer sizes should be chosen such that +the ProcessL() method can be guaranteed to have enough destination buffer to +completely process one source buffer. + +The ProcessL should return a TCodecProcessResult returning the number of source bytes processed +and the number of destination bytes processed along with a process result code defined thus: +- EProcessComplete: the codec processed all the source data into the sink buffer +- EProcessIncomplete: the codec filled sink buffer before all the source buffer was processed +- EDstNotFilled: the codec processed the source buffer but the sink buffer was not filled +- EEndOfData: the codec detected the end data - all source data in processed but sink may not be full +- EProcessError: the codec process error condition + +Unlike the 7.0s CMMFCodec::ProcessL method, the CMMFSwCodec::ProcessL method +should not return EProcessIncomplete as this case is not handled by the +CMMFSwCodecWrapper. +*/ +class CMMFSwCodec : public CBase + { +public: + /** + @publishedAll + @released + + Indicates the result of processing data from the source buffer to a destination buffer + and provides functions to compare the result code. + The CMMFSwCodec buffer sizes should be set to return EProcessComplete + The other return codes are to keep the ProcessL method compatible with + the 7.0s CMMFCodec API. + */ + class TCodecProcessResult + { + public: + /** + Flag to track the codec's processing status. + */ + enum TCodecProcessResultStatus + { + /** The codec has successfully completed its processing. */ + EProcessComplete, + /** Could not empty the source buffer because the destination buffer became full. */ + EProcessIncomplete, + /** Codec came across an end of data. */ + EEndOfData, + /** Could not fill the destination buffer because the source buffer has been emptied. */ + EDstNotFilled, + /** An error occured. */ + EProcessError + }; + + /** Overloaded operator to test equality. */ + TBool operator==(const TCodecProcessResultStatus aStatus) const {return (iCodecProcessStatus == aStatus);} + /** Overloaded operator to test inequality. */ + TBool operator!=(const TCodecProcessResultStatus aStatus) const {return (iCodecProcessStatus != aStatus);} + + /** + Default constructor. + */ + TCodecProcessResult() + :iCodecProcessStatus(EProcessError), iSrcBytesProcessed(0), iDstBytesAdded(0) {}; + + public: + /** + The codec's processing status + + @see enum TCodecProcessResultStatus + */ + TCodecProcessResultStatus iCodecProcessStatus; + + /** The number of source bytes processed */ + TUint iSrcBytesProcessed; + + /** The number of bytes added to the destination buffer */ + TUint iDstBytesAdded; + }; +public: + + /** + Processes the data in the specified source buffer and writes the processed data to + the specified destination buffer. + + This function is synchronous, when the function returns the data has been processed. + This is a virtual function that each derived class must implement. + + @param aSource + The source buffer containing data to encode or decode. + @param aDest + The destination buffer to hold the data after encoding or decoding. + + @return The result of the processing. + + @see TCodecProcessResult + */ + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest) = 0; + + /** + Gets the max size of the source buffer passed into the + CMMFSwCodec::ProcessL function. + + Note that this means that this is the Max size of each buffer passed to the codec. The actual + size of the data could be less than the max size. This is a virtual function that each derived + class must implement. + + @return The max size of the source buffer in bytes. + */ + virtual TUint SourceBufferSize() = 0; + + /** + Gets the max size of the sink (destination) buffer passed into the + CMMFSwCodec::ProcessL method. + + Note that this means that this is the Max size of each buffer passed to the codec. The actual + size of the data written to this buffer could be less than the max size. This is a virtual + function that each derived class must implement. + + @return The max size of the sink buffer in bytes. + */ + virtual TUint SinkBufferSize() = 0; + + /** + @internalAll + + Function that needs to be overriden if the codec is a 'Null' codec + ie. it does not perform any data type transformation. The 'Null' codec + should override this to return ETrue and provide a dummy + ProcessL. The CMMFSwCodecWrapper will then use the same buffer + for both the source and the sink. Null codecs should return the same + buffer size for both the Source and SinkBufferSize methods. + Since most CMMFSwCodec implementations will not be null codecs + this method can be ignored. + + Would not normally expect 3rd parties to have to implement this. + */ + virtual TBool IsNullCodec() {return EFalse;}; + }; + +/** +@publishedAll +@released + +Class to make a CMMFSwCodec into a CMMFHwDevice ECOM plugin. + +Most of the code to make a CMMFSwCodec into a CMMFHwDevice ECOM plugin is provided +in CMMFSwCodecWrapper. Someone writing a plugin derrived from CMMFSwCodecWrapper +only needs to provide the standard ECOM implementation code, constructors +and destructors and implement the Codec() function which should return the +appropriate CMMFSwCodec. + +Third parties using CMMFSwCodecWrapper that do not use the RMdaDevSound API +to talk to the sound drivers would need to port the datapaths for their own +sound drivers. Third parties would also need to change the custom interfaces +where necessary. +*/ +class CMMFSwCodecWrapper : public CMMFHwDevice + { +public: + IMPORT_C virtual ~CMMFSwCodecWrapper(); +protected: + IMPORT_C CMMFSwCodecWrapper(); + IMPORT_C virtual TInt Init(THwDeviceInitParams &aDevInfo); + IMPORT_C virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + IMPORT_C virtual TInt Stop(); + IMPORT_C virtual TInt Pause(); + IMPORT_C virtual TAny* CustomInterface(TUid aInterfaceId); + IMPORT_C virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + IMPORT_C virtual TInt ThisHwBufferEmptied(CMMFBuffer& aBuffer); + IMPORT_C virtual TInt SetConfig(TTaskConfig& aConfig); + IMPORT_C virtual TInt StopAndDeleteCodec(); + IMPORT_C virtual TInt DeleteCodec(); + /** + This method must return the CMMFSwCodec used by the derived + CMMFSwCodecWrapper class. The method should create the CMMFSwCodec + if it hasn't done so already. + + This is a virtual function that each derived class must implement. + + @return The CMMFSwCodec used by the derrived CMMFSwCodecWrapper + */ + virtual CMMFSwCodec& Codec() = 0; + IMPORT_C void SetVbrFlag(); +private: + TInt StartEncode(); + TInt StartDecode(); + TInt StartConvert(); + +protected: + /** + The software codec used + */ + CMMFSwCodec* iCodec; + + /** + The source buffer for the codec + */ + CMMFDataBuffer* iSourceBuffer; + + /** + The sink buffer for the codec + */ + CMMFDataBuffer* iSinkBuffer; + + /** + The datapath used to transfer the data + */ + CMMFSwCodecDataPath* iDataPath; + + /** + The play custom interface + */ + MPlayCustomInterface* iPlayCustomInterface; + + /** + The record custom interface + */ + MRecordCustomInterface* iRecordCustomInterface; + + /** + The buffer size of the sound device + */ + TUint iDeviceBufferSize; + + /** + The sample rate of the sound device + */ + TInt iSampleRate; + + /** + The number of channels of the sound device + */ + TInt iChannels; + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/inc/SwCodecWrapper/mmfSwCodecWrappercustomInterfacesUIDs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/inc/SwCodecWrapper/mmfSwCodecWrappercustomInterfacesUIDs.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2003-2009 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: +// + +/** + @publishedPartner + @released + @file +*/ + +#ifndef __MMF_SWCODECWRAPPERCUSTOMINTERFACESUIDS_HRH__ +#define __MMF_SWCODECWRAPPERCUSTOMINTERFACESUIDS_HRH__ + +/** +Custom Interface Uid for these Hw Device implementations +*/ + +#define KMmfPlaySettingsCustomInterface 0x101F9FC1 +#define KMmfRecordSettingsCustomInterface 0x101F9FC2 +#define KMmfUidEmptyBuffersCustomInterface 0x1027379d + +/** +Message from sw codec wrapper to hw device observer +to tell it to update the bytes played via its play settings +custom interface +*/ + +#define KMmfHwDeviceObserverUpdateBytesPlayed 0x101FE2A4 + +/** +Custom Interface Uid for TTaskConfig +*/ +#define KUidRefDevSoundTaskConfig 0x1020428A + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/inc/plugin/mmfHwDeviceImplementationUIDs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/inc/plugin/mmfHwDeviceImplementationUIDs.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,52 @@ +// Copyright (c) 2003-2009 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: +// mmfHwDeviceImplementationUIDs +// +// + +/** + @file + @internalTechnology +*/ + +#ifndef __MMF_HWDEVICEIMPLEMENTATIONUIDS_HRH__ +#define __MMF_HWDEVICEIMPLEMENTATIONUIDS_HRH__ + +// These are the ECOM Implementation UIDs for the codecs supplied in Symbian plugins. +// The ECOM Interface UID for CMMFCodec is defined in mmfcodec.h + +#define KMmfUidHwDevicePCM16ToPCM16 0x101F9F00 +#define KMmfUidHwDevicePCM16ToPCMU8 0x101F9F01 +#define KMmfUidHwDevicePCMU8ToPCM16 0x101F9F21 +#define KMmfUidHwDeviceMulawToPCM16 0x101F9F31 +#define KMmfUidHwDeviceAlawToPCM16 0x101F9F32 +#define KMmfUidHwDevicePCM16ToMuLaw 0x101F9F33 +#define KMmfUidHwDevicePCM16ToALaw 0x101F9F34 +#define KMmfUidHwDevicePCM16toPCM16B 0x101F9F35 +#define KMmfUidHwDevicePCM8ToPCM16 0x101F9F36 +#define KMMFUidHwDevicePCM16toPCMU16B 0x101F9F37 +#define KMmfUidHwDeviceS16ToPCMU16 0x101F9F38 +#define KMmfUidHwDeviceS16ToPCMS8 0x101F9F39 +#define KMmfUidHwDeviceU16BEToPCMS16 0x101F9F3A +#define KMmfUidHwDeviceU16ToPCMS16 0x101F9F3B +#define KMmfUidHwDeviceS16ToPCMU8 0x101F9F3C +#define KMMFUidHwDevicePCM16BtoPCM16 0x101F9F3D +#define KMMFUidHwDevicePCMU16toPCMU16B 0x101F9F3E +#define KMMFUidHwDevicePCMU16BtoPCMU16 0x101F9F3F +#define KMmfUidHwDeviceIMAADPCMToPCM16 0x101F9F40 +#define KMmfUidHwDevicePCM16ToIMAADPCM 0x101F9F41 +#define KMmfUidHwDevicePCM16ToGSM610 0x101FFA05 +#define KMmfUidHwDeviceGSM610ToPCM16 0x101FFA06 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/inc/plugin/mmfSBCCodecImplementationUIDs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/inc/plugin/mmfSBCCodecImplementationUIDs.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,32 @@ +// Copyright (c) 2003-2009 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: +// + +/** + @file + @internalTechnology +*/ + +#ifndef __MMF_SBCCODECIMPLEMENTATIONUIDS_HRH__ +#define __MMF_SBCCODECIMPLEMENTATIONUIDS_HRH__ + +// These are the ECOM Implementation UIDs for the codecs supplied in Symbian plugins. +// The ECOM Interface UID for CMMFCodec is defined in mmfcodec.h + +#define KMmfUidCodecPCM16ToSBC 0x10204975 + +// SBC encoder configuration type UID +#define KMmfUidSBCConfigure 0x10204976 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/codec/SBCEncoder.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/codec/SBCEncoder.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2004-2009 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: +// audiocodecs.dll Reference software audio codec plugins +// +// + +/** + @file +*/ + +TARGET sbcencoder.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN +TARGETPATH /system/libs/plugins +UNPAGED + +// MAGIC Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x10204974 +VENDORID 0x70000001 + +USERINCLUDE . +USERINCLUDE ../../inc/plugin + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/codec/sbcencoder +SOURCE SBCEncoder.cpp +SOURCE SBCCodecImplementationProxy.cpp + +start resource 10204974.rss +target sbcencoder.rsc +end + + +LIBRARY euser.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/controller/MmfAudioToneController.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/controller/MmfAudioToneController.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2003-2009 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: +// MmfAudioToneController.dll Reference tone controller +// +// + +/** + @file +*/ + +target mmfaudiotonetestcontroller.dll +CAPABILITY ALL -TCB +targettype plugin +UNPAGED + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x2002C398 +VENDORID 0x70000001 + +SOURCEPATH ../../src/controller/audio +SOURCE MmfAudioToneController.cpp +SOURCE MmfAudioToneControllerFactory.cpp + +USERINCLUDE ../../src/sounddevice + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef __OMAP__ + +// Delete the HwDevice once we have OMAP Server implementation +// Interfacing with HwDevice implementation begins +USERINCLUDE /GenericGatewayComponent/raw/RawHwDevice +USERINCLUDE /GenericGatewayComponent/raw/RawGwc +USERINCLUDE /GenericGatewayComponent/Gwc +USERINCLUDE /GenericGatewayComponent/BridgeAbstractionLayer +// Interfacing with HwDevice implementation ends +#endif //__OMAP__ + + +start resource 2002C398.rss +target mmfaudiotonetestcontroller.rsc +end + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfdevsound.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY mmfstandardcustomcommands.lib +#ifdef EABI +LIBRARY ecom.lib +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/client/MmfAudioServerProxy.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/client/MmfAudioServerProxy.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,54 @@ +// Copyright (c) 2004-2009 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 "../../../src/SoundDevice/MmfBase.hrh" // get the UID + +target mmfaudioserverproxy.dll +CAPABILITY ALL -TCB +targettype DLL +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfAudioServerProxyExeUnicodeDefine +VENDORID 0x70000001 + +userinclude ../../../src/SoundDevice +userinclude ../../src/Client +userinclude ../../src/Server/AudioServer + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/Client +SOURCE MmfAudioServerProxy.cpp + +library euser.lib +library estor.lib + +#ifdef EABI +DEFFILE MmfAudioServerProxy.def +#endif + +#ifdef WINSCW +DEFFILE MMFAUDIOSERVERPROXY.DEF +#endif + +nostrictdef + +start wins + baseaddress 0x4f000000 +end + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/client/MmfDevSoundProxy.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/client/MmfDevSoundProxy.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2004-2009 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 "../../../src/SoundDevice/MmfBase.hrh" // get the UID + +target mmfdevsoundproxy.dll +CAPABILITY ALL -TCB +targettype DLL +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfDevSoundProxyExeUnicodeDefine +VENDORID 0x70000001 + +userinclude ../../../src/SoundDevice +userinclude ../../src/Client +userinclude ../../src/Server/AudioServer +userinclude ../../../src/server + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +userinclude ../../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/Client +SOURCE MmfDevSoundProxy.cpp + +library euser.lib +library mmfaudioserverproxy.lib +library estor.lib + +#ifdef EABI +DEFFILE MmfDevSoundProxy.def +#endif + +#ifdef WINSCW +DEFFILE MMFDEVSOUNDPROXY.DEF +#endif + +nostrictdef + +start wins + baseaddress 0x4f000000 +end + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfAudioPolicy.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfAudioPolicy.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,72 @@ +// Copyright (c) 2001-2009 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: +// mmfaudiopolicy.dll Audio policy server +// +// + +/** + @file +*/ + + +#include "../../../src/SoundDevice/MmfBase.hrh" // get the UID + + +TARGET mmfaudiopolicy.dll +CAPABILITY MultimediaDD ProtServ UserEnvironment DRM +TARGETTYPE dll +#ifdef EABI +DEFFILE MmfAudioPolicy.def +#endif + +#ifdef WINSCW +DEFFILE MMFAUDIOPOLICY.DEF +#endif +NOSTRICTDEF +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfAudioPolicyDllUnicodeDefine +VENDORID 0x70000001 + +//MACRO ALLOW_POLICY_DEBUG //may be used to allow some dbg messages + +userinclude ../../../src/server +userinclude ../../../src/server/Policy +userinclude ../../src/Server/Policy + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +userinclude ../../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../../src/server/Policy +SOURCE MmfAudioPolicy.cpp +SOURCE MmfAudioPolicyServer.cpp +SOURCE MmfAudioPolicySession.cpp +SOURCE MdaHwInfo.cpp + +SOURCEPATH ../../src/Server/Policy +SOURCE MmfAudioPolicyStart.cpp + +LIBRARY ecom.lib +LIBRARY euser.lib +LIBRARY mmfcontrollerframework.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +LIBRARY mdasoundadapter.lib +#endif + +start wins +baseaddress 0x4F440000 +end diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfAudioServer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfAudioServer.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +// Copyright (c) 2004-2009 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 "../../../src/SoundDevice/MmfBase.hrh" // get the UID + + +TARGET mmfaudioserver.exe +CAPABILITY MultimediaDD ProtServ UserEnvironment DRM +TARGETTYPE exe +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfAudioServerDllUnicodeDefine +VENDORID 0x70000001 + +// Define this macro if devsound instances should each get their own heap +// (you may want to define it in "MmfDevSoundServer.mmp" to turn on +// the __UHEAP_MARK macro) +//MACRO SYMBIAN_USE_SEPARATE_HEAPS + +userinclude ../../../src/server +userinclude ../../src/Server/AudioServer + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +userinclude ../../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + +SOURCEPATH ../../src/Server/AudioServer + + +SOURCE MmfAudioServer.cpp +SOURCE MmfAudioServerStart.cpp +SOURCE MmfAudioServerSession.cpp + + + +library euser.lib +library estor.lib +library mmfdevsoundserver.lib +library mmfaudiopolicyproxy.lib + +start wins +baseaddress 0x4F440000 +end diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfDevSoundServer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/server/MmfDevSoundServer.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2004-2009 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 "../../../src/SoundDevice/MmfBase.hrh" // get the UID + + +TARGET mmfdevsoundserver.dll +CAPABILITY MultimediaDD ProtServ UserEnvironment DRM +TARGETTYPE dll +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfDevSoundServerDllUnicodeDefine +VENDORID 0x70000001 + +// Define this macro if devsound instances are using separate heaps +// (see: "MmfAudioServer.mmp") +//MACRO SYMBIAN_USE_SEPARATE_HEAPS + +USERINCLUDE ../../src/Server/AudioServer +USERINCLUDE ../../../src/server +USERINCLUDE ../../../src/SoundDevice + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +USERINCLUDE ../../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + + +SOURCEPATH ../../src/Server/AudioServer +SOURCE MmfDevSoundServer.cpp +SOURCE MmfDevSoundServerStart.cpp +SOURCE MmfDevSoundSession.cpp +SOURCE MmfDevSoundSessionBody.cpp +SOURCE MmfDevSoundCIDeMuxUtility.cpp +SOURCE mmfdevsoundserverconsts.cpp + +SOURCEPATH ../../../src/SoundDevice +SOURCE ToneGenerator.cpp +SOURCE MmfDevSoundEventHandler.cpp +SOURCE DevSoundUtility.cpp + + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY mmfaudiopolicyproxy.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY mmcommonutils.lib +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +LIBRARY puresolverutils.lib +LIBRARY omxilcoreclient.lib +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + +#ifdef EABI +DEFFILE MmfDevSoundServer.DEF +#endif + +#ifdef WINSCW +DEFFILE MMFDEVSOUNDSERVER.DEF +#endif +nostrictdef + +start wins +baseaddress 0x4F440000 +end diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/platsec/sounddevice/MmfDevSoundRefPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/platsec/sounddevice/MmfDevSoundRefPlugin.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,69 @@ +// Copyright (c) 2001-2009 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 "../../../inc/Plugin/mmfdevsound.hrh" + +/** +@file + +@SYMPurpose MMFDevSoundRefPlugin.dll Reference DevSound plugin +*/ + +TARGET mmfdevsoundrefplugin.dll +CAPABILITY ALL -TCB +TARGETTYPE PLUGIN +UNPAGED + +UID 0x10009D8D KMmfUidDevSoundRefPluginDll +VENDORID 0x70000001 + +SOURCEPATH ../../src/SoundDevice + +SOURCE SoundDeviceBody.cpp +SOURCE MmfDevSoundCallbackHandler.cpp +SOURCE DevSoundPluginMain.cpp +SOURCE MmfDevSoundCIMuxUtility.cpp + +SOURCEPATH ../../../src/SoundDevice + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +USERINCLUDE ../../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +START RESOURCE 101FFA53.rss +TARGET mmfdevsoundrefplugin.rsc +END + +START RESOURCE FixedSequence.rss +TARGETPATH resource/devsound +HEADER +END + +USERINCLUDE ../../src/Client +USERINCLUDE ../../src/Server/AudioServer +USERINCLUDE ../../../src/server +USERINCLUDE ../../src/SoundDevice + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY mmfdevsoundproxy.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/plugin/Gsm610HwDevices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/plugin/Gsm610HwDevices.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,52 @@ +// Copyright (c) 2002-2009 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: +// Gsm610HwDev.dll Software implementation of GSM6.10 audio hardware device +// +// + +/** + @file +*/ + +target gsm610hwdev.dll +CAPABILITY ALL -TCB +targettype plugin +UNPAGED + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101FD9F0 +VENDORID 0x70000001 + +USERINCLUDE ../../../../mmlibs/mmfw/Codecs/Inc/Gsm610CodecCommon + +USERINCLUDE ../../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/plugin/audio/Gsm610 +source GSM610.CPP gsm610Proxy.cpp + + +start resource 101FD9F0.RSS +target gsm610hwdev.rsc +end + +LIBRARY euser.lib +LIBRARY mmfswcodecwrapper.lib +LIBRARY gsm610codeccommon.lib +#ifdef EABI +LIBRARY ecom.lib +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/plugin/mmfAudioHwDevices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/plugin/mmfAudioHwDevices.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,73 @@ +// Copyright (c) 2003-2009 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: +// MMFAudioHwDevices.dll Software implementation of reference audio hardware devices +// +// + +/** + @file +*/ + +target mmfaudiohwdevices.dll +CAPABILITY ALL -TCB +targettype plugin +UNPAGED + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101FD9EF +VENDORID 0x70000001 + +USERINCLUDE ../../../../mmlibs/mmfw/Codecs/Inc/MMFCodecCommon + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +USERINCLUDE ../../../../mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/plugin/audio +SOURCE MMFAudioCodecImplementationProxy.cpp +SOURCE MMFpcm16ToPcm16HwDevice.cpp +SOURCE MMFpcm16ToPcmU8HwDevice.cpp +SOURCE MMFpcmU8ToPcm16HwDevice.cpp +SOURCE Mmfalawtopcm16hwdevice.cpp +SOURCE MmfMuLawToPcm16hwDevice.cpp +SOURCE Mmfimaadpcmtopcm16hwdevice.cpp +SOURCE mmfpcm16toAlawhwdevice.cpp +SOURCE mmfpcm16toMulawhwdevice.cpp +SOURCE mmfpcm16SwapEndianhwdevice.cpp +SOURCE mmfpcmS16topcmU16Codec.cpp +SOURCE mmfpcm16topcmU16BEHwDevice.cpp +SOURCE mmfpcmS16PcmS8HwDevice.cpp +SOURCE mmfpcmS8ToPcmS16HwDevice.cpp +SOURCE mmfpcmU16BeToPcmS16HwDevice.cpp +SOURCE mmfpcmU16TopcmS16HwDevice.cpp +SOURCE mmfpcm16ToImaAdpcm.cpp + + +start resource 101FD9EF.rss +target mmfaudiohwdevices.rsc +end + +LIBRARY euser.lib +LIBRARY mmfswcodecwrapper.lib +LIBRARY mmfcodeccommon.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +LIBRARY mdasoundadapter.lib +#endif +#ifdef EABI +LIBRARY ecom.lib +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/server/MmfAudioPolicyProxy.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/server/MmfAudioPolicyProxy.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,67 @@ +// Copyright (c) 2009 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: +// mmfaudiopolicyproxy.dll Audio policy proxy plugin +// + + + +/** + @file +*/ + +#include "../../src/SoundDevice/MmfBase.hrh" // get the UID + +target mmfaudiopolicyproxy.dll +CAPABILITY MultimediaDD ProtServ UserEnvironment DRM +targettype DLL +UNPAGED + +UID KSharedLibraryUidDefine KUidMmfAudioPolicyProxyExeUnicodeDefine +VENDORID 0x70000001 + +userinclude ../../src/SoundDevice +userinclude ../../src/server + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +userinclude ../../../../../../../os/mm/mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/server/Policy + +source MmfAudioPolicyProxy.cpp + +library euser.lib + +library mmfaudiopolicy.lib + +#ifdef EABI +DEFFILE MmfAudioPolicyProxy.def +#endif + +#ifdef WINSCW +DEFFILE MMFAUDIOPOLICYPROXY.DEF +#endif + + +nostrictdef + +start wins + baseaddress 0x4f000000 +end + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/swcodecwrapper/mmfswaudiodevice.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/swcodecwrapper/mmfswaudiodevice.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2003-2009 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. + +// Enable logging of this dll +// MACRO SYMBIAN_SWCODEC_LOGGING + +// Normally on SetFormat we try and handle failure. If this macro is enabled, skip first step +// Only allow the "CD" rates of 44100, 22050 and 11025 whatever is actually supported. +// This simulates the behaviour of some hardware. +// Assumes one is supported. +// MACRO SYMBIAN_SOUNDADAPTER_FORCECDRATES + +target mmfswaudiodevice.dll +capability ALL -TCB +targettype DLL +unpaged + +uid 0x1000008D 0x10287081 +vendorid 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +userinclude ../../inc // for local mmf +userinclude ../../../../mmlibs/mmfw/inc // for rateconvert.h + +sourcepath ../../src/swcodecwrapper + +source mmfswaudioinput.cpp + +library euser.lib +library mmfserverbaseclasses.lib +library audioutils.lib + + +#ifdef WINSCW +DEFFILE ../../bwins/mmfswaudiodevice.def +#endif + +#ifdef EABI +DEFFILE ../../eabi/mmfswaudiodevice.def +#endif + +nostrictdef + +smpsafe + + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/mmpfiles/swcodecwrapper/mmfswcodecwrapper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/mmpfiles/swcodecwrapper/mmfswcodecwrapper.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2003-2009 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: +// mmfswcodecwrapper.dll Hardware device wrapper for reference software audio devices +// __CYCLE_MMF_DATABUFFERS__ tries to replicate the conditions described in INC021405 +// ('Play-EOF-Play on HwAccelerated solution Panics'). Each time DevSound returns a +// buffer it will be different to the previous one supplied. This simulates implementations +// where multiple buffers are available. +// A similar thing happens on OMAP hardware. +// MACRO __CYCLE_MMF_DATABUFFERS__ +// __USE_MMF_TRANSFERBUFFERS__ enables devsound to create CMMFTransferBuffers rather than +// CMMFDescriptorBuffers +// MACRO __USE_MMF_TRANSFERBUFFERS__ +// __USE_MMF_PTRBUFFERS__ enables devsound to create CMMFPtrBuffers rather than +// CMMFDescriptorBuffers +// note this MACRO cannot be used in conjunction with __CYCLE_MMF_DATABUFFERS__ and/or __USE_MMF_TRANSFERBUFFERS__ +// MACRO __USE_MMF_PTRBUFFERS__ +// +// Enable to get enhanced logging output +//MACRO SYMBIAN_SCW_DEBUG + +/** + @file +*/ + + + +target mmfswcodecwrapper.dll +CAPABILITY ALL -TCB +targettype DLL +UNPAGED + +UID 0x1000008D 0x101F9EEE //static interface DLL Uid KSharedLibraryUid +VENDORID 0x70000001 + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +userinclude ../../../../mmdevicefw/mdf/src/audio/mdasoundadapter +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../../src/swcodecwrapper + +source mmfSwCodecWrapper.cpp +source mmfSwCodecDataPath.cpp +source mmfSwCodecPlayDataPath.cpp +source mmfSwCodecRecordDataPath.cpp +source mmfSwCodecConvertDataPath.cpp +source mmfSwCodecUtility.cpp + + +library euser.lib +library mmfserverbaseclasses.lib +library ecom.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +library mdasoundadapter.lib +#endif +library mmfswaudiodevice.lib + +#ifdef EABI +DEFFILE ../../eabi/mmfswcodecwrapper.def +#endif + +#ifdef WINSCW +DEFFILE ../../bwins/MMFSWCODECWRAPPER.DEF +#endif + +nostrictdef + +start wins +baseaddress 0x4F140000 +end + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/10204974.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/10204974.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,43 @@ + +// Copyright (c) 2004-2009 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 +#include +#include "mmfSBCCodecImplementationUIDs.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10204974; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceCodec; // CMMFCodec + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidCodecPCM16ToSBC; + version_no = 1; + display_name = "PCM16->SBC Codec"; + default_data = " P16, SBC" ; // four CC codes + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/SBCCodecImplementationProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/SBCCodecImplementationProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2004 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 +#include +#include + +#include "SBCEncoder.h" + +/** +Exported proxy for instantiation method resolution +Define the interface UIDs +*/ +const TImplementationProxy implementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidCodecPCM16ToSBC, CSBCEncoder::NewL) + }; + +/** +Used by the ECom system to obtain a list of implementations available in the library + +@internalAll +@param aTableCount will be initialized to the number of entries +@return TImplementationProxy* a pointer to a list of available implementations +*/ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(implementationTable) / sizeof(TImplementationProxy); + return implementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/SBCConst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/SBCConst.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,180 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __SBCCONST_H__ +#define __SBCCONST_H__ + +/** +SBC Syncword, used in the begin of each sbc frame to identify sbc frame, +it's value is always 0x9c +*/ +const TUint8 KSBCFrameSyncWord = 0x9c; + +/** +This table is used to calculate bit allocation for 4 subbands sbc frame +with Loudness allocation method +*/ +const TInt8 KSBCOffset4[4][4] = + { + {-1, 0, 0, 0}, // fs = 16000 + {-2, 0, 0, 1}, // fs = 32000 + {-2, 0, 0, 1}, // fs = 44100 + {-2, 0, 0, 1} // fs = 48000 + }; + +/** +This table is used to calculate bit allocation for 8 subbands sbc frame +with Loudness allocation method +*/ +const TInt8 KSBCOffset8[4][8] = + { + {-2, 0, 0, 0, 0, 0, 0, 1}, // fs = 16000 + {-3, 0, 0, 0, 0, 0, 1, 2}, // fs = 32000 + {-4, 0, 0, 0, 0, 0, 1, 2}, // fs = 44100 + {-4, 0, 0, 0, 0, 0, 1, 2} // fs = 48000 + }; + +/** +2^32, scale value of Table KSBCProto4 and KSBCProto8. +*/ +const TUint8 KSBCProtoBitsShift = 32; + +/** +Table KSBCProto4 is derived form Table Proto_4_40 (see A2DP spec for detail) +by scaling up by 2^32, it is for the Analysis process for 4 subbands sbc frames, +we are using integer numbers for high speed, after the calculation the results +will be scaled down by the same value. +*/ +const TInt32 KSBCProto4[40] = + { + 0, 2304460, 6407591, 11741191, + 16480657, 16716234, 8013623, -13143128, + 46874251, 87782726, 124020356, 138271872, + 111139929, 26338680, -123788377, -333488531, + 582368677, 837466400, 1059296397, 1210442915, + 1264074726, 1210442915, 1059296397, 837466400, + -582368677, -333488531, -123788377, 26338680, + 111139929, 138271872, 124020356, 87782726, + -46874251, -13143128, 8013623, 16716234, + 16480657, 11741191, 6407591, 2304460 + }; + +/** +Table KSBCProto8 is derived form Table Proto_8_80 (see A2DP spec for detail) +by scaling up by 2^32, it is for the Analysis process for 8 subbands sbc frames, +we are using integer numbers for high speed, after the calculation the results +will be scaled down by the same value. +*/ +const TInt32 KSBCProto8[80] = + { + 0, 672486, 1474275, 2382076, + 3538707, 4895941, 6341097, 7661007, + 8640724, 9035408, 8566508, 6943084, + 3874724, -767963, -7085541, -15020250, + 24307345, 34486060, 44918676, 54748951, + 62932121, 68309566, 69668008, 65792073, + 55564768, 38042997, 12558847, -21113115, + -62880072, -112141060, -167826440, -228437728, + 292053237, 356416821, 419083117, 477586143, + 529417202, 572366304, 604531701, 624444638, + 631167211, 624444638, 604531701, 572366304, + 529417202, 477586143, 419083117, 356416821, + -292053237, -228437728, -167826440, -112141060, + -62880072, -21113115, 12558847, 38042997, + 55564768, 65792073, 69668008, 68309566, + 62932121, 54748951, 44918676, 34486060, + -24307345, -15020250, -7085541, -767963, + 3874724, 6943084, 8566508, 9035408, + 8640724, 7661007, 6341097, 4895941, + 3538707, 2382076, 1474275, 672486 + }; + + +/** +2^30, scale value of Table KSBCAnalysisMatrix4 and KSBCAnalysisMatrix8. +*/ +const TUint8 KSBCAnalysisMatrixBitsShift = 30; + +/** +Table of cos((i + 0.5) * (k - 2) * PI / 4) * 2^30 +This table is used in Analysis process for 4 subbands, here we are using +integer values instead of real values for high speed, the values are scaled +up by 2^30, after calculation the results will be scaled down by the same value. +*/ +const TInt32 KSBCAnalysisMatrix4[4][8] = + { + { 759250125, 992008094, 1073741824, 992008094, + 759250125, 410903207, 0, -410903207 }, + + { -759250125, 410903207, 1073741824, 410903207, + -759250125, -992008094, 0, 992008094 }, + + { -759250125, -410903207, 1073741824, -410903207, + -759250125, 992008094, 0, -992008094 }, + + { 759250125, -992008094, 1073741824, -992008094, + 759250125, -410903207, 0, 410903207 } + }; + +/** +Table of cos((i + 0.5) * (k - 4) * PI / 8) * 2^30 +This table is used in Analysis process for 8 subbands, here we are using +integer values instead of real values for high speed, the values are scaled +up by 2^30, after calculation the results will be scaled down by the same value. +*/ +const TInt32 KSBCAnalysisMatrix8[8][16] = + { + { 759250125, 892783698, 992008094, 1053110176, + 1073741824, 1053110176, 992008094, 892783698, + 759250125, 596538995, 410903207, 209476638, + 0, -209476638, -410903207, -596538995 }, + + { -759250125, -209476638, 410903207, 892783698, + 1073741824, 892783698, 410903207, -209476638, + -759250125, -1053110176, -992008094, -596538995, + 0, 596538995, 992008094, 1053110176 }, + + { -759250125, -1053110176, -410903207, 596538995, + 1073741824, 596538995, -410903207, -1053110176, + -759250125, 209476638, 992008094, 892783698, + 0, -892783698, -992008094, -209476638 }, + + { 759250125, -596538995, -992008094, 209476638, + 1073741824, 209476638, -992008094, -596538995, + 759250125, 892783698, -410903207, -1053110176, + 0, 1053110176, 410903207, -892783698 }, + + { 759250125, 596538995, -992008094, -209476638, + 1073741824, -209476638, -992008094, 596538995, + 759250125, -892783698, -410903207, 1053110176, + 0, -1053110176, 410903207, 892783698 }, + + { -759250125, 1053110176, -410903207, -596538995, + 1073741824, -596538995, -410903207, 1053110176, + -759250125, -209476638, 992008094, -892783698, + 0, 892783698, -992008094, 209476638 }, + + { -759250125, 209476638, 410903207, -892783698, + 1073741824, -892783698, 410903207, 209476638, + -759250125, 1053110176, -992008094, 596538995, + 0, -596538995, 992008094, -1053110176 }, + + { 759250125, -892783698, 992008094, -1053110176, + 1073741824, -1053110176, 992008094, -892783698, + 759250125, -596538995, 410903207, -209476638, + 0, 209476638, -410903207, 596538995 } + }; + +#endif // __SBCCONST_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/SBCEncoder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/SBCEncoder.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1791 @@ +// Copyright (c) 2004-2009 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 // KMmfUidSBCConfigure + +#include "SBCEncoder.h" +#include "SBCConst.h" +#include "SBCFrameParameters.h" + +/** +The sbc configuration UID, used to identify configuration type, +have to use this to configure any sbc codec. +*/ +const TUid KSBCConfigTypeUid = { KMmfUidSBCConfigure }; + +/** +SBC CRC shift register initial value for SBC CRC calculation +*/ +const TUint8 KSbcCRCShiftRegisterInit = 0x0f; +/** +SBC CRC XOR mask, derived from polynomial G(X) = X^8 + X^4 + X^3 + X^2 + 1 +*/ +const TUint8 KSbcCRCShiftRegisterXorMask = 0x1d; + +#ifdef _DEBUG + +enum + { + ESbcBitstreamPosErr, + ESbcSampleOverflow + }; + +_LIT(KSBCEncoderPanicCategory, "CSBCEncoder"); + +static inline void Panic(TInt aError) + { + User::Panic(KSBCEncoderPanicCategory, aError); + } + +#endif + +/* ========================= class CBitStreamParser ========================= */ + +/** +class CBitStreamParser constructor +@internalComponent +@param aBitStream +The bit stream buffer to be parsed +*/ +CBitStreamParser::CBitStreamParser(TDes8& aBitStream) : iBitStream(aBitStream), + iByteOffset(0), iBitOffset(0) + { + iPtr = const_cast(aBitStream.Ptr() ); + } + +/** +class CBitStreamParser destructor +@internalComponent +*/ +CBitStreamParser::~CBitStreamParser() + { + } + +/** +class CBitStreamParser second phase constructor +@internalComponent +*/ +void CBitStreamParser::ConstructL() + { + } + +/** +This function creates a new CBitStreamParser object and push it into CleanupStack. +@internalComponent +@param aBitStream +The bit stream buffer to be parsed +@return pointer to the new CBitStreamParser object +@leave if out of memory +*/ +CBitStreamParser* CBitStreamParser::NewLC(TDes8& aBitStream) + { + CBitStreamParser* self = new(ELeave) CBitStreamParser(aBitStream); + CleanupStack::PushL(self); + self->ConstructL(); + return self; + } + +/** +This function reset the internal bit position of CBitStreamParser +@internalComponent +*/ +void CBitStreamParser::Reset() + { + iPtr = const_cast(iBitStream.Ptr() ); + iByteOffset = 0; + iBitOffset = 0; + } + +/** +This function reads a number of bits from bit stream buffer at current bit position +and change the bit position to then end of the last bit read. +@internalComponent +@param aBitsToRead +Number of bits to read, at most 8 bits +@return the bits value in byte +@panic if bit position is outside of the stream buffer +*/ +TUint8 CBitStreamParser::ReadBits(TInt aBitsToRead) + { + TUint8 result = 0; + if (aBitsToRead >= 8 - iBitOffset) + { + __ASSERT_DEBUG(iByteOffset < static_cast(iBitStream.MaxLength() ), Panic(ESbcBitstreamPosErr) ); + // extra code to handle exception for URel version + if (iByteOffset >= static_cast(iBitStream.MaxLength() ) ) + { + return 0; + } + + aBitsToRead -= (8 - iBitOffset); + result = static_cast( (*iPtr & (0xff >> iBitOffset) ) << aBitsToRead); + + iPtr++; + iByteOffset++; + iBitOffset = 0; + } + if (aBitsToRead > 0) + { + __ASSERT_DEBUG(iByteOffset < static_cast(iBitStream.MaxLength() ), Panic(ESbcBitstreamPosErr) ); + // extra code to handle exception for URel version + if (iByteOffset >= static_cast(iBitStream.MaxLength() ) ) + { + return 0; + } + + result |= static_cast( (*iPtr & (0xff >> iBitOffset) ) >> (8 - iBitOffset - aBitsToRead) ); + iBitOffset = static_cast(iBitOffset + aBitsToRead); + } + return result; + } + +/** +This function writes a number of bits to the bit stream buffer at current bit position +and change the bit position to then end of the last bit written. +@internalComponent +@param aBitsToWrite +Number of bits to write, at most 8 bits +@param aBitsValue +The bits value to write in byte +@panic if bit position is outside of the stream buffer +*/ +void CBitStreamParser::WriteBits(TInt aBitsToWrite, TUint8 aBitsValue) + { + if (aBitsToWrite >= 8 - iBitOffset) + { + __ASSERT_DEBUG(iByteOffset < static_cast(iBitStream.MaxLength() ), Panic(ESbcBitstreamPosErr) ); + // extra code to handle exception for URel version + if (iByteOffset >= static_cast(iBitStream.MaxLength() ) ) + { + return; + } + + aBitsToWrite -= (8 - iBitOffset); + *iPtr &= ~(0xff >> iBitOffset); // clear bits + *iPtr |= (aBitsValue >> aBitsToWrite) & (0xff >> iBitOffset); // set bits + + iPtr++; + iByteOffset++; + iBitOffset = 0; + } + if (aBitsToWrite > 0) + { + __ASSERT_DEBUG(iByteOffset < static_cast(iBitStream.MaxLength() ), Panic(ESbcBitstreamPosErr) ); + // extra code to handle exception for URel version + if (iByteOffset >= static_cast(iBitStream.MaxLength() ) ) + { + return; + } + + *iPtr &= (0xff << (8 - iBitOffset) ) | (0xff >> (iBitOffset + aBitsToWrite) ); // clear bits + *iPtr |= (aBitsValue << (8 - iBitOffset - aBitsToWrite) ) & (0xff >> iBitOffset); // set bits + iBitOffset = static_cast(iBitOffset + aBitsToWrite); + } + } + +/** +This function reads 8 bits from bit stream buffer at current bit position +and change the bit position to then end of the last bit read. +@internalComponent +@return the bits value in byte +*/ +TUint8 CBitStreamParser::ReadByte() + { + return ReadBits(8); + } + +/** +This function writes 8 bits to the bit stream buffer at current bit position +and change the bit position to then end of the last bit written. +@internalComponent +@param aByteValue +The byte value to write +*/ +void CBitStreamParser::WriteByte(TUint8 aByteValue) + { + WriteBits(8, aByteValue); + } + +/** +This function sets the bit position to a specific position. +@internalComponent +@param aByteOffset +New byte position to set +@param aBitOffset +New bit position to set +@panic if bit position is outside of the stream buffer +*/ +void CBitStreamParser::SetPosition(TUint aByteOffset, TUint8 aBitOffset) + { + while (aBitOffset >= 8) + { + aBitOffset -= 8; + iByteOffset++; + } + + __ASSERT_DEBUG(iByteOffset < static_cast(iBitStream.MaxLength() ), Panic(ESbcBitstreamPosErr) ); + // extra code to handle exception for URel version + if (iByteOffset >= static_cast(iBitStream.MaxLength() ) ) + { + aBitOffset = 0; + iByteOffset = iBitStream.MaxLength(); + } + + iPtr = const_cast(iBitStream.Ptr() ) + aByteOffset; + iByteOffset = aByteOffset; + iBitOffset = aBitOffset; + } + +/** +This function gets the bit position. +@internalComponent +@param aByteOffset +Read byte position +@param aBitOffset +Read bit position +*/ +void CBitStreamParser::Position(TUint& aByteOffset, TUint8& aBitOffset) const + { + aByteOffset = iByteOffset; + aBitOffset = iBitOffset; + } + +/* ========================= class CSbcCRCCalculator ========================= */ + +/** +Constructor +@internalComponent +*/ +CSbcCRCCalculator::CSbcCRCCalculator() : iShiftRegister(KSbcCRCShiftRegisterInit) + { + } + +/** +This function resets the shift register value to intial SBC CRC value +@internalComponent +*/ +void CSbcCRCCalculator::Reset() + { + iShiftRegister = KSbcCRCShiftRegisterInit; + } + +/** +This function inputs one bit into the shift register +@internalComponent +@param aBit +The lowest bit contains the bit to input. +*/ +void CSbcCRCCalculator::InputBit(TUint8 aBit) + { + TUint8 inputBit = static_cast( (iShiftRegister >> 7) ^ (aBit & 0x1) ); + iShiftRegister <<= 1; + + if (inputBit) + { + iShiftRegister ^= KSbcCRCShiftRegisterXorMask; + } + } + +/** +This function inputs a number of bits into the shift register +@internalComponent +@param aBits +The number of bits to input, at most 8 bits. +@param aValue +The input bits value. +*/ +void CSbcCRCCalculator::InputBits(TUint8 aBits, TUint8 aValue) + { + for (TInt bit = aBits - 1; bit >= 0; bit--) + { + InputBit(static_cast(aValue >> bit) ); + } + } + +/** +This function inputs 8 bits into the shift register. +@internalComponent +@param aValue +The input byte value. +*/ +void CSbcCRCCalculator::InputByte(TUint8 aByte) + { + InputBit(static_cast(aByte >> 7) ); + InputBit(static_cast(aByte >> 6) ); + InputBit(static_cast(aByte >> 5) ); + InputBit(static_cast(aByte >> 4) ); + InputBit(static_cast(aByte >> 3) ); + InputBit(static_cast(aByte >> 2) ); + InputBit(static_cast(aByte >> 1) ); + InputBit(aByte); + } + +/** +This function gets the shift register value. +@internalComponent +@return the shift register value. +*/ +TUint8 CSbcCRCCalculator::ShiftRegister() + { + return iShiftRegister; + } + +/* ============================ class CSBCEncoder ============================ */ + +/** +Constructor. +@internalComponent +*/ +CSBCEncoder::CSBCEncoder() + { + } + +/** +Destructor. +@internalComponent +*/ +CSBCEncoder::~CSBCEncoder() + { + delete iSbcFrameEncoder; + delete iPcmSampleCach; // this is used to cache any remaining samples less than on frame + } + +/** +Second phase constructor. +@internalComponent +@param aInitParams +Initial parameters for creating this object, not in use for the moment +@leave never +*/ +void CSBCEncoder::ConstructL(TAny* /*aInitParams*/) + { + } + +/** +This function resets any existing audio samples from the cach. +@internalComponent +@leave never +*/ +void CSBCEncoder::ResetL() + { + if (iPcmSampleCach) + { + iPcmSampleCach->Des().Zero(); + } + } + +/** +This function creates a new CSBCEncoder object. +@internalComponent +@param aInitParams +Initial parameters for creating this object, not in use for the moment +@leave if out of memory +*/ +CMMFCodec* CSBCEncoder::NewL(TAny* aInitParams) + { + CSBCEncoder* self = new(ELeave) CSBCEncoder(); + CleanupStack::PushL(self); + self->ConstructL(aInitParams); + CleanupStack::Pop(); + return self; + } + +/** +This function is used for configuring the CSBCEncoder object. Should be called before encode +@internalComponent +@param aConfigType +Configuration UID, has to be set to KSBCConfigTypeUid +@param aConfigData +A package buffer which contains all the settings +@leave KErrNotSupported if configuration UID does't match or parameters setting is invalid. +*/ +void CSBCEncoder::ConfigureL(TUid aConfigType, const TDesC8& aConfigData) + { + if (aConfigType != KSBCConfigTypeUid) + { + User::Leave(KErrNotSupported); + } + + const TSBCFrameParameters& param = + static_cast&>(aConfigData)(); + + if (param.Validate() != 0) + { + User::Leave(KErrArgument); + } + + iParameters = param; + + if (iPcmSampleCach) + { + delete iPcmSampleCach; + iPcmSampleCach = NULL; + } + + if (iSbcFrameEncoder) + { + // must call this whenever ConfigureL() is called to make sure CSBCFrameEncoder + // uses the new configuration, as we can change the configuration without creating + // a new CSBCFrameEncoder object + iSbcFrameEncoder->Configure(iParameters); + } + + iSbcFrameLength = iParameters.CalcFrameLength(); + iPcmFrameSize = sizeof(TInt16) * param.BlockLength() * param.Subbands() * param.Channels(); + } + +/** +This function encodes sbc audio stream with PCM16 audio source samples, and write processed +result to destination buffer. It also caches any less than one frame remaining audio samples. +@internalComponent +@param aSrc +Source buffer contains the PCM16 audio source samples +@param aDst +Destination buffer to contain the encoded sbc audio stream +@return processed result +@leave + KErrAbort if configuration is invalid, + KErrArgument if destination buffer size is smaller than one frame length, + KErrCorrupt if output bytes is not the same as frame length or + if we still have enough src and dst but the process stoped, + Or other errors e.g. out of memory error. +*/ +TCodecProcessResult CSBCEncoder::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + // check if ConfigureL gets called already + if (iParameters.Validate() != 0) + { + User::Leave(KErrAbort); + } + + // check if dst big enough to hold at least one frame + CMMFDataBuffer* dst = static_cast(&aDst); + const TUint dstMaxLen = dst->Data().MaxLength(); + + if (dstMaxLen < iSbcFrameLength) + { + User::Leave(KErrArgument); + } + + // process data + const CMMFDataBuffer* src = static_cast(&aSrc); + const TUint srcLen = src->Data().Length(); + TUint srcPos = src->Position(); + TUint dstPos = dst->Position(); + + const TUint8* srcPtr = src->Data().Ptr(); + TUint8* dstPtr = const_cast(dst->Data().Ptr() ); + TUint cachedSize = CachedSampleSize(); + + while (cachedSize + srcLen - srcPos >= iPcmFrameSize && dstMaxLen - dstPos >= iSbcFrameLength) + { + TPtrC8 srcDes(srcPtr + srcPos, iPcmFrameSize); + TPtr8 dstDes(dstPtr + dstPos, iSbcFrameLength); + + srcPos += EncodeFrameL(srcDes, dstDes); + dstPos += iSbcFrameLength; + cachedSize = 0; + } + + // check result + TCodecProcessResult result; + result.iStatus = TCodecProcessResult::EProcessComplete; + + if (dstMaxLen - dstPos >= iSbcFrameLength) // still enough dst buffer + { + result.iStatus = TCodecProcessResult::EDstNotFilled; + } + + // cach remaining src + if (CachedSampleSize() + srcLen - srcPos >= iPcmFrameSize) // still enough src + { + if (result.iStatus == TCodecProcessResult::EDstNotFilled) + { + User::Leave(KErrCorrupt); + } + else + { + result.iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + else if (srcLen - srcPos > 1) // remaining src less than one frame, cach it + { + srcPos += CachePcmSamplesL(*src, srcPos); + } + + // set new position for dst + dst->Data().SetLength(dstPos); + + // return result + result.iSrcBytesProcessed = srcPos - src->Position(); + result.iDstBytesAdded = dstPos - dst->Position(); + return result; + } + +/** +This function encodes one SBC frame with PCM16 audio source samples, and write processed +result to destination buffer. +@internalComponent +@param aSrc +Source buffer contains the PCM16 audio source samples +@param aDst +Destination buffer to contain the encoded sbc audio stream +@return the number of bytes the source has been processed +@leave if out of memory. +*/ +TUint CSBCEncoder::EncodeFrameL(const TDesC8& aSrc, TDes8& aDst) + { + if (!iSbcFrameEncoder) + { + iSbcFrameEncoder = CSBCFrameEncoder::NewL(); + iSbcFrameEncoder->Configure(iParameters); + } + + if (CachedSampleSize() > 0) + { // encode one frame with cached samples and src + TUint appendBytes = iPcmFrameSize - CachedSampleSize(); + // append src to cach to make up one frame + iPcmSampleCach->Des().Append(aSrc.Ptr(), appendBytes); + // encode cach + iSbcFrameEncoder->EncodeFrameL(*iPcmSampleCach, aDst); + // empty cach + iPcmSampleCach->Des().Zero(); + // return bytes src processed + return appendBytes; + } + else + { + // encode one frame with src only + iSbcFrameEncoder->EncodeFrameL(aSrc, aDst); + // return bytes src processed + return iPcmFrameSize; + } + } + +/** +This function caches any less than one frame remaining audio samples. +@internalComponent +@param aSrc +Source buffer contains the PCM16 audio source samples. +@param aSrcPos +Position from where the samples are cached. +@return the number of bytes the source has been cached +@leave if out of memory. +*/ +TUint CSBCEncoder::CachePcmSamplesL(const CMMFDataBuffer& aSrc, TUint aSrcPos) + { + if (!iPcmSampleCach) + { + iPcmSampleCach = HBufC8::NewL(iPcmFrameSize); + } + + const TUint8* pSrc = aSrc.Data().Ptr() + aSrcPos; + const TUint cachSize = (aSrc.Data().Length() - aSrcPos) & 0xfffe; // take even number + + iPcmSampleCach->Des().Append(pSrc, cachSize); + + return cachSize; + } + +/** +This function gets the size of the cach. +@internalComponent +@return the cached samples size +*/ +TUint CSBCEncoder::CachedSampleSize() + { + if (!iPcmSampleCach) + { + return 0; + } + return iPcmSampleCach->Des().Size(); + } + +/* ========================== class CSBCFrameEncoder ========================== */ + +/** +Constructor. +@internalComponent +*/ +CSBCFrameEncoder::CSBCFrameEncoder() + { + } + +/** +Destructor. +@internalComponent +*/ +CSBCFrameEncoder::~CSBCFrameEncoder() + { + } + +/** +Second phase constructor. +@internalComponent +*/ +void CSBCFrameEncoder::ConstructL() + { + } + +/** +This function creates a CSBCFrameEncoder object. +@internalComponent +@return pointer of the CSBCFrameEncoder object. +*/ +CSBCFrameEncoder* CSBCFrameEncoder::NewL() + { + CSBCFrameEncoder* self = new(ELeave) CSBCFrameEncoder(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/** +This function resets the analysis filter bank, this should be called everytime +when encoding a new sbc audio stream. +@internalComponent +*/ +void CSBCFrameEncoder::Reset() + { + const TUint8 numChannels = iParameters.Channels(); + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 channel = 0; channel < numChannels; channel++) + { + TInt16* analysisSamples = iAnalysisSamples[channel]; + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + *analysisSamples++ = 0; + } + } + } + +/** +This function sets the configuration for SBC Frame Encoder and resets the analysis filter bank. +@internalComponent +@param aParameters +This contains all the parameters to set +*/ +void CSBCFrameEncoder::Configure(const TSBCFrameParameters& aParameters) + { + iParameters = aParameters; + // has to call this whenever the configuration changed, this resets the Analyse Filter Bank + Reset(); + } + +/** +This function encodes one SBC frame with PCM16 source samples and output it to destination buffer. +@internalComponent +@param aSrc +Source buffer contains the source samples +@param aFrame +Destination buffer to contain the processed sbc audio stream +@leave if out of memory +*/ +void CSBCFrameEncoder::EncodeFrameL(const TDesC8& aSrc, TDes8& aFrame) + { + // encode frame + Analyse(aSrc); + CalcScaleFactors(); + JoinSubbands(); + CalcBitAllocation(); + Quantize(); + + // output frame + WriteFrameL(aFrame); + } + +/** +This function does the analysis filtering, the analysed samples are used to encode sbc subbands. +@internalComponent +@param aSrc +Source buffer contains the source samples +*/ +void CSBCFrameEncoder::Analyse(const TDesC8& aSrc) + { + const TUint8 channelMode = iParameters.ChannelMode(); + const TInt16* inputSamples = reinterpret_cast(aSrc.Ptr() ); + + if (channelMode == TSBCFrameParameters::EMono) + { + AnalyseMono(inputSamples); + } + else // two-channel modes + { + // two channel samples are interleavedly stored in the following order + // one left sample, one right sample, ... + AnalyseOneChannel(inputSamples, 0); + AnalyseOneChannel(inputSamples + 1, 1); + } + } + +/** +This function analyses audio samples for Mono and Dual Channel modes. +@internalComponent +@param aInputSamples +Array of source samples +*/ +void CSBCFrameEncoder::AnalyseMono(const TInt16 aInputSamples[]) + { + const TUint8 numSubbands = iParameters.Subbands(); + const TUint8 numBlocks = iParameters.BlockLength(); + + for (TUint8 block = 0; block < numBlocks; block++) + { + if (numSubbands == 4) + { + Analyse4Subbands(aInputSamples, block, 0); + } + else + { + Analyse8Subbands(aInputSamples, block, 0); + } + aInputSamples += numSubbands; + } + } + +/** +This function analyses audio samples for Stereo and Joint Stereo modes. +@internalComponent +@param aInputSamples +Array of source samples +@param aChannel +The channel number to be analysed +*/ +void CSBCFrameEncoder::AnalyseOneChannel(const TInt16 aInputSamples[], TUint8 aChannel) + { + const TUint8 numSubbands = iParameters.Subbands(); + const TUint8 numBlocks = iParameters.BlockLength(); + + TInt16 inputSamples[KSbcMaxSubbands]; + for (TUint8 block = 0; block < numBlocks; block++) + { + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + inputSamples[subband] = *aInputSamples; + aInputSamples += 2; // 1 left sample, 1 right sample, ... + } + + if (numSubbands == 4) + { + Analyse4Subbands(inputSamples, block, aChannel); + } + else + { + Analyse8Subbands(inputSamples, block, aChannel); + } + } + } + + +/** +This function analyses 4 subbands for sbc frame with 4 subbands. +@internalComponent +@param aInputSamples +Array of source samples +@param aBlock +The block number to be analysed +@param aChannel +The channel number to be analysed +*/ +void CSBCFrameEncoder::Analyse4Subbands(const TInt16 aInputSamples[], TUint8 aBlock, TUint8 aChannel) + { + // for easier understanding, this code is a copy from the A2DP spec, + // all the naming are kept. + TInt i = 0; + TInt k = 0; + TInt16* X = iAnalysisSamples[aChannel]; // 40 analyse samples + + for (i = 39; i >= 4; i--) + { + X[i] = X[i - 4]; + } + for (i = 3; i >= 0; i--) + { + X[i] = *aInputSamples++; + } + + TInt64 Y[8]; // partial calculation, see Figure 12.5 in A2DP spec for detail + for (i = 0; i < 8; i++) + { + TInt64 sum = 0; + for (k = 0; k <= 4; k++) + { + // for some strange reason, RVCT is not happy about converting + // TInt16 to TInt64 in the equation directly. + const TInt64 sample = X[i + (k << 3)]; + sum += KSBCProto4[i + (k << 3)] * sample; + } + Y[i] = sum >> (KSBCProtoBitsShift - 10); + } + + TInt32* outputSamples = iOutputSamples[aBlock][aChannel]; + for (i = 0; i < 4; i++) + { + const TInt32* M = KSBCAnalysisMatrix4[i]; + TInt64 sum = 0; + for (k = 0; k < 8; k++) + { + sum += M[k] * Y[k]; + } + sum >>= (KSBCAnalysisMatrixBitsShift + 9); + sum = (sum >> 1) + (sum & 0x1); + outputSamples[i] = static_cast(sum); + } + } + +/** +This function analyses 8 subbands for sbc frame with 8 subbands. +@internalComponent +@param aInputSamples +Array of source samples +@param aBlock +The block number to be analysed +@param aChannel +The channel number to be analysed +*/ +void CSBCFrameEncoder::Analyse8Subbands(const TInt16 aInputSamples[], TUint8 aBlock, TUint8 aChannel) + { + // for easier understanding, this code is a copy from the A2DP spec, + // all the naming are kept. + TInt i = 0; + TInt k = 0; + TInt16* X = iAnalysisSamples[aChannel]; // 80 analysis samples + + for (i = 79; i >= 8; i--) + { + X[i] = X[i - 8]; + } + for (i = 7; i >= 0; i--) + { + X[i] = *aInputSamples++; + } + + TInt64 Y[16]; // partial calculation, see Figure 12.5 in A2DP spec for detail + for (i = 0; i < 16; i++) + { + TInt64 sum = 0; + for (k = 0; k <= 4; k++) + { + // for some strange reason, RVCT is not happy about converting + // TInt16 to TInt64 in the equation directly. + const TInt64 sample = X[i + (k << 4)]; + sum += KSBCProto8[i + (k << 4)] * sample; + } + Y[i] = sum >> (KSBCProtoBitsShift - 10); + } + + TInt32* outputSamples = iOutputSamples[aBlock][aChannel]; + for (i = 0; i < 8; i++) + { + const TInt32* M = KSBCAnalysisMatrix8[i]; + TInt64 sum = 0; + for (k = 0; k < 16; k++) + { + sum += M[k] * Y[k]; + } + sum >>= (KSBCAnalysisMatrixBitsShift + 9); + sum = (sum >> 1) + (sum & 0x1); + outputSamples[i] = static_cast(sum); + } + } + +/** +This function calculates the scale factor for one sample. +@internalComponent +@param aSample +A sample +@return scale factor of thie sample +*/ +static inline TUint8 ScaleFactor(TInt32 aSample) + { + if (aSample < 0) + aSample = -aSample; + + // top bit of the sample is sign bit, ignore it + // start from the second high bit + TUint32 mask = 0x40000000; + for (TInt8 bit = 30; bit > 0; bit--) + { + if (aSample & mask) + { + return bit; + } + mask >>= 1; + } + return 0; + } + +/** +This function calculates the scale factors for all samples in one sbc frame. +@internalComponent +*/ +void CSBCFrameEncoder::CalcScaleFactors() + { + const TUint8 numBlocks = iParameters.BlockLength(); + const TUint8 numChannels = iParameters.Channels(); + const TUint8 numSubbands = iParameters.Subbands(); + + TInt32 maxSubbandValues[KSbcMaxChannels][KSbcMaxSubbands]; + + // find all maximum values of each subband + for (TUint8 block = 0; block < numBlocks; block++) + { + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TInt32* samples = iOutputSamples[block][channel]; + TInt32* maxValues = maxSubbandValues[channel]; + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (block == 0 || Abs(*samples) > *maxValues) + { + *maxValues = Abs(*samples); + } + samples++; + maxValues++; + } + } + } + + // calculate scale factors for all subband + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TInt32* maxValues = maxSubbandValues[channel]; + TUint8* scale = iScaleFactors[channel]; + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + *scale++ = ScaleFactor(*maxValues++); + } + } + } + +/** +This function joins two subband samples for Joint Stereo mode. +@internalComponent +@param aLeftSample +Left channel subband sample +@param aRightSample +Right channel subband sample +*/ +static inline void JoinTwoSamples(TInt32& aLeftSample, TInt32& aRightSample) + { + aLeftSample = (aLeftSample + aRightSample) >> 1; // L1 = (L0 + R0) / 2 + aRightSample = aLeftSample - aRightSample; // R1 = L1 - R0 = (L0 - R0) / 2 + } + +/** +This function sets the join flats for all subbands for one frame, +and joins those subbands if needed for this frame. +@internalComponent +*/ +void CSBCFrameEncoder::JoinSubbands() + { + if (iParameters.ChannelMode() != TSBCFrameParameters::EJointStereo) + { + return; + } + + const TUint8 numBlocks = iParameters.BlockLength(); + const TUint8 numSubbands = iParameters.Subbands(); + + TInt32 maxJoinValues[2][KSbcMaxSubbands - 1]; // 2 channels + + // find maximum join subband values + for (TUint8 block = 0; block < numBlocks; block++) + { + const TInt32* leftSamples = iOutputSamples[block][0]; + const TInt32* rightSamples = iOutputSamples[block][1]; + + TInt32* maxLeftJoin = maxJoinValues[0]; + TInt32* maxRightJoin = maxJoinValues[1]; + + for (TUint8 subband = 0; subband < numSubbands - 1; subband++) + { + TInt32 leftJoin = *leftSamples++; + TInt32 rightJoin = *rightSamples++; + + JoinTwoSamples(leftJoin, rightJoin); + + if (block == 0 || Abs(leftJoin) > *maxLeftJoin) + { + *maxLeftJoin = Abs(leftJoin); + } + if (block == 0 || Abs(rightJoin) > *maxRightJoin) + { + *maxRightJoin = Abs(rightJoin); + } + maxLeftJoin++; + maxRightJoin++; + } + } + + // calculate scale factors for all join subbands + const TInt32* maxLeftJoin = maxJoinValues[0]; + const TInt32* maxRightJoin = maxJoinValues[1]; + + TUint8* leftScale = iScaleFactors[0]; + TUint8* rightScale = iScaleFactors[1]; + + for (TUint8 subband = 0; subband < numSubbands - 1; subband++) + { + const TUint8 leftJoinScale = ScaleFactor(*maxLeftJoin++); + const TUint8 rightJoinScale = ScaleFactor(*maxRightJoin++); + + iJoin[subband] = 0; + if (leftJoinScale + rightJoinScale < *leftScale + *rightScale) + { + iJoin[subband] = 1; + *leftScale = leftJoinScale; + *rightScale = rightJoinScale; + } + leftScale++; + rightScale++; + } + iJoin[numSubbands - 1] = 0; // join[subband - 1] is always 0 + + // now do the joining job + DoJoinSubbands(); + } + +/** +This function joins all subbands if needed for this frame. +@internalComponent +*/ +void CSBCFrameEncoder::DoJoinSubbands() + { + const TUint8 numBlocks = iParameters.BlockLength(); + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 block = 0; block < numBlocks; block++) + { + TInt32* leftSamples = iOutputSamples[block][0]; + TInt32* rightSamples = iOutputSamples[block][1]; + + for (TUint8 subband = 0; subband < numSubbands - 1; subband++) + { + if (iJoin[subband]) + { + JoinTwoSamples(*leftSamples, *rightSamples); + } + leftSamples++; + rightSamples++; + } + } + } + +/** +This function quantizes one sample according to: + sample = (sample / scale + 1.0) * level / 2.0 + scale = 2 ^ (scale_factor + 1) + level = (2 ^ bits) - 1 +@internalComponent +@param aSample +A sample to be quantized. +@param aScaleFactor +The scale factor value. +@param aBits +The number of bits for this sample +@panic if quantized sample overflow +*/ +static void QuantizeOneSample(TInt32& aSample, TUint8 aScaleFactor, TUint8 aBits) + { + // output = sample + scale + TInt64 temp = (TInt)aSample + (0x1 << (aScaleFactor + 1) ); + // output = (sample + scale) * level / scale + temp = ( (temp << aBits) - temp) >> (aScaleFactor + 2); + + aSample = static_cast(temp); + + // check bounce + __ASSERT_DEBUG(aSample >= 0 && aSample <= (TInt32)0xffff, Panic(ESbcSampleOverflow) ); + // extra code to handle exception for URel version + if (aSample < 0) + { + aSample = 0; + } + if (aSample > (TInt32)0xffff) + { + aSample = (TInt32)0xffff; + } + } + +/** +This function quantizes all samples in one sbc frame. +@internalComponent +*/ +void CSBCFrameEncoder::Quantize() + { + const TUint8 numBlocks = iParameters.BlockLength(); + const TUint8 numChannels = iParameters.Channels(); + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 block = 0; block < numBlocks; block++) + { + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TUint8* bits = iBits[channel]; + const TUint8* scale = iScaleFactors[channel]; + TInt32* samples = iOutputSamples[block][channel]; + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + QuantizeOneSample(*samples++, *scale++, *bits++); + } + } + } + } + +/** +This function calculates bit allocation for all samples in one sbc frame using scale factors. +@internalComponent +*/ +void CSBCFrameEncoder::CalcBitAllocation() + { + switch (iParameters.ChannelMode()) + { + case TSBCFrameParameters::EMono: + case TSBCFrameParameters::EDualChannel: + CalcBitAllocIndependent(); + break; + + case TSBCFrameParameters::EStereo: + case TSBCFrameParameters::EJointStereo: + CalcBitAllocCombined(); + break; + } + } + +/** +This function calculates bit allocation for one channel for Mono and Dual Channel. +@internalComponent +*/ +void CSBCFrameEncoder::CalcBitAllocIndependent() + { + const TUint8 numChannels = iParameters.Channels(); + for (TUint8 channel = 0; channel < numChannels; channel++) + { + TInt8 bitneed[KSbcMaxSubbands]; + CalcBitneedIndependent(bitneed, iScaleFactors[channel]); + DistributeBitsIndependent(bitneed, iBits[channel]); + } + } + +/** +This function calculates bitneed for one channel for Mono and Dual Channel. +@internalComponent +@param aBitneed +Array of bitneed to hold the result +@param aScaleFactors +The scale factors used for this calculation +*/ +void CSBCFrameEncoder::CalcBitneedIndependent(TInt8 aBitneed[], const TUint8 aScaleFactors[]) + { + // see A2DP spec for reference + const TUint8 numSubbands = iParameters.Subbands(); + + if (iParameters.AllocationMethod() == TSBCFrameParameters::ESNR) + { + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + *aBitneed++ = *aScaleFactors++; + } + } + else // Loudness + { + const TInt8* offset = NULL; + if (numSubbands == 4) + { + offset = KSBCOffset4[iParameters.SamplingFrequencyEnum()]; + } + else + { + offset = KSBCOffset8[iParameters.SamplingFrequencyEnum()]; + } + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (*aScaleFactors == 0) + { + *aBitneed = -5; + } + else if ( (*aBitneed = static_cast(*aScaleFactors - *offset) ) > 0) + { + (*aBitneed) >>= 1; + } + aScaleFactors++; + aBitneed++; + offset++; + } + } + } + +/** +This function gets the maximum bitneed in one channel for Mono and Dual Channel. +@internalComponent +@param aBitneed +Array of bitneed. +*/ +TInt8 CSBCFrameEncoder::MaxBitneedIndependent(const TInt8 aBitneed[]) + { + // see A2DP spec for reference + TInt8 maxBitneed = 0; + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (*aBitneed > maxBitneed) + { + maxBitneed = *aBitneed; + } + aBitneed++; + } + + return maxBitneed; + } + +/** +This function calculates how many bitslices fit into the bitpool for one channel +for Mono and Dual Channel. +@internalComponent +@param aBitneed +Array of bitneed. +@param aBitCount +The bit count, counts how many bits used +@return the number of bitslices +*/ +TInt8 CSBCFrameEncoder::CalcBitSlicesIndependent(const TInt8 aBitneed[], TInt& aBitCount) + { + // see A2DP spec for reference + aBitCount = 0; + TInt8 sliceCount = 0; + TInt8 bitSlices = static_cast(MaxBitneedIndependent(aBitneed) + 1); + + const TUint8 numSubbands = iParameters.Subbands(); + const TUint8 bitpool = iParameters.Bitpool(); + + do { + bitSlices--; + aBitCount += sliceCount; + sliceCount = 0; + + const TInt8* bitneed = aBitneed; + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (*bitneed > bitSlices + 1 && *bitneed < bitSlices + 16) + { + sliceCount++; + } + else if (*bitneed == bitSlices + 1) + { + sliceCount += 2; + } + bitneed++; + } + } while (aBitCount + sliceCount < bitpool); + + if (aBitCount + sliceCount == bitpool) + { + aBitCount += sliceCount; + bitSlices--; + } + + return bitSlices; + } + +/** +This function distributes number of bits to each subband for all samples +for Mono and Dual Channel. +@internalComponent +@param aBitneed +Array of bitneed. +@param aBits +Bits allocated for each subbands +*/ +void CSBCFrameEncoder::DistributeBitsIndependent(const TInt8 aBitneed[], TUint8 aBits[]) + { + // see A2DP spec for reference + TInt bitCount = 0; + TInt8 bitSlices = CalcBitSlicesIndependent(aBitneed, bitCount); + + const TUint8 numSubbands = iParameters.Subbands(); + + // distribute bits until the last bitslice is reached + TUint8 subband = 0; + for (; subband < numSubbands; subband++) + { + if (aBitneed[subband] < bitSlices + 2) + { + aBits[subband] = 0; + } + else + { + aBits[subband] = static_cast(Min(aBitneed[subband] - bitSlices, 16) ); + } + } + + // distribute the remaining bits + const TUint8 bitpool = iParameters.Bitpool(); + + subband = 0; + while (bitCount < bitpool && subband < numSubbands) + { + if (aBits[subband] >= 2 && aBits[subband] < 16) + { + aBits[subband]++; + bitCount++; + } + else if (aBitneed[subband] == bitSlices + 1 && bitpool > bitCount + 1) + { + aBits[subband] += 2; // ? bits[ch][sb] = 2 in A2DP spec, a bug in the spec? + bitCount += 2; + } + subband++; + } + + subband = 0; + while (bitCount < bitpool && subband < numSubbands) + { + if (aBits[subband] < 16) + { + aBits[subband]++; + bitCount++; + } + subband++; + } + } + +/** +This function calculates bit allocation for both channels for Stereo and Joint Stereo. +@internalComponent +*/ +void CSBCFrameEncoder::CalcBitAllocCombined() + { + TInt8 bitneed[2][KSbcMaxSubbands]; + + CalcBitneedCombined(bitneed); + DistributeBitsCombined(bitneed); + } + +/** +This function calculates bitneed for both channels for Stereo and Joint Stereo. +@internalComponent +@param aBitneed +Array of bitneed to hold the result +*/ +void CSBCFrameEncoder::CalcBitneedCombined(TInt8 aBitneed[][KSbcMaxSubbands]) + { + // see A2DP spec for reference + const TUint8 numSubbands = iParameters.Subbands(); + + if (iParameters.AllocationMethod() == TSBCFrameParameters::ESNR) + { + for (TInt8 channel = 0; channel < 2; channel++) + { + const TUint8* scaleFactor = iScaleFactors[channel]; + TInt8* bitneed = aBitneed[channel]; + for (TInt8 subband = 0; subband < numSubbands; subband++) + { + *bitneed++ = *scaleFactor++; + } + } + } + else // Loudness + { + const TInt8* offset = NULL; + if (numSubbands == 4) + { + offset = KSBCOffset4[iParameters.SamplingFrequencyEnum()]; + } + else + { + offset = KSBCOffset8[iParameters.SamplingFrequencyEnum()]; + } + + for (TInt8 channel = 0; channel < 2; channel++) + { + const TUint8* scaleFactor = iScaleFactors[channel]; + TInt8* bitneed = aBitneed[channel]; + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (*scaleFactor == 0) + { + *bitneed = -5; + } + else if ( (*bitneed = static_cast(*scaleFactor - offset[subband]) ) > 0) + { + (*bitneed) >>= 1; + } + scaleFactor++; + bitneed++; + } // for subband + } // for channel + } + } + +/** +This function gets the maximum bitneed of both channels subbands for Stereo and Joint Stereo. +@internalComponent +@param aBitneed +Array of bitneed. +*/ +TInt8 CSBCFrameEncoder::MaxBitneedCombined(const TInt8 aBitneed[][KSbcMaxSubbands]) + { + // see A2DP spec for reference + TInt8 maxBitneed = 0; + const TUint8 numSubbands = iParameters.Subbands(); + + for (TInt8 channel = 0; channel < 2; channel++) + { + const TInt8* bitneed = aBitneed[channel]; + for (TInt8 subband = 0; subband < numSubbands; subband++) + { + if (*bitneed > maxBitneed) + { + maxBitneed = *bitneed; + } + bitneed++; + } + } + return maxBitneed; + } + +/** +This function calculates how many bitslices fit into the bitpool for both channels +for Stereo and Joint Stereo. +@internalComponent +@param aBitneed +Array of bitneed. +@param aBitCount +The bit count, counts how many bits used +@return the number of bitslices +*/ +TInt8 CSBCFrameEncoder::CalcBitSlicesCombined(const TInt8 aBitneed[][KSbcMaxSubbands], TInt& aBitCount) + { + // see A2DP spec for reference + aBitCount = 0; + TInt8 sliceCount = 0; + TInt8 bitSlices = static_cast(MaxBitneedCombined(aBitneed) + 1); + + const TUint8 numSubbands = iParameters.Subbands(); + const TUint8 bitpool = iParameters.Bitpool(); + + do { + bitSlices--; + aBitCount += sliceCount; + sliceCount = 0; + + for (TInt8 channel = 0; channel < 2; channel++) + { + const TInt8* bitneed = aBitneed[channel]; + for (TInt8 subband = 0; subband < numSubbands; subband++) + { + if (*bitneed > bitSlices + 1 && *bitneed < bitSlices + 16) + { + sliceCount++; + } + else if (*bitneed == bitSlices + 1) + { + sliceCount += 2; + } + bitneed++; + } + } + } while (aBitCount + sliceCount < bitpool); + + if (aBitCount + sliceCount == bitpool) + { + aBitCount += sliceCount; + bitSlices--; + } + + return bitSlices; + } + +/** +This function distributes number of bits to each subband for all samples +for Stereo and Joint Stereo. +@internalComponent +@param aBitneed +Array of bitneed. +*/ +void CSBCFrameEncoder::DistributeBitsCombined(const TInt8 aBitneed[][KSbcMaxSubbands]) + { + // see A2DP spec for reference + TInt bitCount = 0; + TInt bitSlices = CalcBitSlicesCombined(aBitneed, bitCount); + + const TUint8 numSubbands = iParameters.Subbands(); + const TUint8 bitpool = iParameters.Bitpool(); + + // distribute bits until the last bitslice is reached + TInt8 channel = 0; + TInt8 subband = 0; + for (; channel < 2; channel++) + { + const TInt8* bitneed = aBitneed[channel]; + TUint8* bits = iBits[channel]; + for (subband = 0; subband < numSubbands; subband++) + { + if (*bitneed < bitSlices + 2) + { + *bits = 0; + } + else + { + *bits = static_cast(Min(*bitneed - bitSlices, 16) ); + } + bitneed++; + bits++; + } + } + + // distribute the remaining bits + channel = 0; + subband = 0; + while (bitCount < bitpool && subband < numSubbands) + { + TUint8& bits = iBits[channel][subband]; + if (bits >= 2 && bits < 16) + { + bits++; + bitCount++; + } + else if (aBitneed[channel][subband] == bitSlices + 1 && bitpool > bitCount + 1) + { + bits += 2; // ? bits[ch][sb] = 2 in A2DP spec, a bug in the spec? + bitCount += 2; + } + + if (channel == 1) + { + channel = 0; + subband++; + } + else + { + channel = 1; + } + } + + channel = 0; + subband = 0; + while (bitCount < bitpool && subband < numSubbands) + { + TUint8& bits = iBits[channel][subband]; + if (bits < 16) + { + bits++; + bitCount++; + } + + if (channel == 1) + { + channel = 0 ; + subband++; + } + else + { + channel = 1; + } + } + } + +/** +This function calculates the CRC code for sbc frame. +@internalComponent +@return sbc CRC value +*/ +TUint8 CSBCFrameEncoder::CalcCRC() + { + CSbcCRCCalculator crc; + + crc.InputByte(iParameters.Parameters() ); // 5 parameters + crc.InputByte(iParameters.Bitpool() ); // bitpool + + // join[] & RFA bits + const TUint8 numSubbands = iParameters.Subbands(); + if (iParameters.ChannelMode() == TSBCFrameParameters::EJointStereo) + { + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + crc.InputBit(iJoin[subband]); + } + } + + // scale factors + const TUint8 numChannels = iParameters.Channels(); + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TUint8* scaleFactors = iScaleFactors[channel]; + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + crc.InputBits(4, *scaleFactors++); + } + } + + return crc.ShiftRegister(); + } + +/** +This function outputs the encoded sbc frame into the destination buffer. +@internalComponent +@param aFrame +The destination buffer +@leave if out of memory +*/ +void CSBCFrameEncoder::WriteFrameL(TDes8& aFrame) + { + CBitStreamParser* parser = CBitStreamParser::NewLC(aFrame); + + WriteHeader(*parser); + WriteScaleFactors(*parser); + WriteData(*parser); + WritePaddingL(*parser); + + CleanupStack::PopAndDestroy(parser); + } + +/** +This function writes the sbc frame header into the destination buffer. +@internalComponent +@param aParser +The bit stream parser which manipulates the destination buffer bit stream +*/ +void CSBCFrameEncoder::WriteHeader(CBitStreamParser& aParser) + { + // syncword + aParser.WriteByte(KSBCFrameSyncWord); + // sampling frequency, blocklength, channel mode, allocatin method, subbands + aParser.WriteByte(iParameters.Parameters() ); + // bitpool + aParser.WriteByte(iParameters.Bitpool() ); + // crc check + aParser.WriteByte(CalcCRC() ); + + if (iParameters.ChannelMode() == TSBCFrameParameters::EJointStereo) + { + // join[] & RFA + const TUint8 numSubbands = iParameters.Subbands(); + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + aParser.WriteBits(1, iJoin[subband]); + } + } + } + +/** +This function writes the sbc frame scale factors into the destination buffer. +@internalComponent +@param aParser +The bit stream parser which manipulates the destination buffer bit stream +*/ +void CSBCFrameEncoder::WriteScaleFactors(CBitStreamParser& aParser) + { + const TUint8 numChannels = iParameters.Channels(); + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TUint8* scaleFactors = iScaleFactors[channel]; + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + aParser.WriteBits(4, *scaleFactors++); + } + } + } + +/** +This function writes one sbc subband sample into the destination buffer. +@internalComponent +@param aParser +The bit stream parser which manipulates the destination buffer bit stream +@param aBits +The number of bits to write +@param aSample +The sample value to write +*/ +static void WriteOneSample(CBitStreamParser& aParser, TUint8 aBits, TInt32 aSample) + { + if (aBits >= 8) + { + aBits -= 8; + aParser.WriteByte(static_cast( (aSample >> aBits) & 0xff) ); + } + if (aBits > 0) + { + aParser.WriteBits(aBits, static_cast(aSample & 0xff) ); + } + } + +/** +This function writes the sbc frame data into the destination buffer. +@internalComponent +@param aParser +The bit stream parser which manipulates the destination buffer bit stream +*/ +void CSBCFrameEncoder::WriteData(CBitStreamParser& aParser) + { + const TUint8 numBlocks = iParameters.BlockLength(); + const TUint8 numChannels = iParameters.Channels(); + const TUint8 numSubbands = iParameters.Subbands(); + + for (TUint8 block = 0; block < numBlocks; block++) + { + for (TUint8 channel = 0; channel < numChannels; channel++) + { + const TUint8* bits = iBits[channel]; + const TInt32* samples = iOutputSamples[block][channel]; + + for (TUint8 subband = 0; subband < numSubbands; subband++) + { + if (*bits > 0) + { + WriteOneSample(aParser, *bits, *samples); + } + bits++; + samples++; + } + } + } + } + +/** +This function writes the sbc frame padding bits into the destination buffer. +@internalComponent +@param aParser +The bit stream parser which manipulates the destination buffer bit stream +@panic if output frame length is not the same as expected +*/ +void CSBCFrameEncoder::WritePaddingL(CBitStreamParser& aParser) + { + TUint byteOffset; + TUint8 bitOffset; + + aParser.Position(byteOffset, bitOffset); + + if (bitOffset != 0) + { + aParser.WriteBits(8 - bitOffset, 0); + byteOffset++; + } + + if (byteOffset != iParameters.CalcFrameLength() ) + { + User::Leave(KErrCorrupt); + } + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/SBCEncoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/SBCEncoder.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,182 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __SBCENCODER_H__ +#define __SBCENCODER_H__ + +#include +#include + +#include "SBCFrameParameters.h" + +const TUint8 KSbcMaxBlocks = 16; +const TUint8 KSbcMaxChannels = 2; +const TUint8 KSbcMaxSubbands = 8; + +/** +This class is for manipulating (reading/writing) raw bit stream. +It is used in sbc encoder for generating sbc frame bit stream. +@internalComponent +*/ +class CBitStreamParser : public CBase + { +public: + static CBitStreamParser* NewLC(TDes8& aBitStream); + void Reset(); + + /** relative position */ + TUint8 ReadBits(TInt aBitsToRead); + void WriteBits(TInt aBitsToWrite, TUint8 aBitsValue); + + inline TUint8 ReadByte(); + inline void WriteByte(TUint8 aByteValue); + + /** absolute position */ + inline void SetPosition(TUint aByteOffset, TUint8 aBitOffset); + inline void Position(TUint& aByteOffset, TUint8& aBitOffset) const; + +private: + CBitStreamParser(TDes8& aBitStream); + ~CBitStreamParser(); + + void ConstructL(); + +private: + TDes8& iBitStream; + TUint8* iPtr; + TUint iByteOffset; + TUint8 iBitOffset; + }; + +/** +This class is for checking and generating SBC CRC code. +It is used in sbc encoder for generating SBC CRC check number. +@internalComponent +*/ +class CSbcCRCCalculator : public CBase + { +public: + CSbcCRCCalculator(); + + void Reset(); + void InputBit(TUint8 aBit); + void InputBits(TUint8 aBits, TUint8 aValue); + void InputByte(TUint8 aByte); + + TUint8 ShiftRegister(); + +private: + TUint8 iShiftRegister; + }; + +/** +This class is for encoding one SBC frame +@internalComponent +*/ +class CSBCFrameEncoder : public CBase + { +public: + static CSBCFrameEncoder* NewL(); + ~CSBCFrameEncoder(); + void EncodeFrameL(const TDesC8& aSrc, TDes8& aFrame); + void Configure(const TSBCFrameParameters& aParameters); + void Reset(); + +private: + CSBCFrameEncoder(); + void ConstructL(); + + /** encode frame */ + void Analyse(const TDesC8& aSrc); + void CalcScaleFactors(); + void JoinSubbands(); + void CalcBitAllocation(); + void Quantize(); + + void AnalyseMono(const TInt16 aInputSamples[]); + void AnalyseOneChannel(const TInt16 aInputSamples[], TUint8 aChannel); + void Analyse4Subbands(const TInt16 aInputSamples[], TUint8 aBlock, TUint8 aChannel); + void Analyse8Subbands(const TInt16 aInputSamples[], TUint8 aBlock, TUint8 aChannel); + + void DoJoinSubbands(); + + void CalcBitAllocIndependent(); + void CalcBitneedIndependent(TInt8 aBitneed[], const TUint8 aScaleFactors[]); + TInt8 MaxBitneedIndependent(const TInt8 aBitneed[]); + TInt8 CalcBitSlicesIndependent(const TInt8 aBitneed[], TInt& aBitCount); + void DistributeBitsIndependent(const TInt8 aBitneed[], TUint8 aBits[]); + + void CalcBitAllocCombined(); + void CalcBitneedCombined(TInt8 aBitneed[][KSbcMaxSubbands]); + TInt8 MaxBitneedCombined(const TInt8 aBitneed[][KSbcMaxSubbands]); + TInt8 CalcBitSlicesCombined(const TInt8 aBitneed[][KSbcMaxSubbands], TInt& aBitCount); + void DistributeBitsCombined(const TInt8 aBitneed[][KSbcMaxSubbands]); + + TUint8 CalcCRC(); + + /** writing result back */ + void WriteFrameL(TDes8& aFrame); + void WriteHeader(CBitStreamParser& aParser); + void WriteScaleFactors(CBitStreamParser& aParser); + void WriteData(CBitStreamParser& aParser); + void WritePaddingL(CBitStreamParser& aParser); + +private: + /** input parameters, set before encode */ + TSBCFrameParameters iParameters; + + TInt16 iAnalysisSamples[2][KSbcMaxSubbands * 10]; + TUint8 iScaleFactors[2][KSbcMaxSubbands]; + TUint8 iBits[2][KSbcMaxSubbands]; + TInt32 iOutputSamples[KSbcMaxBlocks][2][KSbcMaxSubbands]; + TUint8 iJoin[KSbcMaxSubbands]; + }; + +/** +This class is for encoding one SBC frame +@internalComponent +*/ +class CSBCEncoder : public CMMFCodec + { +public: + static CMMFCodec* NewL(TAny* aInitParams); + virtual ~CSBCEncoder(); + void ConfigureL(TUid aConfigType, const TDesC8& aConfigData); + TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst); + +private: + CSBCEncoder(); + void ConstructL(TAny* aInitParams); + void ResetL(); + + TUint EncodeFrameL(const TDesC8& aSrc, TDes8& aDst); + TUint CachePcmSamplesL(const CMMFDataBuffer& aSrc, TUint aSrcPos); + TUint CachedSampleSize(); + +private: + /** input parameters, set before encode */ + TSBCFrameParameters iParameters; + TUint iPcmFrameSize; + + /** CSBCFrameEncoder encodes each frame */ + CSBCFrameEncoder* iSbcFrameEncoder; + TUint iSbcFrameLength; + + /** pcm audio sample cach */ + HBufC8* iPcmSampleCach; + }; + +#endif // __SBCENCODER_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/codec/sbcencoder/SBCFrameParameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/codec/sbcencoder/SBCFrameParameters.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,588 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __SBCFRAMEPARAMETERS_H__ +#define __SBCFRAMEPARAMETERS_H__ + +/** +This class contains 6 SBC frame parameters: sampling frequency, block length, +channel mode, allocation mode, subbands and bitpool. It can validate all the +parameters, calculate frame length and bit rate. +@internalComponent +*/ +class TSBCFrameParameters + { +public: + /** + This enum list all the possible sampling frequency settings + */ + enum TSamplingFrequency + { + /** + sampling frequency is 16000 Hz + */ + E16000Hz = 0, + /** + sampling frequency is 32000 Hz + */ + E32000Hz, + /** + sampling frequency is 44100 Hz + */ + E44100Hz, + /** + sampling frequency is 48000 Hz + */ + E48000Hz + }; + + /** + This enum list all the possible block length settings + */ + enum TBlockLength + { + /** + block length is 4, one frame contains 4 blocks of audio samples + */ + E4Blocks = 0, + /** + block length is 8, one frame contains 8 blocks of audio samples + */ + E8Blocks, + /** + block length is 12, one frame contains 12 blocks of audio samples + */ + E12Blocks, + /** + block length is 16, one frame contains 16 blocks of audio samples + */ + E16Blocks + }; + + /** + This enum list all the possible channel mode settings + */ + enum TChannelMode + { + /** + channel mode is Mono, in this mode, + only one channel contains audio samples. + */ + EMono = 0, + /** + channel mode is Dual Channel, in this mode, + it contains two seperate mono audio samples. + */ + EDualChannel, + /** + channel mode is Stereo, in this mode, + it contains stereo audio samples. + */ + EStereo, + /** + channel mode is Joint Stereo, in this mode, + the left channel stores half of sum of both channels, + the right channel stores half of difference of both channels. + */ + EJointStereo + }; + + /** + This enum list all the possible allocation method settings + */ + enum TAllocationMethod + { + /** + allocation method is Loudness, in this mode, + the bit allocation calculation uses Table offset4 or offset8 as well as scale factors + */ + ELoudness = 0, + /** + allocation method is SNR, in this mode, + bit allocation only uses scale factors + */ + ESNR + }; + + /** + This enum list all the possible subbands settings + */ + enum TSubbands + { + /** + subbands is 4, each channel contains 4 subbands in each block, + each subband contains one sample + */ + E4Subbands = 0, + /** + subbands is 8, each channel contains 8 subbands in each block, + each subband contains one sample + */ + E8Subbands + }; + +public: + inline TSBCFrameParameters(); + + inline void Reset(); + + inline TUint8 SamplingFrequencyEnum() const; + inline TUint SamplingFrequencyHz() const; + inline void SetSamplingFrequency(TSamplingFrequency aSamplingFrequency); + + inline TUint8 BlockLength() const; + inline void SetBlockLength(TBlockLength aBlockLength); + + inline TUint8 ChannelMode() const; + inline TUint8 Channels() const; + inline void SetChannelMode(TChannelMode aChannelMode); + + inline TUint8 AllocationMethod() const; + inline void SetAllocationMethod(TAllocationMethod aAllocationMethod); + + inline TUint8 SubbandsEnum() const; + inline TUint8 Subbands() const; + inline void SetSubbands(TSubbands aSubbands); + + inline TUint8 Bitpool() const; + inline void SetBitpool(TUint8 aBitpool); + + inline TUint8 Parameters() const; + inline TInt Validate() const; + + inline TUint CalcFrameLength() const; + inline TUint CalcBitRate(TUint aFrameLength) const; + +private: + TUint8 iParameters; + TUint8 iBitpool; + }; + +/** +The minimum SBC bitpool value is 2 +*/ +const TUint8 KSBCMinBitpoolValue = 2; +/** +The maximum SBC bitpool value is 250 +*/ +const TUint8 KSBCMaxBitpoolValue = 250; + +/** +The sampling frequency bits mask is 0b11, 2 bits +*/ +const TUint8 KSBCSampFreqBitsMask = 0x3; +/** +The bit offset of sampling frequency field in TSBCFrameParameters::iParameters is 6 +*/ +const TUint8 KSBCSampFreqBitOffset = 6; + +/** +The block length bits mask is 0b11, 2 bits +*/ +const TUint8 KSBCBlckLengBitsMask = 0x3; +/** +The bit offset of block length field in TSBCFrameParameters::iParameters is 4 +*/ +const TUint8 KSBCBlckLengBitOffset = 4; + +/** +The block length bits mask is 0b11, 2 bits +*/ +const TUint8 KSBCChnlModeBitsMask = 0x3; +/** +The bit offset of block length field in TSBCFrameParameters::iParameters is 2 +*/ +const TUint8 KSBCChnlModeBitOffset = 2; + +/** +The block length bits mask is 0b01, 1 bit +*/ +const TUint8 KSBCAllcMthdBitsMask = 0x1; +/** +The bit offset of block length field in TSBCFrameParameters::iParameters is 1 +*/ +const TUint8 KSBCAllcMthdBitOffset = 1; + +/** +The block length bits mask is 0b01, 1 bit +*/ +const TUint8 KSBCSubbandsBitsMask = 0x1; +/** +The bit offset of block length field in TSBCFrameParameters::iParameters is 0 +*/ +const TUint8 KSBCSubbandsBitOffset = 0; + +/** +Constructor +@internalComponent +*/ +inline TSBCFrameParameters::TSBCFrameParameters() : iParameters(0), iBitpool(0) + { + } + +/** +This function reset all the parameters +@internalComponent +*/ +inline void TSBCFrameParameters::Reset() + { + iParameters = 0; + iBitpool = 0; + } + +/** +This function gets the sampling frequency enum value +@internalComponent +@return enum value of sampling frequency +*/ +inline TUint8 TSBCFrameParameters::SamplingFrequencyEnum() const + { + return static_cast( (iParameters >> KSBCSampFreqBitOffset) & KSBCSampFreqBitsMask); + } + +/** +This function gets the sampling frequency value in Hz +@internalComponent +@return samplinng frequency value in Hz +*/ +inline TUint TSBCFrameParameters::SamplingFrequencyHz() const + { + switch (SamplingFrequencyEnum() ) + { + case E16000Hz: + return 16000; + + case E32000Hz: + return 32000; + + case E44100Hz: + return 44100; + + case E48000Hz: + return 48000; + } + return 0; + } + +/** +This function sets the sampling frequency value +@internalComponent +@param aSampFreq +New sampling frequency enum value to set +*/ +inline void TSBCFrameParameters::SetSamplingFrequency(TSamplingFrequency aSampFreq) + { + // clear sampling frequency bits + iParameters &= ~(KSBCSampFreqBitsMask << KSBCSampFreqBitOffset); + // set new sampling frequency bits + iParameters |= ( (aSampFreq & KSBCSampFreqBitsMask) << KSBCSampFreqBitOffset); + } + +/** +This function gets the block length value +@internalComponent +@return number of blocks in one frame +*/ +inline TUint8 TSBCFrameParameters::BlockLength() const + { + switch ( (iParameters >> KSBCBlckLengBitOffset) & KSBCBlckLengBitsMask) + { + case E4Blocks: + return 4; + + case E8Blocks: + return 8; + + case E12Blocks: + return 12; + + case E16Blocks: + return 16; + } + return 0; + } + +/** +This function sets the block length value +@internalComponent +@param aBlockLen +New block length value to set +*/ +inline void TSBCFrameParameters::SetBlockLength(TBlockLength aBlockLen) + { + // clear block length bits + iParameters &= ~(KSBCBlckLengBitsMask << KSBCBlckLengBitOffset); + // set new block length bits + iParameters |= ( (aBlockLen & KSBCBlckLengBitsMask) << KSBCBlckLengBitOffset); + } + +/** +This function gets the channel mode enum value +@internalComponent +@return channel mode enum value +*/ +inline TUint8 TSBCFrameParameters::ChannelMode() const + { + return static_cast( (iParameters >> KSBCChnlModeBitOffset) & KSBCChnlModeBitsMask); + } + +/** +This function gets number of channels +@internalComponent +@return number of channels +*/ +inline TUint8 TSBCFrameParameters::Channels() const + { + switch (ChannelMode() ) + { + case EMono: + return 1; + + case EDualChannel: + case EStereo: + case EJointStereo: + return 2; + } + return 0; + } + +/** +This function sets the channel mode enum value +@internalComponent +@param aChnlMode +New channel mode enum value to set +*/ +inline void TSBCFrameParameters::SetChannelMode(TChannelMode aChnlMode) + { + // clear channel mode bits + iParameters &= ~(KSBCChnlModeBitsMask << KSBCChnlModeBitOffset); + // set new channel mode bits + iParameters |= ( (aChnlMode & KSBCChnlModeBitsMask) << KSBCChnlModeBitOffset); + } + +/** +This function gets the allocation method enum value +@internalComponent +@return allocation method enum value +*/ +inline TUint8 TSBCFrameParameters::AllocationMethod() const + { + return static_cast( (iParameters >> KSBCAllcMthdBitOffset) & KSBCAllcMthdBitsMask); + } + +/** +This function sets the channel mode enum value +@internalComponent +@param aAllocMethod +New channel mode enum value to set +*/ +inline void TSBCFrameParameters::SetAllocationMethod(TAllocationMethod aAllocMethod) + { + // clear allocation method bits + iParameters &= ~(KSBCAllcMthdBitsMask << KSBCAllcMthdBitOffset); + // set new allocation method bits + iParameters |= ( (aAllocMethod & KSBCAllcMthdBitsMask) << KSBCAllcMthdBitOffset); + } + +/** +This function gets the subbands enum value +@internalComponent +@return subbands enum value +*/ +inline TUint8 TSBCFrameParameters::SubbandsEnum() const + { + return static_cast( (iParameters >> KSBCSubbandsBitOffset) & KSBCSubbandsBitsMask); + } + +/** +This function gets the subbands value +@internalComponent +@return subbands value, i.e 4, 8 +*/ +inline TUint8 TSBCFrameParameters::Subbands() const + { + switch (SubbandsEnum() ) + { + case E4Subbands: + return 4; + + case E8Subbands: + return 8; + } + return 0; + } + +/** +This function sets the subbands enum value +@internalComponent +@param aSubbands +New subbands enum value to set +*/ +inline void TSBCFrameParameters::SetSubbands(TSubbands aSubbands) + { + // clear subbands bits + iParameters &= ~(KSBCSubbandsBitsMask << KSBCSubbandsBitOffset); + // set new subbands bits + iParameters |= ( (aSubbands & KSBCSubbandsBitsMask) << KSBCSubbandsBitOffset); + } + +/** +This function gets the bitpool value +@internalComponent +@return bitpool value +*/ +inline TUint8 TSBCFrameParameters::Bitpool() const + { + return iBitpool; + } + +/** +This function sets the bitpool enum value +@internalComponent +@param aSubbands +New bitpool enum value to set +*/ +inline void TSBCFrameParameters::SetBitpool(TUint8 aBitpool) + { + iBitpool = aBitpool; + } + +/** +This function gets the 5 parameters (except bitpool) byte value +@internalComponent +@return 5 parameters byte value +*/ +inline TUint8 TSBCFrameParameters::Parameters() const + { + return iParameters; + } + +/** +This function checks the bitpool value according to: +1. bitpool >= 2 and bitpool <= 250 +2. bitpool <= 16 * subbands for Mono and Dual Channel, + bitpool <= 32 * subbands for Stereo and Joint Stereo +3. results in bit_rate <= 320 kbps for Mono + results in bit_rate <= 512 kpbs for two-channel modes +@internalComponent +@return -1 if invalid; 0 if valid +*/ +inline TInt TSBCFrameParameters::Validate() const + { + if (iBitpool < KSBCMinBitpoolValue || iBitpool > KSBCMaxBitpoolValue) + { + return -1; + } + + const TUint16 numSubbands = Subbands(); // use 16 bits to avoid overflow + const TUint8 channelMode = ChannelMode(); + + if (channelMode == EMono || channelMode == EDualChannel) + { + // bitpool <= 16 * subbands, for Mono and Dual_Channel modes + if (iBitpool > (numSubbands << 4) ) + { + return -1; + } + } + else + { + // bitpool <= 32 * subbands, for Stereo and Joint_Stereo modes + if (iBitpool > (numSubbands << 5) ) + { + return -1; + } + } + + if (channelMode == EMono) + { + // bit rate <= 320kbps for Mono mode + if (CalcBitRate(CalcFrameLength() ) > 320) + { + return -1; + } + } + else + { + // bit rate <= 512kpbs for two-channels modes + if (CalcBitRate(CalcFrameLength() ) > 512) + { + return -1; + } + } + + return 0; + } + +/** +This function calculates the frame length value according to: +1. for MONO or DUAL_CHANNEL + frame_len = 4 + (4 * subbands * channels) / 8 + ceil(blocks * channels * bitpool / 8) +2. for STEREO + frame_len = 4 + (4 * subbands * channels) / 8 + ceil(blocks * bitpool / 8) +3. for JOINT_STEREO + frame_len = 4 + (4 * subbands * channels) / 8 + ceil((subbands + blocks * bitpool) / 8) +ceil(), taking the upper integer value +@internalComponent +@return frame length value +*/ +inline TUint TSBCFrameParameters::CalcFrameLength() const + { + TUint temp = 0; + switch (ChannelMode() ) + { + case EMono: + temp = BlockLength() * Bitpool(); // blocks * bitpool + break; + + case EDualChannel: + temp = (BlockLength() * Bitpool() ) << 1; // blocks * bitpool * 2 + break; + + case EStereo: + temp = BlockLength() * Bitpool(); // blocks * bitpool + break; + + case EJointStereo: + temp = Subbands() + BlockLength() * Bitpool(); // subbands + blocks * bitpool + break; + + default: + User::Panic(_L("Invalid channel mode"), KErrNotSupported); + break; + } + + TUint frameLen = 4 + ( (Subbands() * Channels() ) >> 1) + (temp >> 3); + if (temp & 0x7) + { + frameLen++; + } + + return frameLen; + } + +/** +This function calculates the bit rate value according to: + bit_rate = 8 * frame_len * sampling_freq / subbands / blocks +@internalComponent +@return bit rate value in kHz +*/ +inline TUint TSBCFrameParameters::CalcBitRate(TUint aFrameLen) const + { + return (aFrameLen << 3) * SamplingFrequencyHz() / (Subbands() * BlockLength() * 1000); + } + +#endif // __SBCFRAMEPARAMETERS_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/controller/audio/2002C398.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/controller/audio/2002C398.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2003-2009 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: +// Copied from... Registry file for the Example Interface Implementation Collection +// +// + +#include +#include +#include "MmfAudioToneController.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x2002C398; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceController ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidControllerAudioTone ; + version_no = 1; + display_name = "Symbian Audio Tone Test controller"; + default_data = "?"; + opaque_data = "Symbianyes0x101F5D07

0x101FFA00";//yes indicates controller has no url handling capability. + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidToneSequenceFormatInterface; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidToneSequenceFormatRead ; + version_no = 1; + display_name = "Tone Sequence Play Format"; + default_data = "?"; + opaque_data = "Symbian0x101F5D07.sqnSQNC"; + } + }; + } + + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1029 @@ +// Copyright (c) 2003-2009 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 +#include +#include +#include +#include +#include +#include "MmfAudioToneController.h" +#include + +/* + A list of panic codes for the Audio Tone Controller +@internalTechnology + + TMmfAudioToneControllerPanics is an enumeration with the following entries: + EBadArgument indicates a bad argument + EBadState indicates a state viaolation + EBadInvariant indicates an invariant violation + EBadReset indicates failed reset + EPostConditionViolation indicates a post condition violation +*/ +enum TMmfAudioToneControllerPanics + { + EBadArgument, + EBadState, + EBadInvariant, + EBadReset, + EPostConditionViolation, + EBadCall, + ENoDataSource, + ENoDataSink, + EMessageAlreadyBeingProcessed, + ENoMessageToProcess, + EStateNotReadyToPlay, + EStateNotConstructed, + EBadStateToGetDataSource, + EBadStateToGetDataSink, + EBadStateForPrime, + EStateNotPrimed, + EBadResetState, + EBadStateToReset, + EBadPlayState, + EBadPauseState, + EBadStateToPause, + EBadStateToStop, + EBadStopState, + ENotReadyForDataSourceRemoval, + EBadDataSourceRemoval, + ENotReadyForDataSinkRemoval, + EBadDataSinkRemoval, + ENotReadyForCustomCommand, + EBadStateAfterNegotiate, + EBadStateToSetPriority, + EBadPriorityState, + EBadInitializeState, + EBadStateToSetVolume, + EBadStateAfterVolumeSet, + EBadStateToGetMaxVolume, + EBadStateAfterGetMaxVolume, + EBadStateToGetVolume, + EBadStateAfterGetVolume, + EBadStateToSetVolumeRamp, + EBadStateAfterSetVolumeRamp, + EBadStateToSetBalance, + EBadStateAfterSetBalance, + EBadStateToGetBalance, + EBadStateAfterGetBalance, + EBadStateForTransition, + EBadStateAfterTransition, + EStateNotValid, + }; + + +/** + Instantiates a new Audio Tone Controller. Usually invoked from ECom + + @internalTechnology + @return CMMFController* bas class for all plugin controllers + */ +CMMFController* CMMFAudioToneController::NewL() + { + CMMFAudioToneController* self = new(ELeave) CMMFAudioToneController; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop( self ); + return STATIC_CAST( CMMFController*, self ); + } + + + +/** +2nd Phase constructor + +@internalComponent +*/ +void CMMFAudioToneController::ConstructL() + { + iSourceAndSinkAdded = EFalse; + + // Construct custom command parsers + CMMFAudioPlayDeviceCustomCommandParser* audPlayDevParser = CMMFAudioPlayDeviceCustomCommandParser::NewL(*this); + CleanupStack::PushL(audPlayDevParser); + AddCustomCommandParserL(*audPlayDevParser); + CleanupStack::Pop( audPlayDevParser );//audPlayDevParser + + CMMFAudioPlayControllerCustomCommandParser* audPlayConParser = CMMFAudioPlayControllerCustomCommandParser::NewL(*this); + CleanupStack::PushL(audPlayConParser); + AddCustomCommandParserL(*audPlayConParser); + CleanupStack::Pop(audPlayConParser);//audPlayConParser + + CMMFAudioPlayControllerSetRepeatsCustomCommandParser* audPlayConSetRepeatsParser = CMMFAudioPlayControllerSetRepeatsCustomCommandParser::NewL(*this); + CleanupStack::PushL(audPlayConSetRepeatsParser); + AddCustomCommandParserL(*audPlayConSetRepeatsParser); + CleanupStack::Pop(audPlayConSetRepeatsParser); + + // [ assert the invariant now that we are constructed ] + __ASSERT_ALWAYS( Invariant(), Panic( EStateNotConstructed)); + } + + +/** +1st Phase constructor + +@internalComponent +*/ + +CMMFAudioToneController::CMMFAudioToneController() : iState(EStopped) + { + } + +/** +Destructor + +@internalTechnology +*/ +CMMFAudioToneController::~CMMFAudioToneController() + { + delete iMMFDevSound; + delete iToneSequenceData; + delete iMessage; + } + +/** +Adds a data source to the controller + +@internalTechnology + +@param aSource will provide the data the controller plays +*/ +void CMMFAudioToneController::AddDataSourceL(MDataSource& aSource) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateToGetDataSource)); + + // [ precondition that the controller is stopped ] + if( State() != EStopped ) + User::Leave( KErrNotReady ); + + //[ precondition iData source is not already configured ] + if (iDataSource) + User::Leave(KErrAlreadyExists); + + //Only works with files or descriptors + if ((aSource.DataSourceType() != KUidMmfFileSource ) && (aSource.DataSourceType() != KUidMmfDescriptorSource)) + User::Leave( KErrNotSupported ) ; + + + //extract the tone data into a buffer ready to play. + iToneSequenceData = CMMFDataBuffer::NewL(STATIC_CAST(CMMFClip*, &aSource)->Size()); + + aSource.SourcePrimeL(); + STATIC_CAST(CMMFClip*, &aSource)->ReadBufferL(iToneSequenceData,0); + aSource.SourceStopL(); + + + //[ its now safe to set the source ] + iDataSource = &aSource ; + + //[ assert the post condition ] + __ASSERT_ALWAYS(iDataSource, Panic(EMMFAudioControllerPanicDataSourceDoesNotExist)); + + iDataSource->SetSourcePrioritySettings(iPrioritySettings); + } + + + +/** +Adds a data sink to the controller + +@internalTechnology + +@param aSink will accept the data the controller plays +*/ +void CMMFAudioToneController::AddDataSinkL(MDataSink& aSink) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateToGetDataSink)); + + // [ precondition that the controller is stopped ] + if( State() != EStopped ) + User::Leave( KErrNotReady ); + + // [ assert precondition that sink does not exist ] + if (iMMFDevSound) + User::Leave(KErrAlreadyExists); + + //Only support playing to audio output + if (aSink.DataSinkType() != KUidMmfAudioOutput) + User::Leave( KErrNotSupported ); + + iMMFDevSound = CMMFDevSound::NewL(); + + // [ assert post conditions that a sink has been added ] + __ASSERT_ALWAYS(iMMFDevSound, Panic(EMMFAudioControllerPanicDataSinkDoesNotExist)); + } + +/** +Primes the controller, ready for playing + +@internalTechnology + +@param aMessage allows response to client upon completion or error +*/ +void CMMFAudioToneController::PrimeL(TMMFMessage& aMessage) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateForPrime)); + + //[ assert the precondition ( in a friendly way for this api + // that we are either stopped or primed already ] + if(!(( State() == EStopped ) || (State() == EPrimed ))) + User::Leave( KErrNotReady ); + + // [ precondition we have a data source & sink and aren't already processing a message] + __ASSERT_ALWAYS( iDataSource, Panic( ENoDataSource)); + __ASSERT_ALWAYS( iMMFDevSound, Panic( ENoDataSink)); + __ASSERT_ALWAYS( !iMessage, Panic( EMessageAlreadyBeingProcessed )); + + if (iState == EStopped) + { + + iMessage = new(ELeave) TMMFMessage(aMessage); //store message + __ASSERT_ALWAYS( iMessage, Panic( EPostConditionViolation )); //check if message created sucessfully + SetState(EPriming); + + TRAPD(err,NegotiateL()); + if(err != KErrNone) + { + SetState( EStopped ); + delete iMessage; + iMessage = NULL; + User::Leave(err); + } + } + + __ASSERT_ALWAYS( Invariant(), Panic( EStateNotPrimed ) ); + + } + +/** +Primes the controller, ready for playingAdds a data sink to the controller + +@internalTechnology +*/ +void CMMFAudioToneController::PrimeL() + { + Panic(EBadCall); + } + +/** +This method resets the controller + +@internalTechnology +*/ +void CMMFAudioToneController::ResetL() + { + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateToReset ) ); + + // Stop recording if it's not stopped, + if (State() != EStopped) + { + StopL(); + } + + //[ ensure loggoff of source and sink ] + iDataSource = NULL ; + delete iMMFDevSound; iMMFDevSound = NULL ; + iSourceAndSinkAdded = EFalse; + delete iMessage; + iMessage = NULL; + + + // [ assert the invariant] + __ASSERT_ALWAYS( Invariant(), Panic( EBadResetState ) ); + + __ASSERT_ALWAYS( ResetPostCondition(), Panic( EBadReset )); + __ASSERT_ALWAYS( Invariant(), Panic(EBadState)); + } + +/** +This function determnines if the reset post condition is valid + +@internalComponent +*/ +TBool CMMFAudioToneController::ResetPostCondition() const + { + TBool result = EFalse ; + if((iMMFDevSound == NULL) && + (iDataSource == NULL) && + (State() == EStopped)) + { + result = ETrue; + } + return result; + } + + +/** +Start playing the audio tone, passing the data to Dev Sound + +The controller will be put into the EPlaying state + +@internalTechnology +*/ +void CMMFAudioToneController::PlayL() + { + // [ assert the precondition that the + // play command is only activated in the primed state] + if ( State() != EPrimed && State() != EPausePlaying) + User::Leave(KErrNotReady); + + // [ assert the Invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EStateNotReadyToPlay)); + + if(State() == EPausePlaying && iIsResumeSupported) + { + User::LeaveIfError(iMMFDevSound->Resume()); + } + else + { + iMMFDevSound->PlayToneSequenceL(iToneSequenceData->Data()); + } + + SetState( EPlaying ); + + //[ assert the post condition we are playing ] + __ASSERT_ALWAYS( (State() == EPlaying ), Panic( EBadState)); + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadPlayState)); + } + +/** +This should Pause playing of the audio tone. HOWEVER, this is not possible with a +tone sequence. This method is therefore provided as a NOP purely to allow audio +clients to operate correctly. + +The controller will be put into the EPrimed state + +@internalTechnology + */ +void CMMFAudioToneController::PauseL() + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToPause)); + + __ASSERT_ALWAYS(iMMFDevSound, Panic(EMMFAudioControllerPanicDataSinkDoesNotExist)); + + if(iIsResumeSupported) + { + iMMFDevSound->Pause(); + SetState(EPausePlaying); + } + else + { + // If Resume is not supported + // this method can't do anything, as we have no interface to restart DevSound + // after pausing a tone. It need to be here however as client utility does + // Pause() Stop() when stopping. + SetState(EPrimed); + } + + //[ assert the post condition we are stopped ] + __ASSERT_ALWAYS( (State() == EPrimed || State() == EPausePlaying), Panic( EBadState)); + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadPauseState)); + } + +/** +This stops the tone that is currently playing +The controller will be put into the EStopped state + +@internalTechnology +*/ +void CMMFAudioToneController::StopL() + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToStop)); + + // [ precondition that we are not already stopped + // && if we are stopped do nothing. + // Due to the asynchronous nature of the controller + // interaction the response to stopped when stopped + // should not be an error ] + if (State() != EStopped) + { + //[ update state to stopped propogate to devsound ] + iMMFDevSound->Stop(); + SetState(EStopped); + } + + //[ assert the post condition we are stopped ] + __ASSERT_ALWAYS( (State() == EStopped), Panic( EBadState)); + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStopState)); + } + + +/** +Removes a data source form the controller + +@internalTechnology + +@param aDataSource The source that is to be removed. +*/ +void CMMFAudioToneController::RemoveDataSourceL(MDataSource& aDataSource ) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(ENotReadyForDataSourceRemoval) ); + + //[ precondition is that we have a data source ] + if( !iDataSource ) + User::Leave(KErrNotReady); + + //[precondition the data source is the data source we have] + if( iDataSource != &aDataSource ) + User::Leave(KErrArgument); + + //[ the controller is in the stopped state ] + if(State() != EStopped) + User::Leave(KErrNotReady); + + //[ remove the data sink from the controller and delete the format] + if( iSourceAndSinkAdded ) + { + iMMFDevSound->Stop(); + iSourceAndSinkAdded = EFalse ; + } + + iDataSource = NULL ; + + // [ assert postcondition we are stopped ] + __ASSERT_ALWAYS( (State() == EStopped), Panic(EPostConditionViolation) ); + + //[ assert postcondition the SourceAndSinkAdded is false ] + __ASSERT_ALWAYS( !iSourceAndSinkAdded, Panic( EPostConditionViolation )); + + //[ assert postcondition the data sink is null ] + __ASSERT_ALWAYS( (iDataSource == NULL ), Panic( EPostConditionViolation )); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadDataSourceRemoval)); + } + + +/** +Removes a data sink form the controller + +@internalTechnology + +@param aDataSink The sink that is to be removed. We donot +use this value, as we only support a single sink. +*/ +void CMMFAudioToneController::RemoveDataSinkL(MDataSink& /*aDataSink*/) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(ENotReadyForDataSinkRemoval) ); + + //[ precondition is that we have a data sink ] + if(!iMMFDevSound) + User::Leave(KErrNotReady); + + //[ the controller is in the stopped state ] + if(State() != EStopped) + User::Leave(KErrNotReady); + + //[ remove the data sink from the controller and delete the format] + if(iSourceAndSinkAdded) + { + iMMFDevSound->Stop(); + iSourceAndSinkAdded = EFalse; + } + + delete iMMFDevSound; iMMFDevSound = NULL; + + + // [ assert postcondition we are stopped ] + __ASSERT_ALWAYS( (State() == EStopped), Panic(EPostConditionViolation) ); + + //[ assert postcondition the SourceAndSinkAdded is false ] + __ASSERT_ALWAYS( !iSourceAndSinkAdded, Panic( EPostConditionViolation )); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadDataSinkRemoval)); + } + +/** +Handles a CustomCommand for the controller. This controller doesn't support Custom Commands + +@internalTechnology +@param aMessage +*/ +void CMMFAudioToneController::CustomCommand(TMMFMessage& aMessage) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(ENotReadyForCustomCommand)); + // [ We do not have any custom commands ] + aMessage.Complete(KErrNotSupported); + } + +/** +Configures Dev Sound, ready for playing. + +@internalComponent +*/ +void CMMFAudioToneController::NegotiateL() + { + if (!iMMFDevSound) + Panic(EMMFAudioOutputDevSoundNotLoaded); + + iMMFDevSound->InitializeL(*this, EMMFStateTonePlaying); + iMMFDevSound->SetPrioritySettings(iPrioritySettings); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterNegotiate)); + } + +/** +Set the priority settings that this controller should use to access Dev Sound + +@internalTechnology +@param aPrioritySettings The requires priority settings +*/ +void CMMFAudioToneController::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToSetPriority)); + + //[ assert the precondition ] + if(State() != EStopped) + { + ASSERT(EFalse); // used to leave here with KErrNotReady + return; + } + + //[ update the priority settings of the controller] + iPrioritySettings = aPrioritySettings; + + if (iMMFDevSound) + { + iMMFDevSound->SetPrioritySettings(iPrioritySettings); + } + + __ASSERT_ALWAYS( Invariant(), Panic(EBadPriorityState)); + } + + + +/** +This method is called by DevSound after initialization, indicating that it has completed and +whether there was an error + +@internalTechnology +@param aError the error supplied by Dev Sound +*/ +void CMMFAudioToneController::InitializeComplete(TInt aError) + { + //[ assert the state is EPriming ] + __ASSERT_ALWAYS( ( State() == EPriming ), Panic( EBadState )); + __ASSERT_ALWAYS( iMessage, Panic( ENoMessageToProcess )); + + if(aError != KErrNone) + { + SetState( EStopped ); + iMessage->Complete(aError); + } + else + { + SetState( EPrimed ); + iMessage->Complete(aError); + iIsResumeSupported = iMMFDevSound->IsResumeSupported(); + } + + delete iMessage; + iMessage = NULL; + + // [ assert the invariant] + __ASSERT_ALWAYS( Invariant(), Panic( EBadInitializeState ) ); + } + + +/** +This method is called by DevSound after it has finished playing a tone sequence, indicating +whether there was an error + +@internalTechnology +@param aError the error supplied by DevSound +*/ +void CMMFAudioToneController::ToneFinished(TInt aError) + { + // NB KErrInUse, KErrDied OR KErrAccessDenied may be returned + // to indicate that the sound device is in use by another higher + // priority client. + if (aError == KErrCancel || aError == KErrInUse || + aError == KErrDied || aError == KErrAccessDenied) + return; + + if (aError == KErrUnderflow) + aError = KErrNone; + + if (State() != EStopped) + { + iMMFDevSound->Stop(); + SetState( EStopped ); + } + + //now send event to client... + TMMFEvent event; + event.iEventType = KMMFEventCategoryPlaybackComplete; + event.iErrorCode = aError; + DoSendEventToClient(event); + } + + + +/** +Called my DevSound to indicate we have been thrown off H/W by a higher priority + +@internalTechnology +@param aEvent contains the reason we have been contacted by DevSound +*/ +void CMMFAudioToneController::SendEventToClient(const TMMFEvent& aEvent) + { + if(State() == EPlaying) + SetState(EStopped); + + DoSendEventToClient(aEvent); + } + + + + +/** +Sets the playback volume + +@internalTechnology +@param aVolume the required volume +*/ +void CMMFAudioToneController::MapdSetVolumeL(TInt aVolume) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToSetVolume)); + + // [ precondition is true for state + // we can set the volume in any state ] + + //[ precondition we have a data sink ] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + + // [ assert the precondition that aVolume is in range ] + TInt maxVolume = iMMFDevSound->MaxVolume(); + if( ( aVolume < 0 ) || ( aVolume > maxVolume )) + User::Leave(KErrArgument); + + //[ set the volume on the device ] + iMMFDevSound->SetVolume(aVolume); + + //[ assert the post condition volume is equal to a volume] + TInt soundVolume = 0; + soundVolume = iMMFDevSound->Volume(); + + __ASSERT_ALWAYS( ( soundVolume == aVolume), Panic(EPostConditionViolation)); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterVolumeSet)); + } + +/** +Gets the maximum level the playback volume can be set to + +@internalTechnology +@param aMaxVolume contains the maximum volume setting +*/ +void CMMFAudioToneController::MapdGetMaxVolumeL(TInt& aMaxVolume) + { + // [ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToGetMaxVolume)); + + //[ precondition we have a data sink ] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + //[ get the volume from the device ] + aMaxVolume = iMMFDevSound->MaxVolume(); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterGetMaxVolume)); + + } + + +/** +Gets the current playback volume + +@internalTechnology +@param aVolume the current volume +*/ +void CMMFAudioToneController::MapdGetVolumeL(TInt& aVolume) + { + // [ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToGetVolume)); + + //[ precondition that we have a data sink ] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + aVolume = iMMFDevSound->Volume(); + + // [ assert precondition that the volume is in range + // 0.. aMaxVolume ] + TInt aMaxVolume = iMMFDevSound->MaxVolume(); + __ASSERT_ALWAYS( (aVolume <= aMaxVolume), Panic(EBadState)); + __ASSERT_ALWAYS( (aVolume >= 0), Panic(EBadState)); + + // [ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterGetVolume)); + + } + +/** +Sets the duration over which the volume should increase + +@internalTechnology +@param aRampDuration the time over which the volume should ramp +*/ +void CMMFAudioToneController::MapdSetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration) + { + // [ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToSetVolumeRamp)); + + //[ precondition that we have a data sink ] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + iMMFDevSound->SetVolumeRamp(aRampDuration); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterSetVolumeRamp)); + + } + + +/** +Sets the balance of the tone playback + +@internalTechnology +@param aBalance the required balance level (KMMFBalanceMaxLeft <= aBalance <= KMMFBalanceMaxRight) +*/ +void CMMFAudioToneController::MapdSetBalanceL(TInt aBalance) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateToSetBalance)); + + // [ precondition is that we have a data sink ] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + + // [ separate out left and right balance ] + TInt left = 0; + TInt right = 0; + CalculateLeftRightBalance( left, right, aBalance ); + + //[ set the balance ] + iMMFDevSound->SetPlayBalanceL(left, right); + + // [assert the post condition that the balance is set correctly] + TInt rightBalance = 0; + TInt leftBalance = 0; + iMMFDevSound->GetPlayBalanceL(leftBalance, rightBalance); + + //[ assert post condition holds] + TBool postCondition = (( rightBalance == right) && ( leftBalance == left)); + __ASSERT_ALWAYS( postCondition, Panic( EPostConditionViolation ) ); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateAfterSetBalance)); + } + +/** +Converts the balance from a range to a left/right form. + +Balance is provided to devsound using left and right levels, but supplied to the controller as a range +(KMMFBalanceMaxLeft --> KMMFBalanceMaxRight). This method converts the range into a left/right form + +@internalComponent + +@param aLeft set to the left setting +@param aRight set to the right setting +@param aBalance the range required +*/ +void CMMFAudioToneController::CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const + { + // Check the balance is within limits & modify to min or max values if necessary + if (aBalance < KMMFBalanceMaxLeft) + aBalance = KMMFBalanceMaxLeft; + if (aBalance > KMMFBalanceMaxRight) + aBalance = KMMFBalanceMaxRight; + + //[ Now separate percentage balances out from aBalance ] + aLeft = (100 * (aBalance-KMMFBalanceMaxRight)) / (KMMFBalanceMaxLeft-KMMFBalanceMaxRight); + aRight = 100 - aLeft; + + //[ assert post condition that left and right are within range ] + __ASSERT_ALWAYS( ( (aLeft <= 100) && (aLeft >= 0) ), Panic(EPostConditionViolation)); + __ASSERT_ALWAYS( ( (aRight <= 100) && (aRight >= 0) ), Panic(EPostConditionViolation)); + } + + +/** +Gets the balance of the tone playback + +@internalTechnology +@param aBalance set to the current balance level (KMMFBalanceMaxLeft <= aBalance <= KMMFBalanceMaxRight) +*/ +void CMMFAudioToneController::MapdGetBalanceL(TInt& aBalance) + { + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateToGetBalance)); + + //[ precondition that we have a sink] + if (!iMMFDevSound) + User::Leave(KErrNotReady); + + + TInt left = 50; // arbitrary values + TInt right = 50; + iMMFDevSound->GetPlayBalanceL(left, right); + + CalculateBalance( aBalance, left, right ); + + //[ assert the invariant ] + __ASSERT_ALWAYS( Invariant(), Panic(EBadStateAfterGetBalance)); + } + + +/** +Converts the balance from a left/right form to a range. + +Balance is obtained from DevSound using left and right levels, but supplied to the client as a range +(KMMFBalanceMaxLeft --> KMMFBalanceMaxRight). + +@internalComponent + +@param aLeft the current left setting +@param aRight current right setting +@param aBalance set to the balance range +*/ +void CMMFAudioToneController::CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const + { + //[ assert pre conditions ] + __ASSERT_ALWAYS( (( aLeft + aRight ) == 100 ), Panic( EBadArgument )); + __ASSERT_ALWAYS( (( 0 <= aLeft) && ( 100 >= aLeft)), Panic( EBadArgument) ); + __ASSERT_ALWAYS( (( 0 <= aRight) && ( 100 >= aRight)), Panic( EBadArgument) ); + + aBalance = (aLeft * (KMMFBalanceMaxLeft-KMMFBalanceMaxRight))/100 + KMMFBalanceMaxRight; + + //[ assert post condition that aBalance is within limits ] + __ASSERT_ALWAYS( !(aBalance < KMMFBalanceMaxLeft || aBalance > KMMFBalanceMaxRight), Panic(EBadArgument)); + + } + + + + +/** +The function validates a state transition from iState to aState and +returns ETrue if the transition is allowed. + +@internalComponent +@param TControllerState +@return Valid controller state or not +*/ +TBool CMMFAudioToneController::IsValidStateTransition( TControllerState aState ) const + { + TBool result = ETrue ; + //[ assert the precondition that aState is a valid State ] + __ASSERT_ALWAYS( IsValidState(aState), Panic( EBadArgument ) ); + //[ assert the invariant that iState is a valid State ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateForTransition )); + + // [ check the valid state transitions ] + // the only invalid transition is + // stopped to playing + if( ( iState == EStopped ) && ( aState == EPlaying )) + { + result = EFalse ; + } + + //[ assert the invariant that iState is a valid State ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadStateAfterTransition )); + + return result ; + } + +/* +This function returns whether the invariant is valid + +@internalComponent +@return Is the class in a good condition +*/ +TBool CMMFAudioToneController::Invariant() const + { + //[ The invariant is for now defined + // as simply being in the correct state + return IsValidState( iState); + } + +/* +This function sets the state of the controller. + +@internalComponent +@return Whether ths state transition is valid +*/ +TBool CMMFAudioToneController::SetState(TControllerState aState) + { + TBool result = ETrue; + //[ assert the precondition that the state is a valid state ] + __ASSERT_ALWAYS( IsValidState( aState), Panic( EBadArgument ) ); + //[ assert the invariant the current state is valid ] + __ASSERT_ALWAYS( Invariant(), Panic( EStateNotValid ) ); + //[ only allow valid state transitions ] + if( IsValidStateTransition( aState ) ) + { + //[ valid state transition set the state] + iState = aState ; + } + else + { + //[ invalid state transition return EFalse ] + result = EFalse; + } + // [ assert the invariant on the state ] + __ASSERT_ALWAYS( Invariant(), Panic( EBadState )); + + return result ; + } + +/* +checks whether a state is valid + +@internalComponent +@return Is the state a valid one +*/ +TBool CMMFAudioToneController::IsValidState( TControllerState aState ) const + { + TBool result = EFalse; + if(( aState >= EStopped ) && ( aState <= EPlaying )) + { + result = ETrue; + } + return result; + } + +/** +The function State returns the current state of the audio controller + +@internalComponent +@return State of the controller +*/ +CMMFAudioToneController::TControllerState CMMFAudioToneController::State() const + { + __ASSERT_ALWAYS( Invariant(), Panic( EBadState ) ); + return iState; + } + + +/** +* MapcSetRepeatsL +* @param aRepeatNumberOfTimes +* @param aTrailingSilence +* +*/ +TInt CMMFAudioToneController::MapcSetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) + { + TInt err = KErrNone; + if (!iMMFDevSound) + { + return KErrNotReady; + } + else + { + if(iMMFDevSound->QueryIgnoresUnderflow()) + { + iMMFDevSound->SetToneRepeats(aRepeatNumberOfTimes, aTrailingSilence); + } + else + { + err = KErrNotSupported; + } + } + return err; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,178 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMF_AUDIOTONECONTROLLER_H__ +#define __MMF_AUDIOTONECONTROLLER_H__ + +// Standard EPOC32 includes required by this header file +#include +#include +#include + +// Public Media Server includes +#include +#include +#include + +#include +#include + + +/** +Panic category and codes for the Audio Tone Controller +@internalTechnology +*/ +_LIT(KMMFAudioToneControllerPanicCategory, "MMFAudioToneController"); +enum TMMFMdaAudioToneControllerPanicCodes + { + EMMFMdaAudioToneControllerAlreadyPrepared, + EMMFMdaAudioToneControllerBadToneConfig, + EMMFMdaAudioToneControllerBadMixinCall + }; + +/** +The public API for clients of the MMFAudioToneController +@internalTechnology +*/ + +class CMMFAudioToneController : public CMMFController, + public MMMFAudioPlayDeviceCustomCommandImplementor, + public MMMFAudioPlayControllerCustomCommandImplementor, + public MDevSoundObserver, + public MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor + { +public: + static CMMFController* NewL(); + virtual ~CMMFAudioToneController(); + + //implement CMMFController ecom plugin interface + virtual void AddDataSourceL(MDataSource& aDataSource); + virtual void AddDataSinkL(MDataSink& aDataSink); + virtual void RemoveDataSourceL(MDataSource& aDataSource); + virtual void RemoveDataSinkL(MDataSink& aDataSink); + + virtual void ResetL(); + virtual void PrimeL(); + virtual void PrimeL(TMMFMessage& aMessage); + virtual void PlayL(); + virtual void PauseL(); + virtual void StopL(); + + virtual TTimeIntervalMicroSeconds PositionL() const {User::Leave(KErrNotSupported); TTimeIntervalMicroSeconds zero(0); return zero;} + virtual void SetPositionL(const TTimeIntervalMicroSeconds& /*aPosition*/){} + virtual TTimeIntervalMicroSeconds DurationL() const {TTimeIntervalMicroSeconds zero(0); return zero;} + virtual void CustomCommand(TMMFMessage& aMessage); + + virtual void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + + virtual void GetNumberOfMetaDataEntriesL(TInt& /*aNumberOfEntries*/){User::Leave(KErrNotSupported);} + virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt /*aIndex*/){User::Leave(KErrNotSupported); return NULL;} + + //from MMMFAudioPlayDeviceCustomCommandImplementor + virtual void MapdSetVolumeL(TInt aVolume); + virtual void MapdGetMaxVolumeL(TInt& aMaxVolume); + virtual void MapdGetVolumeL(TInt& aVolume); + virtual void MapdSetVolumeRampL(const TTimeIntervalMicroSeconds& aRampDuration); + virtual void MapdSetBalanceL(TInt aBalance); + virtual void MapdGetBalanceL(TInt& aBalance); + + //from MMMFAudioPlayControllerCustomCommandImplementor + virtual void MapcSetPlaybackWindowL(const TTimeIntervalMicroSeconds& /*aStart*/, const TTimeIntervalMicroSeconds& /*aEnd*/) {User::Leave(KErrNotSupported);} + virtual void MapcDeletePlaybackWindowL() {User::Leave(KErrNotSupported);} + virtual void MapcGetLoadingProgressL(TInt& /*aPercentageComplete*/) {User::Leave(KErrNotSupported);} + + + + // From DevSoundObserver + void InitializeComplete(TInt aError); + void ToneFinished(TInt aError); + void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void PlayError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void RecordError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void ConvertError(TInt /*aError*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void DeviceMessage(TUid /*aMessageId*/, const TDesC8& /*aMsg*/) {Panic(EMMFMdaAudioToneControllerBadMixinCall);} + void SendEventToClient(const TMMFEvent& aEvent); + + //from MMMFAudioPlayControllerSetRepeatsCustomCommandImplementor + virtual TInt MapcSetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); + + +public: + +/** + TControllerState is an enumeration within the namespace CMMFAudioToneController + The enumeration provides a set of control states: + EStopped is the initial state the controller resides in after it has been loaded + EPrimed is the state the controller is in when it has been associated with datapaths but is not streaming data + EPlaying is the state the controller is in when it is streaming data +*/ + enum TControllerState + { + EStopped, + EPrimed, + EPriming, + EPausePlaying, + EPlaying, + }; + +protected: + CMMFAudioToneController(); +protected: + void ConstructL(); + void NegotiateL(); + + // state accessor functions + TBool SetState( TControllerState aState ); + TControllerState State() const ; + TBool IsValidStateTransition( TControllerState aState ) const; + TBool Invariant() const; + TBool IsValidState( TControllerState aState ) const ; + TBool ResetPostCondition() const; + + void CalculateLeftRightBalance( TInt& aLeft, TInt& aRight, TInt aBalance ) const; + void CalculateBalance( TInt& aBalance, TInt aLeft, TInt aRight ) const; + + + void Panic(TInt aPanicCode) const {User::Panic(KMMFAudioToneControllerPanicCategory, aPanicCode);} + +private: +/** The data source provided by the Controller Framework, not owned (do not delete) */ + MDataSource* iDataSource; + +/** buffer that holds the data to be played */ + CMMFDataBuffer* iToneSequenceData; + +/** the Dev Sound that will be used to play the tone*/ + CMMFDevSound* iMMFDevSound; + +/** Current state of the controller, see TControllerState*/ + TControllerState iState; + +/** Priority setting used to controll access the Dev Sound*/ + TMMFPrioritySettings iPrioritySettings; + +/** Indicates whether both a surce and data sink have been supplied by the Controller Framework*/ + TBool iSourceAndSinkAdded; + +/** Indicates whether DevSound supports resume for current configuration*/ + TBool iIsResumeSupported; + +/** Used to store message */ + TMMFMessage* iMessage; + }; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneController.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2003 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: +* +*/ + + +#ifndef __MMF_PLUGIN_AUDIOTONECONTROLLER_HRH__ +#define __MMF_PLUGIN_AUDIOTONECONTROLLER_HRH__ + +//dll = 0x101F7D95 + +#define KMmfUidControllerAudioTone 0x101F7D96 +#define KMmfUidToneSequenceFormatInterface 0x101FFA00 +#define KMmfUidToneSequenceFormatRead 0x101FFA01 + + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneControllerFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/controller/audio/MmfAudioToneControllerFactory.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2003 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 "MmfAudioToneController.hrh" +#include "MmfAudioToneController.h" + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +// move to another module to allow custom audio controller for testing + +/** +Table of implementations to be returned to th ECom system +@internalAll +*/ +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidControllerAudioTone, CMMFAudioToneController::NewL) + }; + +/** +Used by the ECom system to obtain a list of implementations available in the library + +@internalAll +@param aTableCount will be initialized to the number of entries +@return TImplementationProxy* a pointer to a list of available implementations +*/ + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/DevSoundPluginMain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/DevSoundPluginMain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,42 @@ +// Copyright (c) 2005-2009 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 "SoundDeviceBody.h" +#include + +#include + +MMMFDevSoundPlugin* NewDevSoundL() + { + MMMFDevSoundPlugin* result = CMMFDevSoundClientImp::NewL(); + return result; + } + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidDevSoundRefPlugin, NewDevSoundL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCIMuxUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCIMuxUtility.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,147 @@ +// Copyright (c) 2005-2009 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 "MmfDevSoundCIMuxUtility.h" +#include +#include +#include +#include +#include + + +CMMFDevSoundCIMuxUtility* CMMFDevSoundCIMuxUtility::NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel) + { + CMMFDevSoundCIMuxUtility* self = new (ELeave) CMMFDevSoundCIMuxUtility(aCustomChannel); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CMMFDevSoundCIMuxUtility::ConstructL() + { + // nothing needed in this implementation + } + +CMMFDevSoundCIMuxUtility::~CMMFDevSoundCIMuxUtility() + { + + } + +const TInt KMuxTempBufferSize = 20; + +// create a custom interface Mux implementation +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFDevSoundCIMuxUtility::CreateCustomInterfaceMuxL(TUid aInterfaceId) + { + // The Uid of the plugin will be the match string + TInt uidAsInteger = aInterfaceId.iUid; + TBuf8 tempBuffer; + tempBuffer.Num(uidAsInteger, EHex); // has value + TUid interfaceUid = {KUidDevSoundCustomInterfaceMux}; + + TUid destructorKey; + MMMFDevSoundCustomInterfaceMuxPlugin* self = + static_cast + (MmPluginUtils::CreateImplementationL(interfaceUid, destructorKey, tempBuffer, KRomOnlyResolverUid)); + + // pass the destructor key so class can destroy itself + self->PassDestructorKey(destructorKey); + CleanupReleasePushL(*self); + + // attempt to construct the plugin + self->CompleteConstructL(this); + CleanupStack::Pop(); // self + + return self; + } + + +// from MMMFDevSoundCustomInterfaceMux interface +TInt CMMFDevSoundCIMuxUtility::OpenSlave(TUid aInterface, const TDesC8& aPackageBuf) + { + // 1. send openslave custom command to remote side + // 2. devsoundsession intercepts this custom command + // and creates / opens interface + // open packet = command, interface, inBuff + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCIOpenSlave; + TPckgBuf idBuffer(aInterface); + + return iCustomChannel->SyncCustomCommand(commandId, idBuffer, aPackageBuf, NULL); + } + +void CMMFDevSoundCIMuxUtility::CloseSlave(TInt aHandle) + { + // 1. send closeslave custom command to remote side + // 2. demuxplugin removes its handle for this interface + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCICloseSlave; + TPckgBuf handleBuffer(aHandle); + + iCustomChannel->SyncCustomCommand(commandId, handleBuffer, KNullDesC8, NULL); + } + + +TInt CMMFDevSoundCIMuxUtility::SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf) + { + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCISendSlaveSyncCommand; + + TMMFDevSoundCustomInterfaceCommand commandPair; + commandPair.iCommand = aCommand; + commandPair.iHandle = aHandle; + TPckgBuf comBuffer(commandPair); + + return iCustomChannel->SyncCustomCommand(commandId, comBuffer, aPackageBuf, NULL); + } + +TInt CMMFDevSoundCIMuxUtility::SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf) + { + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult; + + TMMFDevSoundCustomInterfaceCommand commandPair; + commandPair.iCommand = aCommand; + commandPair.iHandle = aHandle; + TPckgBuf comBuffer(commandPair); + + return iCustomChannel->SyncCustomCommand(commandId, comBuffer, aPackageBuf, &aResultBuf); + } + +void CMMFDevSoundCIMuxUtility::SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf) + { + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCISendSlaveAsyncCommand; + + // command and handle comes from client with asynchronous commands + + iCustomChannel->AsyncCustomCommand(commandId, aStatus, aComPackage, aPackageBuf, NULL); + } + +void CMMFDevSoundCIMuxUtility::SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf) + { + TUid commandId(KNullUid); + commandId.iUid = EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult; + + // command and handle comes from client with asynchronous commands + + iCustomChannel->AsyncCustomCommand(commandId, aStatus, aComPackage, aPackageBuf, &aResultBuf); + } + +CMMFDevSoundCIMuxUtility::CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel) +: iCustomChannel(aCustomChannel) + { + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCIMuxUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCIMuxUtility.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,63 @@ +// Copyright (c) 2005-2009 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: +// MmfDevSoundCIMuxUtility.cpp +// +// + +#ifndef MMFDEVSOUNDCIMUXUTILITY_H +#define MMFDEVSOUNDCIMUXUTILITY_H + +#include +#include +#include +#include "MmfDevSoundServerStart.h" +#include "MmfAudioClientServer.h" +#include + + +/** +* @internalTechnology +* @file +*/ + +class CMMFDevSoundCIMuxUtility; +NONSHARABLE_CLASS( CMMFDevSoundCIMuxUtility ) : public CBase, + public MMMFDevSoundCustomInterfaceMuxUtility + { +public: + static CMMFDevSoundCIMuxUtility* NewL(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); + virtual ~CMMFDevSoundCIMuxUtility(); + void ConstructL(); + + // create a custom interface Mux implementation + MMMFDevSoundCustomInterfaceMuxPlugin* CreateCustomInterfaceMuxL(TUid aInterfaceId); + + // from MMMFDevSoundCustomInterfaceMux interface + virtual TInt OpenSlave(TUid, const TDesC8& aPackageBuf); + virtual void CloseSlave(TInt aHandle); + virtual TInt SendSlaveSyncCommand(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf); + virtual TInt SendSlaveSyncCommandResult(TInt aHandle, TInt aCommand, const TDesC8& aPackageBuf, TDes8& aResultBuf); + virtual void SendSlaveAsyncCommand(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf); + virtual void SendSlaveAsyncCommandResult(TMMFDevSoundCustomInterfaceCommandPackage& aComPackage, TRequestStatus& aStatus, const TDesC8& aPackageBuf, TDes8& aResultBuf); +private: + CMMFDevSoundCIMuxUtility(MMMFDevSoundCustomInterfaceChannel* aCustomChannel); + + MMMFDevSoundCustomInterfaceChannel* iCustomChannel; + }; + + + + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCallbackHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCallbackHandler.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,211 @@ +// Copyright (c) 2005-2009 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 "SoundDeviceBody.h" +#include "MmfDevSoundCallbackHandler.h" +#include "MmfAudioClientServer.h" + +CMsgQueueHandler* CMsgQueueHandler::NewL(RMMFDevSoundProxy* aDevSoundProxy, + MDevSoundObserver& aDevSoundObserver, + RMsgQueue* aMsgQueue, + MMMFDevSoundCustomInterfaceObserver& aDevSoundIntfcObserver) + { + CMsgQueueHandler* self = new(ELeave) CMsgQueueHandler(aDevSoundProxy, aDevSoundObserver, aMsgQueue, aDevSoundIntfcObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CMsgQueueHandler::SetObserver(MDevSoundObserver& aDevSoundObserver) + { + iDevSoundObserver = &aDevSoundObserver; + } + +CMsgQueueHandler::CMsgQueueHandler(RMMFDevSoundProxy* aDevSoundProxy, + MDevSoundObserver& aDevSoundObserver, + RMsgQueue* aMsgQueue, + MMMFDevSoundCustomInterfaceObserver& aDevSoundIntfcObserver) : + CActive(EPriorityStandard), iDevSoundProxy(aDevSoundProxy), + iDevSoundObserver(&aDevSoundObserver), iMsgQueue(aMsgQueue), iDevSoundIntfcObserver(aDevSoundIntfcObserver) + { + CActiveScheduler::Add(this); + } + +void CMsgQueueHandler::ConstructL() + { + } + +CMsgQueueHandler::~CMsgQueueHandler() + { + delete iBuffer; + Cancel(); + iMsgQueue->Close(); + } + +void CMsgQueueHandler::ReceiveEvents() + { + iMsgQueue->NotifyDataAvailable(iStatus); + SetActive(); + } + +void CMsgQueueHandler::RunL() + { + TInt queueErr = iMsgQueue->Receive(iCurrentItem); + TInt err = KErrNone; + + if (!queueErr || queueErr == KErrUnderflow) + { + // Signal that we're ready to process the next message + iMsgQueue->NotifyDataAvailable(iStatus); + SetActive(); + } + + if (!queueErr) + { + iCurrentRequest = iCurrentItem.iRequest; + switch (iCurrentRequest) + { + case EMMFDevSoundProxyICEvent: + DoInitComplete(); + break; + case EMMFDevSoundProxyBTBFEvent: + { + TRAP(err, DoBTBFCompleteL()); + if (err) + { + iDevSoundObserver->PlayError(err); + } + } + break; + case EMMFDevSoundProxyBTBEEvent: + { + TRAP(err, DoBTBECompleteL()); + if (err) + { + iDevSoundObserver->RecordError(err); + } + } + break; + case EMMFDevSoundProxyPEEvent: + DoPlayErrorComplete(); + break; + case EMMFDevSoundProxyREEvent: + DoRecordErrorComplete(); + break; + case EMMFDevSoundProxyTFEvent: + DoToneFinishedComplete(); + break; + case EMMFDevSoundProxySETCEvent: + DoSendEventToClientComplete(); + break; + case EMMFDevSoundCustomCommandCloseMuxDemuxPair: + { + TMMFEvent pckgevent = iCurrentItem.iEventPckg(); + TInt handle = pckgevent.iEventType.iUid; + iDevSoundIntfcObserver.CloseCustomInterface(handle); + } + break; + default: + break; + } + + } + } + +TInt CMsgQueueHandler::RunError(TInt aError) + { + TMMFEvent event; + event.iErrorCode = aError; + iDevSoundObserver->SendEventToClient(event); + return KErrNone; + } + +void CMsgQueueHandler::DoCancel() + { + iMsgQueue->CancelDataAvailable(); + } + +void CMsgQueueHandler::DoInitComplete() + { + iDevSoundObserver->InitializeComplete(iCurrentItem.iErrorCode); + } + +void CMsgQueueHandler::DoPlayErrorComplete() + { + iDevSoundObserver->PlayError(iCurrentItem.iErrorCode); + } + +void CMsgQueueHandler::DoBTBFCompleteL() + { + // Wanted to push both the message request and the message's data + // through the queue in one go but the data is too large so try + // issuing a new request for the data before doing all this... + User::LeaveIfError(iDevSoundProxy->BufferToBeFilledData(iSetPckg)); + + TMMFDevSoundProxyHwBuf set; + set.iBufferType = iSetPckg().iBufferType; + set.iRequestSize = iSetPckg().iRequestSize; + set.iBufferSize = iSetPckg().iBufferSize; + set.iLastBuffer = iSetPckg().iLastBuffer; + + CMMFDataBuffer* buffer = CMMFDescriptorBuffer::NewL(set.iBufferSize); + CleanupStack::PushL(buffer); + buffer->SetRequestSizeL(set.iRequestSize); + CleanupStack::Pop(buffer); + buffer->SetLastBuffer(set.iLastBuffer); + iDevSoundProxy->SetBuffer(buffer);//DevSoundProxy takes the ownership of "buffer" + + iDevSoundObserver->BufferToBeFilled(buffer); + } + +void CMsgQueueHandler::DoBTBECompleteL() + { + User::LeaveIfError(iDevSoundProxy->BufferToBeEmptiedData(iSetPckg)); + + TMMFDevSoundProxyHwBuf aSet; + aSet.iBufferType = iSetPckg().iBufferType; + aSet.iRequestSize = iSetPckg().iRequestSize; + aSet.iBufferSize = iSetPckg().iBufferSize; + aSet.iLastBuffer = iSetPckg().iLastBuffer; + + if(iBuffer) + { + delete iBuffer; + iBuffer = NULL; + } + iBuffer = CMMFDescriptorBuffer::NewL(aSet.iBufferSize); + iBuffer->SetRequestSizeL(aSet.iRequestSize); + iBuffer->SetLastBuffer(aSet.iLastBuffer); + + User::LeaveIfError(iDevSoundProxy->GetRecordedBufferL(*iBuffer)); + + iDevSoundObserver->BufferToBeEmptied(iBuffer); + } + +void CMsgQueueHandler::DoRecordErrorComplete() + { + iDevSoundObserver->RecordError(iCurrentItem.iErrorCode); + } + +void CMsgQueueHandler::DoToneFinishedComplete() + { + iDevSoundObserver->ToneFinished(iCurrentItem.iErrorCode); + } + +void CMsgQueueHandler::DoSendEventToClientComplete() + { + iDevSoundObserver->SendEventToClient(iCurrentItem.iEventPckg()); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCallbackHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/MmfDevSoundCallbackHandler.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,81 @@ +// Copyright (c) 2001-2009 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: +// + + +#ifndef __MMFDEVSOUNDCALLBACKHANDLER_H +#define __MMFDEVSOUNDCALLBACKHANDLER_H + +#include +#include +#include +#include +#include "MmfDevSoundProxy.h" + +#include + +/* + * + * Class Name: CMsgQueueHandler + * + * AO that manages the message queue + * @internalComponent + * + */ +class CMsgQueueHandler : public CActive + { +public: + static CMsgQueueHandler* NewL(RMMFDevSoundProxy* aDevSoundProxy, + MDevSoundObserver& aDevSoundObserver, + RMsgQueue* aMsgQueue, + MMMFDevSoundCustomInterfaceObserver& aDevSoundIntfcObserver); + void SetObserver(MDevSoundObserver& aDevSoundObserver); + ~CMsgQueueHandler(); + void ReceiveEvents(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); +private: + CMsgQueueHandler(RMMFDevSoundProxy* aDevSoundProxy, + MDevSoundObserver& aDevSoundObserver, + RMsgQueue* aMsgQueue, + MMMFDevSoundCustomInterfaceObserver& aDevSoundIntfcObserver); + void ConstructL(); + + void ReceiveAllEvents(); + + void DoInitComplete(); + void DoPlayErrorComplete(); + void DoRecordErrorComplete(); + void DoBTBFCompleteL(); + void DoBTBECompleteL(); + void DoToneFinishedComplete(); + void DoSendEventToClientComplete(); + +private: + RMMFDevSoundProxy* iDevSoundProxy; + MDevSoundObserver* iDevSoundObserver; + TMMFDevSoundProxyHwBufPckg iSetPckg; + + TMMFEventPckg iEventPckg; + + RMsgQueue* iMsgQueue; + TMMFDevSoundQueueItem iCurrentItem; + TMMFDevSoundProxyRequest iCurrentRequest; + + CMMFDataBuffer* iBuffer; // buffer to be emptied + MMMFDevSoundCustomInterfaceObserver& iDevSoundIntfcObserver; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,698 @@ +// Copyright (c) 2001-2009 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 +#include "SoundDeviceBody.h" +#include // KUidRefDevSoundTaskConfig + +const TInt KMaxMessageQueueItems = 8; + +/* + * + * Default Constructor. + * + * No default implementation. CMMFDevSound implements 2-phase construction. + * + */ +CMMFDevSoundClientImp::CMMFDevSoundClientImp() + { + } + +/* + * + * Destructor. + * + * Deletes all objects and releases all resource owned by this + * instance. + * + */ +CMMFDevSoundClientImp::~CMMFDevSoundClientImp() + { + // clear the array of custom interfaces + for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++) + { + iCustomInterfaceArray[i].iInterface->Release(); + } + iCustomInterfaceArray.Reset(); + iCustomInterfaceArray.Close(); + + // delete the MUX utility + delete iMuxUtility; + + if (iMsgQueueHandler && iMsgQueueHandler->IsActive()) + { + iMsgQueueHandler->Cancel(); + } + delete iMsgQueueHandler; + + iMsgQueue.Close(); + + if( iDevSoundProxy != NULL) + { + iDevSoundProxy->Close(); + delete iDevSoundProxy; + } + } + +/* + * + * Constructs, and returns a pointer to, a new CMMFDevSound object. + * + * Leaves on failure. + * + */ +CMMFDevSoundClientImp* CMMFDevSoundClientImp::NewL() + { + CMMFDevSoundClientImp* self = new (ELeave) CMMFDevSoundClientImp(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/* + * + * 2nd phase constructor - assumes that iParent has already been set up properly. + * + */ +void CMMFDevSoundClientImp::ConstructL() + { + // all these data properties should be NULL, but add ASSERTs to verify + + ASSERT(iDevSoundProxy==NULL); + iDevSoundProxy = new (ELeave) RMMFDevSoundProxy(); + + TInt err = iMsgQueue.CreateGlobal(KNullDesC, KMaxMessageQueueItems); // global, accessible to all that have its handle + User::LeaveIfError(err); + err = iDevSoundProxy->Open(iMsgQueue); + if(err) + { + delete iDevSoundProxy; + iDevSoundProxy = NULL; + } + + User::LeaveIfError(err); + + // create MUX utility + iMuxUtility = CMMFDevSoundCIMuxUtility::NewL(this); + } + + +/* + * + * Initializes CMMFDevSound object to play and record PCM16 raw audio data + * with sampling rate of 8 KHz. + * + * On completion of Initialization, calls InitializeComplete() on + * aDevSoundObserver. + * + * Leaves on failure. + * + * @param "MDevSoundObserver& aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "TMMFState aMode" + * Mode for which this object will be used. + * + */ +void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + + { + TInt initError = KErrNone; + iDevSoundObserver = &aDevSoundObserver; + initError = iDevSoundProxy->InitializeL(aMode); + + if (initError) + { + User::Leave(initError); + } + + if (iMsgQueueHandler) + { + iMsgQueueHandler->Cancel(); + iMsgQueueHandler->SetObserver(*iDevSoundObserver); + } + else + { + iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this); + } + + iMsgQueueHandler->ReceiveEvents(); + } + +/* + * + * Configure CMMFDevSound object for the settings in aConfig. + * + * Use this to set sampling rate, Encoding and Mono/Stereo. + * + * @param "TMMFCapabilities& aConfig" + * Attribute values to which CMMFDevSound object will be configured to. + * + * As part of defect 20796, the iRecordFormat has been set under the iPlayFormat, + * before it was not set at all. + * + */ +void CMMFDevSoundClientImp::SetConfigL(const TMMFCapabilities& aConfig) + { + iDevSoundProxy->SetConfigL(aConfig); + } + +/* + * + * Changes the current playback volume to a specified value. + * + * The volume can be changed before or during playback and is effective + * immediately. + * + * @param "TInt aVolume" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the + * volume is not within this range, the volume is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +void CMMFDevSoundClientImp::SetVolume(TInt aVolume) + { + iDevSoundProxy->SetVolume(aVolume); + } + +/* + * + * Changes the current recording gain to a specified value. + * + * The gain can be changed before or during recording and is effective + * immediately. + * + * @param "TInt aGain" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the + * volume is not within this range, the gain is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +void CMMFDevSoundClientImp::SetGain(TInt aGain) + { + iDevSoundProxy->SetGain(aGain); + } + +/* + * + * Sets the speaker balance for playing. + * + * The speaker balance can be changed before or during playback and is + * effective immediately. + * + * @param "TInt& aLeftPercentage" + * On return contains left speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on left + * speaker. + * + * @param "TInt& aRightPercentage" + * On return contains right speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on + * right speaker. + * + */ +void CMMFDevSoundClientImp::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iDevSoundProxy->SetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * + * Sets the microphone gain balance for recording. + * + * The microphone gain balance can be changed before or during recording and + * is effective immediately. + * + * @param "TInt aLeftPercentage" + * Left microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on left microphone. + * + * @param "TInt aRightPercentage" + * Right microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on right microphone. + * + */ +void CMMFDevSoundClientImp::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + iDevSoundProxy->SetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * + * Initializes audio device and start play process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, PlayError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() + * method will be called with a buffer reference. After reading data into the + * buffer reference passed, the client should call PlayData() to play data. + * + * The amount of data that can be played is specified in + * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this + * size will be ignored. + * + * Leaves on failure. + * + */ +void CMMFDevSoundClientImp::PlayInitL() + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + iDevSoundProxy->PlayInitL(); + } + +/* + * + * Initializes audio device and start record process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, RecordError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() + * method will be called with a buffer reference. This buffer contains recorded + * or encoded data. After processing data in the buffer reference passed, the + * client should call RecordData() to continue recording process. + * + * The amount of data that is available is specified in + * CMMFBuffer::RequestSize(). + * + * Leaves on failure. + * + */ +void CMMFDevSoundClientImp::RecordInitL() + { + + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + iDevSoundProxy->RecordInitL(); + } + +/* + * + * Plays data in the buffer at the current volume. The client should fill + * the buffer with audio data before calling this method. The Observer gets + * reference to buffer along with callback BufferToBeFilled(). When playing of + * the audio sample is complete, successfully or otherwise, the method + * PlayError() on observer is called. + * + */ +void CMMFDevSoundClientImp::PlayData() + { + ASSERT(iDevSoundObserver); + iDevSoundProxy->PlayData(); + } + +/* + * + * Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +void CMMFDevSoundClientImp::Stop() + { + iDevSoundProxy->Stop(); + } + +/* + * + * Temporarily Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +void CMMFDevSoundClientImp::Pause() + { + iDevSoundProxy->Pause(); + } + +/* + * + * Returns the sample recorded so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +TInt CMMFDevSoundClientImp::SamplesRecorded() + { + return iDevSoundProxy->SamplesRecorded(); + } + +/* + * + * Returns the sample played so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +TInt CMMFDevSoundClientImp::SamplesPlayed() + { + return iDevSoundProxy->SamplesPlayed(); + } + + +/* + * + * Initializes audio device and start playing tone. Tone is played with + * frequency and for duration specified. + * + * Leaves on failure. + * + * @param "TInt aFrequency" + * Frequency at with the tone will be played. + * + * @param "TTimeIntervalMicroSeconds& aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + * + */ +void CMMFDevSoundClientImp::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + { + iDevSoundProxy->PlayToneL(aFrequency, aDuration); + } + +/* + * Initializes audio device and start playing a dual tone. + * The tone consists of two sine waves of different frequencies summed together + * Dual Tone is played with specified frequencies and for specified duration. + * + * @param "aFrequencyOne" + * First frequency of dual tone + * + * @param "aFrequencyTwo" + * Second frequency of dual tone + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + */ +void CMMFDevSoundClientImp::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + iDevSoundProxy->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration); + } + +/* + * + * Initializes audio device and start playing DTMF string aDTMFString. + * + * Leaves on failure. + * + * @param "TDesC& aDTMFString" + * DTMF sequence in a descriptor. + * + */ +void CMMFDevSoundClientImp::PlayDTMFStringL(const TDesC& aDTMFString) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + iDevSoundProxy->PlayDTMFStringL(aDTMFString); + } + +/* + * + * Initializes audio device and start playing tone sequence. + * + * Leaves on failure. + * + * @param "TDesC8& aData" + * Tone sequence in a descriptor. + * + */ +void CMMFDevSoundClientImp::PlayToneSequenceL(const TDesC8& aData) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + iDevSoundProxy->PlayToneSequenceL(aData); + } + +/* + * + * Initializes audio device and start playing the specified pre-defined tone + * sequence. + * + * Leaves on failure. + * + * @param "TInt aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * CMdaAudioPlayerUtility::FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + */ +void CMMFDevSoundClientImp::PlayFixedSequenceL(TInt aSequenceNumber) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + iDevSoundProxy->PlayFixedSequenceL(aSequenceNumber); + } + +/* + * + * Defines the duration of tone on, tone off and tone pause to be used during the + * DTMF tone playback operation. + * + * Supported only during tone playing. + * + * @param "TTimeIntervalMicroSeconds32& aToneOnLength" + * The period over which the tone will be played. If this is set to + * zero, then the tone is not played. + * + * @param "TTimeIntervalMicroSeconds32& aToneOffLength" + * The period over which the no tone will be played. + * + * @param "TTimeIntervalMicroSeconds32& aPauseLength" + * The period over which the tone playing will be paused. + * + */ +void CMMFDevSoundClientImp::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + { + iDevSoundProxy->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength); + } + +/* + * + * Defines the period over which the volume level is to rise smoothly from + * nothing to the normal volume level. + * + * @param "TTimeIntervalMicroSeconds& aRampDuration" + * The period over which the volume is to rise. A zero value causes + * the tone sample to be played at the normal level for the full + * duration of the playback. A value, which is longer than the duration + * of the tone sample, that the sample never reaches its normal + * volume level. + * + * + */ +void CMMFDevSoundClientImp::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + iDevSoundProxy->SetVolumeRamp(aRampDuration); + } + + +/** + * @see sounddevice.h + */ +void CMMFDevSoundClientImp::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + { + iDevSoundProxy->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + +/** + * @see sounddevice.h + */ +void CMMFDevSoundClientImp::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const + { + iDevSoundProxy->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings); + } + +/** + * @see sounddevice.h + */ +TInt CMMFDevSoundClientImp::SetClientThreadInfo(TThreadId aTid) + { + return iDevSoundProxy->SetClientThreadInfo(aTid); + } + + +TInt CMMFDevSoundClientImp::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + return iDevSoundProxy->RegisterAsClient(aEventType,aNotificationRegistrationData); + } + +TInt CMMFDevSoundClientImp::CancelRegisterAsClient(TUid aEventType) + { + return iDevSoundProxy->CancelRegisterAsClient(aEventType); + } + +TInt CMMFDevSoundClientImp::GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData) + { + return iDevSoundProxy->GetResourceNotificationData(aEventType,aNotificationData); + } + +TInt CMMFDevSoundClientImp::WillResumePlay() + { + return iDevSoundProxy->WillResumePlay(); + } + +TInt CMMFDevSoundClientImp::EmptyBuffers() + { + return iDevSoundProxy->EmptyBuffers(); + } + +TInt CMMFDevSoundClientImp::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) + { + return iDevSoundProxy->GetTimePlayed(aTime); + } +/* + * + * Returns a given Custom Interface on the DevSound based on the UID + * If this is not recognised then the custominterface is created by + * a pair of ECOM plugins. + * + * @released + * @param "TUid aInterfaceId" + * The UID of the required Custom Interface + * @return a pointer to the custom interface + * + */ +TAny* CMMFDevSoundClientImp::CustomInterface(TUid aInterfaceId) + { + // check if this UID refers to auto/pause/resume + if (aInterfaceId == KMmfUidDevSoundAudioResourceCustomInterface) + { + MAutoPauseResumeSupport* result = this; + return result; + } + if (aInterfaceId == KMmfUidDevSoundEmptyBuffersCustomInterface) + { + MMMFDevSoundEmptyBuffers* result = this; + return result; + } + if (aInterfaceId == KMmfUidDevSoundAudioClientThreadInfoCustomInterface) + { + MAudioClientThreadInfo* result = this; + return result; + } + + if (aInterfaceId == KMmfUidDevSoundTimePlayedCustomInterface) + { + MMMFDevSoundTimePlayed* result = this; + return result; + } + + // we are being asked for a Custom Interface not natively supported + // by the DevSound plugin. + + // first check if we already have resolved a custom interface of this type + TInt index = FindCustomInterface(aInterfaceId); + + MMMFDevSoundCustomInterfaceMuxPlugin* ptr = NULL; + + // if we found the interface, take a copy of this instead + if (index != KNullHandle) + { + // check our index is valid + ptr = iCustomInterfaceArray[index-1].iInterface; + if (ptr) + { + return ptr->CustomInterface(aInterfaceId); + } + else + { + // we may not need this code because this + // *should* be impossible to reach + return NULL; + } + } + else + { + // else try and instantiate a plugin tunnelling + // pair to support this Custom Interface + TRAPD(err, ptr = iMuxUtility->CreateCustomInterfaceMuxL(aInterfaceId)); + + if (ptr && (err == KErrNone)) + { + TMMFDevSoundCustomInterfaceData data; + data.iInterface = ptr; + data.iId = aInterfaceId; + + // attempt to open remote demux + // this will store a handle in the mux plugin if successful + // and also return it here - invalid handle = -1 + data.iHandle = ptr->OpenInterface(aInterfaceId); + + // if the handle is greater than zero then we know we have + // successfully opened the interface + if (data.iHandle > KNullHandle) + { + // append this to the current interface list + TInt err = KErrNone; + err = iCustomInterfaceArray.Append(data); + if (err == KErrNone) + { + // return the custom interface on the ptr + return ptr->CustomInterface(aInterfaceId); + } + } + + // no memory or other problem so shut down interface + ptr->Release(); + ptr = NULL; + } + } + + // if code gets here then we don't support the interface + // so we can pass it onto the DevSound proxy so that we + // can attempt to resolve the interface externally + return iDevSoundProxy->CustomInterface(aInterfaceId); + } + +TInt CMMFDevSoundClientImp::FindCustomInterface(TUid aInterfaceId) + { + TInt index = KNullHandle; + + for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++) + { + if (iCustomInterfaceArray[i].iId == aInterfaceId) + { + index = i+1; // use index+1 as the handle, so 0 is undefined/not-found + break; + } + } + + return index; + } + +void CMMFDevSoundClientImp::CloseCustomInterface(TInt aIndex) + { + for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++) + { + if(iCustomInterfaceArray[i].iHandle == aIndex) + { + iCustomInterfaceArray[i].iInterface->Release(); + iCustomInterfaceArray.Remove(i); + break; + } + } + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,185 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __SOUNDDEVICEBODY__H__ +#define __SOUNDDEVICEBODY__H__ + +#include "MmfDevSoundCallbackHandler.h" +#include +#include +#include +#include "MmfDevSoundCIMuxUtility.h" + + +/* + * + * Class Name: CMMFDevSoundClientImp + * + * Reference internals for CMMFDevSound + * @internalComponent + * + */ +class CMMFDevSoundClientImp : public CBase, + public MMMFDevSoundPlugin, + public MAudioClientThreadInfo, + public MAutoPauseResumeSupport, + public MMMFDevSoundCustomInterfaceChannel, + public MMMFDevSoundEmptyBuffers, + public MMMFDevSoundCustomInterfaceObserver, + public MMMFDevSoundTimePlayed + + { +public: + static CMMFDevSoundClientImp* NewL(); + ~CMMFDevSoundClientImp(); + + // Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode); + // Initializes with hardware device and mode (play, record, convert) + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode); + // Initializes with hardware device associated with specific FourCC code + // and desired mode (play, record, convert) + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); + + // Returns device capabilities + TMMFCapabilities Capabilities(); + // Returns device configuration + TMMFCapabilities Config() const; + // Sets device configuration + void SetConfigL(const TMMFCapabilities& aCaps); + + // Returns maximum play volume device supports + TInt MaxVolume(); + // Returns play volume device is configured to + TInt Volume(); + // Sets device play volume + void SetVolume(TInt aVolume); + + // Returns maximum record gain device supports + TInt MaxGain(); + // Returns record gain device is configured to + TInt Gain(); + // Sets device record gain + void SetGain(TInt aGain); + + // Returns play balance + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + // Sets play balance + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + + // Returns record balance + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + // Sets record balance + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + + // Initializes audio device and start play process + void PlayInitL(); + // Initializes audio device and start record process + void RecordInitL(); + // Plays the data in the buffer + void PlayData(); + // Records data into buffer + void RecordData(); + // Stops the ongoing operation + void Stop(); + // Tempororily Stops the ongoing operation + void Pause(); + + // Returns the Sample recorded so far + TInt SamplesRecorded(); + // Returns the Sample played so far + TInt SamplesPlayed(); + + // Initializes device and start playing tone + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + // Initializes device and start playing dual tone + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + // Initializes device and start playing DTMF String + void PlayDTMFStringL(const TDesC& aDTMFString); + // Initializes device and start playing tone sequence + void PlayToneSequenceL(const TDesC8& aData); + // Initializes device and start playing fixed sequence + void PlayFixedSequenceL(TInt aSequenceNumber); + + // Sets tone repeat attributes + void SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); + // Sets DTMF tone attributes + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength); + // Sets volume ramp for playing + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + // Sets priority settings + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + + // Provides interface for sending custom commands for the audio device + TAny* CustomInterface(TUid aInterfaceId); + + // Provides interface for querying fixed sequence count + TInt FixedSequenceCount(); + // Provides interface for querying fixed sequence name + const TDesC& FixedSequenceName(TInt aSequenceNumber); + // Gets the supported input datatypes + void GetSupportedInputDataTypesL(RArray& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const; + // Gets the supported output datatypes + void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; + // Set the real client thread with thread Id + TInt SetClientThreadInfo(TThreadId aTid); + + // Registers the client for notification + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); + //cancels the registered notification + TInt CancelRegisterAsClient(TUid aEventType); + //get the notification data to resume + TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData); + //if client need more than the default timeout period + TInt WillResumePlay(); + + // from MMMFDevSoundEmptyBuffers + //Empties the buffers below DevSound without causing the codec to be deleted. + TInt EmptyBuffers(); + + // added to support custom command passing through DevSound + TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam); + void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam); + + //from MMMFDevSoundCustomInterfaceObserver + void CloseCustomInterface(TInt aIndex); + + //from MMMFDevSoundTimePlayed + TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime); +private: + // So that nobody can extend + CMMFDevSoundClientImp(); + // Second phase constructor + void ConstructL(); + + TInt FindCustomInterface(TUid aInterfaceId); +private: + // custom interface storage + RArray iCustomInterfaceArray; + CMMFDevSoundCIMuxUtility* iMuxUtility; + + RMMFDevSoundProxy* iDevSoundProxy; + MDevSoundObserver* iDevSoundObserver; + + RMsgQueue iMsgQueue; + CMsgQueueHandler* iMsgQueueHandler; + }; + +#include "SoundDeviceBody.inl" + +#endif // __SOUNDDEVICEBODY__H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/SoundDevice/SoundDeviceBody.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,324 @@ +// Copyright (c) 2001-2009 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: +// Initializes DevSound object for the mode aMode for processing audio data +// with hardware device aHWDev. +// On completion of Initialization, the observer will be notified via call back +// InitializeComplete(). +// Leaves on failure. +// @param "MDevSoundObserver& aDevSoundObserver" +// A reference to DevSound Observer instance. +// @param "TUid aHWDev" +// CMMFHwDevice implementation identifier. +// @param "TMMFState aMode" +// Mode for which this object will be used. +// +// + +inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + { + TInt initError = KErrNone; + iDevSoundObserver = &aDevSoundObserver; + initError = iDevSoundProxy->InitializeL(aHWDev, aMode); + + if (initError) + { + User::Leave(initError); + } + + if (iMsgQueueHandler) + { + iMsgQueueHandler->Cancel(); + iMsgQueueHandler->SetObserver(*iDevSoundObserver); + } + else + { + iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this); + } + + iMsgQueueHandler->ReceiveEvents(); + } + +/* + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device supporting FourCC aDesiredFourCC. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "MDevSoundObserver& aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "TFourCC aDesiredFourCC" + * CMMFHwDevice implementation FourCC. + * + * @param "TMMFState aMode" + * Mode for which this object will be used. + * + */ +inline void CMMFDevSoundClientImp::InitializeL(MDevSoundObserver& aDevSoundObserver, + TFourCC aDesiredFourCC, TMMFState aMode) + { + TInt initError = KErrNone; + iDevSoundObserver = &aDevSoundObserver; + + initError = iDevSoundProxy->InitializeL(aDesiredFourCC, aMode); + + if (initError) + { + User::Leave(initError); + } + + if (iMsgQueueHandler) + { + iMsgQueueHandler->Cancel(); + iMsgQueueHandler->SetObserver(*iDevSoundObserver); + } + else + { + iMsgQueueHandler = CMsgQueueHandler::NewL(iDevSoundProxy, *iDevSoundObserver, &iMsgQueue, *this); + } + iMsgQueueHandler->ReceiveEvents(); + } + +/* + * + * Returns the supported Audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSoundClientImp::Capabilities() + { + return iDevSoundProxy->Capabilities(); + } + +/* + * + * Returns the current audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSoundClientImp::Config() const + { + return iDevSoundProxy->Config(); + } + +/* + * + * Returns an integer representing the maximum volume. + * + * This is the maximum value which can be passed to CMMFDevSound::SetVolume. + * + * @return "TInt" + * The maximum volume. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSoundClientImp::MaxVolume() + { + return iDevSoundProxy->MaxVolume(); + } + +/* + * + * Returns an integer representing the current volume. + * + * @return "TInt" + * The current volume level. + * + */ +inline TInt CMMFDevSoundClientImp::Volume() + { + return iDevSoundProxy->Volume(); + } + +/* + * + * Returns an integer representing the maximum gain. + * + * This is the maximum value which can be passed to CMMFDevSound::SetGain. + * + * @return "TInt" + * The maximum gain. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSoundClientImp::MaxGain() + { + return iDevSoundProxy->MaxGain(); + } + +/* + * + * Returns an integer representing the current gain. + * + * @return "TInt" + * The current gain level. + * + */ +inline TInt CMMFDevSoundClientImp::Gain() + { + return iDevSoundProxy->Gain(); + } + +/* + * + * Returns the speaker balance set for playing. + * + * Leaves on failure. + * + * @param "TInt& aLeftPercentage" + * On return contains the left speaker volume percentage. + * + * @param "TInt& aRightPercentage" + * On return contains the right speaker volume percentage. + * + */ +inline void CMMFDevSoundClientImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iDevSoundProxy->GetPlayBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * + * Returns the microphone gain balance set for recording. + * + * Leaves on failure. + * + * @param "TInt& aLeftPercentage" + * On return contains the left microphone gain percentage. + * + * @param "TInt& aRightPercentage" + * On return contains the right microphone gain percentage. + * + */ +inline void CMMFDevSoundClientImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + iDevSoundProxy->GetRecordBalanceL(aLeftPercentage, aRightPercentage); + } + +/* + * + * Contine the process of recording. Once the buffer is filled with recorded + * data, the Observer gets reference to buffer along with callback + * BufferToBeEmptied(). After processing the buffer (copying over to a + * different buffer or writing to file) the client should call this + * method to continue recording process. + * + */ +inline void CMMFDevSoundClientImp::RecordData() + { + ASSERT(iDevSoundObserver); + iDevSoundProxy->RecordData(); + } + +/* + * + * Defines the number of times the audio is to be repeated during the tone + * playback operation. + * + * A period of silence can follow each playing of tone. The tone playing can + * be repeated indefinitely. + * + * @param "TInt aRepeatCount" + * The number of times the tone, together with the trailing silence, + * is to be repeated. If this is set to KMdaRepeatForever, then the + * tone, together with the trailing silence, is repeated indefinitely + * or until Stop() is called. If this is set to zero, then the tone is + * not repeated. + * + * Supported only during tone playing. + * + */ +inline void CMMFDevSoundClientImp::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + { + iDevSoundProxy->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence); + } + +/* + * + * Defines the priority settings that should be used for this instance. + * + * @param "const TMMFPrioritySettings& aPrioritySettings" + * An class type representing the client's priority, priority + * preference and state. + * + */ +inline void CMMFDevSoundClientImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + iDevSoundProxy->SetPrioritySettings(aPrioritySettings); + } + + +/* + * + * Returns the number of available pre-defined tone sequences. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * @return "TInt" + * The fixed sequence count. This value is implementation dependent + * but is always greater than or equal to zero. + * + */ +inline TInt CMMFDevSoundClientImp::FixedSequenceCount() + { + + return iDevSoundProxy->FixedSequenceCount(); + } + +/* + * + * Returns the name assigned to a specific pre-defined tone sequence. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * The function raises a panic if sequence number specified invalid. + * + * @return "TDesC&" + * A reference to a Descriptor containing the fixed sequence + * name indexed by aSequenceNumber. + * + * @param "TInt aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * CMdaAudioPlayerUtility::FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + */ +inline const TDesC& CMMFDevSoundClientImp::FixedSequenceName(TInt aSequenceNumber) + { + return iDevSoundProxy->FixedSequenceName(aSequenceNumber); + } + + +inline TInt CMMFDevSoundClientImp::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) + { + return iDevSoundProxy->SyncCustomCommand(aUid, aParam1, aParam2, aOutParam); + } + +inline void CMMFDevSoundClientImp::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) + { + iDevSoundProxy->AsyncCustomCommand(aUid, aStatus, aParam1, aParam2, aOutParam); + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/client/MmfAudioServerProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/client/MmfAudioServerProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,119 @@ +// Copyright (c) 2004-2009 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 +#include +#include + +#include "MmfAudioServerProxy.h" +#include "MmfAudioServerStart.h" +#include "MmfBase.hrh" +#include "MmfAudioClientServer.h" + +#define KMaxServerNameLength 256 + +static const TUid KUidAudioServer = {KUidMmfAudioServerDllUnicodeDefine}; +const TInt KRetries = 5; +const TInt KInitialTime = 100000; //100ms +const TInt KTimeIncrement = 50000; // 50ms + + +EXPORT_C TInt RMMFAudioServerProxy::Open() + { + + const TUidType serverUid(KNullUid,KNullUid,KUidAudioServer); + + // Assume the server is already running and attempt to create a session + // 4 message slots + TInt err = CreateSession(KAudioServerName, TVersion(KMMFAudioServerVersion, + KMMFAudioServerMinorVersionNumber, + KMMFAudioServerBuildVersionNumber)); + if(err == KErrNotFound) + { + // Server not running + // Construct the server binary name + TBuf serverFile; + RProcess server; + + _LIT(KEmpty,""); + + err = server.Create(KAudioServerFileName, KEmpty, serverUid); + if(err != KErrNone) + return err; + // Synchronise with the server + TRequestStatus reqStatus; + server.Rendezvous(reqStatus); + + if (reqStatus!=KRequestPending) + { + server.Kill(0); + } + else + { + // Start the test harness + server.Resume(); + // Server will call the reciprocal static synchronise call + } + User::WaitForRequest(reqStatus); // wait for rendezvous or death + server.Close(); + TInt reqStatusValue = reqStatus.Int(); + if(reqStatusValue != KErrNone) + { + if(reqStatusValue == KErrNoMemory || reqStatusValue == KErrNotFound) + { + // All error codes except KErrNoMemory and KErrNotFound are assumed + // to be a duplicate server instance dying, then keep trying connection + // to the server. This can happen when two servers attempt to start + // at the same time. + return reqStatusValue; + } + //Wait for sometime, then retry and creation session + TInt waitTime = KInitialTime; + for(TInt retries=0;retries +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "MmfAudioClientServer.h" + + +class RMMFAudioServerProxy; // declared here; + +NONSHARABLE_CLASS( RMMFAudioServerProxy ): public RMmfSessionBase +/** +*@internalTechnology +*/ + { +public: + + IMPORT_C TInt Open(); + IMPORT_C TInt SetDevSoundInfo(); + IMPORT_C TInt GetDevSoundSessionHandle(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,545 @@ +// Copyright (c) 2004-2009 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 +#include +#include +#include "MmfDevSoundProxy.h" +#include "MmfDevSoundServerStart.h" +#include "MmfBase.hrh" +#include "MmfAudioClientServer.h" +#include +#include + + +/** +@internalTechnology + +This function raises a panic + +@param aError + one of the several panic codes that may be raised by this dll + +@panic EMMFDevSoundProxyPlayDataWithoutInitialize is raised when playdata is called without initialization +@panic EMMFDevSoundProxyRecordDataWithoutInitialize is raised when recorddata is called without initialization +@panic EMMFDevSoundProxyConvertDataWithoutInitialize is raised when convertdata is called without initialization +*/ +GLDEF_C void Panic(TMMFDevSoundProxyPanicCodes aPanicCode) + { + User::Panic(KMMFDevSoundProxyPanicCategory, aPanicCode); + } + +EXPORT_C RMMFDevSoundProxy::RMMFDevSoundProxy() + : iBuffer(NULL), iSeqName(NULL), iMsgQueueHandle(NULL), iAudioServerProxy (NULL) + { + } + +EXPORT_C void RMMFDevSoundProxy::Close() + { + RMmfSessionBase::Close(); + iState = EIdle; + if(iAudioServerProxy) + { + iAudioServerProxy->Close(); + delete iAudioServerProxy; + } + delete iBuffer; + delete iSeqName; + } + +EXPORT_C TInt RMMFDevSoundProxy::Open(RHandleBase& aMsgQueueHandle) + { + TInt err = KErrNone; + iMsgQueueHandle = &aMsgQueueHandle; + TRAP(err, iSeqName = HBufC::NewL(KMaxFixedSequenceNameLength)); + if(err == KErrNone) + { + TRAP(err, iAudioServerProxy = new (ELeave) RMMFAudioServerProxy()); + if(err == KErrNone) + { + err = iAudioServerProxy->Open(); + if(err == KErrNone) + { + err = SetReturnedHandle(iAudioServerProxy->GetDevSoundSessionHandle()); + } + } + } + if(err) + { + Close(); + } + + return err; + } +EXPORT_C TInt RMMFDevSoundProxy::SetDevSoundInfo() + { + return SendReceive(EMMFAudioLaunchRequests); + } + +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TMMFState aMode) + { + TMMFDevSoundProxySettings set; + set.iMode = aMode; + TMMFDevSoundProxySettingsPckg pckg(set); + TIpcArgs args(&pckg, *iMsgQueueHandle); + return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize1, args); + } + +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TUid aHWDev, TMMFState aMode) + { + TMMFDevSoundProxySettings set; + set.iHWDev = aHWDev; + set.iMode = aMode; + TMMFDevSoundProxySettingsPckg pckg(set); + TIpcArgs args(&pckg, *iMsgQueueHandle); + return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize2, args); + } + +EXPORT_C TInt RMMFDevSoundProxy::InitializeL(TFourCC aDesiredFourCC, TMMFState aMode) + { + TMMFDevSoundProxySettings set; + set.iDesiredFourCC = aDesiredFourCC; + set.iMode = aMode; + TMMFDevSoundProxySettingsPckg pckg(set); + TIpcArgs args(&pckg, *iMsgQueueHandle); + return RSessionBase::SendReceive(EMMFDevSoundProxyInitialize4, args); + } + +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Capabilities() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyCapabilities,KNullDesC8,KNullDesC8,pckg); + return pckg().iCaps; + } + +EXPORT_C TMMFCapabilities RMMFDevSoundProxy::Config() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyConfig,KNullDesC8,KNullDesC8,pckg); + return pckg().iConfig; + } + +EXPORT_C TInt RMMFDevSoundProxy::SetConfigL(const TMMFCapabilities& aConfig) + { + TMMFDevSoundProxySettings set; + set.iConfig = aConfig; + TMMFDevSoundProxySettingsPckg pckg(set); + TInt err = SendReceive(EMMFDevSoundProxySetConfig, pckg); + User::LeaveIfError(err); + return err; + } + +EXPORT_C TInt RMMFDevSoundProxy::MaxVolume() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyMaxVolume,KNullDesC8,KNullDesC8,pckg); + return pckg().iMaxVolume; + } + +EXPORT_C TInt RMMFDevSoundProxy::Volume() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyVolume,KNullDesC8,KNullDesC8,pckg); + return pckg().iVolume; + } + +EXPORT_C TInt RMMFDevSoundProxy::SetVolume(TInt aVolume) + { + TMMFDevSoundProxySettings set; + set.iVolume = aVolume; + TMMFDevSoundProxySettingsPckg pckg(set); + return SendReceive(EMMFDevSoundProxySetVolume, pckg); + } + +EXPORT_C TInt RMMFDevSoundProxy::MaxGain() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyMaxGain,KNullDesC8,KNullDesC8,pckg); + return pckg().iMaxGain; + } + +EXPORT_C TInt RMMFDevSoundProxy::Gain() + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceiveResult(EMMFDevSoundProxyGain,KNullDesC8,KNullDesC8,pckg); + return pckg().iGain; + } + +EXPORT_C TInt RMMFDevSoundProxy::SetGain(TInt aGain) + { + TMMFDevSoundProxySettings set; + set.iGain = aGain; + TMMFDevSoundProxySettingsPckg pckg(set); + return SendReceive(EMMFDevSoundProxySetGain, pckg); + } + +EXPORT_C void RMMFDevSoundProxy::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyPlayBalance,KNullDesC8,KNullDesC8,pckg)); + aLeftPercentage = pckg().iLeftPercentage; + aRightPercentage = pckg().iRightPercentage; + } + +EXPORT_C void RMMFDevSoundProxy::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + TMMFDevSoundProxySettings set; + set.iLeftPercentage = aLeftPercentage; + set.iRightPercentage = aRightPercentage; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceive(EMMFDevSoundProxySetPlayBalance, pckg)); + } + +EXPORT_C void RMMFDevSoundProxy::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + TMMFDevSoundProxySettings set; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyRecordBalance,KNullDesC8,KNullDesC8,pckg)); + aLeftPercentage = pckg().iLeftPercentage; + aRightPercentage = pckg().iRightPercentage; + } + +EXPORT_C void RMMFDevSoundProxy::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + TMMFDevSoundProxySettings set; + set.iLeftPercentage = aLeftPercentage; + set.iRightPercentage = aRightPercentage; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceive(EMMFDevSoundProxySetRecordBalance, pckg)); + } + +EXPORT_C void RMMFDevSoundProxy::PlayInitL() + { + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayInit)); + iState = EPlaying; + } + +EXPORT_C void RMMFDevSoundProxy::RecordInitL() + { + User::LeaveIfError(SendReceive(EMMFDevSoundProxyRecordInit)); + iState = ERecording; + } + +EXPORT_C void RMMFDevSoundProxy::PlayData() + { + __ASSERT_ALWAYS(iState == EPlaying, Panic(EMMFDevSoundProxyPlayDataWithoutInitialize)); + + TMMFDevSoundProxyHwBuf set; + set.iLastBuffer = iBuffer->LastBuffer(); + TMMFDevSoundProxyHwBufPckg pckg(set); + SendReceive(EMMFDevSoundProxyPlayData, pckg, iBuffer->Data()); + } + +EXPORT_C void RMMFDevSoundProxy::RecordData() + { + __ASSERT_ALWAYS(iState == ERecording, Panic(EMMFDevSoundProxyRecordDataWithoutInitialize)); + SendReceive(EMMFDevSoundProxyRecordData); + } + +EXPORT_C void RMMFDevSoundProxy::Stop() + { + SendReceive(EMMFDevSoundProxyStop); + iState = EIdle; + } + +EXPORT_C void RMMFDevSoundProxy::Pause() + { + SendReceive(EMMFDevSoundProxyPause); + } + +EXPORT_C void RMMFDevSoundProxy::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + { + TMMFDevSoundProxySettings set; + set.iFrequencyOne = aFrequency; + set.iDuration = aDuration; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayTone, pckg)); + } + +EXPORT_C void RMMFDevSoundProxy::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + TMMFDevSoundProxySettings set; + set.iFrequencyOne = aFrequencyOne; + set.iFrequencyTwo = aFrequencyTwo; + set.iDuration = aDuration; + TMMFDevSoundProxySettingsPckg pckg(set); + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDualTone, pckg)); + } + +EXPORT_C void RMMFDevSoundProxy::PlayDTMFStringL(const TDesC& aDTMFString) + { + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayDTMFString, aDTMFString)); + } + +EXPORT_C void RMMFDevSoundProxy::PlayToneSequenceL(const TDesC8& aData) + { + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayToneSequence, aData)); + } + +EXPORT_C void RMMFDevSoundProxy::PlayFixedSequenceL(TInt aSequenceNumber) + { + TPckgBuf seqNum(aSequenceNumber); + User::LeaveIfError(SendReceive(EMMFDevSoundProxyPlayFixedSequence, seqNum)); + } + +EXPORT_C void RMMFDevSoundProxy::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + { + TMMFDevSoundProxySettings set; + set.iToneOnLength = aToneOnLength; + set.iToneOffLength = aToneOffLength; + set.iPauseLength = aPauseLength; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceive(EMMFDevSoundProxySetDTMFLengths, pckg); + } + +EXPORT_C void RMMFDevSoundProxy::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + TMMFDevSoundProxySettings set; + set.iDuration = aRampDuration; + TMMFDevSoundProxySettingsPckg pckg(set); + SendReceive(EMMFDevSoundProxySetVolumeRamp, pckg); + } + +EXPORT_C void RMMFDevSoundProxy::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) + { + aSupportedDataTypes.Reset(); + + TMMFPrioritySettings prioritySet = aPrioritySettings; + TMMFPrioritySettingsPckg pckg(prioritySet); + + TPckgBuf numberOfElementsPckg; + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedInputDataTypes, pckg, KNullDesC8, numberOfElementsPckg)); + + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); + TPtr8 ptr = buf->Des(); + + + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr)); + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + + for (TInt i=0; i& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) + { + aSupportedDataTypes.Reset(); + + TMMFPrioritySettings prioritySet = aPrioritySettings; + TMMFPrioritySettingsPckg pckg(prioritySet); + + TPckgBuf numberOfElementsPckg; + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyGetSupportedOutputDataTypes, pckg, KNullDesC8, numberOfElementsPckg)); + + HBufC8* buf = HBufC8::NewLC(numberOfElementsPckg()*sizeof(TFourCC)); + TPtr8 ptr = buf->Des(); + + + User::LeaveIfError(SendReceiveResult(EMMFDevSoundProxyCopyFourCCArrayData,KNullDesC8,KNullDesC8,ptr)); + RDesReadStream stream(ptr); + CleanupClosePushL(stream); + + for (TInt i=0; i numSamples; + SendReceiveResult(EMMFDevSoundProxySamplesRecorded, KNullDesC8, KNullDesC8, numSamples); + return numSamples(); + } + +EXPORT_C TInt RMMFDevSoundProxy::SamplesPlayed() + { + TPckgBuf numSamples; + SendReceiveResult(EMMFDevSoundProxySamplesPlayed, KNullDesC8, KNullDesC8, numSamples); + return numSamples(); + } + +EXPORT_C void RMMFDevSoundProxy::SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + { + TPckgBuf countRepeat(aRepeatCount); + TPckgBuf repeatTS(aRepeatTrailingSilence); + SendReceive(EMMFDevSoundProxySetToneRepeats, countRepeat, repeatTS); + } + +EXPORT_C void RMMFDevSoundProxy::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + TPckgBuf prioritySet(aPrioritySettings); + SendReceive(EMMFDevSoundProxySetPrioritySettings, prioritySet); + } + +EXPORT_C const TDesC& RMMFDevSoundProxy::FixedSequenceName(TInt aSequenceNumber) + { + TPckgBuf seqNum(aSequenceNumber); + TPtr SeqNamePtr = iSeqName->Des(); + SeqNamePtr.FillZ(); + SendReceiveResult(EMMFDevSoundProxyFixedSequenceName, seqNum, KNullDesC8, SeqNamePtr); + return *iSeqName; + } + +EXPORT_C TAny* RMMFDevSoundProxy::CustomInterface(TUid /*aInterfaceId*/) + { + // No custom interfaces are supported at the moment so return NULL. + //TO DO + return NULL; + } + +EXPORT_C TInt RMMFDevSoundProxy::FixedSequenceCount() + { + TPckgBuf fixSeqCountPckg; + SendReceiveResult(EMMFDevSoundProxyFixedSequenceCount, fixSeqCountPckg); + return fixSeqCountPckg(); + } + +EXPORT_C TInt RMMFDevSoundProxy::BufferToBeFilledData(TMMFDevSoundProxyHwBufPckg& aSetPckg) + { + // Note that there will only ever be one of these requests outstanding per session + return SendReceiveResult(EMMFDevSoundProxyBTBFData, aSetPckg); + } + +EXPORT_C TInt RMMFDevSoundProxy::BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg) + { + // Note that there will only ever be one of these requests outstanding per session + return SendReceiveResult(EMMFDevSoundProxyBTBEData, aSetPckg); + } + +EXPORT_C void RMMFDevSoundProxy::SetBuffer(CMMFDataBuffer* aBuffer) + { + if(iBuffer) + { + delete iBuffer; + } + iBuffer = aBuffer; + } + +EXPORT_C TInt RMMFDevSoundProxy::GetRecordedBufferL(CMMFDataBuffer& aBuffer) + { + return SendReceiveResult(EMMFDevSoundProxyGetRecordedBuffer, aBuffer.Data()); + } + +EXPORT_C TInt RMMFDevSoundProxy::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + TMMFDevSoundProxySettings set; + set.iNotificationEventUid = aEventType; + TMMFDevSoundProxySettingsPckg pckg(set); + return SendReceive(EMMFDevSoundProxyRequestResourceNotification, pckg, aNotificationRegistrationData); + } + +EXPORT_C TInt RMMFDevSoundProxy::CancelRegisterAsClient(TUid aEventType) + { + TMMFDevSoundProxySettings set; + set.iNotificationEventUid = aEventType; + TMMFDevSoundProxySettingsPckg pckg(set); + return SendReceiveResult(EMMFDevSoundProxyCancelRequestResourceNotification, pckg); + } + +EXPORT_C TInt RMMFDevSoundProxy::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) + { + TMMFDevSoundProxySettings set; + set.iNotificationEventUid = aEventType; + TMMFDevSoundProxySettingsPckg pckg(set); + return SendReceiveResult(EMMFDevSoundProxyGetResourceNotificationData, pckg,KNullDesC8,aNotificationData); + } + +EXPORT_C TInt RMMFDevSoundProxy::WillResumePlay() + { + return SendReceive(EMMFDevSoundProxyWillResumePlay); + } + +EXPORT_C TInt RMMFDevSoundProxy::EmptyBuffers() + { + return SendReceive(EMMFDevSoundProxyEmptyBuffers); + } + +EXPORT_C TInt RMMFDevSoundProxy::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) + { + TTimeIntervalMicroSeconds time(0); + TPckgBuf timePckg(time); + TInt err = SendReceiveResult(EMMFDevSoundProxyGetTimePlayed, KNullDesC8, KNullDesC8, timePckg); + if(err==KErrNone) + { + aTime = timePckg(); + } + return err; + } + +// implementation of a simple CustomCommand() scheme +EXPORT_C TInt RMMFDevSoundProxy::SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) + { + // the UID of the custom command is passed as an integer so as maintain consistency with the async methods below + TInt command = aUid.iUid; + + if (aOutParam==NULL) + { + return SendReceive(EMMFDevSoundProxySyncCustomCommand, command, aParam1, aParam2); + } + else + { + return SendReceiveResult(EMMFDevSoundProxySyncCustomCommandResult, command, aParam1, aParam2, *aOutParam); + } + } + +EXPORT_C void RMMFDevSoundProxy::AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam) + { + // this seemingly only allows 1 simultaneous async call. Need an array of TRequestStatus for more than one call. + // the UID of the custom command is passed as an integer so as to prevent the need of a consistent UID array. + TInt command = aUid.iUid; + + if (aOutParam==NULL) + { + SendReceive(EMMFDevSoundProxyAsyncCustomCommand, command, aParam1, aParam2, aStatus); + } + else + { + SendReceiveResult(EMMFDevSoundProxyAsyncCustomCommandResult, command, aParam1, aParam2, *aOutParam, aStatus); + } + } + +EXPORT_C TInt RMMFDevSoundProxy::SetClientThreadInfo(TThreadId& aTid) + { + TPckgBuf threadId(aTid); + return SendReceive(EMMFDevSoundProxySetClientThreadInfo, threadId); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/client/MmfDevSoundProxy.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,129 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFDEVSOUNDPROXY_H__ +#define __MMFDEVSOUNDPROXY_H__ + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "MmfAudioClientServer.h" +#include "MmfAudioServerProxy.h" + + +/** +Panic category and codes for the MmfDevSoundProxy +@internalTechnology +*/ +_LIT(KMMFDevSoundProxyPanicCategory, "MmfDevSoundProxy"); +enum TMMFDevSoundProxyPanicCodes + { + EMMFDevSoundProxyPlayDataWithoutInitialize, + EMMFDevSoundProxyRecordDataWithoutInitialize, + EMMFDevSoundProxyConvertDataWithoutInitialize + }; + +class RMMFDevSoundProxy; // declared here. + +NONSHARABLE_CLASS( RMMFDevSoundProxy ): public RMmfSessionBase +/** +*@internalTechnology +*/ + { +public: + + IMPORT_C RMMFDevSoundProxy(); + IMPORT_C TInt Open(RHandleBase& aMsgQueueHandle); + IMPORT_C TInt SetDevSoundInfo(); + IMPORT_C TInt InitializeL(TMMFState aMode); + IMPORT_C TInt InitializeL(TUid aHWDev, TMMFState aMode); + IMPORT_C TInt InitializeL(TFourCC aDesiredFourCC, TMMFState aMode); + IMPORT_C TMMFCapabilities Capabilities(); + IMPORT_C TMMFCapabilities Config(); + IMPORT_C TInt SetConfigL(const TMMFCapabilities& aConfig); + IMPORT_C TInt MaxVolume(); + IMPORT_C TInt Volume(); + IMPORT_C TInt SetVolume(TInt aVolume); + IMPORT_C TInt MaxGain(); + IMPORT_C TInt Gain(); + IMPORT_C TInt SetGain(TInt aGain); + IMPORT_C void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + IMPORT_C void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + IMPORT_C void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + IMPORT_C void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + IMPORT_C void Close(); + IMPORT_C void PlayInitL(); + IMPORT_C void RecordInitL(); + IMPORT_C void PlayData(); + IMPORT_C void RecordData(); + IMPORT_C void Stop(); + IMPORT_C void Pause(); + IMPORT_C void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + IMPORT_C void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + IMPORT_C void PlayDTMFStringL(const TDesC& aDTMFString); + IMPORT_C void PlayToneSequenceL(const TDesC8& aData); + IMPORT_C void PlayFixedSequenceL(TInt aSequenceNumber); + IMPORT_C void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength); + IMPORT_C void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + IMPORT_C void GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings); + IMPORT_C void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings); + IMPORT_C TInt SamplesRecorded(); + IMPORT_C TInt SamplesPlayed(); + IMPORT_C void SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); + IMPORT_C void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + IMPORT_C const TDesC& FixedSequenceName(TInt aSequenceNumber); + IMPORT_C TAny* CustomInterface(TUid aInterfaceId); + IMPORT_C TInt FixedSequenceCount(); + + IMPORT_C TInt BufferToBeFilledData(TMMFDevSoundProxyHwBufPckg& aSetPckg); + IMPORT_C TInt BufferToBeEmptiedData(TMMFDevSoundProxyHwBufPckg& aSetPckg); + + IMPORT_C void CancelReceiveEvents(); + IMPORT_C void SetBuffer(CMMFDataBuffer* aBuffer); + IMPORT_C TInt GetRecordedBufferL(CMMFDataBuffer& aBuffer); + + IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); + IMPORT_C TInt CancelRegisterAsClient(TUid aEventType); + IMPORT_C TInt GetResourceNotificationData(TUid aEventType,TDes8& aNotificationData); + IMPORT_C TInt WillResumePlay(); + IMPORT_C TInt EmptyBuffers(); + + IMPORT_C TInt SyncCustomCommand(TUid aUid, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam); + IMPORT_C void AsyncCustomCommand(TUid aUid, TRequestStatus& aStatus, const TDesC8& aParam1, const TDesC8& aParam2, TDes8* aOutParam); + IMPORT_C TInt SetClientThreadInfo(TThreadId& aTid); + IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime); + +private: + TMMFDevSoundProxySettingsPckg iDspsPckg; + CMMFDataBuffer* iBuffer; + HBufC* iSeqName; + enum TState + { + EIdle=0, + EPlaying, + ERecording, + EConverting + }; + TState iState; + RHandleBase* iMsgQueueHandle; + RMMFAudioServerProxy* iAudioServerProxy; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioClientServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioClientServer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,158 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef MMFAUDIOCLIENTSERVER_H +#define MMFAUDIOCLIENTSERVER_H + +#include +#include +#include + +// opcodes used in message passing between client and server +enum TMMFAudioServerRequest + { + EMMFAudioLaunchRequests, + EMMFDevSoundSessionHandle + }; + +enum TMMFDevSoundProxyRequest + { + EMMFDevSoundProxyInitialize1, + EMMFDevSoundProxyInitialize2, + EMMFDevSoundProxyInitialize3, + EMMFDevSoundProxyInitialize4, + EMMFDevSoundProxyCapabilities, + EMMFDevSoundProxyConfig, + EMMFDevSoundProxySetConfig, + EMMFDevSoundProxyMaxVolume, + EMMFDevSoundProxyVolume, + EMMFDevSoundProxySetVolume, + EMMFDevSoundProxyMaxGain, + EMMFDevSoundProxyGain, + EMMFDevSoundProxySetGain, + EMMFDevSoundProxyPlayBalance, + EMMFDevSoundProxySetPlayBalance, + EMMFDevSoundProxyRecordBalance, + EMMFDevSoundProxySetRecordBalance, + EMMFDevSoundProxyICEvent, + EMMFDevSoundProxyBTBFEvent, + EMMFDevSoundProxyBTBEEvent, + EMMFDevSoundProxyPEEvent, + EMMFDevSoundProxyREEvent, + EMMFDevSoundProxyTFEvent, + EMMFDevSoundProxySETCEvent, + EMMFDevSoundProxyPlayInit, + EMMFDevSoundProxyRecordInit, + EMMFDevSoundProxyPlayData, + EMMFDevSoundProxyRecordData, + EMMFDevSoundProxyStop, + EMMFDevSoundProxyPause, + EMMFDevSoundProxyPlayTone, + EMMFDevSoundProxyPlayDualTone, + EMMFDevSoundProxyPlayDTMFString, + EMMFDevSoundProxyPlayDTMFStringLength, + EMMFDevSoundProxyPlayToneSequence, + EMMFDevSoundProxyPlayFixedSequence, + EMMFDevSoundProxySetDTMFLengths, + EMMFDevSoundProxySetVolumeRamp, + EMMFDevSoundProxyGetSupportedInputDataTypes, + EMMFDevSoundProxyGetSupportedOutputDataTypes, + EMMFDevSoundProxyCopyFourCCArrayData, + EMMFDevSoundProxyGetRecordedBuffer, + EMMFDevSoundProxySamplesRecorded, + EMMFDevSoundProxySamplesPlayed, + EMMFDevSoundProxySetToneRepeats, + EMMFDevSoundProxySetPrioritySettings, + EMMFDevSoundProxyFixedSequenceName, + EMMFDevSoundProxyCustomInterface, + EMMFDevSoundProxyFixedSequenceCount, + EMMFDevSoundProxyRequestResourceNotification, + EMMFDevSoundProxyCancelRequestResourceNotification, + EMMFDevSoundProxyGetResourceNotificationData, + EMMFDevSoundProxyWillResumePlay, + EMMFDevSoundProxyBTBFData, + EMMFDevSoundProxyBTBEData, + EMMFDevSoundProxySyncCustomCommand, + EMMFDevSoundProxySyncCustomCommandResult, + EMMFDevSoundProxyAsyncCustomCommand, + EMMFDevSoundProxyAsyncCustomCommandResult, + EMMFDevSoundProxyEmptyBuffers, + EMMFDevSoundCustomCommandCloseMuxDemuxPair, + EMMFDevSoundProxySetClientThreadInfo, + EMMFDevSoundProxyGetTimePlayed + }; + +class TMMFDevSoundProxyHwBuf +/** +*@internalTechnology +*/ + { +public: + TUid iBufferType; + TInt iRequestSize; + TBool iLastBuffer; + TUint iBufferSize; + }; + +typedef TPckgBuf TMMFDevSoundProxyHwBufPckg; + + +class TMMFDevSoundProxySettings +/** +*@internalTechnology +*/ + { +public: + TMMFState iMode; + TUid iHWDev; + TFourCC iDesiredFourCC; + TMMFCapabilities iCaps; + TMMFCapabilities iConfig; + TInt iMaxVolume; + TInt iVolume; + TInt iMaxGain; + TInt iGain; + TInt iLeftPercentage; + TInt iRightPercentage; + TInt iFrequencyOne; + TInt iFrequencyTwo; + TTimeIntervalMicroSeconds iDuration; + TTimeIntervalMicroSeconds32 iToneOnLength; + TTimeIntervalMicroSeconds32 iToneOffLength; + TTimeIntervalMicroSeconds32 iPauseLength; + TUid iNotificationEventUid; + }; + + +typedef TPckgBuf TMMFDevSoundProxySettingsPckg; +const TInt KMaxFixedSequenceNameLength = 1024; + +/** +*@internalTechnology +* TMMFDevSoundQueueItem is used to pass asynch messages between the devsound proxy and server +* for the observer's BufferToBeFilled, BufferToBeEmptied, PlayError, RecordError, ToneFinished, +* InitializeComplete and SendEventToClient events. +*/ +class TMMFDevSoundQueueItem + { +public: + // Would've been nice to send TMMFDevSoundProxyHwBufPckg data here too + // but that would break the message size limit + TMMFDevSoundProxyRequest iRequest; + TMMFEventPckg iEventPckg; // SendEventToClient message payload + TInt iErrorCode; // InitComplete, ToneFinished, PlayError, RecordError message payload + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,343 @@ +// Copyright (c) 2004-2009 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 +#include "MmfAudioServer.h" +#include "MmfAudioServerStart.h" +#include "MmfDevSoundSession.h" +#include "MmfAudioServerSession.h" +#include "MmfDevSoundServer.h" +#include "MmfDevSoundServerStart.h" +#include "mmfbase.hrh" + + +static const TUid KUidDevSoundServer = {KUidMmfDevSoundServerDllUnicodeDefine}; + +const TInt KAudioServerShutDownDelay = 50000000; //50 sec + + +CMMFAudioServer* CMMFAudioServer::NewL() + { + CMMFAudioServer* s = new(ELeave) CMMFAudioServer(); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(); + return s; + } + +CMMFAudioServer::CMMFAudioServer() : + CMmfIpcServer(EPriorityStandard) + { + } + +void CMMFAudioServer::ConstructL() + { + // Call base class to Start server + StartL(KAudioServerName); + iDelayAudioServerShutDown = CDelayAudioServerShutDown::NewL(); + // Create an audio policy server + iAudioPolicyProxy = new (ELeave) RMMFAudioPolicyProxy(); + User::LeaveIfError(iAudioPolicyProxy->CreateServer(iPolicyServerHandle)); + } + +CMMFAudioServer::~CMMFAudioServer() + { + if (iDelayAudioServerShutDown) + { + iDelayAudioServerShutDown->Cancel(); + delete iDelayAudioServerShutDown; + } + iDevSoundServList.ResetAndDestroy(); + iDevSoundServList.Close(); + if( iAudioPolicyProxy != NULL) + { + iAudioPolicyProxy->Close(); + delete iAudioPolicyProxy; + } + iPolicyServerHandle.Close(); + } + +CMmfIpcSession* CMMFAudioServer::NewSessionL(const TVersion& aVersion) const + { + TVersion v(KMMFAudioServerVersion,KMMFAudioServerMinorVersionNumber,KMMFAudioServerBuildVersionNumber); + if(!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); + + TInt i=0; + while(iIsActive()) + { + iDevSoundServList.Remove(i); + delete devSoundMonitorThread; + } + else + { + i++; + } + } + iDevSoundServList.Compress(); + + RMMFDevSoundServerProxy devSoundSessionHandle; + User::LeaveIfError(StartDevSoundServer(devSoundSessionHandle)); + CMMFAudioServerSession* audioServerSession = CMMFAudioServerSession::NewL(devSoundSessionHandle); + return audioServerSession; + } + +void CMMFAudioServer::IncrementSessionId() + { + iAudioServerSessionId++; + } + +void CMMFAudioServer::DecrementSessionId() + { + iAudioServerSessionId--; + } + +void CMMFAudioServer::IncrementDevSoundCount() + { + iDevSoundCount++; + if(iDevSoundCount) + iDelayAudioServerShutDown->Cancel(); //in the case we started the shutdown due to no more DevSound + } + +void CMMFAudioServer::DecrementDevSoundCount() + { + iDevSoundCount--; + if ( iDevSoundCount == 0 ) + { + iDelayAudioServerShutDown->SetDelay(TTimeIntervalMicroSeconds32(KAudioServerShutDownDelay)); + } + } + +void CMMFAudioServer::SendEventToClient(TInt aSessionToAlert, TInt /*aSessionToBeLaunched*/) + { + // For the session requested, send event to client + iSessionIter.SetToFirst(); + CMMFAudioServerSession* session = static_cast(iSessionIter++); + while (session != NULL) + { + if (session->AudioServerSessionId() == aSessionToAlert) + { + break; // Finished + } + session = static_cast(iSessionIter++); + } + } + +void CMMFAudioServer::LaunchRequest(TInt aSessionId) + { + iSessionIter.SetToFirst(); + CMMFAudioServerSession* session = static_cast(iSessionIter++); + while (session != NULL) + { + if (session->AudioServerSessionId() == aSessionId) + { + break; // Finished + } + session = static_cast(iSessionIter++); + } + } + +TInt CMMFAudioServer::StartDevSoundServer(RMMFDevSoundServerProxy& aDevSoundSessionHandle) const + { + RMessage2 message(Message()); + CStartAndMonitorDevSoundThread* monitorDevSound = NULL; + + TRAPD(err, monitorDevSound = CStartAndMonitorDevSoundThread::NewL(const_cast(this))); + if(err != KErrNone) + { + delete monitorDevSound; + return err; + } + + err = iDevSoundServList.Append(monitorDevSound); + if(err != KErrNone) + { + delete monitorDevSound; + return err; + } + + return monitorDevSound->StartDevSoundServer(message, aDevSoundSessionHandle); + + } + + +CMMFAudioServer::CDelayAudioServerShutDown* CMMFAudioServer::CDelayAudioServerShutDown::NewL() + { + CDelayAudioServerShutDown* self = new(ELeave) CDelayAudioServerShutDown; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CMMFAudioServer::CDelayAudioServerShutDown::CDelayAudioServerShutDown() : CActive(0) + { + } + +void CMMFAudioServer::CDelayAudioServerShutDown::ConstructL() + { + User::LeaveIfError(iShutDownTimer.CreateLocal()); + CActiveScheduler::Add(this); + } + +CMMFAudioServer::CDelayAudioServerShutDown::~CDelayAudioServerShutDown() + { + Cancel(); + iShutDownTimer.Close(); + } + + +void CMMFAudioServer::CDelayAudioServerShutDown::SetDelay(TTimeIntervalMicroSeconds32 aDelay) + { + __ASSERT_ALWAYS(!IsActive(), User::Panic(_L("CDelayedShutDown"), 1)); + iShutDownTimer.After(iStatus, aDelay); + SetActive(); + } + +void CMMFAudioServer::CDelayAudioServerShutDown::RunL() + { + CActiveScheduler::Stop(); + } + + +void CMMFAudioServer::CDelayAudioServerShutDown::DoCancel() + { + iShutDownTimer.Cancel(); + } + + +CStartAndMonitorDevSoundThread* CStartAndMonitorDevSoundThread::NewL(CMMFAudioServer* aAudioServer) + { + CStartAndMonitorDevSoundThread* self = new(ELeave) CStartAndMonitorDevSoundThread(aAudioServer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CStartAndMonitorDevSoundThread::ConstructL() + { + CActiveScheduler::Add(this); + } + +TInt CStartAndMonitorDevSoundThread::StartDevSoundServer(RMessage2& aMessage, RMMFDevSoundServerProxy& aDevSoundSessionHandle) + { + RThread clientThread; + TInt err = aMessage.Client(clientThread); + if (err != KErrNone) + { + return err; + } + RProcess clientProcess; + err = clientThread.Process(clientProcess); + if (err != KErrNone) + { + clientThread.Close(); + return err; + } + TProcessId clientProcessId(clientProcess.Id()); + + clientThread.Close(); + clientProcess.Close(); + + RServer2 devSoundServerHandle; + TDevSoundServerStart start(iAudioServer, clientProcessId, devSoundServerHandle);//Pass to DevSoundServer the clien't process ID + + const TUidType serverUid(KNullUid,KNullUid,KUidDevSoundServer); + + TThreadFunction serverFunc=CMMFDevSoundServer::StartThread; + + err = iServer.Create(_L(""), serverFunc, KDevSoundServerStackSize, +#ifdef SYMBIAN_USE_SEPARATE_HEAPS + KDevSoundServerInitHeapSize, KDevSoundServerMaxHeapSize, +#else + &User::Heap(), //shared heap is now default +#endif + &start, EOwnerProcess); + + + if(err != KErrNone) + return err; + // Synchronise with the server + TRequestStatus reqStatus; + iServer.Rendezvous(reqStatus); + + if (reqStatus!=KRequestPending) + { + iServer.Kill(0); + } + else + { + // Start the test harness + iServer.Resume(); + // Server will call the reciprocal static synchronise call + } + + User::WaitForRequest(reqStatus); // wait for start or death + if(reqStatus.Int() != KErrNone) + { + iServer.Close(); + devSoundServerHandle.Close(); + return reqStatus.Int(); + } + err = aDevSoundSessionHandle.Open(devSoundServerHandle); + + if(err != KErrNone) + { + iServer.Close(); + devSoundServerHandle.Close(); + return err; + } + aDevSoundSessionHandle.ShareProtected(); + iServer.Logon(iStatus); + SetActive(); + + iAudioServer->IncrementDevSoundCount(); + return KErrNone; + } + + +CStartAndMonitorDevSoundThread::CStartAndMonitorDevSoundThread(CMMFAudioServer* aAudioServer): CActive(0) + { + iAudioServer = aAudioServer; + } + +CStartAndMonitorDevSoundThread::~CStartAndMonitorDevSoundThread() + { + Cancel(); + } + +void CStartAndMonitorDevSoundThread::RunL() + { + iServer.Close(); + iAudioServer->DecrementDevSoundCount(); + } + +void CStartAndMonitorDevSoundThread::DoCancel() + { + iServer.LogonCancel(iStatus); + } + +TInt RMMFDevSoundServerProxy::Open(RServer2& aDevSoundServerHandle) + { + TInt err = CreateSession(aDevSoundServerHandle, TVersion(KMMFDevSoundServerVersion, + KMMFDevSoundServerMinorVersionNumber, + KMMFDevSoundServerBuildVersionNumber), -1, EIpcSession_GlobalSharable); + return err; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,113 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFAUDIOSERVER_H__ +#define __MMFAUDIOSERVER_H__ + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "mmfAudioPolicyProxy.h" + +class CStartAndMonitorDevSoundThread; +class RMMFDevSoundServerProxy; + +class CMMFAudioServer : public CMmfIpcServer +/** +*@internalTechnology +*/ + { +public: + static CMMFAudioServer* NewL(); + ~CMMFAudioServer(); + CMmfIpcSession* NewSessionL(const TVersion &aVersion) const; + void IncrementSessionId(); + void DecrementSessionId(); + + void IncrementDevSoundCount(); + void DecrementDevSoundCount(); + + void SendEventToClient(TInt aSessionToAlert, TInt aSessionToBeLaunched); + void LaunchRequest(TInt aSessionId); + //CAudioPolicy* AudioPolicy() {return iAudioPolicy;}; + TInt AudioServerSessionId() {return iAudioServerSessionId;}; + TInt StartDevSoundServer(RMMFDevSoundServerProxy& aDevSoundSessionHandle) const; + RServer2& PolicyServerHandle(); +private: + + class CDelayAudioServerShutDown : public CActive + { + public: + // Construct/destruct + static CDelayAudioServerShutDown* NewL(); + ~CDelayAudioServerShutDown(); + // Request + void SetDelay(TTimeIntervalMicroSeconds32 aDelay); + private: + // Construct/destruct + CDelayAudioServerShutDown(); + void ConstructL(); + + // From CActive + void RunL(); + void DoCancel(); + private: + RTimer iShutDownTimer; // Has + }; + +private: + CMMFAudioServer(); + void ConstructL(); + +private: + TInt iAudioServerSessionId; + TInt iDevSoundCount; + TInt iSessionToBeLaunched; + CDelayAudioServerShutDown* iDelayAudioServerShutDown; + mutable RPointerArray iDevSoundServList; + RServer2 iPolicyServerHandle; + RMMFAudioPolicyProxy* iAudioPolicyProxy; + }; + +class CStartAndMonitorDevSoundThread: public CActive + { +public: + static CStartAndMonitorDevSoundThread* NewL(CMMFAudioServer* aAudioServer); + ~CStartAndMonitorDevSoundThread(); + TInt StartDevSoundServer(RMessage2& aMessage, RMMFDevSoundServerProxy& aDevSoundSessionHandle); +private: + // Construct + CStartAndMonitorDevSoundThread(CMMFAudioServer* aAudioServer); + void ConstructL(); + + // From CActive + void RunL(); + void DoCancel(); +private: + CMMFAudioServer* iAudioServer; + RThread iServer; + }; + +class RMMFDevSoundServerProxy : public RMmfSessionBase + { +public: + TInt Open(RServer2& aDevSoundServerHandle); + }; + +#include "MmfAudioServer.inl" +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServer.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,20 @@ +// Copyright (c) 2005-2009 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: +// + +inline RServer2& CMMFAudioServer::PolicyServerHandle() + { + return iPolicyServerHandle; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,88 @@ +// Copyright (c) 2004-2009 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 "MmfAudioServerSession.h" +#include "MmfAudioClientServer.h" +#include "MmfAudioServer.h" +#include +#include + + +/* + This call takes ownership of aDevSoundSessionHandle. We need to ensure that it is closed + in case of failure, but want to avoid double close situations. We emporarily push the argument + onto cleanup stack and pass it into the CMMFAudioServerSession once we know that the assignment + can't fail. The latter object itself takes ownership. + */ +CMMFAudioServerSession* CMMFAudioServerSession::NewL(RHandleBase& aDevSoundSessionHandle) + { + CleanupClosePushL(aDevSoundSessionHandle); + CMMFAudioServerSession* self = new(ELeave) CMMFAudioServerSession(); + CleanupStack::Pop(&aDevSoundSessionHandle); + self->SetDevSoundSessionHandle(aDevSoundSessionHandle); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CMMFAudioServerSession::ConstructL() + { + } + +CMMFAudioServerSession::CMMFAudioServerSession()// : iEventsQue(_FOFF(TMMFAudioPolicyEventHolder,iLink)) + { + } + +void CMMFAudioServerSession::CreateL(const CMmfIpcServer& aServer) + { + CMmfIpcSession::CreateL(aServer); + CMMFAudioServer* server = static_cast(CONST_CAST(CMmfIpcServer*, &aServer)); + server->IncrementSessionId(); + iAudioServerSessionId = server->AudioServerSessionId(); + } + +CMMFAudioServerSession::~CMMFAudioServerSession() + { + CMMFAudioServer* server = + const_cast(static_cast(Server())); + if (server) + { + server->DecrementSessionId(); + } + iDevSoundSessionHandle.Close(); + } + +void CMMFAudioServerSession::ServiceL(const RMmfIpcMessage& aMessage) + { + switch(aMessage.Function()) + { + case EMMFDevSoundSessionHandle: + aMessage.Complete(iDevSoundSessionHandle); + break; + default: + User::Leave(KErrNotSupported); + break; + } + } + +void CMMFAudioServerSession::SendEventToClient(/*TMMFAudioPolicyEvent& aEvent*/) + { + } + +void CMMFAudioServerSession::SetDevSoundSessionHandle(RHandleBase& aDevSoundSessionHandle) + { + iDevSoundSessionHandle = aDevSoundSessionHandle; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerSession.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFAUDIOSERVERSESSION_H__ +#define __MMFAUDIOSERVERSESSION_H__ + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "MmfAudioClientServer.h" + + +class CMMFAudioServer; +class CMMFDevSoundServer; + +class CMMFAudioServerSession : public CMmfIpcSession +/** +*@internalTechnology +*/ + { +public: + static CMMFAudioServerSession* NewL(RHandleBase& aDevSoundSessionHandle); + ~CMMFAudioServerSession(); + void CreateL(const CMmfIpcServer& aServer); + void ServiceL(const RMmfIpcMessage& aMessage); + TInt AudioServerSessionId(void) {return iAudioServerSessionId;}; + void SendEventToClient(/*TMMFAudioServerEvent& aEvent*/); + +private: + CMMFAudioServerSession(); + void ConstructL(); + void SetDevSoundSessionHandle(RHandleBase& aDevSoundSessionHandle); +private: + TInt iAudioServerSessionId; + RHandleBase iDevSoundSessionHandle; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerStart.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerStart.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2009 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 +#include "MmfAudioServerStart.h" +#include "MmfAudioServer.h" + + +// EKA2 much simpler +// Just an E32Main and a MainL() +LOCAL_C void MainL() +/** + * Much simpler, uses the new Rendezvous() call to sync with the client + */ + { + // Leave the hooks in for platform security +#if (defined __DATA_CAGING__) + RProcess().DataCaging(RProcess::EDataCagingOn); + RProcess().SecureApi(RProcess::ESecureApiOn); +#endif + CActiveScheduler* sched=NULL; + sched=new(ELeave) CActiveScheduler; + CActiveScheduler::Install(sched); + CMMFAudioServer* server = NULL; + TRAPD(err,server = CMMFAudioServer::NewL()); + RProcess::Rendezvous(err); + if(!err) + { + // Sync with the client and enter the active scheduler + sched->Start(); + } + delete server; + delete sched; + + } + + + +GLDEF_C TInt E32Main() +/** + * @return - Standard Epoc error code on exit + */ + { + CTrapCleanup* cleanup = CTrapCleanup::New(); + if(cleanup == NULL) + { + return KErrNoMemory; + } + TRAP_IGNORE(MainL()); + delete cleanup; + return KErrNone; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerStart.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfAudioServerStart.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2004-2009 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: +// + + + +#ifndef __MMFAUDIOSERVERSTART_H +#define __MMFAUDIOSERVERSTART_H + +#include + +_LIT(KAudioServerFileName,"MMFAudioServer.exe"); +_LIT(KAudioServerName,"!MMFAudioServer"); + +const TUint KMMFAudioServerVersion=8; +const TUint KMMFAudioServerMinorVersionNumber=0; +const TUint KMMFAudioServerBuildVersionNumber=1; + + +class TAudioServerStart +/** +*@internalTechnology +*/ + { +public: + TAudioServerStart() {}; + TAudioServerStart(TRequestStatus& aStatus); + TAudioServerStart(const TProcessId& aProcessId, TRequestStatus& aStatus); + TPtrC AsCommand() const; + TInt GetCommand(); + TInt Signal(); +public: + TProcessId iProcessId; +private: + TThreadId iId; + TRequestStatus* iStatus; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundCIDeMuxUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundCIDeMuxUtility.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,202 @@ +// Copyright (c) 2005-2009 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 "MmfDevSoundCIDeMuxUtility.h" +#include +#include +#include +#include + + +CMMFDevSoundCIDeMuxUtility* CMMFDevSoundCIDeMuxUtility::NewL(MMMFDevSoundCustomInterfaceDeMuxInterface* aInterface) + { + CMMFDevSoundCIDeMuxUtility* self = new (ELeave) CMMFDevSoundCIDeMuxUtility(aInterface); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CMMFDevSoundCIDeMuxUtility::ConstructL() + { + // nothing to do in this plugin + } + +CMMFDevSoundCIDeMuxUtility::~CMMFDevSoundCIDeMuxUtility() + { + + } + +const TInt KDeMuxTempBufferSize = 20; + +// create a custom interface Mux implementation +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDevSoundCIDeMuxUtility::CreateCustomInterfaceDeMuxL(TUid aInterfaceId) + { + // The Uid of the plugin will be the match string + TInt uidAsInteger = aInterfaceId.iUid; + + TBuf8 tempBuffer; + tempBuffer.Num(uidAsInteger, EHex); // has value + TUid interfaceUid = {KUidDevSoundCustomInterfaceDeMux}; + + TUid destructorKey; + MMMFDevSoundCustomInterfaceDeMuxPlugin* self = + static_cast + (MmPluginUtils::CreateImplementationL(interfaceUid, destructorKey, tempBuffer, KRomOnlyResolverUid)); + + // pass the destructor key so class can destroy itself + self->PassDestructorKey(destructorKey); + CleanupReleasePushL(*self); + + // attempt to construct the plugin + self->CompleteConstructL(this); + CleanupStack::Pop(); // self + + return self; + } + + +// this will leave if the command is not a supported custom interface command +// the integer being returned is not an error code per-se it is the return code +// from the message being handled and so it makes sense here to have the function +// returning an integer but also able to leave if there is a problem +TInt CMMFDevSoundCIDeMuxUtility::ProcessCustomInterfaceCommandL(const RMmfIpcMessage& aMessage) + { + // get command manually - this is quicker than extracting all info + // plus we don't know whether this is async or sync + TInt command; + command = aMessage.Int0(); + + TInt retVal = KErrNotFound; + + switch (command) + { + case EMMFDevSoundCustomCommandCIOpenSlave: + { + // get a local copy of descriptor + HBufC8* tempBuf = HBufC8::NewL(User::LeaveIfError(InputDesLength(aMessage))); + CleanupStack::PushL(tempBuf); + TPtr8 tempPtr(tempBuf->Des()); + ReadFromInputDesL(aMessage, &tempPtr); + + // fetch the interface Uid + TPckgBuf idBuffer; + aMessage.ReadL(1, idBuffer); + + retVal = iInterface->DoOpenSlaveL(idBuffer(), tempPtr); + CleanupStack::PopAndDestroy(tempBuf); + break; + } + case EMMFDevSoundCustomCommandCICloseSlave: + { + // handle is at offset 1 + TPckgBuf handleBuffer; + aMessage.ReadL(1, handleBuffer); + iInterface->DoCloseSlaveL(handleBuffer()); + retVal = KErrNone; // no return from CloseSlave + break; + } + case EMMFDevSoundCustomCommandCISendSlaveSyncCommand: + { + retVal = iInterface->DoSendSlaveSyncCommandL(aMessage); + break; + } + case EMMFDevSoundCustomCommandCISendSlaveSyncCommandResult: + { + retVal = iInterface->DoSendSlaveSyncCommandResultL(aMessage); + break; + } + case EMMFDevSoundCustomCommandCISendSlaveAsyncCommand: + { + iInterface->DoSendSlaveAsyncCommandL(aMessage); + retVal = KErrNone; // no return from async + break; + } + case EMMFDevSoundCustomCommandCISendSlaveAsyncCommandResult: + { + iInterface->DoSendSlaveAsyncCommandResultL(aMessage); + retVal = KErrNone; // no return from async + break; + } + default: + User::Leave(retVal); + } + + return retVal; + } + + +// at the moment these two functions are the same but this may change on different platforms +// so separate sync and async message data functions have been defined +void CMMFDevSoundCIDeMuxUtility::GetSyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData) + { + // data is stored as commandUID, (command, handle), inbuf, outbuf + TPckgBuf comBuffer; + aMessage.ReadL(1, comBuffer); + + // get command and handle + aData.iCommand = comBuffer().iCommand; + aData.iHandle = comBuffer().iHandle; + } + +void CMMFDevSoundCIDeMuxUtility::GetAsyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData) + { + // data is stored as commandUID, (command, handle), inbuf, outbuf,status + TPckgBuf comBuffer; + aMessage.ReadL(1, comBuffer); + + // get command and handle + aData.iCommand = comBuffer().iCommand; + aData.iHandle = comBuffer().iHandle; + } + + +TInt CMMFDevSoundCIDeMuxUtility::InputDesLength(const RMmfIpcMessage& aMessage) + { + // input descriptor is at offset 2 + TInt len = aMessage.GetDesLength(2); + return len; + } + +void CMMFDevSoundCIDeMuxUtility::ReadFromInputDesL(const RMmfIpcMessage& aMessage, TDes8* aBufToFill) + { + // check if the descriptor is large enough + TInt len = User::LeaveIfError(InputDesLength(aMessage)); + if (len > aBufToFill->MaxLength()) + { + User::Leave(KErrArgument); + } + + // input descriptor is at offset 2 + aMessage.ReadL(2, *aBufToFill); + } + +void CMMFDevSoundCIDeMuxUtility::WriteToOutputDesL(const RMmfIpcMessage& aMessage, TDesC8& aBufToWrite) + { + // output descriptor is at offset 3 + aMessage.WriteL(3, aBufToWrite); + } + + +void CMMFDevSoundCIDeMuxUtility::CompleteMessage(const RMmfIpcMessage& aMessage, TInt aError) + { + aMessage.Complete(aError); + } + +CMMFDevSoundCIDeMuxUtility::CMMFDevSoundCIDeMuxUtility(MMMFDevSoundCustomInterfaceDeMuxInterface* aInterface) +: iInterface(aInterface) + { + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundCIDeMuxUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundCIDeMuxUtility.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,70 @@ +// Copyright (c) 2005-2009 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: +// MMFDevSoundCIDeMuxUtility.cpp +// +// + +#ifndef MMFDEVSOUNDCIDEMUXUTILITY_H +#define MMFDEVSOUNDCIDEMUXUTILITY_H + +#include +#include +#include +#include "MmfDevSoundServerStart.h" +#include "MmfAudioClientServer.h" +#include + + +/** +* @internalTechnology +* @file +*/ + +class CMMFDevSoundCIDeMuxUtility; +NONSHARABLE_CLASS( CMMFDevSoundCIDeMuxUtility ) : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxUtility + { +public: + static CMMFDevSoundCIDeMuxUtility* NewL(MMMFDevSoundCustomInterfaceDeMuxInterface* aInterface); + virtual ~CMMFDevSoundCIDeMuxUtility(); + void ConstructL(); + + // create a custom interface Mux implementation + MMMFDevSoundCustomInterfaceDeMuxPlugin* CreateCustomInterfaceDeMuxL(TUid aInterfaceId); + + // check and process custom commands + TInt ProcessCustomInterfaceCommandL(const RMmfIpcMessage& aMessage); + + // utility functions from MMMFDevSoundCustomInterfaceDeMuxUtility + // get all settings at once into client supplied package + virtual void GetSyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData); + virtual void GetAsyncMessageDataL(const RMmfIpcMessage& aMessage, TMMFDevSoundCIMessageData& aData); + + // read and write to input and output descriptors + virtual TInt InputDesLength(const RMmfIpcMessage& aMessage); + virtual void ReadFromInputDesL(const RMmfIpcMessage& aMessage, TDes8* aBufToFill); + virtual void WriteToOutputDesL(const RMmfIpcMessage& aMessage, TDesC8& aBufToWrite); + + // message related + virtual void CompleteMessage(const RMmfIpcMessage& aMessage, TInt aError); +private: + CMMFDevSoundCIDeMuxUtility(MMMFDevSoundCustomInterfaceDeMuxInterface* aInterface); + MMMFDevSoundCustomInterfaceDeMuxInterface* iInterface; + }; + + + + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServer.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,215 @@ +// Copyright (c) 2004-2009 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 +#include "MmfDevSoundServer.h" +#include "MmfDevSoundServerStart.h" +#include "MmfDevSoundSession.h" + +const TInt KDevSoundShutDownDelay = 0; //0 sec +_LIT(KMMFDevSoundServerName, "MMFDevSoundServer-"); + + + +EXPORT_C CMMFDevSoundServer* CMMFDevSoundServer::NewL(CMMFAudioServer* aAudioServer, TProcessId& aClientPID) + { + CMMFDevSoundServer* s = new(ELeave) CMMFDevSoundServer(aAudioServer, aClientPID); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(); + return s; + } + +CMMFDevSoundServer::CMMFDevSoundServer(CMMFAudioServer* aAudioServer, TProcessId& aClientPID) : + CMmfIpcServer(EPriorityStandard, EGlobalSharableSessions), iClientPID(aClientPID) + { + iAudioServer = aAudioServer; + } + +void CMMFDevSoundServer::ConstructL() + { + RProcess client; + User::LeaveIfError(client.Open(iClientPID)); + iClientHasCaps = client.HasCapability(ECapabilityMultimediaDD, KSuppressPlatSecDiagnostic); + client.Close(); + + iDelayDevSoundShutDown = CDelayDevSoundShutDown::NewL(); + + // Call base class to Start server + StartL(KNullDesC); + } + +CMMFDevSoundServer::~CMMFDevSoundServer() + { + if (iDelayDevSoundShutDown) + { + iDelayDevSoundShutDown->Cancel(); + delete iDelayDevSoundShutDown; + } + } + +CMmfIpcSession* CMMFDevSoundServer::NewSessionL(const TVersion& aVersion) const + { + TVersion v(KMMFDevSoundServerVersion,KMMFDevSoundServerMinorVersionNumber,KMMFDevSoundServerBuildVersionNumber); + if(!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); + + CMMFDevSoundSession* devSoundSession = CMMFDevSoundSession::NewL(iAudioServer->PolicyServerHandle()); + return devSoundSession; + } + +void CMMFDevSoundServer::IncrementSessionId() + { + iDevSoundSessionId++; + if(iDevSoundSessionId) + iDelayDevSoundShutDown->Cancel(); + + } + +void CMMFDevSoundServer::DecrementSessionId() + { + iDevSoundSessionId--; + if ( iDevSoundSessionId == 0 ) + { + iDelayDevSoundShutDown->SetDelay(TTimeIntervalMicroSeconds32(KDevSoundShutDownDelay)); + } + } + +void CMMFDevSoundServer::SendEventToClient(TInt aSessionToAlert, TInt /*aSessionToBeLaunched*/) + { + // For the session requested, send event to client + iSessionIter.SetToFirst(); + CMMFDevSoundSession* session = static_cast(iSessionIter++); + while (session != NULL) + { + if (session->DevSoundSessionId() == aSessionToAlert) + { + break; // Finished + } + session = static_cast(iSessionIter++); + } + } + +void CMMFDevSoundServer::LaunchRequest(TInt aSessionId) + { + iSessionIter.SetToFirst(); + CMMFDevSoundSession* session = static_cast(iSessionIter++); + while (session != NULL) + { + if (session->DevSoundSessionId() == aSessionId) + { + break; // Finished + } + session = static_cast(iSessionIter++); + } + } + +TBool CMMFDevSoundServer::CheckClientCapabilities() + { + return iClientHasCaps; + } + +void CMMFDevSoundServer::SetClientCapabilitiesL(TThreadId aTid) + { + RThread clientThread; + User::LeaveIfError(clientThread.Open(aTid)); + CleanupClosePushL(clientThread); + + RProcess clientProcess; + User::LeaveIfError(clientThread.Process(clientProcess)); + CleanupClosePushL(clientProcess); + + iClientHasCaps = clientProcess.HasCapability(ECapabilityMultimediaDD, KSuppressPlatSecDiagnostic); + + CleanupStack::PopAndDestroy(2, &clientThread); // clientProcess, clientThread + } + +void CMMFDevSoundServer::RenamePrioritizeServer() + { + //Rename devsound server name + RThread devsoundServerThread; + TThreadId threadId; + TName name; + name.Append(KMMFDevSoundServerName); + threadId = devsoundServerThread.Id(); + name.AppendNum(threadId.Id(),EHex); + //We are ignoring the error code returned from User::RenameThread + //as it is not important here, may be for profiling + User::RenameThread(name); + + //Set the devsound priority + TThreadPriority devsoundServerPriority = static_cast(KDevsoundServerPriority); + devsoundServerThread.SetPriority(devsoundServerPriority); + } + +CMMFDevSoundServer::CDelayDevSoundShutDown* CMMFDevSoundServer::CDelayDevSoundShutDown::NewL() + { + CDelayDevSoundShutDown* self = new(ELeave) CDelayDevSoundShutDown; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CMMFDevSoundServer::CDelayDevSoundShutDown::CDelayDevSoundShutDown() : CActive(0) + { + } + +void CMMFDevSoundServer::CDelayDevSoundShutDown::ConstructL() + { + User::LeaveIfError(iTimer.CreateLocal()); + CActiveScheduler::Add(this); + } + +CMMFDevSoundServer::CDelayDevSoundShutDown::~CDelayDevSoundShutDown() + { + Cancel(); + iTimer.Close(); + } + + +void CMMFDevSoundServer::CDelayDevSoundShutDown::SetDelay(TTimeIntervalMicroSeconds32 aDelay) + { + __ASSERT_ALWAYS(!IsActive(), + User::Panic(_L("CDelayedShutDown"), 1)); + iTimer.After(iStatus, aDelay); + SetActive(); + } + +void CMMFDevSoundServer::CDelayDevSoundShutDown::RunL() + { + CActiveScheduler::Stop(); + } + +void CMMFDevSoundServer::CDelayDevSoundShutDown::DoCancel() + { + iTimer.Cancel(); + } + +/** +@internalTechnology + +This function raises a panic on the client of the devsoundserver + +@param aError + one of the several panic codes that may be raised by this dll on the client + +@panic EMMFDevSoundPlayDataWithoutInitialize is raised when playdata is called without initialization +@panic EMMFDevSoundRecordDataWithoutInitialize is raised when recorddata is called without initialization +*/ +GLDEF_C void PanicClient(const RMmfIpcMessage& aMessage, TMMFDevSoundClientPanicCodes aPanicCode) + { + aMessage.Panic(KMMFDevSoundClientPanicCategory, aPanicCode); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,112 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFDEVSOUNDSERVER_H__ +#define __MMFDEVSOUNDSERVER_H__ + +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "MmfAudioServer.h" +#include "MmfDevSoundServerStart.h" + +/** +Panic category and codes that MmfDevSoundServer raises on the client +@internalTechnology +*/ +_LIT(KMMFDevSoundClientPanicCategory, "DevSoundClient"); +enum TMMFDevSoundClientPanicCodes + { + EMMFDevSoundPlayDataWithoutInitialize, + EMMFDevSoundRecordDataWithoutInitialize + }; + +class CMMFDevSoundServer; // declared here. + +NONSHARABLE_CLASS( CMMFDevSoundServer ): public CMmfIpcServer +/** +*@internalTechnology +*/ + { +public: + IMPORT_C static CMMFDevSoundServer* NewL(CMMFAudioServer* aAudioServer, TProcessId& aClientPID); + ~CMMFDevSoundServer(); + CMmfIpcSession* NewSessionL(const TVersion &aVersion) const; + void IncrementSessionId(); + void DecrementSessionId(); + void SendEventToClient(TInt aSessionToAlert, TInt aSessionToBeLaunched); + void LaunchRequest(TInt aSessionId); + TInt DevSoundSessionId() {return iDevSoundSessionId;}; + TBool CheckClientCapabilities(); + void SetClientCapabilitiesL(TThreadId aTid); + + IMPORT_C static TInt StartThread(TAny* aParams); + +private: + + CMMFDevSoundServer(CMMFAudioServer* aAudioServer, TProcessId& aClientPID); + void ConstructL(); + static void RenamePrioritizeServer(); + static void StartThreadL(TDevSoundServerStart& aStart); + class CDelayDevSoundShutDown : public CActive + { + public: + // Construct/destruct + static CDelayDevSoundShutDown* NewL(); + ~CDelayDevSoundShutDown(); + // Request + void SetDelay(TTimeIntervalMicroSeconds32 aDelay); + private: + // Construct/destruct + CDelayDevSoundShutDown(); + void ConstructL(); + + // From CActive + void RunL(); + void DoCancel(); + private: + RTimer iTimer; // Has + }; + + +private: + TInt iDevSoundSessionId; + TInt iSessionToBeLaunched; + TProcessId iClientPID; + TBool iClientHasCaps; + CDelayDevSoundShutDown* iDelayDevSoundShutDown; + CMMFAudioServer* iAudioServer; + }; + +GLDEF_C void PanicClient(const RMmfIpcMessage& aMessage, TMMFDevSoundClientPanicCodes aPanicCode); + +/** +@SYMPatchable +@publishedPartner + +Patchable constant for licencee to set devsound server thread priority +Licencees should ensure that the devsound server thread priority is equal to the system server priority for better responsiveness. +If SYMBIAN_CURB_SYSTEMSERVER_PRIORITIES is defined, setting devsound server thread priority to EPriorityAbsoluteHigh will ensure +devsound server's thread priority is set to system server's priority. +If the macro is unavailable it is recommended to use EPriorityAbsoluteRealTime1. Usage of EPriorityAbsoluteRealTime1 requires ProtServ capability. +The constant can be changed at ROM build time using patchdata OBY keyword. + */ +IMPORT_C extern const TInt KDevsoundServerPriority; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,69 @@ +// Copyright (c) 2004-2009 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 +#include +#include "MmfDevSoundServer.h" + + +EXPORT_C TInt CMMFDevSoundServer::StartThread(TAny* aParms) +/** +Thread entry-point function. +The TServerStart objects is passed as the thread parameter +**/ + { + TInt err = KErrNone; +#ifdef SYMBIAN_USE_SEPARATE_HEAPS + __UHEAP_MARK; +#endif + TDevSoundServerStart* start = reinterpret_cast(aParms); + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (!cleanup) + { + err = KErrNoMemory; + } + else + { + TRAP(err, StartThreadL(*start)); + } + delete cleanup; + + REComSession::FinalClose(); +#ifdef SYMBIAN_USE_SEPARATE_HEAPS + __UHEAP_MARKEND; +#endif + return err; + } + +void CMMFDevSoundServer::StartThreadL(TDevSoundServerStart& aStart) + { + CActiveScheduler* sched = new(ELeave) CActiveScheduler; + CleanupStack::PushL(sched); + + CActiveScheduler::Install(sched); + CMMFDevSoundServer* server = CMMFDevSoundServer::NewL(aStart.iAudioServer, aStart.iProcessId); + CleanupStack::PushL(server); + + //Rename and set the priority of devsound server + RenamePrioritizeServer(); + + aStart.iDevSoundServerHandle = server->Server(); + // Sync with the client and enter the active scheduler + RThread::Rendezvous(KErrNone); + sched->Start(); + + CleanupStack::PopAndDestroy(2, sched); // sched, server + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2004-2009 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: +// + + + +#ifndef __MMFDEVSOUNDSERVERSTART_H +#define __MMFDEVSOUNDSERVERSTART_H + +#include +#include "MmfAudioServer.h" + + +_LIT(KDevSoundServerName,"!MMFDevSndSvr"); +const TInt KDevSoundServerStackSize=0x2000; // 8KB +const TInt KDevSoundServerInitHeapSize=0x1000; // 4KB +const TInt KDevSoundServerMaxHeapSize=0x1000000; // 16MB + +const TUint KMMFDevSoundServerVersion=8; +const TUint KMMFDevSoundServerMinorVersionNumber=0; +const TUint KMMFDevSoundServerBuildVersionNumber=1; + + +class TDevSoundServerStart +/** +*@internalTechnology +*/ + { +public: + TDevSoundServerStart(CMMFAudioServer* aAudioServer, const TProcessId& aProcessId, RServer2& aDevSoundServerHandle); + +public: + TProcessId iProcessId; + CMMFAudioServer* iAudioServer; + RServer2& iDevSoundServerHandle; + }; + +#include "MmfDevSoundServerStart.inl" + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundServerStart.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,20 @@ +// Copyright (c) 2004-2009 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: +// + + +inline TDevSoundServerStart::TDevSoundServerStart(CMMFAudioServer* aAudioServer, const TProcessId& aProcessId, RServer2& aDevSoundServerHandle) + :iProcessId(aProcessId), iAudioServer(aAudioServer), iDevSoundServerHandle(aDevSoundServerHandle) + { + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1351 @@ +// Copyright (c) 2004-2009 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 +#include "MmfDevSoundSession.h" +#include "MmfDevSoundSessionXtnd.h" +#include "MmfDevSoundSessionBody.h" + +#include "MmfAudioClientServer.h" +#include "MmfAudioServer.h" +#include "MmfDevSoundServer.h" + +void CMMFDevSoundSession::CreateL(const CMmfIpcServer& aServer) + { + CMmfIpcSession::CreateL(aServer); + CMMFDevSoundServer& server = + const_cast(static_cast(aServer)); + server.IncrementSessionId(); + iDevSoundSessionId = server.DevSoundSessionId(); + iClientHasCaps = server.CheckClientCapabilities(); + } + +TBool CMMFDevSoundSession::CheckClientCapabilities() + { + return iClientHasCaps; + } + +void CMMFDevSoundSession::ServiceL(const RMmfIpcMessage& aMessage) + { + TBool complete = EFalse; + switch(aMessage.Function()) + { + case EMMFDevSoundProxyInitialize1: + complete = DoInitialize1L(aMessage); + break; + case EMMFDevSoundProxyInitialize2: + complete = DoInitialize2L(aMessage); + break; + case EMMFDevSoundProxyInitialize3: + complete = DoInitialize3L(aMessage); + break; + case EMMFDevSoundProxyInitialize4: + complete = DoInitialize4L(aMessage); + break; + case EMMFDevSoundProxyCapabilities: + complete = DoCapabilitiesL(aMessage); + break; + case EMMFDevSoundProxyConfig: + complete = DoConfigL(aMessage); + break; + case EMMFDevSoundProxySetConfig: + complete = DoSetConfigL(aMessage); + break; + case EMMFDevSoundProxyMaxVolume: + complete = DoMaxVolumeL(aMessage); + break; + case EMMFDevSoundProxyVolume: + complete = DoVolumeL(aMessage); + break; + case EMMFDevSoundProxySetVolume: + complete = DoSetVolumeL(aMessage); + break; + case EMMFDevSoundProxyMaxGain: + complete = DoMaxGainL(aMessage); + break; + case EMMFDevSoundProxyGain: + complete = DoGainL(aMessage); + break; + case EMMFDevSoundProxySetGain: + complete = DoSetGainL(aMessage); + break; + case EMMFDevSoundProxyPlayBalance: + complete = DoGetPlayBalanceL(aMessage); + break; + case EMMFDevSoundProxySetPlayBalance: + complete = DoSetPlayBalanceL(aMessage); + break; + case EMMFDevSoundProxyRecordBalance: + complete = DoGetRecordBalanceL(aMessage); + break; + case EMMFDevSoundProxySetRecordBalance: + complete = DoSetRecordBalanceL(aMessage); + break; + case EMMFDevSoundProxyBTBFData: + complete = DoBufferToBeFilledDataL(aMessage); + break; + case EMMFDevSoundProxyBTBEData: + complete = DoBufferToBeEmptiedDataL(aMessage); + break; + case EMMFDevSoundProxyPlayInit: + complete = DoPlayInitL(aMessage); + break; + case EMMFDevSoundProxyRecordInit: + complete = DoRecordInitL(aMessage); + break; + case EMMFDevSoundProxyPlayData: + complete = DoPlayDataL(aMessage); + break; + case EMMFDevSoundProxyRecordData: + complete = DoRecordDataL(aMessage); + break; + case EMMFDevSoundProxyStop: + complete = DoStopL(aMessage); + break; + case EMMFDevSoundProxyPause: + complete = DoPauseL(aMessage); + break; + case EMMFDevSoundProxyPlayTone: + complete = DoPlayToneL(aMessage); + break; + case EMMFDevSoundProxyPlayDualTone: + complete = DoPlayDualToneL(aMessage); + break; + case EMMFDevSoundProxyPlayDTMFString: + complete = DoPlayDTMFStringL(aMessage); + break; + case EMMFDevSoundProxyPlayToneSequence: + complete = DoPlayToneSequenceL(aMessage); + break; + case EMMFDevSoundProxyPlayFixedSequence: + complete = DoPlayFixedSequenceL(aMessage); + break; + case EMMFDevSoundProxySetDTMFLengths: + complete = DoSetDTMFLengthsL(aMessage); + break; + case EMMFDevSoundProxySetVolumeRamp: + complete = DoSetVolumeRampL(aMessage); + break; + case EMMFDevSoundProxyGetSupportedInputDataTypes: + complete = DoGetSupportedInputDataTypesL(aMessage); + break; + case EMMFDevSoundProxyGetSupportedOutputDataTypes: + complete = DoGetSupportedOutputDataTypesL(aMessage); + break; + case EMMFDevSoundProxyCopyFourCCArrayData: + complete = DoCopyFourCCArrayDataL(aMessage); + break; + case EMMFDevSoundProxyGetRecordedBuffer: + complete = DoGetRecordedBufferL(aMessage); + break; + case EMMFDevSoundProxySamplesRecorded: + complete = DoSamplesRecordedL(aMessage); + break; + case EMMFDevSoundProxySamplesPlayed: + complete = DoSamplesPlayedL(aMessage); + break; + case EMMFDevSoundProxySetToneRepeats: + complete = DoSetToneRepeatsL(aMessage); + break; + case EMMFDevSoundProxySetPrioritySettings: + complete = DoSetPrioritySettingsL(aMessage); + break; + case EMMFDevSoundProxyFixedSequenceName: + complete = DoFixedSequenceNameL(aMessage); + break; + case EMMFDevSoundProxyFixedSequenceCount: + complete = DoFixedSequenceCountL(aMessage); + break; + case EMMFDevSoundProxyRequestResourceNotification: + complete = DoRegisterAsClientL(aMessage); + break; + case EMMFDevSoundProxyCancelRequestResourceNotification: + complete = DoCancelRegisterAsClientL(aMessage); + break; + case EMMFDevSoundProxyGetResourceNotificationData: + complete = DoGetResourceNotificationDataL(aMessage); + break; + case EMMFDevSoundProxyWillResumePlay: + complete = DoWillResumePlayL(aMessage); + break; + case EMMFDevSoundProxySetClientThreadInfo: + complete = DoSetClientThreadInfoL(aMessage); + break; + case EMMFDevSoundProxyGetTimePlayed: + complete = DoGetTimePlayedL(aMessage); + break; + + // custom command support + case EMMFDevSoundProxySyncCustomCommand: + complete = DoSyncCustomCommandL(aMessage); + break; + case EMMFDevSoundProxySyncCustomCommandResult: + complete = DoSyncCustomCommandResultL(aMessage); + break; + case EMMFDevSoundProxyAsyncCustomCommand: + complete = DoAsyncCustomCommandL(aMessage); + break; + case EMMFDevSoundProxyAsyncCustomCommandResult: + complete = DoAsyncCustomCommandResultL(aMessage); + break; + case EMMFDevSoundProxyEmptyBuffers: + complete = DoEmptyBuffersL(aMessage); + break; + default: + User::Leave(KErrNotSupported); + break; + } + if (complete) + aMessage.Complete(KErrNone); + } + +TBool CMMFDevSoundSession::DoInitialize1L(const RMmfIpcMessage& aMessage) + { + if(iMsgQueue.Handle() == 0) + { + TInt err = iMsgQueue.Open(aMessage, 1); // a global queue. + User::LeaveIfError(err); + } + TMMFDevSoundProxySettingsPckg buf; + MmfMessageUtil::ReadL(aMessage,0,buf); + TMMFState mode = buf().iMode; + iBody->InitializeL(*this, mode); + iBufferPlay = NULL; + return ETrue; + } + +TBool CMMFDevSoundSession::DoInitialize2L(const RMmfIpcMessage& aMessage) + { + if(iMsgQueue.Handle() == 0) + { + TInt err = iMsgQueue.Open(aMessage, 1); // a global queue. + User::LeaveIfError(err); + } + TMMFDevSoundProxySettingsPckg buf; + MmfMessageUtil::ReadL(aMessage,0,buf); + TUid HWDev = buf().iHWDev; + TMMFState mode = buf().iMode; + iBody->InitializeL(*this, HWDev, mode); + iBufferPlay = NULL; + return ETrue; + } + +TBool CMMFDevSoundSession::DoInitialize3L(const RMmfIpcMessage& /*aMessage*/) + { + User::Leave(KErrNotSupported); + return ETrue; + } + +TBool CMMFDevSoundSession::DoInitialize4L(const RMmfIpcMessage& aMessage) + { + if(iMsgQueue.Handle() == 0) + { + TInt err = iMsgQueue.Open(aMessage, 1); // a global queue. + User::LeaveIfError(err); + } + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TFourCC desiredFourCC = buf().iDesiredFourCC; + TMMFState mode = buf().iMode; + iBody->InitializeL(*this, desiredFourCC, mode); + iBufferPlay = NULL; + return ETrue; + } + +TBool CMMFDevSoundSession::DoCapabilitiesL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iCaps = iBody->Capabilities(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoConfigL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iConfig = iBody->Config(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetConfigL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TMMFCapabilities config = buf().iConfig; + iBody->SetConfigL(config); + return ETrue; + } + +TBool CMMFDevSoundSession::DoMaxVolumeL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iMaxVolume = iBody->MaxVolume(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoVolumeL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iVolume = iBody->Volume(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetVolumeL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt volume = buf().iVolume; + iBody->SetVolume(volume); + return ETrue; + } + +TBool CMMFDevSoundSession::DoMaxGainL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iMaxGain = iBody->MaxGain(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoGainL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + set.iGain = iBody->Gain(); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetGainL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt gain = buf().iGain; + iBody->SetGain(gain); + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetPlayBalanceL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + iBody->GetPlayBalanceL(set.iLeftPercentage, set.iRightPercentage); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetPlayBalanceL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt leftPercentage = buf().iLeftPercentage; + TInt rightPercentage = buf().iRightPercentage; + iBody->SetPlayBalanceL(leftPercentage, rightPercentage); + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetRecordBalanceL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettings set; + iBody->GetRecordBalanceL(set.iLeftPercentage, set.iRightPercentage); + TMMFDevSoundProxySettingsPckg pckg(set); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetRecordBalanceL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt leftPercentage = buf().iLeftPercentage; + TInt rightPercentage = buf().iRightPercentage; + iBody->SetRecordBalanceL(leftPercentage, rightPercentage); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayInitL(const RMmfIpcMessage& /*aMessage*/) + { + iBody->PlayInitL(); + return ETrue; + } + +TBool CMMFDevSoundSession::DoRecordInitL(const RMmfIpcMessage& aMessage) + { + iBody->RecordInitL(aMessage); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayDataL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxyHwBufPckg buf; + aMessage.ReadL(TInt(0),buf); + iBufferPlay->SetLastBuffer(buf().iLastBuffer); + + aMessage.ReadL(TInt(1),iBufferPlay->Data()); + return iBody->PlayData(aMessage); + } + +TBool CMMFDevSoundSession::DoRecordDataL(const RMmfIpcMessage& aMessage) + { + return iBody->RecordData(aMessage); + } + +TBool CMMFDevSoundSession::DoStopL(const RMmfIpcMessage& /*aMessage*/) + { + if(iMsgQueue.Handle() != 0) + { + TMMFDevSoundQueueItem queueItem; + TInt err = KErrNone; + while(err != KErrUnderflow) + { + err = iMsgQueue.Receive(queueItem); + } + } + iBody->Stop(); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPauseL(const RMmfIpcMessage& /*aMessage*/) + { + iBody->Pause(); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayToneL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt frequency = buf().iFrequencyOne; + TTimeIntervalMicroSeconds duration(buf().iDuration); + iBody->PlayToneL(frequency, duration); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayDualToneL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TInt frequencyOne = buf().iFrequencyOne; + TInt frequencyTwo = buf().iFrequencyTwo; + TTimeIntervalMicroSeconds duration(buf().iDuration); + iBody->PlayDualToneL(frequencyOne, frequencyTwo, duration); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayDTMFStringL(const RMmfIpcMessage& aMessage) + { + TInt DTMFLength = User::LeaveIfError(aMessage.GetDesLength(0)); + + if(iDTMFString) + { + delete iDTMFString; + iDTMFString = NULL; + } + + iDTMFString = HBufC::NewL(DTMFLength); + TPtr DTMFPtr = iDTMFString->Des(); + aMessage.ReadL(TInt(0), DTMFPtr); + + iBody->PlayDTMFStringL(*iDTMFString); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayToneSequenceL(const RMmfIpcMessage& aMessage) + { + TInt toneLength = User::LeaveIfError(aMessage.GetDesLength(0)); + + if(iToneSeqBuf) + { + delete iToneSeqBuf; + iToneSeqBuf = NULL; + } + + iToneSeqBuf = HBufC8::NewL(toneLength); + TPtr8 toneSeqPtr = iToneSeqBuf->Des(); + aMessage.ReadL(TInt(0), toneSeqPtr); + + iBody->PlayToneSequenceL(*iToneSeqBuf); + return ETrue; + } + +TBool CMMFDevSoundSession::DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage) + { + TPckgBuf buf; + aMessage.ReadL(TInt(0),buf); + TInt seqNum = buf(); + + iBody->PlayFixedSequenceL(seqNum); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TTimeIntervalMicroSeconds32 toneOnLength = buf().iToneOnLength; + TTimeIntervalMicroSeconds32 toneOffLength = buf().iToneOffLength; + TTimeIntervalMicroSeconds32 pauseLength = buf().iPauseLength; + iBody->SetDTMFLengths(toneOnLength, toneOffLength, pauseLength); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetVolumeRampL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TTimeIntervalMicroSeconds duration = buf().iDuration; + iBody->SetVolumeRamp(duration); + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetSupportedInputDataTypesL(const RMmfIpcMessage& aMessage) + { + iArray.Reset(); + + TMMFPrioritySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TMMFPrioritySettings prioritySet = buf(); + + iBody->GetSupportedInputDataTypesL(iArray, prioritySet); + + TPckgBuf pckg; + pckg() = iArray.Count(); + aMessage.WriteL(TInt(2),pckg); + + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetSupportedOutputDataTypesL(const RMmfIpcMessage& aMessage) + { + iArray.Reset(); + + TMMFPrioritySettingsPckg buf; + aMessage.ReadL(TInt(0),buf); + TMMFPrioritySettings prioritySet = buf(); + + iBody->GetSupportedOutputDataTypesL(iArray, prioritySet); + + TPckgBuf pckg; + pckg() = iArray.Count(); + aMessage.WriteL(TInt(2),pckg); + + return ETrue; + } + +TBool CMMFDevSoundSession::DoSamplesRecordedL(const RMmfIpcMessage& aMessage) + { + TPckgBuf pckg; + pckg() = iBody->SamplesRecorded(); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSamplesPlayedL(const RMmfIpcMessage& aMessage) + { + TPckgBuf pckg; + pckg() = iBody->SamplesPlayed(); + aMessage.WriteL(TInt(2),pckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetToneRepeatsL(const RMmfIpcMessage& aMessage) + { + TPckgBuf countRepeat; + aMessage.ReadL(TInt(0),countRepeat); + + TPckgBuf repeatTS; + aMessage.ReadL(TInt(1),repeatTS); + + iBody->SetToneRepeats(countRepeat(), repeatTS()); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetPrioritySettingsL(const RMmfIpcMessage& aMessage) + { + TPckgBuf prioritySet; + aMessage.ReadL(TInt(0),prioritySet); + + iBody->SetPrioritySettings(prioritySet()); + return ETrue; + } + +TBool CMMFDevSoundSession::DoFixedSequenceNameL(const RMmfIpcMessage& aMessage) + { + TPckgBuf seqNum; + aMessage.ReadL(0, seqNum); + aMessage.WriteL(2, iBody->FixedSequenceName(seqNum()).Left(KMaxFixedSequenceNameLength)); + return ETrue; + } + +TBool CMMFDevSoundSession::DoFixedSequenceCountL(const RMmfIpcMessage& aMessage) + { + TPckgBuf fixSeqCountPckg; + TInt fixSeqCount = iBody->FixedSequenceCount(); + fixSeqCountPckg = fixSeqCount; + + aMessage.WriteL(TInt(0),fixSeqCountPckg); + return ETrue; + } + + +TBool CMMFDevSoundSession::DoCopyFourCCArrayDataL(const RMmfIpcMessage& aMessage) + { + const TInt KBufExpandSize8 = 8;//two TInts + CBufFlat* dataCopyBuffer = CBufFlat::NewL(KBufExpandSize8); + CleanupStack::PushL(dataCopyBuffer); + RBufWriteStream stream; + stream.Open(*dataCopyBuffer); + CleanupClosePushL(stream); + for (TInt i=0;iPtr(0)); + CleanupStack::PopAndDestroy(2);//iDataCopyBuffer, stream + return ETrue; + } + + +TBool CMMFDevSoundSession::DoGetRecordedBufferL(const RMmfIpcMessage& aMessage) + { + MmfMessageUtil::Write(aMessage, TInt(0), iBufferRecord->Data()); + return ETrue; + } + +TBool CMMFDevSoundSession::DoBufferToBeFilledDataL(const RMmfIpcMessage& aMessage) + { + TInt err = MmfMessageUtil::Write(aMessage, 0, iHwBufPckgFill); + aMessage.Complete(err); + return EFalse; + } + +TBool CMMFDevSoundSession::DoBufferToBeEmptiedDataL(const RMmfIpcMessage& aMessage) + { + TInt err = MmfMessageUtil::Write(aMessage, 0, iHwBufPckgEmpty); + aMessage.Complete(err); + return EFalse; + } + +TBool CMMFDevSoundSession::DoRegisterAsClientL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(0,buf); + HBufC8* notificationRegistrationData = NULL; + notificationRegistrationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLengthL(1))); + TPtr8 dataPtr(notificationRegistrationData->Des()); + aMessage.ReadL(1,dataPtr); + TInt err = KErrNone; + err = iBody->RegisterAsClient(buf().iNotificationEventUid,dataPtr); + CleanupStack::PopAndDestroy(1); // Notification Registeration data + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(0,buf); + TInt err = KErrNone; + err = iBody->CancelRegisterAsClient(buf().iNotificationEventUid); + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundProxySettingsPckg buf; + aMessage.ReadL(0,buf); + HBufC8* notificationData = NULL; + notificationData = HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesMaxLengthL(2))); + TPtr8 dataPtr(notificationData->Des()); + aMessage.ReadL(2,dataPtr); + TInt err = KErrNone; + err = iBody->GetResourceNotificationData(buf().iNotificationEventUid,dataPtr); + aMessage.WriteL(2,*notificationData); + CleanupStack::PopAndDestroy(1); // Notification data + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoWillResumePlayL(const RMmfIpcMessage& aMessage) + { + TInt err = KErrNone; + if(CheckClientCapabilities()) + { + err = iBody->WillResumePlay(); + } + else + { + err = KErrPermissionDenied; + } + + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoEmptyBuffersL(const RMmfIpcMessage& aMessage) + { + TInt err = KErrNone; + err = iBody->EmptyBuffers(); + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoSetClientThreadInfoL(const RMmfIpcMessage& aMessage) + { + if (aMessage.HasCapability(ECapabilityMultimediaDD)) + { + TPckgBuf threadId; + aMessage.ReadL(0, threadId); + + CMMFDevSoundServer* server = + const_cast(static_cast(Server())); + server->SetClientCapabilitiesL(threadId()); + iClientHasCaps = server->CheckClientCapabilities(); + } + else + { + User::Leave(KErrPermissionDenied); + } + return ETrue; + } + +TBool CMMFDevSoundSession::DoGetTimePlayedL(const RMmfIpcMessage& aMessage) + { + TInt err = KErrNone; + TPckgBuf timePckg; + err = iBody->GetTimePlayed(timePckg()); + if (err != KErrNone) + { + aMessage.Complete(err); + return EFalse; + } + aMessage.WriteL(TInt(2),timePckg); + return ETrue; + } + +TBool CMMFDevSoundSession::DoSyncCustomCommandL(const RMmfIpcMessage& aMessage) + { + // check whether these are custom interface commands + // if so then send them into the demux pipeline + TInt retVal = KErrNone; + + // try and process this as a custom interface + TRAPD(err, retVal = iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage)); + if (err == KErrNone) + { + // we can pass back valid values here since command + // has been handled by the DeMux framework + aMessage.Complete(retVal); + } + else if (err != KErrNotFound) + { + // the framework left with an error condition + // so we complete the message with this error + aMessage.Complete(err); + } + else + { + // commmand was not found inside the Custom Interface framework + // so we can pass onto the DevSound server implementation + // assume that this will either leave or complete the message + iBody->DoSyncCustomCommandL(aMessage); + } + + // we complete our own message so don't need the framework to do so + return EFalse; + } + +TBool CMMFDevSoundSession::DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage) + { + // check whether these are custom interface commands + TInt retVal = KErrNone; + TRAPD(err, retVal = iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage)); + if (err == KErrNone) + { + // we can pass back valid values here since command + // has been handled by the DeMux framework + aMessage.Complete(retVal); + } + else if (err != KErrNotFound) + { + // the framework left with an error condition + // so we complete the message with this error + aMessage.Complete(err); + } + else + { + // commmand was not found inside the Custom Interface framework + // so we can pass onto the DevSound server implementation + // assume that this will either leave or complete the message + iBody->DoSyncCustomCommandResultL(aMessage); + } + // we complete our own message so don't need the framework to do so + return EFalse; + } + +TBool CMMFDevSoundSession::DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage) + { + // check whether these are custom interface commands + // async message will complete later + TRAPD(err, iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage)); + if ((err != KErrNotFound) && (err != KErrNone)) + { + // the framework left with an error condition + // so we complete the message with this error + aMessage.Complete(err); + } + else if (err == KErrNotFound) + { + // commmand was not found inside the Custom Interface framework + // so we can pass onto the DevSound server implementation + // assume that this will either leave or complete the message + iBody->DoAsyncCustomCommandL(aMessage); + } + return EFalse; + } + +TBool CMMFDevSoundSession::DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage) + { + // check whether these are custom interface commands + // async message will complete later + TRAPD(err, iDeMuxUtility->ProcessCustomInterfaceCommandL(aMessage)); + if ((err != KErrNotFound) && (err != KErrNone)) + { + // the framework left with an error condition + // so we complete the message with this error + aMessage.Complete(err); + } + else if (err == KErrNotFound) + { + // commmand was not found inside the Custom Interface framework + // so we can pass onto the DevSound server implementation + // assume that this will either leave or complete the message + iBody->DoAsyncCustomCommandL(aMessage); + } + return EFalse; + } + + + +void CMMFDevSoundSession::SendEventToClient(/*TMMFAudioPolicyEvent& aEvent*/) + { + } + + +/* + * + * Default Constructor. + * + * + */ +CMMFDevSoundSession::CMMFDevSoundSession() + { + } + +CMMFDevSoundSession::~CMMFDevSoundSession() + { + // clear the array of custom interfaces + for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++) + { + // we could have already deleted interfaces without + // removing them from the array so check for this + // and only delete release plugin if non-null + MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = iCustomInterfaceArray[i].iInterface; + if (ptr) + { + iCustomInterfaceArray[i].iInterface->Release(); + } + } + iCustomInterfaceArray.Reset(); + iCustomInterfaceArray.Close(); + + delete iDeMuxUtility; + + iMsgQueue.Close(); + iArray.Close(); + delete iDTMFString; + delete iToneSeqBuf; + delete iBody; + + CMMFDevSoundServer* server = + const_cast(static_cast(Server())); + if (server) + { + server->DecrementSessionId(); + } + } + +/* + * -doxygen comments moved to header- + * + * Constructs, and returns a pointer to, a new CMMFDevSoundProxy object. + * + * Leaves on failure. + * + */ +CMMFDevSoundSession* CMMFDevSoundSession::NewL(RServer2& aPolicyServerHandle) + { + CMMFDevSoundSession* self = new (ELeave) CMMFDevSoundSessionXtnd; + CleanupStack::PushL(self); + self->ConstructL(aPolicyServerHandle); + CleanupStack::Pop(); + return self; + } + +/* + * -doxygen comments moved to header- + * + * Second phase constructor. + * + */ +void CMMFDevSoundSession::ConstructL(RServer2& aPolicyServerHandle) + { + iBody = CMMFDevSoundSvrImp::NewL(static_cast(this)); + iBody->Construct3L(aPolicyServerHandle); + + iDeMuxUtility = CMMFDevSoundCIDeMuxUtility::NewL(this); + } + +//callbacks +void CMMFDevSoundSession::InitializeComplete(TInt aError) + { + // this may be a re-initialization and so we need to + // re-get our custom interfaces on the DeMux plugins + for (TInt i = 0; i < iCustomInterfaceArray.Count(); i++) + { + // we could have already deleted interfaces without + // removing them from the array so check for this + // and only delete release plugin if non-null + MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = iCustomInterfaceArray[i].iInterface; + if (ptr) + { + // we can't keep track of.. + // 1. where a custom interface is implemented + // 2. the uid of the custom interface to be refreshed + // so assume all have to be refreshed + TRAPD(err, iCustomInterfaceArray[i].iInterface->RefreshL()); + + // if there is an error then this is no longer a + // valid interface so could be deleted this from the array + // but this would involve notifying the client side + // + // since we have no way of notifying the client in this + // implementation and the fact that this is a prototype + // implementation and we will leave this up to the licensee + // to implement as required + if (err != KErrNone) + { + TMMFEvent event; + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundCustomCommandCloseMuxDemuxPair; + item.iErrorCode = err; + event.iEventType.iUid = i+1; + item.iEventPckg() = event; + iMsgQueue.Send(item); + } + } + } + + // The previous implementation was commented out, + // so add a new commented out implementation :) + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyICEvent; + item.iErrorCode = aError; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::ToneFinished(TInt aError) + { + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyTFEvent; + item.iErrorCode = aError; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::BufferToBeFilled(CMMFBuffer* aBuffer) + { + // Package up the data for retrieval later (using a two stage process + // as this payload is too large to be sent via the queue in one message) + iBufferPlay = reinterpret_cast(aBuffer); + iHwBufPckgFill().iBufferType = iBufferPlay->Type(); + iHwBufPckgFill().iRequestSize = iBufferPlay->RequestSize(); + iHwBufPckgFill().iBufferSize = iBufferPlay->Data().MaxLength(); + iHwBufPckgFill().iLastBuffer = iBufferPlay->LastBuffer(); + + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyBTBFEvent; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::PlayError(TInt aError) + { + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyPEEvent; + item.iErrorCode = aError; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::BufferToBeEmptied(CMMFBuffer* aBuffer) + { + iBufferRecord = reinterpret_cast(aBuffer); + + iHwBufPckgEmpty().iBufferType = iBufferRecord->Type(); + iHwBufPckgEmpty().iRequestSize = iBufferRecord->RequestSize(); + iHwBufPckgEmpty().iBufferSize = iBufferRecord->Data().MaxLength(); + iHwBufPckgEmpty().iLastBuffer = iBufferRecord->LastBuffer(); + + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyBTBEEvent; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::RecordError(TInt aError) + { + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxyREEvent; + item.iErrorCode = aError; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +void CMMFDevSoundSession::ConvertError(TInt /*aError*/) + { + } + +void CMMFDevSoundSession::DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) + { + } + +void CMMFDevSoundSession::SendEventToClient(const TMMFEvent& aEvent) + { + TMMFDevSoundQueueItem item; + item.iRequest = EMMFDevSoundProxySETCEvent; + item.iEventPckg() = aEvent; + iMsgQueue.Send(item); // assumes sufficient space in the queue so ignores the return value + } + +/******************************************************************************** + * Non Exported public functions begins here * + ********************************************************************************/ + +// +// Audio Policy specific implementation begins here // +// + +/** + * + * Sets Id for this instance of DevSound + * + * @param "TInt aDevSoundId" + * Integer value assigned by Audio Policy Server + * + */ +void CMMFDevSoundSessionXtnd::SetDevSoundId(TInt aDevSoundId) + { + iBody->SetDevSoundId(aDevSoundId); + } + +/** + * + * Returns information about this DevSound instance. + * + * This method is used by Audio Policy Server to make audio policy decisions. + * + * @return "TMMFDevSoundinfo" + * A reference to TMMFDevSoundinfo object holding the current settings + * of this DevSound instance. + * + */ +TMMFDevSoundInfo CMMFDevSoundSessionXtnd::DevSoundInfo() + { + return iBody->DevSoundInfo(); + } + +/** + * + * Called by Audio Policy Server when a request to play is approved by the + * Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSessionXtnd::StartPlayDataL() + { + iBody->StartPlayDataL(); + } + +/** + * + * Called by Audio Policy Server when a request to record is approved by the + * Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSessionXtnd::StartRecordDataL() + { + iBody->StartRecordDataL(); + } + +/** + * + * Called by Audio Policy Server when a request to play tone is approved by + * the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSessionXtnd::StartPlayToneL() + { + iBody->StartPlayToneL(); + } + +/** + * + * Called by Audio Policy Server when a request to play a dual tone is approved by + * the Audio Policy Server. + * + */ +void CMMFDevSoundSessionXtnd::StartPlayDualToneL() + { + iBody->StartPlayDualToneL(); + } + +/** + * + * Called by Audio Policy Server when a request to play DTMF String is approved + * by the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSessionXtnd::StartPlayDTMFStringL() + { + iBody->StartPlayDTMFStringL(); + } + +/** + * + * Called by Audio Policy Server when a request to play tone sequence is + * approved by the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSessionXtnd::StartPlayToneSequenceL() + { + iBody->StartPlayToneSequenceL(); + } + +/** + * + * Called by Audio Policy Server when the current DevSound instance looses the + * policy because of another instance with a higher priority wants the device. + * + */ +void CMMFDevSoundSessionXtnd::SendEvent(const TMMFEvent& aEvent) + { + iBody->SendEventToClient(aEvent); + } + + +// +// Audio Policy specific implementation begins here // +// + +/** + * + * Updates the total bytes played. + * + */ +void CMMFDevSoundSessionXtnd::UpdateBytesPlayed() + { + iBody->UpdateBytesPlayed(); + } + + +// Custom Interface // +TInt CMMFDevSoundSession::DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf) + { + // it shouldn't be necessary to check if we have already instantiated this + // interface since the client would already know - however this is something + // that a licensee could implement if they required additional functionality + // e.g. many : 1 mappings between client and DevSound. + + MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = NULL; + + // try and instantiate a plugin tunnelling + // pair to support this Custom Interface + ptr = iDeMuxUtility->CreateCustomInterfaceDeMuxL(aInterface); + + TInt handle = KNullHandle; + + if (ptr) + { + TMMFDevSoundCustomInterfaceDeMuxData data; + data.iInterface = ptr; + data.iId = aInterface; + + CleanupReleasePushL(*ptr); + + // setup demux plugin + ptr->SetInterfaceTarget(iBody); + + // try and open interface + // this will fetch the interface from the svr implementation + ptr->DoOpenSlaveL(aInterface, aPackageBuf); + User::LeaveIfError(iCustomInterfaceArray.Append(data)); + + CleanupStack::Pop(); // ptr + + handle = iCustomInterfaceArray.Count(); + return handle; + } + + // we couldn't set up the interface correctly so return a NULL + // handle to the client + return KNullHandle; + } + +void CMMFDevSoundSession::DoCloseSlaveL(TInt aHandle) + { + if (aHandle==KNullHandle) + { + // null-handle -> NOP + return; + } + + if (aHandle iCustomInterfaceArray.Count()) + { + // handle out of range - should not happen, but leave to show error + User::Leave(KErrBadHandle); + } + + // set the current handle location to NULL + // can't re-compress array because this will alter handles + // we could change this to a list type structure but this + // seems overkill for the current prototype + TMMFDevSoundCustomInterfaceDeMuxData& data = iCustomInterfaceArray[aHandle-1]; + + // close and delete the plugin + MMMFDevSoundCustomInterfaceDeMuxPlugin* ptr = data.iInterface; + ptr->DoCloseSlaveL(aHandle); + ptr->Release(); + + // clear the entry + data.iInterface = NULL; + data.iId.iUid = 0; + } + +TInt CMMFDevSoundSession::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + // use the demux utility to get the handle + TMMFDevSoundCIMessageData data; + iDeMuxUtility->GetSyncMessageDataL(aMessage, data); + + TInt handle = data.iHandle; + + if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count()))) + { + + User::Leave(KErrBadHandle); + } + + // call on demux plugin + return iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveSyncCommandL(aMessage); + } + +TInt CMMFDevSoundSession::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) + { + // use the demux utility to get the handle + TMMFDevSoundCIMessageData data; + iDeMuxUtility->GetSyncMessageDataL(aMessage, data); + + TInt handle = data.iHandle; + + if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count()))) + { + + User::Leave(KErrBadHandle); + } + + // call on demux plugin + return iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveSyncCommandResultL(aMessage); + } + +void CMMFDevSoundSession::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage) + { + // use the demux utility to get the handle + TMMFDevSoundCIMessageData data; + iDeMuxUtility->GetAsyncMessageDataL(aMessage, data); + + TInt handle = data.iHandle; + + if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count()))) + { + User::Leave(KErrBadHandle); + } + + // call on demux plugin + iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveAsyncCommandL(aMessage); + } + +void CMMFDevSoundSession::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage) + { + // use the demux utility to get the handle + TMMFDevSoundCIMessageData data; + iDeMuxUtility->GetAsyncMessageDataL(aMessage, data); + + TInt handle = data.iHandle; + + if ((handle <= 0) || (handle > (iCustomInterfaceArray.Count()))) + { + User::Leave(KErrBadHandle); + } + + // call on demux plugin + iCustomInterfaceArray[handle-1].iInterface->DoSendSlaveAsyncCommandResultL(aMessage); + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSession.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,203 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFDEVSOUNDSESSION_H__ +#define __MMFDEVSOUNDSESSION_H__ + +#include +#include +#include +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include "MmfAudioClientServer.h" +#include +#include "MmfDevSoundCIDeMuxUtility.h" + +#include + +class CMMFAudioServer; +class CMMFDevSoundServer; +class CMMFDevSoundSvrImp; + +class CMMFDevSoundSession : public CMmfIpcSession, public MDevSoundObserver, + public MMMFDevSoundCustomInterfaceDeMuxInterface + { +public: + static CMMFDevSoundSession* NewL(RServer2& aPolicyServerHandle); + ~CMMFDevSoundSession(); + + void CreateL(const CMmfIpcServer& aServer); + void ServiceL(const RMmfIpcMessage& aMessage); + TInt DevSoundSessionId(void) {return iDevSoundSessionId;}; + void SendEventToClient(/*TMMFAudioServerEvent& aEvent*/); + TBool CheckClientCapabilities(); + + + TBool DoInitialize1L(const RMmfIpcMessage& aMessage); + TBool DoInitialize2L(const RMmfIpcMessage& aMessage); + TBool DoInitialize3L(const RMmfIpcMessage& aMessage); + TBool DoInitialize4L(const RMmfIpcMessage& aMessage); + TBool DoCapabilitiesL(const RMmfIpcMessage& aMessage); + TBool DoConfigL(const RMmfIpcMessage& aMessage); + TBool DoSetConfigL(const RMmfIpcMessage& aMessage); + TBool DoMaxVolumeL(const RMmfIpcMessage& aMessage); + TBool DoVolumeL(const RMmfIpcMessage& aMessage); + TBool DoSetVolumeL(const RMmfIpcMessage& aMessage); + TBool DoMaxGainL(const RMmfIpcMessage& aMessage); + TBool DoGainL(const RMmfIpcMessage& aMessage); + TBool DoSetGainL(const RMmfIpcMessage& aMessage); + TBool DoGetPlayBalanceL(const RMmfIpcMessage& aMessage); + TBool DoSetPlayBalanceL(const RMmfIpcMessage& aMessage); + TBool DoGetRecordBalanceL(const RMmfIpcMessage& aMessage); + TBool DoSetRecordBalanceL(const RMmfIpcMessage& aMessage); + TBool DoPlayInitL(const RMmfIpcMessage& aMessage); + TBool DoRecordInitL(const RMmfIpcMessage& aMessage); + TBool DoPlayDataL(const RMmfIpcMessage& aMessage); + TBool DoRecordDataL(const RMmfIpcMessage& aMessage); + TBool DoStopL(const RMmfIpcMessage& aMessage); + TBool DoPauseL(const RMmfIpcMessage& aMessage); + TBool DoPlayToneL(const RMmfIpcMessage& aMessage); + TBool DoPlayDualToneL(const RMmfIpcMessage& aMessage); + TBool DoPlayDTMFStringL(const RMmfIpcMessage& aMessage); + TBool DoPlayToneSequenceL(const RMmfIpcMessage& aMessage); + TBool DoPlayFixedSequenceL(const RMmfIpcMessage& aMessage); + TBool DoSetDTMFLengthsL(const RMmfIpcMessage& aMessage); + TBool DoSetVolumeRampL(const RMmfIpcMessage& aMessage); + TBool DoGetSupportedInputDataTypesL(const RMmfIpcMessage& aMessage); + TBool DoCopyFourCCArrayDataL(const RMmfIpcMessage& aMessage); + TBool DoGetRecordedBufferL(const RMmfIpcMessage& aMessage); + TBool DoSamplesRecordedL(const RMmfIpcMessage& aMessage); + TBool DoSamplesPlayedL(const RMmfIpcMessage& aMessage); + TBool DoSetToneRepeatsL(const RMmfIpcMessage& aMessage); + TBool DoSetPrioritySettingsL(const RMmfIpcMessage& aMessage); + TBool DoFixedSequenceNameL(const RMmfIpcMessage& aMessage); + TBool DoFixedSequenceCountL(const RMmfIpcMessage& aMessage); + TBool DoGetSupportedOutputDataTypesL(const RMmfIpcMessage& aMessage); + + TBool DoBufferToBeFilledDataL(const RMmfIpcMessage& aMessage); + TBool DoBufferToBeEmptiedDataL(const RMmfIpcMessage& aMessage); + TBool DoRegisterAsClientL(const RMmfIpcMessage& aMessage); + TBool DoCancelRegisterAsClientL(const RMmfIpcMessage& aMessage); + TBool DoGetResourceNotificationDataL(const RMmfIpcMessage& aMessage); + TBool DoWillResumePlayL(const RMmfIpcMessage& aMessage); + TBool DoEmptyBuffersL(const RMmfIpcMessage& aMessage); + TBool DoSetClientThreadInfoL(const RMmfIpcMessage& aMessage); + TBool DoGetTimePlayedL(const RMmfIpcMessage& aMessage); + + TBool DoSyncCustomCommandL(const RMmfIpcMessage& aMessage); + TBool DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage); + TBool DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage); + TBool DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage); + + // from MMMFDevSoundCustomInterfaceDeMuxInterface + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + virtual void DoCloseSlaveL(TInt aHandle); + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + + + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode); + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode); + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); + + TMMFCapabilities Capabilities(); + TMMFCapabilities Config() const; + void SetConfigL(const TMMFCapabilities& aCaps); + TInt MaxVolume(); + TInt Volume(); + void SetVolume(TInt aVolume); + TInt MaxGain(); + TInt Gain(); + void SetGain(TInt aGain); + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + void PlayInitL(); + void RecordInitL(); + void PlayData(); + void RecordData(); + void Stop(); + void Pause(); + TInt SamplesRecorded(); + TInt SamplesPlayed(); + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + void PlayDTMFStringL(const TDesC& aDTMFString); + void PlayToneSequenceL(const TDesC8& aData); + void PlayFixedSequenceL(TInt aSequenceNumber); + void SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength); + + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + + TAny* CustomInterface(TUid aInterfaceId); + TInt FixedSequenceCount(); + const TDesC& FixedSequenceName(TInt aSequenceNumber); + void GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; + void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; + + void InitializeComplete(TInt aError); + void ToneFinished(TInt aError); + void BufferToBeFilled(CMMFBuffer* aBuffer); + void PlayError(TInt aError); + void BufferToBeEmptied(CMMFBuffer* aBuffer); + void RecordError(TInt aError); + void ConvertError(TInt aError); + void DeviceMessage(TUid aMessageType, const TDesC8& aMsg); + void SendEventToClient(const TMMFEvent& aEvent); + + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); + TInt CancelRegisterAsClient(TUid aEventType); + TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData); + TInt WillResumePlay(); + + +protected: + CMMFDevSoundSession(); + void ConstructL(RServer2& aPolicyServerHandle); + CMMFDevSoundSvrImp* iBody; + +private: + TInt iDevSoundSessionId; + CMMFDataBuffer* iBufferPlay; + CMMFDataBuffer* iBufferRecord; + RArray iArray; + HBufC* iDTMFString; + HBufC8* iToneSeqBuf; + TBool iClientHasCaps; + + RMsgQueue iMsgQueue; // replaces the messages / AO handlers + TMMFDevSoundProxyHwBufPckg iHwBufPckgFill; // data store for 2-stage asynch message passing + TMMFDevSoundProxyHwBufPckg iHwBufPckgEmpty; // data store for 2-stage asynch message passing + + // array of custom interface pairs + RArray iCustomInterfaceArray; + CMMFDevSoundCIDeMuxUtility* iDeMuxUtility; + }; + + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,2160 @@ +// Copyright (c) 2001-2009 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 +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +#include +#endif // SYMBIAN_MULTIMEDIA_CODEC_API +#include "MmfDevSoundSessionBody.h" +#include "MmfDevSoundSessionXtnd.h" +#include "MmfDevSoundServer.h" +#include +#include +#include +#include +#include // KUidRefDevSoundTaskConfig & KMmfUidEmptyBuffersCustomInterface +#include + +const TUid KEmptyBuffersCustomInterfaceTypeUid = {KMmfUidEmptyBuffersCustomInterface}; + +/* + * + * Default Constructor. + * + * No default implementation. CMMFDevSoundProxy implements 2-phase construction. + * + */ +CMMFDevSoundSvrImp::CMMFDevSoundSvrImp(CMMFDevSoundSessionXtnd* aParent) +: iParent(*aParent) + { + iMode= EMMFDevSoundStateIdle; + //Set reasonable default values for DTMF + iDTMFGen.SetToneDurations(250000,50000,250000); + } + +/* + * + * Destructor. + * + * Deletes all objects and releases all resource owned by this + * instance. + * + */ +CMMFDevSoundSvrImp::~CMMFDevSoundSvrImp() + { + delete iToneBuffer1; + delete iToneBuffer2; + delete iDevSoundEventHandler; + if( iAudioPolicyProxy != NULL) + { + iAudioPolicyProxy->Close(); + delete iAudioPolicyProxy; + } + delete iDevSoundUtil; + delete iFixedSequences; + delete iCMMFHwDevice; +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + OMX_Deinit(); +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + } + +/* + * + * Constructs, and returns a pointer to, a new CMMFDevSoundSvrImp object. + * + * Leaves on failure. + * + */ +CMMFDevSoundSvrImp* CMMFDevSoundSvrImp::NewL(CMMFDevSoundSessionXtnd* aParent) + { + CMMFDevSoundSvrImp* self = new (ELeave) CMMFDevSoundSvrImp(aParent); + return self; + } + +/* + * + * 3rd phase constructor - assumes that iParent has already been set up properly + * (During ConstructL() it has yet to be + * + */ +void CMMFDevSoundSvrImp::Construct3L(RServer2& aPolicyServerHandle) + { + // all these data properties should be NULL, but add ASSERTs to verity + ASSERT(iAudioPolicyProxy==NULL); + iAudioPolicyProxy = new (ELeave) RMMFAudioPolicyProxy(); + ASSERT(iDevSoundEventHandler==NULL); + iDevSoundEventHandler = CMMFDevSoundEventHandler::NewL(iAudioPolicyProxy); + User::LeaveIfError(iAudioPolicyProxy->Open(aPolicyServerHandle)); + iDevSoundEventHandler->SetDevSoundInfo(&iParent); + + iDevSoundUtil = CMMFDevSoundUtility::NewL(); + // Initialize Fixed sequence related + iDevSoundUtil->InitializeFixedSequenceL(&iFixedSequences); + +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + OMX_Init(); +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + PreInitializeL(); + } + +/** + * internal procedure to perform all initialization prior to setting the + * data type 4CC code + */ +void CMMFDevSoundSvrImp::PreInitializeL() + { + // Set default values for priority settings: Note: Client must + // over ride default settings by calling SetPrioirtySettings + iAudioPolicyPrioritySettings.iState = EMMFStateStopped; + iAudioPolicyPrioritySettings.iPref = EMdaPriorityPreferenceNone; + iAudioPolicyPrioritySettings.iPriority = 0; + + // Get device capabilities and current settings from Audio Policy: + User::LeaveIfError(iAudioPolicyProxy->GetPlayFormatsSupported(iPlayFormatsSupported)); + User::LeaveIfError(iAudioPolicyProxy->GetPlayFormat(iPlayFormat)); + User::LeaveIfError(iAudioPolicyProxy->GetRecordFormatsSupported(iRecordFormatsSupported)); + User::LeaveIfError(iAudioPolicyProxy->GetRecordFormat(iRecordFormat)); + + //default to play until we know we are recording + User::LeaveIfError(InitializeFormat(iPlayFormatsSupported, iPlayFormat)); + } + +/* + * + * Initializes CMMFDevSoundProxy object to play and record PCM16 raw audio data + * with sampling rate of 8 KHz. + * + * On completion of Initialization, calls InitializeComplete() on + * aDevSoundObserver. + * + * Leaves on failure. + * + * @param "MDevSoundObserver& aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "TMMFState aMode" + * Mode for which this object will be used. + * + */ +void CMMFDevSoundSvrImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode) + + { + // if no HwDevice id specified, load default null implementation + TUid rawUid = {KMmfUidHwDevicePCM16ToPCM16}; + InitializeL(aDevSoundObserver, rawUid, aMode); + __ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated)); + } + +/* + * + * Configure CMMFDevSoundProxy object for the settings in aConfig. + * + * Use this to set sampling rate, Encoding and Mono/Stereo. + * + * @param "TMMFCapabilities& aConfig" + * Attribute values to which CMMFDevSoundProxy object will be configured to. + * + * As part of defect 20796, the iRecordFormat has been set under the iPlayFormat, + * before it was not set at all. + * + */ +void CMMFDevSoundSvrImp::SetConfigL(const TMMFCapabilities& aConfig) + { + TUint attributeValue = aConfig.iRate; + // WINS supports from 8000 Hz to 96000 Hz + // The ToneGenerator currently supports sample rate of 8000Hz only. + if(iMode == EMMFDevSoundStateTonePlaying && (attributeValue != EMMFSampleRate8000Hz )) + { + User::Leave(KErrNotSupported); + } + + if (attributeValue & EMMFSampleRate96000Hz) + { + iPlayFormat().iRate = 96000; + iRecordFormat().iRate = 96000; + iDeviceConfig.iRate = EMMFSampleRate96000Hz; + } + else if (attributeValue & EMMFSampleRate88200Hz) + { + iPlayFormat().iRate = 88200; + iRecordFormat().iRate = 88200; + iDeviceConfig.iRate = EMMFSampleRate88200Hz; + } + else if (attributeValue & EMMFSampleRate64000Hz) + { + iPlayFormat().iRate = 64000; + iRecordFormat().iRate = 64000; + iDeviceConfig.iRate = EMMFSampleRate64000Hz; + } + else if (attributeValue & EMMFSampleRate48000Hz) + { + iPlayFormat().iRate = 48000; + iRecordFormat().iRate = 48000; + iDeviceConfig.iRate = EMMFSampleRate48000Hz; + } + else if (attributeValue & EMMFSampleRate44100Hz) + { + iPlayFormat().iRate = 44100; + iRecordFormat().iRate = 44100; + iDeviceConfig.iRate = EMMFSampleRate44100Hz; + } + else if (attributeValue & EMMFSampleRate32000Hz) + { + iPlayFormat().iRate = 32000; + iRecordFormat().iRate = 32000; + iDeviceConfig.iRate = EMMFSampleRate32000Hz; + } + else if (attributeValue & EMMFSampleRate24000Hz) + { + iPlayFormat().iRate = + iRecordFormat().iRate = 24000; + iDeviceConfig.iRate = EMMFSampleRate24000Hz; + } + else if (attributeValue & EMMFSampleRate22050Hz) + { + iPlayFormat().iRate = 22050; + iRecordFormat().iRate = 22050; + iDeviceConfig.iRate = EMMFSampleRate22050Hz; + } + else if (attributeValue & EMMFSampleRate16000Hz) + { + iPlayFormat().iRate = 16000; + iRecordFormat().iRate = 16000; + iDeviceConfig.iRate = EMMFSampleRate16000Hz; + } + else if (attributeValue & EMMFSampleRate12000Hz) + { + iPlayFormat().iRate = + iRecordFormat().iRate = 12000; + iDeviceConfig.iRate = EMMFSampleRate12000Hz; + } + else if (attributeValue & EMMFSampleRate11025Hz) + { + iPlayFormat().iRate = 11025; + iRecordFormat().iRate = 11025; + iDeviceConfig.iRate = EMMFSampleRate11025Hz; + } + else if (attributeValue & EMMFSampleRate8000Hz) + { + iPlayFormat().iRate = 8000; + iRecordFormat().iRate = 8000; + iDeviceConfig.iRate = EMMFSampleRate8000Hz; + } + else if (attributeValue) + { //if no attribute value assume its not set + User::Leave(KErrNotSupported); + } + + attributeValue = aConfig.iEncoding; + // Map from MMF Encoding enums to RMdaDevSound enum + if(attributeValue & EMMFSoundEncoding8BitPCM) + { + iPlayFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitPCM; + iRecordFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitPCM; + iDeviceConfig.iEncoding = EMMFSoundEncoding8BitPCM; + } + else if(attributeValue & EMMFSoundEncoding8BitALaw) + { + iPlayFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitALaw; + iRecordFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitALaw; + iDeviceConfig.iEncoding = EMMFSoundEncoding8BitALaw; + } + else if(attributeValue & EMMFSoundEncoding8BitMuLaw) + { + iPlayFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitMuLaw; + iRecordFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitMuLaw; + iDeviceConfig.iEncoding = EMMFSoundEncoding8BitMuLaw; + } + else if(attributeValue & EMMFSoundEncoding16BitPCM) + { + iPlayFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + iRecordFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + iDeviceConfig.iEncoding = EMMFSoundEncoding16BitPCM; + } + else if (attributeValue) + { //if no attribute value assume its not set + User::Leave(KErrNotSupported); + } + + // Mono/Stereo settings + attributeValue = aConfig.iChannels; + if(iMode == EMMFDevSoundStateTonePlaying && (attributeValue != EMMFMono )) + { + User::Leave(KErrNotSupported); + } + if(attributeValue & EMMFStereo) + { + iPlayFormat().iChannels = 2; + iRecordFormat().iChannels = 2; + iDeviceConfig.iChannels = EMMFStereo; + } + else if(attributeValue & EMMFMono) + { + iPlayFormat().iChannels = 1; + iRecordFormat().iChannels = 1; + iDeviceConfig.iChannels = EMMFMono; + } + else if (attributeValue) + { //if no attribute value assume its not set + User::Leave(KErrNotSupported); + } + } + +/* + * + * Changes the current playback volume to a specified value. + * + * The volume can be changed before or during playback and is effective + * immediately. + * + * @param "TInt aVolume" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the + * volume is not within this range, the volume is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +void CMMFDevSoundSvrImp::SetVolume(TInt aVolume) + { + + // Check and make sure that the volume is in valid range + if (aVolume < 0) + aVolume = 0; + + if (aVolume > MaxVolume()) + aVolume = MaxVolume(); + + iVolume = aVolume; + + SetDeviceVolume(iVolume); + } + +/* + * + * Changes the current recording gain to a specified value. + * + * The gain can be changed before or during recording and is effective + * immediately. + * + * @param "TInt aGain" + * The volume setting. This can be any value from zero to the value + * returned by a call to CMdaAudioPlayerUtility::MaxVolume(). If the + * volume is not within this range, the gain is automatically set to + * minimum or maximum value based on the value that is being passed. + * Setting a zero value mutes the sound. Setting the maximum value + * results in the loudest possible sound. + * + */ +void CMMFDevSoundSvrImp::SetGain(TInt aGain) + { + // make sure it falls with the correct range + TInt maxGain = iRecordFormatsSupported().iMaxVolume; + if (aGain > maxGain) + aGain = maxGain; + else if (aGain < 0) + aGain = 0; + iGain = aGain; + SetDeviceRecordLevel(iGain); + } + +/* + * + * Sets the speaker balance for playing. + * + * The speaker balance can be changed before or during playback and is + * effective immediately. + * + * @param "TInt& aLeftPercentage" + * On return contains left speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on left + * speaker. + * + * @param "TInt& aRightPercentage" + * On return contains right speaker volume perecentage. This can be any + * value from zero to 100. Setting a zero value mutes the sound on + * right speaker. + * + */ +void CMMFDevSoundSvrImp::SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + if (aLeftPercentage < 0) + aLeftPercentage = 0; + else if (aLeftPercentage > 100) + aLeftPercentage = 100; + if (aRightPercentage < 0) + aRightPercentage = 0; + else if (aRightPercentage > 100) + aRightPercentage = 100; + iLeftPlayBalance = aLeftPercentage; + iRightPlayBalance = aRightPercentage; + } + +/* + * + * Sets the microphone gain balance for recording. + * + * The microphone gain balance can be changed before or during recording and + * is effective immediately. + * + * @param "TInt aLeftPercentage" + * Left microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on left microphone. + * + * @param "TInt aRightPercentage" + * Right microphone gain precentage. This can be any value from zero to + * 100. Setting a zero value mutes the gain on right microphone. + * + */ +void CMMFDevSoundSvrImp::SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage) + { + if (aLeftPercentage < 0) + aLeftPercentage = 0; + else if (aLeftPercentage > 100) + aLeftPercentage = 100; + if (aRightPercentage < 0) + aRightPercentage = 0; + else if (aRightPercentage > 100) + aRightPercentage = 100; + iLeftRecordBalance = aLeftPercentage; + iRightRecordBalance = aRightPercentage; + } + +/* + * + * Initializes audio device and start play process. This method queries and + * acquires the audio policy before initializing audio device. If there was an + * error during policy initialization, PlayError() method will be called on + * the observer with error code KErrAccessDenied, otherwise BufferToBeFilled() + * method will be called with a buffer reference. After reading data into the + * buffer reference passed, the client should call PlayData() to play data. + * + * The amount of data that can be played is specified in + * CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this + * size will be ignored. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::PlayInitL() + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + if (iAudioPolicyPrioritySettings.iState == EMMFStatePlayData) + { + // If policy has not been obtaing then ignore the request. + // If it has then do a stop and start action on HW device + // without informing policy. + + if (iHasPolicy) + { + if (iCMMFHwDevice) + { + TInt err = iCMMFHwDevice->Stop(); + if (err == KErrNone) + { + err = iCMMFHwDevice->Start(EDevDecode, EDevOutFlow); + } + + if (err != KErrNone) + { + Error(err); + } + } + } + return; + } + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayData; + RequestPolicy(); + } + +/* + * + * Initializes audio device and start record process. + * This method: + * 1. Queries and acquires the audio policy before initializing audio device. + * If there was an error during policy initialization, RecordError() method will + * be called on the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied() + * method will be called with a buffer reference. This buffer contains recorded + * or encoded data. After processing data in the buffer reference passed, the + * client should call RecordData() to continue recording process. + * + * 2. Checks if the requesting client process has a UserEnvironment capability. + * If it does not, the audio device will not be initialized and an error + * code KErrAccessDenied will be sent to the client. + * + * The amount of data that is available is specified in + * CMMFBuffer::RequestSize(). + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::RecordInitL(const RMmfIpcMessage& aMessage) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + // Checkes if the client has the UserEnvironment capability + if (!aMessage.HasCapability(ECapabilityUserEnvironment)) + { + User::Leave(KErrPermissionDenied); + } + + if (iAudioPolicyPrioritySettings.iState == EMMFStateRecordData) + { + if (iHasPolicy) + { + if (iCMMFHwDevice) + { + TInt err = iCMMFHwDevice->Stop(); + if (err == KErrNone) + { + err = iCMMFHwDevice->Start(EDevDecode, EDevOutFlow); + } + + if (err != KErrNone) + { + Error(err); + } + + if (iHwDeviceBuffer) + { + iHwDeviceBuffer->SetLastBuffer(EFalse); + } + } + } + + return; + } + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStateRecordData; + RequestPolicy(); + } + +/* + * + * Plays data in the buffer at the current volume. The client should fill + * the buffer with audio data before calling this method. The Observer gets + * reference to buffer along with callback BufferToBeFilled(). When playing of + * the audio sample is complete, successfully or otherwise, the method + * PlayError() on observer is called. + * + */ +TBool CMMFDevSoundSvrImp::PlayData(const RMmfIpcMessage& aMessage) + { + ASSERT(iDevSoundObserver); + + if (iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + // Initialisation has been successful but an error (possibly underflow) has occurred + // which the controller has yet to respond to and that has changed the state to stopped. + // Allow the call to complete and processing to continue... + return ETrue; + } + + if((iAudioPolicyPrioritySettings.iState != EMMFStatePlayData) && (iAudioPolicyPrioritySettings.iState != EMMFStatePaused)) + { + PanicClient(aMessage, EMMFDevSoundPlayDataWithoutInitialize); + return EFalse; + } + if (iMode== EMMFDevSoundStateIdle) + { + return ETrue; + } + TInt error = KErrNone; + if(iCMMFHwDevice) + { + if (iPaused) + { + iPaused = EFalse; + //note PlayData does not leave or return an error code so the Start() fails we cannot + //report the error back at this point + error = iCMMFHwDevice->Start(EDevDecode, EDevOutFlow);//restart hw device after pause + } + else if ((iMode == EMMFDevSoundStatePlaying) && iHasPolicy) + { + TInt len = iHwDeviceBuffer->Data().Length(); + if (iHwDeviceBuffer->LastBuffer()) + { + iLastBufferReceived = ETrue; + } + // Pass the data buffer to HwDevice + error = iCMMFHwDevice->ThisHwBufferFilled(*iHwDeviceBuffer); + } + } + if (error != KErrNone) + { + Error(error); + if(iCMMFHwDevice) + { + iCMMFHwDevice->Stop(); + } + + } + return ETrue; + } + +/* + * + * Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +void CMMFDevSoundSvrImp::Stop() + { + iPaused = EFalse; + + if (!iHasPolicy) + { + UpdatePolicyState(EMMFStateStopped); + return; + } + + // Stop the hw device first - this unloads sound drivers + if (iCMMFHwDevice) + { + iCMMFHwDevice->Stop(); + } + + iDevSoundEventHandler->CancelReceiveEvents(); + + UpdatePolicyState(EMMFStateStopped); + __ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated)); + } + +/* + * + * Temporarily Stops the ongoing operation (Play, Record, TonePlay, Convert) + * + */ +void CMMFDevSoundSvrImp::Pause() + { + iPaused = ETrue; + + if (!iHasPolicy) + { + return; + } + + // Pause the HW device first + if (iCMMFHwDevice) + { + iCMMFHwDevice->Pause(); + } + } + +/* + * + * Returns the sample recorded so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +TInt CMMFDevSoundSvrImp::SamplesRecorded() + { + TInt samples = 0; + + if(iRecordCustomInterface) + { + samples = iRecordCustomInterface->BytesRecorded(); + if(NumberOfChannels() > 1) + { + samples /= NumberOfChannels(); + } + if(BytesPerAudioSample() > 1) + { + samples /= BytesPerAudioSample(); + } + } + + return samples; + } + +/* + * + * Returns the sample played so far. + * + * @return "TInt" + * Returns the samples recorded. + * + */ +TInt CMMFDevSoundSvrImp::SamplesPlayed() + { + TInt samples = 0; + if(iPlayCustomInterface) + { + TUint bytesPlayed = iPlayCustomInterface->BytesPlayed(); + if (bytesPlayed) + iPlayedBytesCount = bytesPlayed; + + samples = iPlayedBytesCount; + if(NumberOfChannels() > 1) + samples /= NumberOfChannels(); + + if(BytesPerAudioSample() > 1) + samples /= BytesPerAudioSample(); + } + //note always pcm16 becuase the iPlayedBytesCount originates from + //RMdaDevSound which is always pcm16 + return samples; //each sample is 2 bytes + } + + +/* + * + * Initializes audio device and start playing tone. Tone is played with + * frequency and for duration specified. + * + * Leaves on failure. + * + * @param "TInt aFrequency" + * Frequency at with the tone will be played. + * + * @param "TTimeIntervalMicroSeconds& aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + * + */ +void CMMFDevSoundSvrImp::PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) + { + if (iMode != EMMFDevSoundStateTonePlaying) + { + User::Leave(KErrNotSupported); //tone playing only supported in tone play state + } + + // Check whether frequency and duration is valid or not + TInt64 zeroInt64(0); + if ((aFrequency<0) || (aDuration.Int64() < zeroInt64)) + { + User::Leave(KErrArgument); + } + + if (!iDevSoundObserver) + { + User::Leave(KErrNotReady); + } + + iToneGen.SetFrequencyAndDuration(aFrequency,aDuration); + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayTone; + RequestPolicy(); + } + +/* + * Initializes audio device and start playing a dual tone. + * The tone consists of two sine waves of different frequencies summed together + * Dual Tone is played with specified frequencies and for specified duration. + * + * @param "aFrequencyOne" + * First frequency of dual tone + * + * @param "aFrequencyTwo" + * Second frequency of dual tone + * + * @param "aDuration" + * The period over which the tone will be played. A zero value causes + * the no tone to be played (Verify this with test app). + */ +void CMMFDevSoundSvrImp::PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + if (!iDevSoundObserver) + { + User::Leave(KErrNotReady); + } + + // Check whether frequencies and duration are valid or not + TInt64 zeroInt64(0); + if ((aFrequencyOne<0) || (aFrequencyTwo<0) || (aDuration.Int64() < zeroInt64)) + { + iDevSoundObserver->ToneFinished(KErrArgument); + return; + } + + + iDualToneGen.SetFrequencyAndDuration(aFrequencyOne, aFrequencyTwo, aDuration); + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayDualTone; + RequestPolicy(); + } + +/* + * + * Initializes audio device and start playing DTMF string aDTMFString. + * + * Leaves on failure. + * + * @param "TDesC& aDTMFString" + * DTMF sequence in a descriptor. + * + */ +void CMMFDevSoundSvrImp::PlayDTMFStringL(const TDesC& aDTMFString) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + if (iMode!= EMMFDevSoundStateTonePlaying) + User::Leave(KErrNotSupported); //tone playing only supported in tone play state + + iDTMFGen.SetString(aDTMFString); + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayDTMFString; + RequestPolicy(); + } + +/* + * + * Initializes audio device and start playing tone sequence. + * + * Leaves on failure. + * + * @param "TDesC8& aData" + * Tone sequence in a descriptor. + * + */ +void CMMFDevSoundSvrImp::PlayToneSequenceL(const TDesC8& aData) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + if (iMode!= EMMFDevSoundStateTonePlaying) + User::Leave(KErrNotSupported); //tone playing only supported in tone play state + + // Check whether the sequence is valid or not + if (!iDevSoundUtil->RecognizeSequence(aData)) + User::Leave(KErrCorrupt); + + iSequenceGen.SetSequenceData(aData); + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayToneSequence; + RequestPolicy(); + } + +/* + * + * Initializes audio device and start playing the specified pre-defined tone + * sequence. + * + * Leaves on failure. + * + * @param "TInt aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + * @see FixesSequenceCount() + * + */ +void CMMFDevSoundSvrImp::PlayFixedSequenceL(TInt aSequenceNumber) + { + if (!iDevSoundObserver) + User::Leave(KErrNotReady); + + if (iMode!= EMMFDevSoundStateTonePlaying) + User::Leave(KErrNotSupported); //tone playing only supported in tone play state + + ASSERT((aSequenceNumber >= 0)&&(aSequenceNumber < iFixedSequences->Count())); + + iFixedSequence.Set(iFixedSequences->MdcaPoint(aSequenceNumber)); + iSequenceGen.SetSequenceData(iFixedSequence); + + // Get audio policy + iAudioPolicyPrioritySettings.iState = EMMFStatePlayToneSequence; + RequestPolicy(); + } + +/* + * + * Defines the duration of tone on, tone off and tone pause to be used during the + * DTMF tone playback operation. + * + * Supported only during tone playing. + * + * @param "TTimeIntervalMicroSeconds32& aToneOnLength" + * The period over which the tone will be played. If this is set to + * zero, then the tone is not played. + * + * @param "TTimeIntervalMicroSeconds32& aToneOffLength" + * The period over which the no tone will be played. + * + * @param "TTimeIntervalMicroSeconds32& aPauseLength" + * The period over which the tone playing will be paused. + * + */ +void CMMFDevSoundSvrImp::SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength) + { + + if(aToneOnLength.Int() < KMdaInfiniteDurationDTMFToneOnLength) + aToneOnLength = TTimeIntervalMicroSeconds32(0); + if(aToneOffLength.Int() < 0) + aToneOffLength = TTimeIntervalMicroSeconds32(0); + if(aPauseLength.Int() < 0) + aPauseLength = TTimeIntervalMicroSeconds32(0); + + iDTMFGen.SetToneDurations(aToneOnLength,aToneOffLength,aPauseLength); + } + +/* + * + * Defines the period over which the volume level is to rise smoothly from + * nothing to the normal volume level. + * + * @param "TTimeIntervalMicroSeconds& aRampDuration" + * The period over which the volume is to rise. A zero value causes + * the tone sample to be played at the normal level for the full + * duration of the playback. A value, which is longer than the duration + * of the tone sample, that the sample never reaches its normal + * volume level. + * + * + */ +void CMMFDevSoundSvrImp::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + // save ramp duration for tone generator + iRampDuration = aRampDuration; + + SetDeviceVolumeRamp(iRampDuration); + } + +/** + * Sets volume ramp on HwDevice. + */ +TInt CMMFDevSoundSvrImp::SetDeviceVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + TInt error = KErrNone; + if (iPlayCustomInterface) + iPlayCustomInterface->SetVolumeRamp(aRampDuration); + else + error = KErrNotReady; + return error; + } + +/** + * @see sounddevice.h + */ +void CMMFDevSoundSvrImp::GetSupportedInputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& /*aPrioritySettings*/) const + { + //aPrioritySettings not used on ref DevSound + //search for playing datatypes + iDevSoundUtil->SeekHwDevicePluginsL(aSupportedDataTypes, EMMFStatePlaying); +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + // append list of codec plugins + iDevSoundUtil->SeekCodecPluginsL(aSupportedDataTypes, EMMFStatePlaying, ETrue); +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + } + +/** + * @see sounddevice.h + */ +void CMMFDevSoundSvrImp::GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& /*aPrioritySettings*/) const + { + //aPrioritySettings not used on ref DevSound + // search for recording datatypes + iDevSoundUtil->SeekHwDevicePluginsL(aSupportedDataTypes, EMMFStateRecording); +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + // append list of codec plugins + iDevSoundUtil->SeekCodecPluginsL(aSupportedDataTypes, EMMFStateRecording, ETrue); +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + } + +TInt CMMFDevSoundSvrImp::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + return iAudioPolicyProxy->RequestResourceNotification(aEventType,aNotificationRegistrationData); + } + +TInt CMMFDevSoundSvrImp::CancelRegisterAsClient(TUid aEventType) + { + return iAudioPolicyProxy->CancelRequestResourceNotification(aEventType); + } + +TInt CMMFDevSoundSvrImp::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData) + { + TInt err = KErrNone; + err = iAudioPolicyProxy->IsRegisteredResourceNotification(aEventType); + if(err == KErrNone) + { + TMMFTimeIntervalMicroSecondsPckg pckg = TTimeIntervalMicroSeconds(SamplesPlayed()); + aNotificationData.Copy(pckg); + } + return err; + } + +TInt CMMFDevSoundSvrImp::WillResumePlay() + { + return iAudioPolicyProxy->StopNotification(); + } + +TInt CMMFDevSoundSvrImp::EmptyBuffers() + { + TInt err = KErrNone; + if (iMode != EMMFStatePlaying) + { + return KErrNotSupported; + } + if (!iCMMFHwDevice) + { + return KErrNotReady; + } + MEmptyBuffersCustomInterface* emptybuffers = reinterpret_cast(iCMMFHwDevice->CustomInterface(KEmptyBuffersCustomInterfaceTypeUid)); + if (emptybuffers) + { + err = emptybuffers->EmptyBuffers(); + } + else + { + err = KErrNotSupported; + } + return err; + } + +TInt CMMFDevSoundSvrImp::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) + { + TInt err = KErrNone; + TTimeIntervalMicroSeconds time(0); + if(iCMMFHwDevice) + { + if(!iTimePlayedCustomInterface) + { + iTimePlayedCustomInterface = reinterpret_cast(iCMMFHwDevice->CustomInterface(KTimePlayedCustomInterfaceTypeUid)); + if(iTimePlayedCustomInterface == NULL) + { + return KErrNotSupported; + } + } + err = iTimePlayedCustomInterface->GetTimePlayed(time); + if(err == KErrNone && time.Int64() > 0) + { + iTimePlayed = time.Int64(); + } + } + aTime = iTimePlayed.Int64(); + return err; + } + +/******************************************************************************** + * Implementations of Non Exported public functions begins here * + ********************************************************************************/ + +// +// Audio Policy specific implementation begins here // +// + +/* + * + * Called by Audio Policy Server when a request to play is approved by the + * Audio Policy Server. + * + * Leaves on failure??. + * + */ +void CMMFDevSoundSvrImp::StartPlayDataL() + { + ASSERT(iMode== EMMFDevSoundStatePlaying); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + TInt error = KErrNone; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStatePlayData); + // Set volume and play format values + error = SetPlayFormat(iPlayFormat); + if (error == KErrNone) + error = SetDeviceVolume(iVolume); + if (error == KErrNone) + error = SetDeviceVolumeRamp(iRampDuration); + + // Initialize attribute values + iPlayedBytesCount = 0; + iTimePlayed = 0; + iLastBufferReceived = EFalse; + + // Start HwDevice + if (error == KErrNone) + error = iCMMFHwDevice->Start(EDevDecode, EDevOutFlow); + } + else + error = KErrNotReady; + + if (error != KErrNone) + { + Error(error); + + } + } + +/* + * + * Called by Audio Policy Server when a request to record is approved by the + * Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::StartRecordDataL() + { + ASSERT(iMode== EMMFDevSoundStateRecording); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStateRecordData); + TInt error = KErrNone; + error = SetRecordFormat(iRecordFormat); + if (error != KErrNone) + { + Error(error); + return; + + } + error = SetDeviceRecordLevel(iGain); + if (error != KErrNone) + { + Error(error); + return; + + } + error = iCMMFHwDevice->Start(EDevEncode, EDevInFlow); + if (iHwDeviceBuffer) + iHwDeviceBuffer->SetLastBuffer(EFalse); + + if (error != KErrNone) + { + Error(error); + return; + } + } + else + iDevSoundObserver->RecordError(KErrNotReady); + } + +/* + * + * Called by Audio Policy Server when a request to play tone is approved by + * the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::StartPlayToneL() + { + ASSERT(iMode == EMMFDevSoundStateTonePlaying); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStatePlayTone); + TInt error = KErrNone; + // Set volume and play format values + error = SetPlayFormat(iPlayFormat); + if (error != KErrNone) + { + Error(error); + return; + + } + if (iHwDeviceID.iUid == KMmfUidHwDevicePCM16ToPCM16) + error = SetDeviceVolume(iVolume); + else + error = KErrGeneral;//hw device should always be pcm16 for tone + + // turn off volume ramping - this is done in software below + if (error == KErrNone) + error = SetDeviceVolumeRamp(TTimeIntervalMicroSeconds(0)); + + if (error != KErrNone) + { + Error(error); + return; + + } + + // Initialize attribute values + iPlayedBytesCount = 0; + iTimePlayed = 0; + // Configure tone generator + iToneGen.Configure( + iPlayFormat().iRate, + iPlayFormat().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*iPlayFormat().iRate)/1000000), + I64LOW((iRampDuration.Int64()*iPlayFormat().iRate)/1000000) + ); + + iCurrentGenerator = &iToneGen; + + // Start playback + DoPlayL(); + } + else + iDevSoundObserver->ToneFinished(KErrNotReady); + } + +/* + * + * Called by Audio Policy Server when a request to play a dual tone is approved by + * the Audio Policy Server. + * + */ +void CMMFDevSoundSvrImp::StartPlayDualToneL() + { + ASSERT(iMode == EMMFDevSoundStateTonePlaying); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStatePlayDualTone); + TInt error = KErrNone; + // Set volume and play format values + error = SetPlayFormat(iPlayFormat); + if (error != KErrNone) + { + Error(error); + return; + } + if (iHwDeviceID.iUid == KMmfUidHwDevicePCM16ToPCM16) + error = SetDeviceVolume(iVolume); + else + error = KErrGeneral;//hw device should always be pcm16 for tone + + // turn off volume ramping - this is done in software below + if (error == KErrNone) + error = SetDeviceVolumeRamp(TTimeIntervalMicroSeconds(0)); + + if (error != KErrNone) + { + Error(error); + return; + + } + + // Initialize attribute values + iPlayedBytesCount = 0; + iTimePlayed = 0; + // Configure dual tone generator + iDualToneGen.Configure( + iPlayFormat().iRate, + iPlayFormat().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*iPlayFormat().iRate)/KOneMillionMicroSeconds), + I64LOW((iRampDuration.Int64()*iPlayFormat().iRate)/KOneMillionMicroSeconds) + ); + + iCurrentGenerator = &iDualToneGen; + + // Start playback + DoPlayL(); + } + else + iDevSoundObserver->ToneFinished(KErrNotReady); + } + +/* + * + * Called by Audio Policy Server when a request to play DTMF String is approved + * by the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::StartPlayDTMFStringL() + { + ASSERT(iMode == EMMFDevSoundStateTonePlaying); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStatePlayDTMFString); + TInt error = KErrNone; + // Set volume and play format values + error = SetPlayFormat(iPlayFormat); + if (error != KErrNone) + { + Error(error); + return; + + } + error = SetDeviceVolume(iVolume); + + // turn off volume ramping - this is done in software below + if (error == KErrNone) + error = SetDeviceVolumeRamp(TTimeIntervalMicroSeconds(0)); + + if (error != KErrNone) + { + Error(error); + return; + } + + // Initialize attribute values + iPlayedBytesCount = 0; + iTimePlayed = 0; + iDTMFGen.Configure( + iPlayFormat().iRate, + iPlayFormat().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*iPlayFormat().iRate)/1000000), + I64LOW((iRampDuration.Int64()*iPlayFormat().iRate)/1000000) + ); + + iCurrentGenerator = &iDTMFGen; + + // Start playback + //need to trap this as we can leave with KErrUnderflow + //if there was no data to play - the error has already + //been sent to the observer and we don't want to call RunError + TRAP(error,DoPlayL()); + if ((error != KErrUnderflow)&&(error != KErrNone)) + { + User::Leave(error); + } + } + else + iDevSoundObserver->ToneFinished(KErrNotReady); + } + +/* + * + * Called by Audio Policy Server when a request to play tone sequence is + * approved by the Audio Policy Server. + * + * Leaves on failure. + * + */ +void CMMFDevSoundSvrImp::StartPlayToneSequenceL() + { + ASSERT(iMode == EMMFDevSoundStateTonePlaying); + if(iAudioPolicyPrioritySettings.iState == EMMFStateStopped) + { + return; + } + iHasPolicy = ETrue; + + if(iCMMFHwDevice) + { + UpdatePolicyState(EMMFStatePlayToneSequence); + TInt error = KErrNone; + // Set volume and play format values + if (iHwDeviceID.iUid == KMmfUidHwDevicePCM16ToPCM16) + error = SetPlayFormat(iPlayFormat); + else error = KErrGeneral;//hw device should always be pcm16 for tone + if (error != KErrNone) + { + Error(error); + return; + } + + if (iHwDeviceID.iUid == KMmfUidHwDevicePCM16ToPCM16) + error = SetDeviceVolume(iVolume); + else + error = KErrGeneral;//hw device should always be pcm16 for tone + + // turn off volume ramping - this is done in software below + if (error == KErrNone) + error = SetDeviceVolumeRamp(TTimeIntervalMicroSeconds(0)); + + if (error != KErrNone) + { + Error(error); + return; + } + + // Initialize attribute values + iPlayedBytesCount = 0; + iTimePlayed = 0; + iSequenceGen.Configure( + iPlayFormat().iRate, + iPlayFormat().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*iPlayFormat().iRate)/1000000), + I64LOW((iRampDuration.Int64()*iPlayFormat().iRate)/1000000) + ); + + iCurrentGenerator = &iSequenceGen; + + // Start playback + DoPlayL(); + } + else + iDevSoundObserver->ToneFinished(KErrNotReady); + } + +/* + * + * Called by Audio Policy Server when the current DevSound instance looses the + * policy because of another instance with a higher priority wants the device. + * + */ +void CMMFDevSoundSvrImp::SendEventToClient(const TMMFEvent& aEvent) + { + if (aEvent.iErrorCode != KErrNone) + { + iHasPolicy = EFalse; + if (iMode == EMMFDevSoundStatePlaying) + { + UpdateBytesPlayed(); + iDevSoundObserver->PlayError(aEvent.iErrorCode); + UpdatePolicyState(EMMFStateStopped); + } + else if (iMode == EMMFDevSoundStateRecording) + { + iDevSoundObserver->RecordError(aEvent.iErrorCode); + UpdatePolicyState(EMMFStateStopped); + } + else if (iMode == EMMFDevSoundStateTonePlaying) + { + iDevSoundObserver->ToneFinished(aEvent.iErrorCode); + } + iCMMFHwDevice->Stop();//unloads sound device + // Have audio Policy launch higher priority request + iAudioPolicyProxy->LaunchRequests(); + } + else + { + iHasPolicy = ETrue; + iDevSoundObserver->SendEventToClient(aEvent); + } + } + + +/** + * + * Sets volume on HwDevice. + * + * @return "TInt" + * Error value returned by HwDevice. + * + */ +TInt CMMFDevSoundSvrImp::SetDeviceVolume(TInt aVolume) + { + TInt error = KErrNone; + if (iPlayCustomInterface) + iPlayCustomInterface->SetVolume(aVolume); + else error = KErrNotReady; + return error; + } + +/** + * + * Sets PlayFormat on HwDevice. + * + * + * @return "TInt" + * Error value returned by HwDevice. + * + */ +TInt CMMFDevSoundSvrImp::SetPlayFormat(RMdaDevSound::TCurrentSoundFormatBuf& aPlayFormat) + { + TInt error = KErrNone; + if (iCMMFHwDevice) + { + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = aPlayFormat().iRate; + + if (aPlayFormat().iChannels == 1) + { + taskConfig.iStereoMode = ETaskMono; + } + else if (aPlayFormat().iChannels == 2) + { + taskConfig.iStereoMode = ETaskInterleaved; + } + else + { + return KErrArgument; + } + + error = iCMMFHwDevice->SetConfig(taskConfig); + //note the iEncoding and iBufferSize are already determined by the + //CMMFHwDevice plugin and so are not set. + } + else + { + error = KErrNotReady; + } + return error; + } + + +/** + * + * Sets RecordFormat on HwDevice. + * + * + * @return "TInt" + * Error value returned by HwDevice. + * + */ +TInt CMMFDevSoundSvrImp::SetRecordFormat(RMdaDevSound::TCurrentSoundFormatBuf& aRecordFormat) + { + TInt error = KErrNone; + if (iCMMFHwDevice) + { + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = aRecordFormat().iRate; + + if (aRecordFormat().iChannels == 1) + { + taskConfig.iStereoMode = ETaskMono; + } + else if (aRecordFormat().iChannels == 2) + { + taskConfig.iStereoMode = ETaskInterleaved; + } + else + { + return KErrArgument; + } + + error = iCMMFHwDevice->SetConfig(taskConfig); + //note the iEncoding and iBufferSize are already determined by the + //CMMFHwDevice plugin and so are not set. + } + else + { + error = KErrNotReady; + } + return error; + } + + +/** + * + * Sets record level on HwDevice. + * + * + * @return "TInt" + * Error value returned by HwDevice. + * + */ +TInt CMMFDevSoundSvrImp::SetDeviceRecordLevel(TInt aGain) + { + TInt error = KErrNone; + if (iRecordCustomInterface) + iRecordCustomInterface->SetGain(aGain); + else error = KErrNotReady; + return error; + + } + + +/** + * + * MMMFHwDeviceObserver mixin implementation. + * + * The CMMFHwDevice implementation object calls this method during decoding + * (playing), when it needs the encoded data in the buffer + * aHwDataBuffer. + * + * @return "TInt" + * Error code. KErrNone if success. + * + */ +TInt CMMFDevSoundSvrImp::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + TInt err = KErrNone; + // Keep a reference to this Hw data Buffer. We need to send the + // reference back to HwDevice implementation + iHwDeviceBuffer = static_cast (&aHwDataBuffer); + // Set the request length, From HwDevice this comes with buffer + // length. + TInt len = iHwDeviceBuffer->Data().MaxLength(); + // Ignore error. since buffer size = Buffer Length + TRAP(err, iHwDeviceBuffer->SetRequestSizeL(len)); + + if (iMode== EMMFDevSoundStatePlaying) // Get Data from Observer + { + if (iLastBufferReceived) + { + iHwDeviceBuffer->Data().SetLength(0); + // Pass the buffer to the he device + err = iCMMFHwDevice->ThisHwBufferFilled(*iHwDeviceBuffer); + } + else + // Pass the buffer to the observer + iDevSoundObserver->BufferToBeFilled(&aHwDataBuffer); + } + else if (iMode == EMMFDevSoundStateTonePlaying) + { + // Hw device will call this method right after its Start was called. + // When it calls this for the first time it hasn't played one single + // buffer yet so check that. + // In this case there's no need to set the active buffer as it's already + // waiting to be played. + if (!iFirstCallFromHwDevice) + SetActiveToneBuffer(); + + // If there is no data in the active buffer, tone play is finished. + // DevSound just have to wait for completion event from audio device. + if (iActiveToneBuffer->Data().Length() > 0) + { + TInt tonelen = iActiveToneBuffer->Data().Length(); + + // don't enter more data than can be handled by the receiving buffer + if (len >= tonelen) len = tonelen; + + // Copy data from tone buffer to hw device buffer + Mem::Copy((TAny*)(iHwDeviceBuffer->Data().Ptr()), (TAny*)(iActiveToneBuffer->Data().Ptr()), len); + + iHwDeviceBuffer->Data().SetLength(len); + // Play data and try to generate next data block + err = iCMMFHwDevice->ThisHwBufferFilled(*iHwDeviceBuffer); + if (err != KErrNone) + return err; + // Check again whether this is the first call from Hw device. + // FillFreeToneBuffer assumes the iActiveToneBuffer has already + // been played. + if (!iFirstCallFromHwDevice) + err = FillFreeToneBuffer(); + else + iFirstCallFromHwDevice = EFalse; // Reset flag + + } + else if (iFirstCallFromHwDevice) + {//we have no data in the tone buffer and thus have no + //outstanding requests to play + err = KErrUnderflow; //simulate underrun + } + else + { + iHwDeviceBuffer->Data().SetLength(0); + iHwDeviceBuffer->SetLastBuffer(ETrue); + // Send an empty last buffer to HwDevice to get a play completion event with KErrUnderflow + err = iCMMFHwDevice->ThisHwBufferFilled(*iHwDeviceBuffer); + } + + // If there was an error filling the buffer could be corrupt data + // notify the client and stop playing.Set err to KErrNone. + if (err != KErrNone) + { + Error(err);//Updates Bytes played informs client + err = KErrNone; + iCMMFHwDevice->Stop();//unloads sound device + } + } + else + { + err = KErrGeneral; + Error(err); + iCMMFHwDevice->Stop();//unloads sound device + + } + return err; + } + + +/** + * + * MMMFHwDeviceObserver mixin implementation. + * + * The CMMFHwDevice implementation object calls this method during encoding + * (recording), when it fills the buffer aHwDataBuffer with + * encoded data. + * + * @return "TInt" + * Error code. KErrNone if success. + * + */ +TInt CMMFDevSoundSvrImp::EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + TInt err = KErrNone; + if(iMode== EMMFDevSoundStateRecording) + { + // Keep a reference to this Hw data Buffer. We need to send the + // reference back to HwDevice implementation + iHwDeviceBuffer = static_cast(&aHwDataBuffer); + + // Set the request length, From HwDevice this comes with buffer + // length. MMF will use RequestSize attribute of the buffer. + // We can avoid this by setting in HwDevice implemenation + TInt len = iHwDeviceBuffer->Data().Length(); + TRAP(err, iHwDeviceBuffer->SetRequestSizeL(len)); + + // if we're pausing (i.e. flushing) set the last buffer flag + // when we get an empty buffer from the logical driver + if(iPaused && iHwDeviceBuffer->Data().Length() == 0) + { + iPaused = EFalse; + + iHwDeviceBuffer->SetLastBuffer(ETrue); + + iDevSoundEventHandler->CancelReceiveEvents(); + + } + + // Send Data from Observer + iDevSoundObserver->BufferToBeEmptied(iHwDeviceBuffer); + } + else + { + err = KErrGeneral; + Error(err); + iCMMFHwDevice->Stop();//unloads sound device + + } + + return err; + } + + +/** + * + * MMMFHwDeviceObserver mixin implementation. + * + * The CMMFHwDevice implementation object calls this method when a message from + * the hardware device implementation is received. + * + * @return "TInt" + * Error code. KErrNone if success. + * + */ +TInt CMMFDevSoundSvrImp::MsgFromHwDevice(TUid aMessageType, const TDesC8& /*aMsg*/) + { + TInt result = KErrNotSupported; + if (aMessageType.iUid == KMmfHwDeviceObserverUpdateBytesPlayed) + {//this is used by sw codec wrapper to request a bytes played update + //bytes played won't be updated in Stopped() or Error() on sw cdoec wrapper + //as the sound device is closed. Non swCodec wrapper Hw device plugins + //can get there bytes updated on Stopped() and/or Error() + UpdateBytesPlayed(); + result = KErrNone; + } + return result; + } + +/** + * + * MMMFHwDeviceObserver mixin implementation. + * + * The CMMFHwDevice implementation object calls this method when the current + * encode or decode task is finished or stopped. The policy state is updated + * + */ +void CMMFDevSoundSvrImp::Stopped() + { + //for swcodec wrap hw devices bytes played updated in MsgFromHwDevice + //but non Swcodec wrappers hw devices may do it differently + //also don't know if non Swcodec wrap hw device will call Stopped or Error first + UpdateBytesPlayed(); + + iLastBufferReceived = EFalse; + UpdatePolicyState(EMMFStateCompleted); + } + +/** + * MMMFHwDeviceObserver mixin implementation + * Processes error from hw device + */ +void CMMFDevSoundSvrImp::Error(TInt aError) + { + if (iMode== EMMFDevSoundStatePlaying) + { + //for swcodec wrap hw devices bytes played updated in MsgFromHwDevice + //but non Swcodec wrappers hw devices may do it differently + //also don't know if non Swcodec wrap hw device will call Stopped or Error first + UpdateBytesPlayed(); + + iDevSoundObserver->PlayError(aError); + UpdatePolicyState(EMMFStateStopped); + } + else if (iMode== EMMFDevSoundStateRecording) + { + iDevSoundObserver->RecordError(aError); + UpdatePolicyState(EMMFStateStopped); + } + else if (iMode== EMMFDevSoundStateTonePlaying) + { + iDevSoundObserver->ToneFinished(aError); + UpdatePolicyState(EMMFStateStopped); + } + //else can't handle error + } + + +/******************************************************************************** + * Non Exported public functions ends here * + ********************************************************************************/ + + +/******************************************************************************** + * Private functions begins here * + ********************************************************************************/ + +TInt CMMFDevSoundSvrImp::InitializeFormat(RMdaDevSound::TSoundFormatsSupportedBuf& aSupportedFormat, + RMdaDevSound::TCurrentSoundFormatBuf& aFormat) + { + // Choose an encoding + TUint32 enc = aSupportedFormat().iEncodings; + // Always defaults to this + if (enc & RMdaDevSound::EMdaSoundEncoding16BitPCM) + aFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + else if (enc & RMdaDevSound::EMdaSoundEncoding8BitALaw) + aFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitALaw; + else if (enc & RMdaDevSound::EMdaSoundEncoding8BitMuLaw) + aFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitMuLaw; + else if (enc & RMdaDevSound::EMdaSoundEncoding8BitPCM) + aFormat().iEncoding = RMdaDevSound::EMdaSoundEncoding8BitPCM; + + // default to Monophonic playback: + aFormat().iChannels=1; + + // Store the device capabilities (WINS supports from 8000 Hz to 44100 Hz) + if ((aSupportedFormat().iMinRate <= 8000) && (8000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate = EMMFSampleRate8000Hz; + if ((aSupportedFormat().iMinRate <= 11025) && (11025 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate11025Hz; + if ((aSupportedFormat().iMinRate <= 12000) && (12000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate12000Hz; + if ((aSupportedFormat().iMinRate <= 16000) && (16000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate16000Hz; + if ((aSupportedFormat().iMinRate <= 22050) && (22050 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate22050Hz; + if ((aSupportedFormat().iMinRate <= 24000) && (24000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate24000Hz; + if ((aSupportedFormat().iMinRate <= 32000) && (32000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate32000Hz; + if ((aSupportedFormat().iMinRate <= 44100) && (44100 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate44100Hz; + if ((aSupportedFormat().iMinRate <= 48000) && (48000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate48000Hz; + if ((aSupportedFormat().iMinRate <= 64000) && (64000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate64000Hz; + if ((aSupportedFormat().iMinRate <= 88200) && (88200 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate88200Hz; + if ((aSupportedFormat().iMinRate <= 96000) && (96000 <= aSupportedFormat().iMaxRate)) + iDeviceCapabilities.iRate |= EMMFSampleRate96000Hz; + + // Store the encodings supported + iDeviceCapabilities.iEncoding = 0; + if (enc & RMdaDevSound::EMdaSoundEncoding16BitPCM) + iDeviceCapabilities.iEncoding |= EMMFSoundEncoding16BitPCM; + if (enc & RMdaDevSound::EMdaSoundEncoding8BitALaw) + iDeviceCapabilities.iEncoding |= EMMFSoundEncoding8BitALaw; + if (enc & RMdaDevSound::EMdaSoundEncoding8BitMuLaw) + iDeviceCapabilities.iEncoding |= EMMFSoundEncoding8BitMuLaw; + if (enc & RMdaDevSound::EMdaSoundEncoding8BitPCM) + iDeviceCapabilities.iEncoding |= EMMFSoundEncoding8BitPCM; + + // Mono and Stereo support + if (aSupportedFormat().iChannels == 2) + iDeviceCapabilities.iChannels = EMMFStereo; + iDeviceCapabilities.iChannels |= EMMFMono; + + iDeviceCapabilities.iBufferSize = aSupportedFormat().iMaxBufferSize; + // Default + iDeviceConfig.iRate = EMMFSampleRate8000Hz; + iDeviceConfig.iEncoding = EMMFSoundEncoding16BitPCM; + iDeviceConfig.iChannels = EMMFMono; + + return KErrNone; + } + +/* + * + * Makes request to Policy Server (asynchronous call) + * + */ +void CMMFDevSoundSvrImp::RequestPolicy() + { + iDevSoundEventHandler->CancelReceiveEvents(); + iDevSoundEventHandler->ReceiveEvents(); + iAudioPolicyPrioritySettings.iCapabilities = iParent.CheckClientCapabilities(); + iAudioPolicyProxy->MakeRequest(iAudioPolicyPrioritySettings); + } + +/* + * + * Creates buffer and begin playback using the specified tone generator. + * + */ +void CMMFDevSoundSvrImp::DoPlayL() + { + // Delete any buffer from previous call and try to create maximum buffer + // size. Double Buffer the Tone data. + if (iToneBuffer1) + { + delete iToneBuffer1; + iToneBuffer1 = NULL; + } + //note the tone buffer needs to be the same as the pcm16->pcm16 'null' + //hw device plugin + // Buffer size = (SampleRate * BytesPerSample * Channels) / 4 + TInt useBufferOfSize = ((SamplingFrequency() * 2 * NumberOfChannels())/KDevSoundFramesPerSecond + (KDevSoundDeltaFrameSize-1)) &~ (KDevSoundDeltaFrameSize-1); + //clamp buffer to desired limits + if(useBufferOfSize < KDevSoundMinFrameSize) + useBufferOfSize = KDevSoundMinFrameSize; + else if(useBufferOfSize > KDevSoundMaxFrameSize) + useBufferOfSize = KDevSoundMaxFrameSize; + + //clamp buffer to limits of hardware + if(useBufferOfSize < Max(iPlayFormatsSupported().iMinBufferSize, iRecordFormatsSupported().iMinBufferSize)) + useBufferOfSize = Max(iPlayFormatsSupported().iMinBufferSize, iRecordFormatsSupported().iMinBufferSize); + else if(useBufferOfSize > Min(iPlayFormatsSupported().iMaxBufferSize, iRecordFormatsSupported().iMaxBufferSize)) + useBufferOfSize = Min(iPlayFormatsSupported().iMaxBufferSize, iRecordFormatsSupported().iMaxBufferSize); + + iToneBuffer1 = CMMFDataBuffer::NewL(useBufferOfSize); + User::LeaveIfError(iCurrentGenerator->FillBuffer(iToneBuffer1->Data())); + + if (iToneBuffer2) + { + delete iToneBuffer2; + iToneBuffer2 = NULL; + } + iToneBuffer2 = CMMFDataBuffer::NewL(useBufferOfSize); + User::LeaveIfError(iCurrentGenerator->FillBuffer(iToneBuffer2->Data())); + + // Assign active buffer + iActiveToneBuffer = iToneBuffer1; + + // Hw device hasn't played anything yet so don't change + // active buffer. This is checked in FillThisHwBuffer. + iFirstCallFromHwDevice = ETrue; + + // Start HwDevice to play data + User::LeaveIfError(iCMMFHwDevice->Start(EDevDecode, EDevOutFlow)); + + } + +/* + * + * This method assigns the other buffer as active buffer. The tone audio + * generator should fill data in the other buffer by now. + * + */ +void CMMFDevSoundSvrImp::SetActiveToneBuffer() + { + if (iActiveToneBuffer == iToneBuffer1) + iActiveToneBuffer = iToneBuffer2; + else if (iActiveToneBuffer == iToneBuffer2) + iActiveToneBuffer = iToneBuffer1; + } + +/* + * + * This method fills data into the free buffer. + * + * @return "TInt" + * Error code. KErrNone if success. + * + */ +TInt CMMFDevSoundSvrImp::FillFreeToneBuffer() + { + TInt err(KErrNone); + if (iActiveToneBuffer == iToneBuffer1) + err = iCurrentGenerator->FillBuffer(iToneBuffer2->Data()); + else if (iActiveToneBuffer == iToneBuffer2) + err = iCurrentGenerator->FillBuffer(iToneBuffer1->Data()); + return err; + } + +/* + * + * Updates the policy state based on Audio policy settings of this devsound instance + * + */ +TInt CMMFDevSoundSvrImp::UpdatePolicyState(TMMFAudioPolicyState aNewState) + { + iAudioPolicyPrioritySettings.iState = aNewState; + TInt error = iAudioPolicyProxy->UpdateState(iAudioPolicyPrioritySettings); + if ((error == KErrNone) && (aNewState == EMMFStateStopped)) + { + iHasPolicy = EFalse; + } + + return error; + } + +/* + * + * Initializes audio device node by setting volume, and sampling rate. + * + * @return "TInt" + * Error Code. KErrNone if success. + * + */ +TInt CMMFDevSoundSvrImp::InitTask() + { + // No Implementation + return KErrNone; + } + + + +/* + * + * Returns an integer representing Sampling Frequency the device is currently + * configured to. + * + * @return "TInt" + * Sampling Frequency. + * + */ +TInt CMMFDevSoundSvrImp::SamplingFrequency() + { + if(iDeviceConfig.iRate == EMMFSampleRate8000Hz) + return 8000; + else if(iDeviceConfig.iRate == EMMFSampleRate11025Hz) + return 11025; + else if(iDeviceConfig.iRate == EMMFSampleRate12000Hz) + return 12000; + else if(iDeviceConfig.iRate == EMMFSampleRate16000Hz) + return 16000; + else if(iDeviceConfig.iRate == EMMFSampleRate22050Hz) + return 22050; + else if(iDeviceConfig.iRate == EMMFSampleRate24000Hz) + return 24000; + else if(iDeviceConfig.iRate == EMMFSampleRate32000Hz) + return 32000; + else if(iDeviceConfig.iRate == EMMFSampleRate44100Hz) + return 44100; + else if(iDeviceConfig.iRate == EMMFSampleRate48000Hz) + return 48000; + else if(iDeviceConfig.iRate == EMMFSampleRate88200Hz) + return 88200; + else if(iDeviceConfig.iRate == EMMFSampleRate96000Hz) + return 96000; + else + return 8000; //default + } + +/* + * + * Returns an integer representing number of channels the device is currently + * configured to. + * + * @return "TInt" + * Number of audio channels 1 if mono, 2 if stereo. + * + */ +TInt CMMFDevSoundSvrImp::NumberOfChannels() + { + if(iDeviceConfig.iChannels == EMMFMono) + return 1; + else + return 2; + } + +/* + * + * Returns an integer representing number of bytes in each audio sample + * + * + * @return "TInt" + * Number of of bytes in each audio sample. + * + */ +TInt CMMFDevSoundSvrImp::BytesPerAudioSample() + { + TInt bytes=1; + switch (iDeviceConfig.iEncoding) + { + case EMMFSoundEncoding8BitPCM: + case EMMFSoundEncoding8BitALaw: + case EMMFSoundEncoding8BitMuLaw: + { + bytes=1; + } + break; + case EMMFSoundEncoding16BitPCM: + { + bytes=2; + } + break; + } + return bytes; + } + + +/******************************************************************************** + * Private functions ends here * + ********************************************************************************/ + + +// CustomCommand* implementation: +// The following come through from the parent object intact - currently it seems +// easier to pass this through with an RMessage, as the result parameter (at least) +// is easier to deal with that way. This might change in the future. +// [TODO - if we extended this to CMMFHwDevice, it might be easier to use some sort +// of TMMFCustomCommandParamBlock throughout, which as well as the uid, in params etc +// by value, also provided a virtual(?) function to set output param. Could then +// use in both plat sec and original code + +void CMMFDevSoundSvrImp::DoSyncCustomCommandL(const RMmfIpcMessage& aMessage) + { + TInt command = aMessage.Int0(); + + // we don't support any commands at the momment + User::Leave(KErrNotSupported); + } + +void CMMFDevSoundSvrImp::DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage) + { + TInt command = aMessage.Int0(); + + // we don't support any commands at the momment + User::Leave(KErrNotSupported); + } + +void CMMFDevSoundSvrImp::DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage) + { + TInt command = aMessage.Int0(); + + // we don't support any commands at the momment + User::Leave(KErrNotSupported); // this will still complete for an async message + } + +void CMMFDevSoundSvrImp::DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage) + { + TInt command = aMessage.Int0(); + + // we don't support any commands at the moment + User::Leave(KErrNotSupported); // this will still complete for an async message + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,361 @@ +// Copyright (c) 2004-2009 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: +// DevSoundSessionBody.h +// +// + +#ifndef MMFDEVSOUNDSESSIONBODY_H +#define MMFDEVSOUNDSESSIONBODY_H + +#include +#include +#include "MmfDevSoundSession.h" +#include "MmfDevSoundSessionXtnd.h" +#include "ToneGenerator.h" +#include "mmfAudioPolicyProxy.h" +#include "MmfDevSoundInfo.h" +#include "DevSoundUtility.h" + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +#include + +//controlls buffer sizes +const TInt KDevSoundDefaultFrameSize = 0x1000; +const TInt KDevSoundMinFrameSize = 0x800; //2K +const TInt KDevSoundMaxFrameSize = 0x4000; //16K +const TInt KDevSoundDeltaFrameSize = 0x800; //2K +const TInt KDevSoundFramesPerSecond = 4; + +//Forward references: +class CDevSoundPlayer; +class CDevSoundError; +class CDevSoundRecorder; +class CDevSoundRecordError; +class CMMFDevSoundProxyXtnd; + +class CMMFHwDevice; +class CMMFHwDeviceObserver; +class MPlayCustomInterface; +class MRecordCustomInterface; +class MEmptyBuffersCustomInterface; +class MTimePlayedCustomInterface; + +/* + * + * Reference internals for CMMFDevSound + * @internalComponent + * + */ +class CMMFDevSoundSvrImp; +NONSHARABLE_CLASS( CMMFDevSoundSvrImp ) : public CBase, public MMMFHwDeviceObserver, + public MMMFDevSoundCustomInterfaceTarget + { +public: + static CMMFDevSoundSvrImp* NewL(CMMFDevSoundSessionXtnd* aParent); + ~CMMFDevSoundSvrImp(); + + // Initializes to raw audio data PCM16 and Sampling Rate of 8 KHz. + void InitializeL(MDevSoundObserver& aDevSoundObserver, TMMFState aMode); + // Initializes with hardware device and mode (play, record, convert) + void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode); + // Initializes with hardware device associated with specific FourCC code + // and desired mode (play, record, convert) + void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode); + + // Returns device capabilities + TMMFCapabilities Capabilities(); + // Returns device configuration + TMMFCapabilities Config() const; + // Sets device configuration + void SetConfigL(const TMMFCapabilities& aCaps); + + // Returns maximum play volume device supports + TInt MaxVolume(); + // Returns play volume device is configured to + TInt Volume(); + // Sets device play volume + void SetVolume(TInt aVolume); + + // Returns maximum record gain device supports + TInt MaxGain(); + // Returns record gain device is configured to + TInt Gain(); + // Sets device record gain + void SetGain(TInt aGain); + + // Returns play balance + void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + // Sets play balance + void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + + // Returns record balance + void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage); + // Sets record balance + void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage); + + // Initializes audio device and start play process + void PlayInitL(); + // Initializes audio device and start record process + void RecordInitL(const RMmfIpcMessage& aMessage); + // Plays the data in the buffer + TBool PlayData(const RMmfIpcMessage& aMessage); + // Records data into buffer + TBool RecordData(const RMmfIpcMessage& aMessage); + // Stops the ongoing operation + void Stop(); + // Tempororily Stops the ongoing operation + void Pause(); + + // Returns the Sample recorded so far + TInt SamplesRecorded(); + // Returns the Sample played so far + TInt SamplesPlayed(); + + // Initializes device and start playing tone + void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + // Initializes device and start playing dual tone + void PlayDualToneL(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + // Initializes device and start playing DTMF String + void PlayDTMFStringL(const TDesC& aDTMFString); + // Initializes device and start playing tone sequence + void PlayToneSequenceL(const TDesC8& aData); + // Initializes device and start playing fixed sequence + void PlayFixedSequenceL(TInt aSequenceNumber); + + // Sets tone repeat attributes + void SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence); + // Sets DTMF tone attributes + void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, + TTimeIntervalMicroSeconds32& aToneOffLength, + TTimeIntervalMicroSeconds32& aPauseLength); + // Sets volume ramp for playing + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + // Sets priority settings + void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings); + + // Provides interface for sending custom commands for the audio device + virtual TAny* CustomInterface(TUid aInterfaceId); + + // Provides interface for querying fixed sequence count + TInt FixedSequenceCount(); + // Provides interface for querying fixed sequence name + const TDesC& FixedSequenceName(TInt aSequenceNumber); + // Gets the supported input datatypes + void GetSupportedInputDataTypesL(RArray& aSupportedDataTypesconst, const TMMFPrioritySettings& aPrioritySettings) const; + // Gets the supported output datatypes + void GetSupportedOutputDataTypesL(RArray& aSupportedDataTypes, const TMMFPrioritySettings& aPrioritySettings) const; + + // Interface for Audio Policy + // Sets id for this DevSound instance + void SetDevSoundId(TInt aDevSoundId); + // Returns info about this DevSound instance + TMMFDevSoundInfo DevSoundInfo(); + // Called by Audio Policy Server when play reqeust is granted + void StartPlayDataL(); + // Called by Audio Policy Server when record reqeust is granted + void StartRecordDataL(); + // Called by Audio Policy Server when play tone reqeust is granted + void StartPlayToneL(); + // Called by Audio Policy Server when play dual tone request is granted + void StartPlayDualToneL(); + // Called by Audio Policy Server when play DTMF reqeust is granted + void StartPlayDTMFStringL(); + // Called by Audio Policy Server when play tone sequence reqeust is granted + void StartPlayToneSequenceL(); + // Called by Audio Policy Server when DevSound instance looses device + void SendEventToClient(const TMMFEvent& aEvent); + // Updates the total bytes played from audio device + void UpdateBytesPlayed(); + + // CMMFHwDevice implementation: + TInt FillThisHwBuffer(CMMFBuffer& aHwBuffer); + TInt EmptyThisHwBuffer(CMMFBuffer& aHwBuffer); + TInt MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg); + void Stopped(); + void Error(TInt aError); + // CMMFHwDevice implementation ends + + //provides interface for register a notification event + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData = KNullDesC8); + //provides interface to cancel the registered notification + TInt CancelRegisterAsClient(TUid aEventType); + //Gets the notification data for client to resume + TInt GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData); + //waits for the client to resume playback even after the timeout expires + TInt WillResumePlay(); + //Empties the buffers below DevSound without causing the codec to be deleted + TInt EmptyBuffers(); + + TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime); + // CustomCommand implementation - this bit knows it is server side + void DoSyncCustomCommandL(const RMmfIpcMessage& aMessage); + void DoSyncCustomCommandResultL(const RMmfIpcMessage& aMessage); + void DoAsyncCustomCommandL(const RMmfIpcMessage& aMessage); + void DoAsyncCustomCommandResultL(const RMmfIpcMessage& aMessage); + +private: + // So that nobody can extend + CMMFDevSoundSvrImp(CMMFDevSoundSessionXtnd* aParent); + // Second phase constructor + void Construct3L(RServer2& aPolicyServerHandle); + void PreInitializeL(); + // Initializes format based on format supported + TInt InitializeFormat(RMdaDevSound::TSoundFormatsSupportedBuf& aSupportedFormat, + RMdaDevSound::TCurrentSoundFormatBuf& aFormat); + // Request Policy + void RequestPolicy(); + // Play tone + void DoPlayL(); + // Sets active tone + void SetActiveToneBuffer(); + // Fills free tone buffer with tone data + TInt FillFreeToneBuffer(); + // Updates the state of audio policy based on the audio policy settings + TInt UpdatePolicyState(TMMFAudioPolicyState aNewState); + // HwDevice implementation begins + TInt InitTask(); + // Returns Sampling Frequency the device is currently configured to + TInt SamplingFrequency(); + // Returns number of channels the device is currently configured to + TInt NumberOfChannels(); + //returns the number of bytes in each audio sample + TInt BytesPerAudioSample(); + // HwDevice implementation ends + TInt SetDeviceVolume(TInt aVolume); + TInt SetPlayFormat(RMdaDevSound::TCurrentSoundFormatBuf& aPlayFormat); + TInt SetRecordFormat(RMdaDevSound::TCurrentSoundFormatBuf& aRecordFormat); + TInt SetDeviceRecordLevel(TInt aGain); + TInt SetDeviceVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); +public: + enum TMMFDevSoundState + { + /** Idle state. + */ + EMMFDevSoundStateIdle, + /** The DevSound is currently playing. + */ + EMMFDevSoundStatePlaying, + /** The DevSound is playing a tone. + */ + EMMFDevSoundStateTonePlaying, + /** The DevSound is currently recording. + */ + EMMFDevSoundStateRecording, + /** The DevSound is playing and recording. + */ + EMMFDevSoundStatePlayingRecording, + /** The DevSound is converting data. + */ + EMMFDevSoundStateConverting + }; +private: + + CMMFDevSoundSessionXtnd& iParent; + + //Objects (owned or referred to): + RMMFAudioPolicyProxy* iAudioPolicyProxy; + CMMFAudioPolicyRequest* iAudioPolicyRequest; + MDevSoundObserver* iDevSoundObserver; + + // Handles receiving events + CMMFDevSoundEventHandler* iDevSoundEventHandler; + + //WINS Sound Device Structures + RMdaDevSound::TSoundFormatsSupportedBuf iPlayFormatsSupported; + RMdaDevSound::TCurrentSoundFormatBuf iPlayFormat; + RMdaDevSound::TSoundFormatsSupportedBuf iRecordFormatsSupported; + RMdaDevSound::TCurrentSoundFormatBuf iRecordFormat; + + // DevSound capabilities + TMMFCapabilities iDeviceCapabilities; + // Current Configuration + TMMFCapabilities iDeviceConfig; + + // AudioPolicy priority used to communicate with server + TMMFAudioPolicyPrioritySettings iAudioPolicyPrioritySettings; + + MPlayCustomInterface* iPlayCustomInterface; + MRecordCustomInterface* iRecordCustomInterface; + + // Bytes of audio data played in current play cycle + TInt iPlayedBytesCount; + TInt iGain; + TInt iVolume; + TMMFDevSoundInfo iDevSoundInfo; + + //Tone Stuff: + MMdaToneSynthesis* iCurrentGenerator; + TMdaSimpleToneGenerator iToneGen; + TMdaDualToneGenerator iDualToneGen; + TMdaDTMFGenerator iDTMFGen; + TMdaSequenceGenerator iSequenceGen; // Not Supported + TInt iRepeatCount; + TTimeIntervalMicroSeconds iRepeatTrailingSilence; + TTimeIntervalMicroSeconds iRampDuration; + // Double buffer tone playing + CMMFDataBuffer* iToneBuffer1; + CMMFDataBuffer* iToneBuffer2; + // Reference to current tone buffer playing + CMMFDataBuffer* iActiveToneBuffer; + + // Hardware device implementation + CMMFHwDevice* iCMMFHwDevice; + // Mode in which DevSound instance will be used for + TMMFDevSoundState iMode; + // Reference to hardware buffer + CMMFDataBuffer* iHwDeviceBuffer; + + TBool iLastBufferReceived; + + // Holds true of Audio data given to DevSound needs to ramped up + CMMFDevSoundUtility* iDevSoundUtil; + + // Fixed sequence related + CPtrC8Array* iFixedSequences; // Holds the fixed sequence data + TPtrC8 iFixedSequence; // Holds reference to current sequence + + // Balance + TInt iLeftPlayBalance; + TInt iRightPlayBalance; + + TInt iLeftRecordBalance; + TInt iRightRecordBalance; + + TBool iPaused; + + TUid iHwDeviceID; + + // Hardware device initialization parameters + THwDeviceInitParams iDevInfo; + + TBool iFirstCallFromHwDevice; + TBool iFourCCSet; + TFourCC iSrcFourCC; + TFourCC iDestFourCC; + + TBool iHasPolicy; + MTimePlayedCustomInterface* iTimePlayedCustomInterface; + TTimeIntervalMicroSeconds iTimePlayed; + friend class CMMFDevSoundSession; + }; + +#include "MmfDevSoundSessionBody.inl" + +#endif // MMFDEVSOUNDSESSIONBODY__H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionBody.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,536 @@ +// Copyright (c) 2004-2009 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 //for SwCodecWrapper CustomInterfaces +#include +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +#include +#endif // SYMBIAN_MULTIMEDIA_CODEC_API +#include "MmfDevSoundServer.h" +#include "MmfDevSoundSessionBody.h" +/* + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device aHWDev. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "MDevSoundObserver& aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "TUid aHWDev" + * CMMFHwDevice implementation identifier. + * + * @param "TMMFState aMode" + * Mode for which this object will be used. + * + */ + + #ifdef _DEBUG +_LIT(KMMFDevSoundSessionCategory, "MMFDevSoundSessionCategory"); +inline void Panic(TInt aError) + { + User::Panic(KMMFDevSoundSessionCategory, aError); + } +enum TMMFDevSoundSessionPanics + { + TMMFDevSoundSessionPolicyNotInvalidated + }; +#endif + +inline void CMMFDevSoundSvrImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode) + { + TInt initError = KErrNone; + iDevSoundObserver = &aDevSoundObserver; + + if (aMode == EMMFStateIdle) + User::Leave(KErrNotSupported); + + iMode= static_cast (aMode); + iHasPolicy = EFalse; + + if (iMode == EMMFDevSoundStateRecording) + {//DEF037912 incase the recording capabilities differ from play + User::LeaveIfError(InitializeFormat(iRecordFormatsSupported, iRecordFormat)); + } + + + iDevSoundObserver = &aDevSoundObserver; + iHwDeviceID.iUid = aHWDev.iUid; + if(iCMMFHwDevice) + { + delete iCMMFHwDevice; + iHwDeviceBuffer = NULL; // buffer is deleted by HwDevice delete + iPlayCustomInterface = NULL; //custom interfaces are also invalid + iRecordCustomInterface = NULL; + iTimePlayedCustomInterface = NULL; + } + + iCMMFHwDevice = NULL; + + // Load the HwDevice implementation from ECom + TRAP(initError,iCMMFHwDevice = CMMFHwDevice::NewL(aHWDev));//trap it to get debug print + + if (initError == KErrNone) + { +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + if (iFourCCSet) + { + MMdfHwDeviceSetup* setup = reinterpret_cast(iCMMFHwDevice->CustomInterface(KUidHwDeviceSetupInterface)); + if (setup!=NULL) + { + setup->SetDataTypesL(iSrcFourCC, iDestFourCC); + } + } +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + iDevInfo.iHwDeviceObserver = this; + initError = iCMMFHwDevice->Init(iDevInfo); + if (initError == KErrNone) + { + TUid playCustomInterfaceUid; + playCustomInterfaceUid.iUid = KMmfPlaySettingsCustomInterface; + TUid recordCustomInterfaceUid; + recordCustomInterfaceUid.iUid = KMmfRecordSettingsCustomInterface; + iPlayCustomInterface = + (MPlayCustomInterface*)iCMMFHwDevice->CustomInterface(playCustomInterfaceUid); + if (!iPlayCustomInterface) + {//DEF40443 need to check custom interface has been created + initError = KErrNoMemory;//it won't if there is no memory + } + else + { + iRecordCustomInterface = + (MRecordCustomInterface*)iCMMFHwDevice->CustomInterface(recordCustomInterfaceUid); + if (!iRecordCustomInterface) + initError = KErrNoMemory; + } + } + } + + // in the InitializeComplete() call we will signal the observer that the + // custom interface may have changed + iDevSoundObserver->InitializeComplete(initError); + + if (initError) + { + User::Leave(initError); + } + __ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated)); + } + +/* + * + * Initializes DevSound object for the mode aMode for processing audio data + * with hardware device supporting FourCC aDesiredFourCC. + * + * On completion of Initialization, the observer will be notified via call back + * InitializeComplete(). + * + * Leaves on failure. + * + * @param "MDevSoundObserver& aDevSoundObserver" + * A reference to DevSound Observer instance. + * + * @param "TFourCC aDesiredFourCC" + * CMMFHwDevice implementation FourCC. + * + * @param "TMMFState aMode" + * Mode for which this object will be used. + * + */ +inline void CMMFDevSoundSvrImp::InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode) + { + // to get HW Uid from the FourCC + RImplInfoPtrArray plugInArray; + TFourCC KPCM16FourCC(' ','P','1','6'); + _LIT(KNullString, ""); + + TUid hwDevicePluginInterface = {KMmfUidPluginInterfaceHwDevice}; + TUid implUid = {0}; + + CleanupResetAndDestroyPushL( plugInArray ); + // Get the implementation UID based on the FourCC and mode. +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + TInt err = KErrNone; + RArray dataTypes; + CleanupClosePushL(dataTypes); + + TRAP(err, iDevSoundUtil->SeekCodecPluginsL(dataTypes, aMode, EFalse)); + // if we find a new codec plugin + TBool found = EFalse; + if (!err && dataTypes.Find(aDesiredFourCC)!=KErrNotFound) + { + TRAP(err, iDevSoundUtil->FindHwDeviceAdapterL(hwDevicePluginInterface, plugInArray)); + if (err == KErrNone) + { + if (aMode == EMMFDevSoundStatePlaying) + {//destination four CC is pcm16 + iFourCCSet = ETrue; + iSrcFourCC = aDesiredFourCC; + iDestFourCC = KPCM16FourCC; + } + else if (aMode == EMMFDevSoundStateRecording) + {//source fourCC is pcm16 + iFourCCSet = ETrue; + iSrcFourCC = KPCM16FourCC; + iDestFourCC = aDesiredFourCC; + } + found = ETrue; + } + } + if (!found) +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + { + plugInArray.ResetAndDestroy(); + if (aMode == EMMFDevSoundStatePlaying) + {//destination four CC is pcm16 + iFourCCSet = ETrue; + iSrcFourCC = aDesiredFourCC; + iDestFourCC = KPCM16FourCC; + iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, aDesiredFourCC, KPCM16FourCC, KNullString); + } + else if (aMode == EMMFDevSoundStateRecording) + {//source fourCC is pcm16 + iFourCCSet = ETrue; + iSrcFourCC = KPCM16FourCC; + iDestFourCC = aDesiredFourCC; + iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, KPCM16FourCC, aDesiredFourCC, KNullString); + } + else + { + User::Leave(KErrNotSupported);//invalid aMode cant set 4CC for tone + } + } + + + if(plugInArray.Count() == 0) + { // couldn't find Decoder only implementation, try to get Decoder/Encoder + iDevSoundUtil->SeekUsingFourCCL(hwDevicePluginInterface, plugInArray, aDesiredFourCC, aDesiredFourCC, KNullString); + if(plugInArray.Count() == 0) + User::Leave(KErrNotSupported); + } + implUid = plugInArray[0]->ImplementationUid(); // Just pick the first in the list + +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + CleanupStack::PopAndDestroy(2, &plugInArray) ; //pluginArray, dataTypes +#else + CleanupStack::PopAndDestroy() ; //pluginArray +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + // If we made it here, there we have found implementation UID + InitializeL(aDevSoundObserver, implUid, aMode); + __ASSERT_DEBUG(!(iHasPolicy&&(iMode == EMMFDevSoundStatePlaying)), Panic(TMMFDevSoundSessionPolicyNotInvalidated)); + } + +/* + * + * Returns the supported Audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSoundSvrImp::Capabilities() + { + return iDeviceCapabilities; + } + +/* + * + * Returns the current audio settings. + * + * @return "TMMFCapabilities" + * Device settings. + * + */ +inline TMMFCapabilities CMMFDevSoundSvrImp::Config() const + { + return iDeviceConfig; + } + +/* + * + * Returns an integer representing the maximum volume. + * + * This is the maximum value which can be passed to CMMFDevSoundProxy::SetVolume. + * + * @return "TInt" + * The maximum volume. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSoundSvrImp::MaxVolume() + { + return iPlayFormatsSupported().iMaxVolume; + } + +/* + * + * Returns an integer representing the current volume. + * + * @return "TInt" + * The current volume level. + * + */ +inline TInt CMMFDevSoundSvrImp::Volume() + { + return iVolume; + } + +/* + * + * Returns an integer representing the maximum gain. + * + * This is the maximum value which can be passed to CMMFDevSoundProxy::SetGain. + * + * @return "TInt" + * The maximum gain. This value is platform dependent but is always + * greater than or equal to one. + * + */ +inline TInt CMMFDevSoundSvrImp::MaxGain() + { + return iRecordFormatsSupported().iMaxVolume;//uses iMaxVolume for iMaxGain + } + +/* + * + * Returns an integer representing the current gain. + * + * @return "TInt" + * The current gain level. + * + */ +inline TInt CMMFDevSoundSvrImp::Gain() + { + return iGain; + } + +/* + * + * Returns the speaker balance set for playing. + * + * Leaves on failure. + * + * @param "TInt& aLeftPrecentage" + * On return contains the left speaker volume percentage. + * + * @param "TInt& aRightPercentage" + * On return contains the right speaker volume percentage. + * + */ +inline void CMMFDevSoundSvrImp::GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + aLeftPercentage = iLeftPlayBalance; + aRightPercentage = iRightPlayBalance; + } + +/* + * + * Returns the microphone gain balance set for recording. + * + * Leaves on failure. + * + * @param "TInt& aLeftPercentage" + * On return contains the left microphone gain percentage. + * + * @param "TInt& aRightPercentage" + * On return contains the right microphone gain percentage. + * + */ +inline void CMMFDevSoundSvrImp::GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage) + { + aLeftPercentage = iLeftRecordBalance; + aRightPercentage = iRightRecordBalance; + } + +/* + * + * Contine the process of recording. Once the buffer is filled with recorded + * data, the Observer gets reference to buffer along with callback + * BufferToBeEmptied(). After processing the buffer (copying over to a + * different buffer or writing to file) the client should call this + * method to continue recording process. + * + */ +inline TBool CMMFDevSoundSvrImp::RecordData(const RMmfIpcMessage& aMessage) + { + ASSERT(iDevSoundObserver); + if(iAudioPolicyPrioritySettings.iState != EMMFStateRecordData) + { + PanicClient(aMessage, EMMFDevSoundRecordDataWithoutInitialize); + return EFalse; + } + // Checkes if the client has a UserEnvironment capability + if (!aMessage.HasCapability(ECapabilityUserEnvironment)) + { + iDevSoundObserver->RecordError(KErrPermissionDenied); + return ETrue; + } + if(iCMMFHwDevice) + { + if ((iMode == EMMFDevSoundStateRecording) && iHasPolicy) + { + iHwDeviceBuffer->Data().SetLength(iHwDeviceBuffer->RequestSize()); + TInt error = iCMMFHwDevice->ThisHwBufferEmptied(*iHwDeviceBuffer); + if(error != KErrNone) + { + Error(error); + iCMMFHwDevice->Stop(); + } + + } + } + return ETrue; + } + +/* + * + * Defines the number of times the audio is to be repeated during the tone + * playback operation. + * + * A period of silence can follow each playing of tone. The tone playing can + * be repeated indefinitely. + * + * @param "TInt aRepeatCount" + * The number of times the tone, together with the trailing silence, + * is to be repeated. If this is set to KMdaRepeatForever, then the + * tone, together with the trailing silence, is repeated indefinitely + * or until Stop() is called. If this is set to zero, then the tone is + * not repeated. + * + * Supported only during tone playing. + * + */ +inline void CMMFDevSoundSvrImp::SetToneRepeats(TInt aRepeatCount, + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence) + { + iRepeatCount = aRepeatCount; + iRepeatTrailingSilence = aRepeatTrailingSilence; + } + +/* + * + * Defines the priority settings that should be used for this instance. + * + * @param "const TMMFPrioritySettings& aPrioritySettings" + * An class type representing the client's priority, priority + * preference and state. + * + */ +inline void CMMFDevSoundSvrImp::SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings) + { + iAudioPolicyPrioritySettings.iPref = aPrioritySettings.iPref; + iAudioPolicyPrioritySettings.iPriority = aPrioritySettings.iPriority; + } + +// Currently only support bitrate custom interface +inline TAny* CMMFDevSoundSvrImp::CustomInterface(TUid aInterfaceId) + { + TAny* ptr = NULL; + if (iCMMFHwDevice) + { + ptr = iCMMFHwDevice->CustomInterface(aInterfaceId); + } + + return ptr; + } + +/* + * + * Returns the number of available pre-defined tone sequences. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * @return "TInt" + * The fixed sequence count. This value is implementation dependent + * but is always greater than or equal to zero. + * + */ +inline TInt CMMFDevSoundSvrImp::FixedSequenceCount() + { + return iFixedSequences->Count(); + } + +/* + * + * Returns the name assigned to a specific pre-defined tone sequence. + * + * This is the number of fixed sequence supported by DevSound by default. + * + * The function raises a panic if sequence number specified invalid. + * + * @return "TDesC&" + * A reference to a Descriptor containing the fixed sequence + * name indexed by aSequenceNumber. + * + * @param "TInt aSequenceNumber" + * The index identifying the specific pre-defined tone sequence. Index + * values are relative to zero. + * This can be any value from zero to the value returned by a call to + * FixedSequenceCount() - 1. + * The function raises a panic if sequence number is not within this + * range. + * + * @see FixedSequenceCount() + * + */ +inline const TDesC& CMMFDevSoundSvrImp::FixedSequenceName(TInt aSequenceNumber) + { + ASSERT((aSequenceNumber >= 0)&&(aSequenceNumber < iFixedSequences->Count())); + return iDevSoundUtil->FixedSequenceName(aSequenceNumber); + } + +/* + * + * Sets Id for this instance of DevSound + * + * @param "TInt aDevSoundId" + * Integer value assigned by Audio Policy Server + * + */ +inline void CMMFDevSoundSvrImp::SetDevSoundId(TInt aDevSoundId) + { + iDevSoundInfo.iDevSoundId = aDevSoundId; + } + +/* + * + * Returns information about this DevSound instance. + * + * This method is used by Audio Policy Server to make audio policy decisions. + * + * @return "TMMFDevSoundinfo" + * A reference to TMMFDevSoundinfo object holding the current settings + * of this DevSound instance. + * + */ +inline TMMFDevSoundInfo CMMFDevSoundSvrImp::DevSoundInfo() + { + return iDevSoundInfo; + } + + +/* + * Updates the total bytes played. + * + */ +inline void CMMFDevSoundSvrImp::UpdateBytesPlayed() + { + if (iPlayCustomInterface) + iPlayedBytesCount = iPlayCustomInterface->BytesPlayed(); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionXtnd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/MmfDevSoundSessionXtnd.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,66 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __MMFDEVSOUNDSESSIONTND_H__ +#define __MMFDEVSOUNDSESSIONTND_H__ + +#include "MmfDevSoundSession.h" +#include "MmfDevSoundInfo.h" + +/* + * + * Class Name: CMMFDevSoundSessionXtnd + * + * This class provides an extended interface for CMMFDevSound - intended + * to provide additional calls that are applicable to a particular implementation + * This version is built on RMdaDevSound + */ +class CMMFDevSoundSessionXtnd; // declared here. + +NONSHARABLE_CLASS( CMMFDevSoundSessionXtnd ) : public CMMFDevSoundSession + { +public: + + // Interface for Audio Policy + // Sets id for this DevSound instance + void SetDevSoundId(TInt aDevSoundId); + // Returns info about this DevSound instance + TMMFDevSoundInfo DevSoundInfo(); + // Called by Audio Policy Server when play reqeust is granted + void StartPlayDataL(); + // Called by Audio Policy Server when record reqeust is granted + void StartRecordDataL(); + // Called by Audio Policy Server when play tone reqeust is granted + void StartPlayToneL(); + // Called by Audio Policy Server when play dual tone request is granted + void StartPlayDualToneL(); + // Called by Audio Policy Server when play DTMF reqeust is granted + void StartPlayDTMFStringL(); + // Called by Audio Policy Server when play tone sequence reqeust is granted + void StartPlayToneSequenceL(); + // Called by Audio Policy Server when DevSound instance looses device + void SendEvent(const TMMFEvent& aEvent); + // Updates the total bytes played from audio device + void UpdateBytesPlayed(); + + // CMMFHwDevice implementation: + TInt FillThisBuffer(CMMFBuffer& aHwBuffer); + TInt EmptyThisBuffer(CMMFBuffer& aHwBuffer); + TInt DeviceMessage(TDesC8& aMsg); + void DeviceStopped(); + // CMMFHwDevice implementation ends + }; + +#endif // __MMFDEVSOUNDSESSIONTND_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/AudioServer/mmfdevsoundserverconsts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/AudioServer/mmfdevsoundserverconsts.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2009 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 +#include + + +#ifdef SYMBIAN_CURB_SYSTEMSERVER_PRIORITIES + EXPORT_C extern const TInt KDevsoundServerPriority = EPriorityAbsoluteHigh; +#else + EXPORT_C extern const TInt KDevsoundServerPriority = EPriorityAbsoluteRealTime1; +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/platsec/server/Policy/MmfAudioPolicyStart.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/platsec/server/Policy/MmfAudioPolicyStart.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,71 @@ +// Copyright (c) 2009 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 +#include +#include "MmfAudioPolicyServer.h" + +_LIT(KMMFAudioPolicyServerName,"MMFAudioPolicyServer"); + +EXPORT_C TInt CMMFAudioPolicyServer::StartThread(TAny* aParms) +/** +Thread entry-point function. +The TServerStart objects is passed as the thread parameter +**/ + { + TInt err = KErrNone; + __UHEAP_MARK; + //This line will be used if parameters need to be passed. + TServerStart* start = reinterpret_cast(aParms); + CTrapCleanup* cleanup = CTrapCleanup::New(); + if (!cleanup) + { + err = KErrNoMemory; + } + else + { + TRAP(err, StartThreadL(*start)); + } + delete cleanup; + + REComSession::FinalClose(); + __UHEAP_MARKEND; + return err; + } + +void CMMFAudioPolicyServer::StartThreadL(TServerStart& aStart) + { + CActiveScheduler* sched = new(ELeave) CActiveScheduler; + CleanupStack::PushL(sched); + + CActiveScheduler::Install(sched); + //Rename Audio Policy server name + RThread audioPolicyThread; + TName name; + name.Append(KMMFAudioPolicyServerName); + //We are ignoring the error code returned from User::RenameThread + //as it is not important here, may be for profiling + User::RenameThread(name); + CMMFAudioPolicyServer* server = CMMFAudioPolicyServer::NewL(); + CleanupStack::PushL(server); + + aStart.iPolicyServerHandle = server->Server(); + // Sync with the client and enter the active scheduler + RThread::Rendezvous(KErrNone); + sched->Start(); + + CleanupStack::PopAndDestroy(2, sched); // sched, server + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/101FD9EF.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/101FD9EF.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,199 @@ + +// Copyright (c) 2003-2009 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 +#include +#include // for KMmfUidPluginInterfaceHwDevice + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101FD9EF; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToIMAADPCM; + version_no = 1; + display_name = "PCM16 ->IMAADPCM Codec"; + default_data = " P16,IMAD" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceIMAADPCMToPCM16; + version_no = 1; + display_name = "IMAADPCM ->PCM16 Codec"; + default_data = "IMAD, P16" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMMFUidHwDevicePCMU16toPCMU16B; + version_no = 1; + display_name = "AUDIOU16 ->PCMU16BE Codec"; + default_data = "PU16,PU6B" ;//four CC codes. + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMMFUidHwDevicePCMU16BtoPCMU16; + version_no = 1; + display_name = "PCMU16BE ->AUDIOU16 Codec"; + default_data = "PU6B,PU16" ;//four CC codes. + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMMFUidHwDevicePCM16BtoPCM16; + version_no = 1; + display_name = "PCM16BE ->AUDIO16 Codec"; + default_data = "P16B, P16" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceS16ToPCMU8; + version_no = 1; + display_name = "AUDIOS16 ->PCMS8 Codec"; + default_data = " P16, P8" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceU16BEToPCMS16; + version_no = 1; + display_name = "AUDIOU16BE ->PCMS16 Codec"; + default_data = "PU6B, P16" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceU16ToPCMS16; + version_no = 1; + display_name = "AUDIOU16 ->PCMS16 Codec"; + default_data = "PU16, P16" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM8ToPCM16; + version_no = 1; + display_name = "PCM8 ->PCM16 Codec"; + default_data = " P8, P16" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMMFUidHwDevicePCM16toPCMU16B; + version_no = 1; + display_name = "AUDIOS16 ->PCMU16BE Codec"; + default_data = " P16,PU6B" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceS16ToPCMU16; + version_no = 1; + display_name = "AUDIOS16 ->PCMU16 Codec"; + default_data = " P16,PU16" ; //four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16toPCM16B; + version_no = 1; + display_name = "AUDIO16 ->PCM16BE Codec"; + default_data = " P16,P16B" ;//four CC codes. + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToMuLaw; + version_no = 1; + display_name = "PCM16 ->MULAW Codec"; + default_data = " P16,uLAW" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToALaw; + version_no = 1; + display_name = "PCM16 ->ALAW Codec"; + default_data = " P16,ALAW" ;//four CC codes. + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceMulawToPCM16; + version_no = 1; + display_name = "MULAW ->PCM16 Codec"; + default_data = "uLAW, P16" ;//four CC codes. + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceAlawToPCM16; + version_no = 1; + display_name = "Alaw -> PCM16 Codec"; + default_data = "ALAW, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToPCM16; + version_no = 1; + display_name = "NULL Hw Device"; + default_data = " P16, P16" ; // FourCC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToPCMU8; + version_no = 1; + display_name = "pcm16->pcmu8 Hw Device"; + default_data = " P16, PU8" ; // FourCC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCMU8ToPCM16; + version_no = 1; + display_name = "pcmu8->pcm16 Hw Device"; + default_data = " PU8, P16" ; // FourCC codes + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/101FD9F0.RSS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/101FD9F0.RSS Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2002-2009 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: +// Copied from... Registry file for the Example Interface Implementation Collection +// +// + +#include +#include +#include // for KMmfUidPluginInterfaceHwDevice + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101FD9F0; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDeviceGSM610ToPCM16; + version_no = 1; + display_name = "GSM610->PCM Codec"; + default_data = "GSM6, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidHwDevicePCM16ToGSM610; + version_no = 1; + display_name = "PCM->GSM610 Codec"; + default_data = " P16,GSM6" ; // four CC codes + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.01T --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.01T Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,18 @@ +// Copyright (c) 2000-2009 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: +// Text to be translated for "Gsm610" Media Server plug-in library +// +// + +#define MEDIASVR_GENAUDIO_GSM_CODEC_NAME "GSM 6.10" diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.CPP --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.CPP Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,442 @@ +// Copyright (c) 2002-2010 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 FILES: +// +// + +// Standard includes +#include +#include + +#include +#include "GSM610.H" +#include +#include +#include +#include + +/** +* +* NewL +* @return CMmfGsm610ToPcm16HwDevice* +* +*/ +CMmfGsm610ToPcm16HwDevice* CMmfGsm610ToPcm16HwDevice::NewL() + { + CMmfGsm610ToPcm16HwDevice* self=new(ELeave) CMmfGsm610ToPcm16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* Codec +* +*/ +CMMFSwCodec& CMmfGsm610ToPcm16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* CMmfGsm610ToPcm16HwDevice +* +*/ +CMmfGsm610ToPcm16HwDevice::~CMmfGsm610ToPcm16HwDevice() + { + } + + +/** +* +* ConstructL +* +*/ +void CMmfGsm610ToPcm16HwDevice::ConstructL() + { + CMMFGsm610ToPcm16Codec* ptr= new(ELeave)CMMFGsm610ToPcm16Codec(); + CleanupStack::PushL(ptr); + ptr->ConstructL(); + iCodec = ptr; + CleanupStack::Pop(ptr); + } + +/** +* +* CMmfPcm16ToGsm610HwDevice +* +*/ +CMmfPcm16ToGsm610HwDevice* CMmfPcm16ToGsm610HwDevice::NewL() + { + CMmfPcm16ToGsm610HwDevice* self=new(ELeave) CMmfPcm16ToGsm610HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* Codec +* @return CMMFSwCodec& +* +*/ +CMMFSwCodec& CMmfPcm16ToGsm610HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ~CMmfPcm16ToGsm610HwDevice +* +*/ +CMmfPcm16ToGsm610HwDevice::~CMmfPcm16ToGsm610HwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMmfPcm16ToGsm610HwDevice::ConstructL() + { + CMMFPcm16ToGsm610Codec* ptr =new(ELeave) CMMFPcm16ToGsm610Codec(); + CleanupStack::PushL(ptr); + ptr->ConstructL(); + iCodec = ptr; + CleanupStack::Pop(ptr); + } + +/** +* +* CMMFGsm610ToPcm16Codec +* +*/ +CMMFGsm610ToPcm16Codec::CMMFGsm610ToPcm16Codec() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFGsm610ToPcm16Codec::ConstructL() + { + iGsmDecoder = GSM610FR_DecoderFactory::CreateDecoderL(); + iGsmDecoder->StartL(); + } + +/** +* +* NewL +* +*/ +CMMFGsm610ToPcm16Codec* CMMFGsm610ToPcm16Codec::NewL() + { + CMMFGsm610ToPcm16Codec* self=new(ELeave) CMMFGsm610ToPcm16Codec(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFGsm610ToPcm16Codec +* +*/ +CMMFGsm610ToPcm16Codec::~CMMFGsm610ToPcm16Codec() + { + if(iGsmDecoder) + { + iGsmDecoder->Release(); + } + } + +/** +* +* ProcessL +* @param aSource +* @param aDest +* @precondition input buffer length is mod 65 +* @precondition output buffer has sufficient space for coded input +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFGsm610ToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDest) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + CMMFBuffer* pSrcBuffer =const_cast(&aSrc); + if( !pSrcBuffer ) + { + User::Leave( KErrArgument ); + } + + CMMFDataBuffer* src = static_cast( pSrcBuffer ); + if( !src ) + { + User::Leave( KErrArgument ); + } + + CMMFDataBuffer* dst = static_cast(&aDest); + if( !dst ) + { + User::Leave( KErrArgument ); + } + + if(!CheckInputBuffers( *src, *dst )) + { + User::Leave( KErrArgument ); + } + + TInt numBuffersToProcess = NumBuffersToProcess( *src ); + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + for( TInt count = 0; count < numBuffersToProcess; count++ ) + { + // Encode two frames of gsm data + iGsmDecoder->ExecuteL( pSrc, pDst ); + pSrc += KGsmFrameSize;; + pDst += KPcmDataForGsmFrame; + result.iSrcBytesProcessed += KGsmFrameSize; + result.iDstBytesAdded += KPcmDataForGsmFrame; + } + + dst->Data().SetLength( result.iDstBytesAdded ); + __ASSERT_DEBUG( ProcessPostCondition( result ), TMmfGsmCodecPanicsNameSpace::Panic( TMmfGsmCodecPanicsNameSpace::EPostConditionViolation )); + return result; + } + +/** +* +* CheckInputBuffers +* @param aSrc +* @param aDest +* @return TBool +* This function returns ETrue if the preconditions of processL are met +* +*/ +TBool CMMFGsm610ToPcm16Codec::CheckInputBuffers( CMMFDataBuffer& aSrc, CMMFDataBuffer& aDest ) + { + TBool result = ETrue; + TInt numInputSubFrames = aSrc.Data().Length() / KGsmFrameSize; + TInt numOutputSubFrames = aDest.Data().MaxLength() / KPcmDataForGsmFrame; + TBool validInputDataLength = (aSrc.Data().Length() % KGsmFrameSize == 0) ? ETrue : aSrc.LastBuffer(); + + if( (numInputSubFrames > numOutputSubFrames) || // sufficient space in the output for the input + (aSrc.Position() > 0 ) || // position must be zero since we can eat all the data + (aDest.Position() > 0 ) || + (!validInputDataLength)) //position must be zero + { + result = EFalse; + } + + return result; + } + +/** +* +* NumBuffersToProcess +* @param aSrc +* @return TBool +* This method returns the number of buffers to process +* +*/ +TInt CMMFGsm610ToPcm16Codec::NumBuffersToProcess( const CMMFDataBuffer& aSrc ) + { + TInt numBuffers = (aSrc.Data().Length() / KGsmFrameSize ); + return numBuffers; + } + +/** +* +* ProcessPostCondition +* @param aResult +* @result TBool Etrue if the post condition is satisfied +* +**/ +TBool CMMFGsm610ToPcm16Codec::ProcessPostCondition( const CMMFSwCodec::TCodecProcessResult& aResult ) + { + TBool status = ETrue; + if( (aResult.iSrcBytesProcessed / KGsmFrameSize ) != (aResult.iDstBytesAdded / KPcmDataForGsmFrame ) ) + { + status = EFalse; + } + return status; + } + +/************************>----------------------------------<*****************************/ + +/** +* +* CMMFPcm16ToGsm610Codec +* +*/ +CMMFPcm16ToGsm610Codec::CMMFPcm16ToGsm610Codec() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToGsm610Codec::ConstructL() + { + iGsmEncoder = GSM610FR_EncoderFactory::CreateEncoderL(); + iGsmEncoder->StartL(); + } + +/** +* +* NewL +* +*/ +CMMFPcm16ToGsm610Codec* CMMFPcm16ToGsm610Codec::NewL() + { + CMMFPcm16ToGsm610Codec* self=new(ELeave) CMMFPcm16ToGsm610Codec(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* CMMFPcm16ToGsm610Codec +* +*/ +CMMFPcm16ToGsm610Codec::~CMMFPcm16ToGsm610Codec() + { + if(iGsmEncoder) + { + iGsmEncoder->Release(); + } + } + +/** +* +* ProcessL +* @param aSource +* @param aDest TCodecProcessResult +* @result +* @precondition input buffer length is mod 320 +* @precondition output buffer has sufficient space for coded input +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToGsm610Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDest) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + CMMFBuffer* pSrcBuffer =const_cast(&aSrc); + if( !pSrcBuffer ) + { + User::Leave( KErrArgument ); + } + + CMMFDataBuffer* src = static_cast( pSrcBuffer ); + if( !src ) + { + User::Leave( KErrArgument ); + } + + CMMFDataBuffer* dst = static_cast(&aDest); + if( !dst ) + { + User::Leave( KErrArgument ); + } + + + if(!CheckInputBuffers( *src, *dst )) + { + User::Leave( KErrArgument ); + } + + TInt numBuffersToProcess = NumBuffersToProcess( *src ); + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + for( TInt count = 0; count < numBuffersToProcess; count++ ) + { + // Encode two frames of gsm data + iGsmEncoder->ExecuteL (pSrc, pDst); + pSrc += KPcmDataForGsmFrame; + pDst += KGsmFrameSize; + result.iSrcBytesProcessed += KPcmDataForGsmFrame; + result.iDstBytesAdded += KGsmFrameSize; + } + + dst->Data().SetLength( result.iDstBytesAdded ); + + __ASSERT_DEBUG( ProcessPostCondition(result), TMmfGsmCodecPanicsNameSpace::Panic( TMmfGsmCodecPanicsNameSpace::EPostConditionViolation )); + + return result ; + } + +/** +* +* CheckInputBuffers +* @param aSrc +* @param aDest +* @return TBool +* This function returns ETrue if there is sufficient space +* in the output buffer for the coded input and +* the position of both input buffers is zero +* +*/ +TBool CMMFPcm16ToGsm610Codec::CheckInputBuffers( CMMFDataBuffer& aSrc, CMMFDataBuffer& aDest ) + { + TBool result = ETrue; + TInt numInputSubFrames = aSrc.Data().Length() / KPcmDataForGsmFrame; + TInt numOutputSubFrames = aDest.Data().MaxLength() / KGsmFrameSize; +#ifdef EABI + TBool validInputDataLength = (aSrc.Data().Length() % KPcmDataForGsmFrame == 0); +#else + TBool validInputDataLength = (aSrc.LastBuffer()? ETrue: (aSrc.Data().Length() % KPcmDataForGsmFrame == 0)); +#endif + if( (numInputSubFrames > numOutputSubFrames) || // sufficient space in the output for the input + (aSrc.Position() > 0 ) || // position must be zero since we can eat all the data + (aDest.Position() > 0 ) || + (!validInputDataLength)) //position must be zero + { + result = EFalse; + } + + return result; + } + +/** +* +* NumBuffersToProcess +* @param aSrc +* @return TBool +* This method returns the number of buffers to process +* +*/ +TInt CMMFPcm16ToGsm610Codec::NumBuffersToProcess( const CMMFDataBuffer& aSrc ) + { + TInt numBuffers = ( aSrc.Data().Length() / KPcmDataForGsmFrame ); + return numBuffers; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.H --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.H Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,182 @@ +// Copyright (c) 2002-2010 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: +// + +#ifndef __GSM610_H__ +#define __GSM610_H__ + +#include + +// Standard EPOC32 includes required by this header file +#include +#include +#include + + +#ifdef EABI +const TUint KNumFramesInABuffer = 50; +#else +const TUint KNumFramesInABuffer = 6; +#endif +const TInt KGsmFrameSize = 65; +const TUint KGsmEncodedFrameSize = KNumFramesInABuffer * KGsmFrameSize ; //50 * 65 encoded frames +const TUint KPcmEncodedFrameSize = KNumFramesInABuffer * 320; // 50 times 160*2 +const TInt KPcmDataForGsmFrame = 640; +const TUint KPcmInputFrameSize = KPcmEncodedFrameSize*2; // cache 2 frames + +/** +* +*class CMmfGsmToPcm16HwDevice +* +*/ +class CMmfGsm610ToPcm16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMmfGsm610ToPcm16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMmfGsm610ToPcm16HwDevice(); +private: + void ConstructL(); + }; + +/** +* +* CMmfPcmHwDevicePcm16ToGsm610 +* +*/ +class CMmfPcm16ToGsm610HwDevice : public CMMFSwCodecWrapper + { +public: + static CMmfPcm16ToGsm610HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMmfPcm16ToGsm610HwDevice(); +private: + void ConstructL(); + }; + +/** +* +* class CMMFGsm610ToPcm16Codec coverts Gsm610 to PCM16 +* +*/ +class MGSM610FR_Decoder; + +class CMMFGsm610ToPcm16Codec : public CMMFSwCodec + { +public: + CMMFGsm610ToPcm16Codec(); + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KGsmEncodedFrameSize;}; + virtual TUint SinkBufferSize() {return KPcmInputFrameSize;}; + static CMMFGsm610ToPcm16Codec* NewL(); + void ConstructL(); + ~CMMFGsm610ToPcm16Codec(); +private: + TBool CheckInputBuffers( CMMFDataBuffer& aSrc, CMMFDataBuffer& aDest ); + TInt NumBuffersToProcess( const CMMFDataBuffer& aSrc ); + TBool ProcessPostCondition( const CMMFSwCodec::TCodecProcessResult& result ); + // do not provide an implmentation for these two methods + const CMMFGsm610ToPcm16Codec& operator=( const CMMFGsm610ToPcm16Codec& ); + CMMFGsm610ToPcm16Codec( const CMMFGsm610ToPcm16Codec& ); +private: + MGSM610FR_Decoder* iGsmDecoder; + }; + +/** +* +* class CMMFPcm16ToGsm610Codec coverts PCM16 to GSM610 +* +*/ +class MGSM610FR_Encoder; + +class CMMFPcm16ToGsm610Codec : public CMMFSwCodec + { +public: + CMMFPcm16ToGsm610Codec(); + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPcmInputFrameSize;}; + virtual TUint SinkBufferSize() {return KGsmEncodedFrameSize;}; + static CMMFPcm16ToGsm610Codec* NewL(); + ~CMMFPcm16ToGsm610Codec(); + void ConstructL(); +private: + TBool CheckInputBuffers( CMMFDataBuffer& aSrc, CMMFDataBuffer& aDest ); + TInt NumBuffersToProcess( const CMMFDataBuffer& aSrc ); + inline TBool ProcessPostCondition( const CMMFSwCodec::TCodecProcessResult& result ); + + // do not supply implementations + const CMMFPcm16ToGsm610Codec& operator=( const CMMFPcm16ToGsm610Codec& ); + CMMFPcm16ToGsm610Codec( const CMMFPcm16ToGsm610Codec &); +private: + MGSM610FR_Encoder* iGsmEncoder; + }; + +/** +* +* class TMmfAudioAudioCodecPanics provides a name space for audio codec +* panics +* +**/ +class TMmfGsmCodecPanicsNameSpace + { +public: + /* + A list of panic codes for Codecs + @internalTechnology + EBadArgument indicates a bad argument + EBadState indicates a state viaolation + EBadInvariant indicates an invariant violation + EPostConditionViolation indicates a post condition violation + */ + enum TMmfGsmCodecPanics + { + EBadArgument, + EBadState, + EBadInvariant, + EBadReset, + EPostConditionViolation + }; +public: + inline static void Panic(const TMmfGsmCodecPanicsNameSpace::TMmfGsmCodecPanics aPanic); + }; + +/** +* +* Panic +* @argument aPanic is the panic code for the codec +* +*/ +inline void TMmfGsmCodecPanicsNameSpace::Panic(const TMmfGsmCodecPanicsNameSpace::TMmfGsmCodecPanics aPanic) + { + _LIT(KGsmCodecPanicCategory, "GsmCodec"); + User::Panic(KGsmCodecPanicCategory, aPanic); + } + +/** +* +* ProcessPostCondition +* @param aResult +* @result TBool Etrue if the post condition is satisfied +* +**/ +inline TBool CMMFPcm16ToGsm610Codec::ProcessPostCondition( const CMMFSwCodec::TCodecProcessResult& aResult ) + { + TBool status = ETrue; + if( (aResult.iSrcBytesProcessed / KPcmDataForGsmFrame ) != (aResult.iDstBytesAdded / KGsmFrameSize ) ) + { + status = EFalse; + } + return status; + } +#endif //__GSM610_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.RSS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/GSM610.RSS Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2000-2009 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 "Mda\Server\Base.rh" +#include "Mda\Server\Resource.rh" +#include "Mda\Common\Audio.hrh" +#include "Mda\Common\GsmAudio.hrh" + +#include "Gsm610.01t" + +RESOURCE MDA_LIBRARY audio_library + { + library_uid= KUidMdaGsmWavCodecLibraryDefine; + version= MDA_LIBRARY_VERSION { build = 1; }; + objects= + { + +// WAV Codecs + MDA_OBJECT_ENTRY + { + object_identifier_uid = KUidMdaGsmWavCodecDefine; + object_type_uid = KUidMdaWavCodecDefine; + info_entry = wav_codec_gsm; + } + }; + } + + +RESOURCE MDARES_ENTRY wav_codec_gsm + { + signature = { MDARES_SIG_DATA {data_string_id=1;} }; + strings = + { + MDARES_TEXT { text=MEDIASVR_GENAUDIO_GSM_CODEC_NAME; }, // Id=0 + MDARES_BINARY { binary=KMdaWavFormatTypeGsmData; } // Id=1 + }; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Gsm610/gsm610Proxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Gsm610/gsm610Proxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2002-2009 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: +// + +// Standard includes +#include +#include + +#include +#include "GSM610.H" +#include +#include +#include + + +// +// Exported proxy for instantiation method resolution +// Define the interface UIDs +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceGSM610ToPCM16, CMmfGsm610ToPcm16HwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToGSM610, CMmfPcm16ToGsm610HwDevice::NewL), + }; + + +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFAudioCodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFAudioCodec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2002-2009 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: +// MMFAudioCodecBase.h +// +// + + +#ifndef __MMF_AUDIOCODEC_BASE_H__ +#define __MMF_AUDIOCODEC_BASE_H__ +#include + +/* +* +* class TMmfAudioAudioCodecPanics provides a name space for audio codec +* panics +* +**/ +class TMmfAudioCodecPanicsNameSpace +{ +public: + /* + A list of panic codes for Codecs + @internalTechnology + EBadArgument indicates a bad argument + EBadState indicates a state viaolation + EBadInvariant indicates an invariant violation + EPostConditionViolation indicates a post condition violation + */ + enum TMmfAudioCodecPanics + { + EBadArgument, + EBadState, + EBadInvariant, + EBadReset, + EPostConditionViolation + }; +public: + inline static void Panic(const TMmfAudioCodecPanicsNameSpace::TMmfAudioCodecPanics aPanic); +}; + +/* +* +* Panic +* @param aPanic is the panic code for the codec +* +*/ +inline void TMmfAudioCodecPanicsNameSpace::Panic(const TMmfAudioCodecPanicsNameSpace::TMmfAudioCodecPanics aPanic) + { + _LIT(KAudioCodecPanicCategory, "AudioCodec"); + User::Panic(KAudioCodecPanicCategory, aPanic); + } + +#endif //__MMF_AUDIOCODEC_BASE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFAudioCodecImplementationProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFAudioCodecImplementationProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 1997-2002 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 +#include // For making it ECom plugin +#include +#include "MMFpcm16ToPcm16HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "MmfPcm16toAlawhwDevice.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "mmfpcmU16TopcmS16HwDevice.h" +#include "mmfpcmU16BeToPcmS16HwDevice.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmS16topcmU16Codec.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "mmfpcmU16BeToPcmS16HwDevice.h" +#include "mmfpcm16ToImaAdpcm.h" + + + +// _________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToPCM16, CMMFPcm16ToPcm16HwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToPCMU8, CMMFPcm16ToPcmU8HwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCMU8ToPCM16, CMMFPcmU8ToPcm16HwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceMulawToPCM16, CMMFMulawToPcm16CodecHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceAlawToPCM16, CMMFAlawToPcm16CodecHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToMuLaw, CMMFPcm16ToMulawHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToALaw, CMMFPcm16ToAlawHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16toPCM16B, CMMFPcm16SwapEndianHwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceS16ToPCMU8, CMMFPcm16ToPcmU8HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceS16ToPCMU16, CMMFPcm16ToPcmU16HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMMFUidHwDevicePCM16toPCMU16B, CMMFPcm16ToPcmU16BEHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM8ToPCM16, CMMFPcm8ToPcm16HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMMFUidHwDevicePCM16toPCMU16B, CMMFPcm16ToPcmU16BEHwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceS16ToPCMU16, CMMFPcm16ToPcmU16HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceU16ToPCMS16, CMMFPcmU16ToPcm16HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceS16ToPCMS8, CMMFPcmS16ToPcmS8HwDevice::NewL ), + IMPLEMENTATION_PROXY_ENTRY(KMMFUidHwDevicePCM16BtoPCM16, CMMFPcm16SwapEndianHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceU16BEToPCMS16, CMMFPcmU16BeToPcmS16HwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDevicePCM16ToIMAADPCM, CMMFPcm16ToImaAdpcmHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidHwDeviceIMAADPCMToPCM16, CMMFImaAdpcmToPcm16CodecHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMMFUidHwDevicePCMU16toPCMU16B, CMMFPcm16SwapEndianHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMMFUidHwDevicePCMU16BtoPCMU16, CMMFPcm16SwapEndianHwDevice::NewL), + }; + +/** +Exported function, returns a pointer to implemenation table. + +@param aTableCount + Reference to table count. + +@return Pointer to the implementation table. +*/ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcm16HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcm16HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,281 @@ +// Copyright (c) 2003-2009 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 "MMFpcm16ToPcm16HwDevice.h" + + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcm16HwDevice" + * + */ +CMMFPcm16ToPcm16HwDevice* CMMFPcm16ToPcm16HwDevice::NewL() + { + CMMFPcm16ToPcm16HwDevice* self = new (ELeave) CMMFPcm16ToPcm16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * + * Second phase constructor. + * + */ +void CMMFPcm16ToPcm16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToPcm16Codec(); + static_cast(iCodec)->SetHwDevice(this); + } + +/** +* +* ~CMMFPcm16ToPcm16HwDevice +* +**/ +CMMFPcm16ToPcm16HwDevice::~CMMFPcm16ToPcm16HwDevice() + { + } + +/** +* +* Codec +* @return CMMFSwCodec& +**/ +CMMFSwCodec& CMMFPcm16ToPcm16HwDevice::Codec() + { + return *iCodec; + } + + + + + +/** +* +* ProcessL +* @param aSrc Source Buffer +* @param sDest Destintion Buffer +* @return CMMFSwCodec::TCodecProcessResult +* +**/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToPcm16Codec::ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/) + {//no processing required for null codec + User::Leave(KErrNotSupported); + //to keep compiler happy + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EEndOfData; + result.iSrcBytesProcessed = 0; + result.iDstBytesAdded = 0; + return result; + }; + + +TUint CMMFPcm16ToPcm16Codec::SourceBufferSize() + { + if (!iBufferSize) + iBufferSize = iHwDevice->CalculateBufferSize(); + return iBufferSize; + } + + +TUint CMMFPcm16ToPcm16Codec::SinkBufferSize() + { + if (!iBufferSize) + iBufferSize = iHwDevice->CalculateBufferSize(); + return iBufferSize; + } + +void CMMFPcm16ToPcm16Codec::SetHwDevice(CMMFPcm16ToPcm16HwDevice* aHwDevice) + { + iHwDevice = aHwDevice; + } + +TUint CMMFPcm16ToPcm16HwDevice::CalculateBufferSize() + { + TUint sampleRate = 0; + TUint channels = 0; + TInt useBufferOfSize = 0; + TInt minBufferSize = 0; + TInt maxBufferSize = 0; + + if (iPlayCustomInterface) + { + sampleRate = iSampleRate; + channels = iChannels; + if ((sampleRate) && (channels)) + { + RMdaDevSound::TSoundFormatsSupportedBuf playFormatsSupported; + if (iDataPath->Device().Handle()) + { + iDataPath->Device().PlayFormatsSupported(playFormatsSupported); + minBufferSize = playFormatsSupported().iMinBufferSize; + maxBufferSize = playFormatsSupported().iMaxBufferSize; + } + else + {//try to get handle + TInt err = iDataPath->Device().Open(); + if (err == KErrNone) + { + iDataPath->Device().PlayFormatsSupported(playFormatsSupported); + minBufferSize = playFormatsSupported().iMinBufferSize; + maxBufferSize = playFormatsSupported().iMaxBufferSize; + iDataPath->Device().Close(); + } + } + } + } + if ((iRecordCustomInterface) && (!sampleRate) && (!channels)) + { //must be record + sampleRate = iSampleRate; + channels = iChannels; + if ((sampleRate) && (channels)) + {//get max and min supported buffer sizes supported by hw + MSwSetParamInterface* interface = + static_cast(iDataPath->CustomInterface(KUidSwSetParamInterface)); + if (interface) + { + interface->GetBufferSizes(minBufferSize, maxBufferSize); + } + } + } +// else convert so not applicable + + if ((sampleRate) && (channels)) + { + // Buffer size = (SampleRate * BytesPerSample * Channels) / 4 + useBufferOfSize = ((sampleRate * 2 * channels)/KDevSoundFramesPerSecond + (KDevSoundDeltaFrameSize-1)) &~ (KDevSoundDeltaFrameSize-1); + //clamp buffer to desired limits + if(useBufferOfSize < KDevSoundMinFrameSize) + useBufferOfSize = KDevSoundMinFrameSize; + else if(useBufferOfSize > KDevSoundMaxFrameSize) + useBufferOfSize = KDevSoundMaxFrameSize; + + //clamp buffer to limits of hardware + if (maxBufferSize) + {//buffer size limits have been set by sound driver + //check we are within the limits + if(useBufferOfSize < minBufferSize) + useBufferOfSize = minBufferSize; + else if(useBufferOfSize > maxBufferSize) + useBufferOfSize = maxBufferSize; + } + } + else + { + useBufferOfSize = KPCM16ToPCM16BufferSize; + } + + return useBufferOfSize; + } + +TAny* CMMFPcm16ToPcm16HwDevice::CustomInterface(TUid aInterfaceId) + { + // if this is the bitrate interface then + // we support this natively + if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate) + { + return static_cast (this); + } + else + { + // otherwise pass the interface call onto the base class + return CMMFSwCodecWrapper::CustomInterface(aInterfaceId); + } + } + +void CMMFPcm16ToPcm16HwDevice::GetSupportedBitRatesL(RArray& aSupportedBitRates) + { + // precondition of needing the datapath + if (!iDataPath) + { + User::Leave(KErrNotReady); + } + + // we only use this interface on the record interface + if (iRecordCustomInterface) + { + MSwInfoInterface* interface = + static_cast(iDataPath->CustomInterface(KUidSwInfoInterface)); + if (interface) + { + RArray supportedSampleRates; + CleanupClosePushL(supportedSampleRates); + User::LeaveIfError(interface->GetSupportedSampleRates(supportedSampleRates)); + BitRatesFromSampleRatesL(aSupportedBitRates, supportedSampleRates); + CleanupStack::PopAndDestroy(&supportedSampleRates); + } + else + { + User::Leave(KErrNotSupported); + } + } + } + +void CMMFPcm16ToPcm16HwDevice::BitRatesFromSampleRatesL(RArray& aSupportedBitRates, + const RArray& aSupportedSampleRates) + { + for (TInt index=0; indexState() != CMMFSwCodecDataPath::EPlaying) + { + // update the member variable, assume it is picked up on next record. + iSampleRate = sampleRate; + } + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcm16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcm16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,90 @@ +// Copyright (c) 2002-2009 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\mmf\src\plugin\Hwdevice\audio\pcm16ToPcm16HwDevice.h +// +// + +#ifndef __MMF_PCM16_TO_PCM16_HW_DEVICE_H__ +#define __MMF_PCM16_TO_PCM16_HW_DEVICE_H__ +#include + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +#include "../../swcodecwrapper/mmfswaudioinput.h" + +#include "../../swcodecwrapper/mmfSwCodecDataPath.h" + +// for the bitrate custom interface +#include + +//note we need to keep this buffer at 8K as the tone utility expects 8K +const TInt KPCM16ToPCM16BufferSize = 0x2000; +const TInt KDevSoundMinFrameSize = 0x800; //2K +const TInt KDevSoundMaxFrameSize = 0x4000; //16K +const TInt KDevSoundDeltaFrameSize = 0x800; //2K +const TInt KDevSoundFramesPerSecond = 4; + +/* +* +* class CMMFPcm16ToPcm16HwDevice +* +*/ +class CMMFPcm16ToPcm16HwDevice : public CMMFSwCodecWrapper, + public MMMFDevSoundCustomInterfaceBitRate + { +public: + static CMMFPcm16ToPcm16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + virtual TAny* CustomInterface(TUid aInterfaceId); + ~CMMFPcm16ToPcm16HwDevice(); + + TUint CalculateBufferSize(); +private: + // from MMMFDevSoundCustomInterfaceBitRate + virtual void GetSupportedBitRatesL(RArray& aSupportedBitRates); + virtual TInt BitRateL(); + virtual void SetBitRateL(TInt aBitRate); + + void BitRatesFromSampleRatesL(RArray& aSupportedBitRates, const RArray& aSupportedSampleRates); + + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToPcm16Codec converts Pcm16 to pcm16 +* +*/ +class CMMFPcm16ToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/); +// virtual TUint SourceBufferSize() {return KPCM16ToPCM16BufferSize;}; +// virtual TUint SinkBufferSize() {return KPCM16ToPCM16BufferSize;}; + virtual TUint SourceBufferSize(); + virtual TUint SinkBufferSize(); + virtual TBool IsNullCodec() {return ETrue;}; + + void SetHwDevice(CMMFPcm16ToPcm16HwDevice* aHwDevice); +private: + TUint iBufferSize; + CMMFPcm16ToPcm16HwDevice* iHwDevice; + }; + +#endif //__MMF_PCM16_TO_PCM16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcmU8HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcmU8HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2003-2009 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 "MMFpcm16ToPcmU8HwDevice.h" + +/** + * + * Returns the created hw device for signed pcm16 to unsigned pcm8 audio. + * + * @return "CMMFPcm16ToPcmU8HwDevice" + * + */ +CMMFPcm16ToPcmU8HwDevice* CMMFPcm16ToPcmU8HwDevice::NewL() + { + CMMFPcm16ToPcmU8HwDevice* self = new (ELeave) CMMFPcm16ToPcmU8HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * + * Second phase constructor. + * + */ +void CMMFPcm16ToPcmU8HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToPcmU8Codec(); + } + +/** +* +* ~CMMFPcm16ToPcmU8HwDevice +*/ +CMMFPcm16ToPcmU8HwDevice::~CMMFPcm16ToPcmU8HwDevice() + { + //The codec is deleted in the base class CMMFSwCodecWrapper + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcm16ToPcmU8HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return 'CMMFSwCodec::TCodecProcessResult' +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToPcmU8Codec::ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSource); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDest); + + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + + TInt noSamples = srcUse /2; + iAudioS16ToU8Pcm.Convert(pSrc, pDst, noSamples ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse / 2; + + dst->Data().SetLength(result.iDstBytesAdded); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length()/2 == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16ToPcmU8Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( aSrcBuffer->Data().Length()/2 > aDestBuffer->Data().MaxLength() ) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcmU8HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcm16ToPcmU8HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCM16_TO_PCMU8_HW_DEVICE_H__ +#define __MMF_PCM16_TO_PCMU8_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" + +#include + +const TInt KPCM16ToPCMU8SourceBufferSize = 0x2000; +const TInt KPCM16ToPCMU8SinkBufferSize = 0x1000; //sink buffer length is half source + +/* +* +* class CMMFPcm16ToPcmU8HwDevice +* +*/ +class CMMFPcm16ToPcmU8HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToPcmU8HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToPcmU8HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToPcmU8Codec converts Pcm16 to Pcm unsigned 8 bit +* +*/ +class CMMFPcm16ToPcmU8Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToPCMU8SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToPCMU8SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioS16ToU8PcmCodec iAudioS16ToU8Pcm ; + }; + +#endif //__MMF_PCMS16_TO_PCMS8_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcmU8ToPcm16HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcmU8ToPcm16HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2003-2009 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 "MMFpcmU8ToPcm16HwDevice.h" + +/** + * + * Returns the created hw device for unsigned pcm8 to signed pcm16 audio. + * + * @return "CMMFPcmU8ToPcm16HwDevice" + * + */ +CMMFPcmU8ToPcm16HwDevice* CMMFPcmU8ToPcm16HwDevice::NewL() + { + CMMFPcmU8ToPcm16HwDevice* self = new (ELeave) CMMFPcmU8ToPcm16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * + * Second phase constructor. + * + */ +void CMMFPcmU8ToPcm16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcmU8ToPcm16Codec(); + } + +/** +* +* ~CMMFPcmU8ToPcm16HwDevice +* +*/ +CMMFPcmU8ToPcm16HwDevice::~CMMFPcmU8ToPcm16HwDevice() + { + //The codec is deleted in the base class CMMFSwCodecWrapper + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcmU8ToPcm16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSource +* @param aDst +* @return 'CMMFSwCodec::TCodecProcessResult' +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcmU8ToPcm16Codec::ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSource); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDest); + + //[ check preconditions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + TInt noSamples = srcUse; + iAudioU8ToS16Pcm.Convert(pSrc, pDst, noSamples ); + + TInt dstBytesAdded = srcUse * 2; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = dstBytesAdded; + + dst->Data().SetLength(dstBytesAdded); + + //[ check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length()/2, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // 2 here signifies sizeof TInt16 + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcmU8ToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( aSrcBuffer->Data().Length() * 2 > aDestBuffer->Data().MaxLength() ) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MMFpcmU8ToPcm16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MMFpcmU8ToPcm16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCMU8_TO_PCM16_HW_DEVICE_H__ +#define __MMF_PCMU8_TO_PCM16_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCMU8ToPCM16SourceBufferSize = 0x0800; +const TInt KPCMU8ToPCM16SinkBufferSize = 0x1000; //sink buffer length is twice source + +/* +* +* class CMMFPcmU8ToPcm16HwDevice +* +*/ +class CMMFPcmU8ToPcm16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcmU8ToPcm16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcmU8ToPcm16HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcmU8ToPcm16Codec converts Pcm 8 unsigned to Pcm16 +* +*/ +class CMMFPcmU8ToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCMU8ToPCM16SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCMU8ToPCM16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioU8ToS16PcmCodec iAudioU8ToS16Pcm ; + }; + +#endif //__MMF_PCMU8_TO_PCM16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MmfALawToPcm16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MmfALawToPcm16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_ALAW_TO_PCM16_HW_DEVICE_H__ +#define __MMF_ALAW_TO_PCM16_HW_DEVICE_H__ +#include +#include +#include + +const TInt KALawToCM16SrcBufferSize = 0x1000; +const TInt KALawToCM16SinkBufferSize = 0x2000; + +/* +* +* CMMFAlawToPcm16CodecHwDevice +* +*/ +class CMMFAlawToPcm16CodecHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFAlawToPcm16CodecHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFAlawToPcm16CodecHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFAlawToPcm16Codec coverts ALaw to PCM +* +*/ +class CMMFAlawToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KALawToCM16SrcBufferSize;}; + virtual TUint SinkBufferSize() {return KALawToCM16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); + TInt AlawSampleToPcm(TUint8 aAlaw); +private: + TMMFAudioALawToS16PcmCodec iAlawTo16Pcm; + }; + +#endif //__MMF_ALAW_TO_PCM16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MmfImaAdpcmtopcm16hwdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MmfImaAdpcmtopcm16hwdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,74 @@ +// Copyright (c) 2002-2009 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: +// + +#ifndef MMFIMAADPCMTOPCM16HWDEVICE_H +#define MMFIMAADPCMTOPCM16HWDEVICE_H +#include +#include +#include +#include + +const TInt KImaToPCM16SrcBufferSize = 1024; +const TInt KImaToPCM16SinkBufferSize = 4096; + +/* +* +* class CMMFImaAdpcmToPcm16CodecHwDevice +* +*/ +class CMMFImaAdpcmToPcm16CodecHwDevice : public CMMFSwCodecWrapper, public MMMFDevSoundCustomInterfaceFileBlockLength + { +public: + static CMMFImaAdpcmToPcm16CodecHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFImaAdpcmToPcm16CodecHwDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); +private: + void SetFileBlockLength(TUint aBlockAlign); + TAny* CustomInterface(TUid aInterfaceId); +private: + void ConstructL(); + +private: + TUint iBlockAlign; + }; + + +/* +* +* class CMMFMulawToPcm16Codec coverts Imaad to PCM16 +* +*/ +class CMMFImaAdpcmToPcm16Codec : public CMMFSwCodec + { +public: + CMMFImaAdpcmToPcm16Codec(); + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KImaToPCM16SrcBufferSize;} + virtual TUint SinkBufferSize() {return KImaToPCM16SinkBufferSize;} + TInt Configure(TUint aChannels, TUint aSampleRate, TUint aBlockAlign = 0); +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioImaAdpcmToS16PcmCodec iImaAdpcmTo16Pcm; + +private: + TUint iChannels; + TUint iSampleRate; + TUint iBlockAlign; + TUint iSamplesPerBlock; + }; + +#endif //MMFIMAADPCMTOPCM16HWDEVICE_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MmfMuLawToPcm16hwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MmfMuLawToPcm16hwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,153 @@ +// Copyright (c) 2003-2009 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 "MMFAudioCodec.h" +#include +#include "MmfMuLawToPcm16hwDevice.h" + +/** +* +* NewL +* +*/ +CMMFMulawToPcm16CodecHwDevice* CMMFMulawToPcm16CodecHwDevice::NewL() + { + CMMFMulawToPcm16CodecHwDevice* self=new(ELeave) CMMFMulawToPcm16CodecHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFMulawPcm16HwDevice +* +*/ +CMMFMulawToPcm16CodecHwDevice::~CMMFMulawToPcm16CodecHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFMulawToPcm16CodecHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFMulawToPcm16Codec(); + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFMulawToPcm16CodecHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return TCodecProcessResult +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFMulawToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[check preconditions hold ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + TInt noSamples = src->Data().Length(); + + iMulawTo16Pcm.Convert(pSrc, pDst, noSamples ); + + TUint dstBytesAdded = noSamples*sizeof(TInt16); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = src->Data().Length(); + result.iDstBytesAdded = dstBytesAdded; + + dst->Data().SetLength( dstBytesAdded ); + + //[ check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length()/2, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // 2 here signifies sizeof TInt16 + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFMulawToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength()/2 ) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MmfMuLawToPcm16hwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MmfMuLawToPcm16hwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_MULAW_TO_PCM16_HW_DEVICE_H__ +#define __MMF_MULAW_TO_PCM16_HW_DEVICE_H__ + +#include +#include + +#include + +const TInt KMuLawToCM16SrcBufferSize = 0x1000; +const TInt KMuLawToCM16SinkBufferSize = 0x2000; + +/* +* +* class CMMFMulawToPcm16CodecHwDevice +* +*/ +class CMMFMulawToPcm16CodecHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFMulawToPcm16CodecHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFMulawToPcm16CodecHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFMulawToPcm16Codec coverts MuLaw to PCM +* +*/ +class CMMFMulawToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KMuLawToCM16SrcBufferSize;}; + virtual TUint SinkBufferSize() {return KMuLawToCM16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); + TInt MulawSampleToPcm(TUint8 aAlaw); +private: + TMMFAudioMuLawToS16PcmCodec iMulawTo16Pcm; + }; + +#endif //__MMF_MULAW_TO_PCM16_HW_DEVICE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/MmfPcm16toAlawhwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/MmfPcm16toAlawhwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCM16_TO_ALAW_HW_DEVICE_H__ +#define __MMF_PCM16_TO_ALAW_HW_DEVICE_H__ +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToALawSrcBufferSize = 0x2000; +const TInt KPCM16ToAlawSinkBufferSize = 0x1000; + +/* +* +* class CMMFPcm16ToAlawHwDevice +* +*/ +class CMMFPcm16ToAlawHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToAlawHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToAlawHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToALawCodec coverts PCM to ALaw +* +*/ +class CMMFPcm16ToALawCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToALawSrcBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToAlawSinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioSPcm16ToAlawCodec iPcm16ToALaw; + }; + +#endif //__MMF_PCM16_TO_ALAW_HW_DEVICE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Mmfalawtopcm16hwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Mmfalawtopcm16hwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2003-2009 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 "MMFAudioCodec.h" +#include +#include "MmfALawToPcm16HwDevice.h" + + +/** +* +* NewL +* +*/ +CMMFAlawToPcm16CodecHwDevice* CMMFAlawToPcm16CodecHwDevice::NewL() + { + CMMFAlawToPcm16CodecHwDevice* self=new(ELeave) CMMFAlawToPcm16CodecHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFAlawPcm16HwDevice +* +*/ +CMMFAlawToPcm16CodecHwDevice::~CMMFAlawToPcm16CodecHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFAlawToPcm16CodecHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFAlawToPcm16Codec(); + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFAlawToPcm16CodecHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @pre position of buffer aSrc is 0 +* @pre position of buffer aDst is 0 +* @pre sufficient bytes in output to consume input +* @return TCodecProcessResult +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFAlawToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + TInt noSamples = src->Data().Length(); + iAlawTo16Pcm.Convert(pSrc, pDst, noSamples ); + + TUint dstBytesAdded = noSamples*sizeof(TInt16); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = src->Data().Length(); + result.iDstBytesAdded = dstBytesAdded; + + dst->Data().SetLength(dstBytesAdded); + + //[ check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length()/2, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // 2 here signifies sizeof TInt16 + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFAlawToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( aSrcBuffer->Data().Length() * 2 > aDestBuffer->Data().MaxLength() ) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/Mmfimaadpcmtopcm16hwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/Mmfimaadpcmtopcm16hwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,301 @@ +// Copyright (c) 2003-2009 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 "MMFAudioCodec.h" +#include +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include + +/** +* +* NewL +* +*/ +CMMFImaAdpcmToPcm16CodecHwDevice* CMMFImaAdpcmToPcm16CodecHwDevice::NewL() + { + CMMFImaAdpcmToPcm16CodecHwDevice* self=new(ELeave)CMMFImaAdpcmToPcm16CodecHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ConstructL +* +*/ +void CMMFImaAdpcmToPcm16CodecHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFImaAdpcmToPcm16Codec(); + } + +/** +* +* ~CMMFMulawPcm16HwDevice +* +*/ +CMMFImaAdpcmToPcm16CodecHwDevice::~CMMFImaAdpcmToPcm16CodecHwDevice() + { + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFImaAdpcmToPcm16CodecHwDevice::Codec() + { + return *iCodec; + } + +/** +Retrieves a custom interface to the device. +The reference CMMFImaAdpcmToPcm16CodecHwDevice supports one FileBlockLength custom interface, +or else calls two standard (CMMFSwCodecWrapper) custom interfaces,TPlayCustomInterface and TRecordCustomInterface. + +@param aInterface + Interface UID, defined with the custom interface. + aInterface = KUidCustomInterfaceDevSoundFileBlockLength, + aInterface = KMmfPlayCustomInterface for TPlayCustomInterface, + aInterface = KMmfRecordCustomInterface for TRecordCustomInterface. +@return A pointer to the interface implementation, The return value must be cast to the + correct type by the user. +*/ +TAny* CMMFImaAdpcmToPcm16CodecHwDevice::CustomInterface(TUid aInterfaceId) + { + if(aInterfaceId == KUidCustomInterfaceDevSoundFileBlockLength) + { + return static_cast(this); + } + else + { + return CMMFSwCodecWrapper::CustomInterface(aInterfaceId); + } + } + +/** +@see CMMFSwCodecWrapper::Start + +this function sets SampleRate and Channels for CMMFImaAdpcmToPcm16Codec +*/ +TInt CMMFImaAdpcmToPcm16CodecHwDevice::Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd) + { + TInt err = static_cast(iCodec)->Configure(iChannels, iSampleRate, iBlockAlign); + if (err == KErrNone) + { + err = CMMFSwCodecWrapper::Start(aFuncCmd, aFlowCmd); + } + + return err; + } + +/** +SetFileBlockLength + +This function sets file's block length for CMMFImaAdpcmToPcm16CodecHwDevice + +@param aBlockAlign + The file's block length +*/ +void CMMFImaAdpcmToPcm16CodecHwDevice::SetFileBlockLength(TUint aBlockAlign) + { + iBlockAlign = aBlockAlign; + } + +CMMFImaAdpcmToPcm16Codec::CMMFImaAdpcmToPcm16Codec() + { + iChannels = 1; + iSampleRate = 0; + iBlockAlign = KImaAdpcmBlockAlign; + iSamplesPerBlock = KImaAdpcmSamplesPerBlock; + } +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @pre position of buffer aSrc is 0 +* @pre position of buffer aDst is 0 +* @pre sufficient bytes in output to consume input +* @return TCodecProcessResult +* This function converts IMA ADPCM samples to PCM samples. +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFImaAdpcmToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + if( !CheckPreconditions( src, dst ) ) + { + //[ precondition(s) violation ] + User::Leave(KErrArgument); + } + + //calculate how much source is required to fill the destination buffer + TUint blocksRemaining = src->Data().Length() / iBlockAlign; + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + //[ [process full blocks ] + TUint dstBytesAdded = 0; + for( TUint count = 0; count < blocksRemaining; count++ ) + { + iImaAdpcmTo16Pcm.Convert(pSrc, pDst, iSamplesPerBlock); + pSrc += iBlockAlign; + pDst += (iSamplesPerBlock * sizeof(TInt16)); + dstBytesAdded += (iSamplesPerBlock * sizeof(TInt16)); + } + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = blocksRemaining * iBlockAlign; + result.iDstBytesAdded = dstBytesAdded; + dst->Data().SetLength(result.iDstBytesAdded); + + //[ check post conditions + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + TInt r1 = src->Data().Length(); + r1 /= iBlockAlign; + TInt r2 = dst->Data().Length(); + r2 /=(iSamplesPerBlock * sizeof(TInt16)); + __ASSERT_DEBUG( r1== r2, TMmfAudioCodecPanicsNameSpace::Panic(TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFImaAdpcmToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + const TUint KTempBufferSize = iSamplesPerBlock * 2; + TInt numInputSubFrames = aSrcBuffer->Data().Length() / iBlockAlign; + TInt numOutputSubFrames = aDestBuffer->Data().MaxLength() / KTempBufferSize; + + //[ we need modulo 1010 bytes on all src frames that are not the last + // frame + // For the last frame we will code only whole frames and effectively + // drop any remaining samples] + TBool validInputDataLength = (aSrcBuffer->Data().Length() % iBlockAlign == 0) ; + + if( (numInputSubFrames > numOutputSubFrames) || // sufficient space in the output for the input + (aSrcBuffer->Position() > 0 ) || // position must be zero since we can eat all the data + (aDestBuffer->Position() > 0 ) || + (!validInputDataLength)) //position must be zero + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } + +/** +Configure + +This function sets file's block length, channels & sample rate. + +@param aChannels + The file's number of channels +@param aSampleRate + The file's sample rate +@param aBlockAlign + The file's block length +*/ +TInt CMMFImaAdpcmToPcm16Codec::Configure(TUint aChannels, TUint aSampleRate, TUint aBlockAlign) + { + iChannels = aChannels; + iSampleRate = aSampleRate; + + if (aBlockAlign < 256) + { + switch (iSampleRate * iChannels) + { + case 8000: // fall through, same as 11025 + case 11025: + case 16000: + iBlockAlign = 256; + break; + case 22050: + iBlockAlign = 512; + break; + + case 44100: + iBlockAlign = 1024; + break; + + case 88200: + iBlockAlign = 2048; + break; + + default: + return KErrArgument; + } + } + else + { + iBlockAlign = aBlockAlign; + } + + const TUint KImaAdpcmBitsPerSample = 4; + iSamplesPerBlock = (iBlockAlign - 4 * iChannels) * 8 / (KImaAdpcmBitsPerSample * iChannels) + 1; + + return KErrNone; + } + + + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16SwapEndianhwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16SwapEndianhwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,156 @@ +// Copyright (c) 2003-2009 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: +// MmfMulawToPcm16HwDevice.cpp +// +// + +#include "MMFAudioCodec.h" +#include +#include "mmfpcm16SwapEndianhwdevice.h" + +/** +* +* NewL +* @return 'CMMFPcm16SwapEndianHwDevice*' +* +*/ +CMMFPcm16SwapEndianHwDevice* CMMFPcm16SwapEndianHwDevice::NewL() + { + CMMFPcm16SwapEndianHwDevice* self=new(ELeave) CMMFPcm16SwapEndianHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16SwapEndianHwDevice +*/ +CMMFPcm16SwapEndianHwDevice::~CMMFPcm16SwapEndianHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16SwapEndianHwDevice::ConstructL() + { + iCodec = new (ELeave)CMMFPcm16SwapEndianCodec(); + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFPcm16SwapEndianHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return 'CMMFSwCodec::TCodecProcessResult' +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16SwapEndianCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ check the preconditions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + TInt srcUse = src->Data().Length(); + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt noSamples = srcUse / 2; //divide by TWO as 2 bytes are equal to 1 sample + iPcm16EndianSwap.Convert(pSrc, pDst, noSamples ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse; + + dst->Data().SetLength(srcUse); + + //[ check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16SwapEndianCodec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength() ) || + ( aSrcBuffer->Data().Length() % 2 != 0 )) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16SwapEndianhwdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16SwapEndianhwdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + + +#ifndef __MMF_SWAP_ENDIAN_HW_DEVICE_H__ +#define __MMF_SWAP_ENDIAN_HW_DEVICE_H__ +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToPCM16BBufferSize = 0x2000; + +/* +* +* class CMMFPcm16SwapEndianHwDevice +* +*/ +class CMMFPcm16SwapEndianHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16SwapEndianHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16SwapEndianHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16SwapEndianCodec coverts PCM16 to PCM16Big Endian +* +*/ +class CMMFPcm16SwapEndianCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToPCM16BBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToPCM16BBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcm16SwapEndianCodec iPcm16EndianSwap; + }; + +#endif //__MMF_SWAP_ENDIAN_HW_DEVICE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16ToImaAdpcm.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16ToImaAdpcm.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,182 @@ +// Copyright (c) 2003-2009 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 "mmfpcm16ToImaAdpcm.h" + +/** +* +* NewL +* +*/ +CMMFPcm16ToImaAdpcmHwDevice* CMMFPcm16ToImaAdpcmHwDevice::NewL() + { + CMMFPcm16ToImaAdpcmHwDevice* self=new(ELeave) CMMFPcm16ToImaAdpcmHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16ToAlawHwDevice +* +*/ +CMMFPcm16ToImaAdpcmHwDevice::~CMMFPcm16ToImaAdpcmHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToImaAdpcmHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToImaAdpcmCodec(); + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFPcm16ToImaAdpcmHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ResetL +* +*/ +void CMMFPcm16ToImaAdpcmCodec::ResetL() + { + //Reset the actual codec + TMMFImaAdpcmCodecState state; + state.iIndex = 0; + state.iPredicted = 0; + iPcm16ToImaAdpcm.SetState(state); + } + +/** +* +* ProcessL +* @param aSrc src buffer +* @param aDst destination buffer +* @return CMMFSwCodec::TCodecProcessResult +* This function converts PCM samples to IMA ADPCM samples in +* blocks of KImaAdpcmBlockAlign (256) bytes. 1010 source +* bytes are required to fill a 256 byte block. +* @pre if last buffer and src contains < 1010 bytes discard input +* This function throws away the last buffer if it contains < 1010 bytes +* (ie we must have sufficient data to process an entire frame ) +* All other src buffers must contain +* All destination buffer must contain +* +**/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToImaAdpcmCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* source = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* destination = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ source and destination must not be null ] + if( !source || !destination ) + User::Leave( KErrArgument ); + + //[ check preconditions ] + if( !BuffersStatus( source, destination )) + { + User::Leave( KErrArgument ); + } + + //[ code the buffers ] + ProcessBuffers( *source, *destination, result ); + + return result; + } + +/** +* +* ProcessBuffers +* @param aSource +* @param aDestination +* @param aResult +* all we have to do is find out how many source frames there +* are to process and process them +* finally returning process complete and fillin the status of the result +* +**/ +void CMMFPcm16ToImaAdpcmCodec::ProcessBuffers(const CMMFDataBuffer& aSource, CMMFDataBuffer& aDestination, CMMFSwCodec::TCodecProcessResult& aResult ) + { + //[ calculate how many full buffers are to be processed ] + const TUint srcLen = aSource.Data().Length(); + TInt numFullSrcFrames = srcLen/KSourceFrameSize; + + TUint8* pSrc = const_cast(aSource.Data().Ptr()); + TUint8* pDst = const_cast(aDestination.Data().Ptr()); + TInt dstBytesAdded = 0; + // calculate number of pcm samples per source frame + const TInt KSamplesPerFrame = KSourceFrameSize/(sizeof(TInt16)); + + //[ convert all the buffers ] + for( TInt count = 0; count < numFullSrcFrames; count++ ) + { + i16PcmToImaAdpcm.Convert(pSrc, pDst, KSamplesPerFrame ); + pSrc += KSourceFrameSize; + pDst += KCodedFrameSize; + dstBytesAdded += KCodedFrameSize; + } + aResult.iSrcBytesProcessed = numFullSrcFrames*KSourceFrameSize; + aResult.iDstBytesAdded = dstBytesAdded; + aDestination.Data().SetLength( aResult.iDstBytesAdded); + } + +/** +* +* BuffersStatus +* @param source buffer containing the data to be coded +* @param destination buffer containing the coded data +* @return TBool EFalse indicates bad buffers +* +**/ +TBool CMMFPcm16ToImaAdpcmCodec::BuffersStatus( const CMMFDataBuffer* source, const CMMFDataBuffer* destination ) + { + TBool status = EFalse; + + //[ demand source and destination positions are zero ] + CMMFDataBuffer* pDst = const_cast( destination ); + if( source->Position() || destination->Position() ) + { + return status; + } + + //[ Have we got full buffers ] + TInt sourceBuffers = source->Data().Length()/KSourceFrameSize; + TInt destBuffers = (pDst->Data().MaxLength())/KCodedFrameSize; + + if( sourceBuffers <= destBuffers ) // the sink can process the source + { + return ETrue; // note this precondition has been weakened in line with other codecs + } // such that it can process partially full buffers + // ie you can if you wish use larger buffers than needed and only partially + // fill them. We do however expect all the input to be processed. + return status; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16ToImaAdpcm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16ToImaAdpcm.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCM16_TO_IMAADPCM_HW_DEVICE_H__ +#define __MMF_PCM16_TO_IMAADPCM_HW_DEVICE_H__ + +#include +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToImaSrcBufferSize = 0x3F20; +const TInt KPCM16ToImaSinkBufferSize = 0x1000; +const TUint KSourceFrameSize = KImaAdpcmSamplesPerBlock * 2; +const TUint KCodedFrameSize = KImaAdpcmBlockAlign; + +/* +* +* class CMMFPcm16ToMulawHwDevice +* +*/ +class CMMFPcm16ToImaAdpcmHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToImaAdpcmHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToImaAdpcmHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToALawCodec coverts Pcm16 to Imaad +* +*/ +class CMMFPcm16ToImaAdpcmCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToImaSrcBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToImaSinkBufferSize;}; +private: + virtual void ResetL(); + void ProcessBuffers(const CMMFDataBuffer& aSource, CMMFDataBuffer& aDestination, CMMFSwCodec::TCodecProcessResult& aResult ); + TBool BuffersStatus( const CMMFDataBuffer* source, const CMMFDataBuffer* destination ); +private: + TMMFAudioPcm16ToImaAdpcmCodec iPcm16ToImaAdpcm; + TMMFAudioPcm16ToImaAdpcmCodec i16PcmToImaAdpcm; + TUint iLastFrameNumber; + }; + +#endif //__MMF_PCM16_TO_IMAADPCM_HW_DEVICE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toAlawhwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toAlawhwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,156 @@ +// Copyright (c) 2003-2009 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 "MmfPcm16toAlawhwDevice.h" + +/** +* +* NewL +* +*/ +CMMFPcm16ToAlawHwDevice* CMMFPcm16ToAlawHwDevice::NewL() + { + CMMFPcm16ToAlawHwDevice* self=new(ELeave) CMMFPcm16ToAlawHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16ToAlawHwDevice +* +*/ +CMMFPcm16ToAlawHwDevice::~CMMFPcm16ToAlawHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToAlawHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToALawCodec(); + } + + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFPcm16ToAlawHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @pre position of buffer aSrc is 0 +* @pre position of buffer aDst is 0 +* @pre sufficient bytes in output to consume input +* @return TCodecProcessResult +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToALawCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + pSrc += src->Position(); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + pDst += dst->Position(); + + TUint destUse = src->Data().Length()/2; + + //compress TWO bytes (16-bit PCM word) into a to 1 byte sample + iPcm16ToALaw.Convert(pSrc, pDst, destUse ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = src->Data().Length(); + result.iDstBytesAdded = destUse; + + dst->Data().SetLength(result.iDstBytesAdded); + + //[ post condition evaluation here ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length()/2 == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16ToALawCodec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length()/2 > aDestBuffer->Data().MaxLength()) || + ( aSrcBuffer->Data().Length() % 2 != 0 )) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toMulawhwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toMulawhwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2003-2009 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 "mmfpcm16toMulawhwdevice.h" + +/** +* +* NewL +* +*/ +CMMFPcm16ToMulawHwDevice* CMMFPcm16ToMulawHwDevice::NewL() + { + CMMFPcm16ToMulawHwDevice* self=new(ELeave) CMMFPcm16ToMulawHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16ToMulawHwDevice +* +*/ +CMMFPcm16ToMulawHwDevice::~CMMFPcm16ToMulawHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToMulawHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToMuLawCodec(); + } + +/** +* +* Codec +* +*/ +CMMFSwCodec &CMMFPcm16ToMulawHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @pre position of buffer aSrc is 0 +* @pre position of buffer aDst is 0 +* @pre sufficient bytes in output to consume input +* @return TCodecProcessResult +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToMuLawCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + CMMFSwCodec::TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + if( !CheckPreconditions( src, dst ) ) + { + //[ precondition(s) violation ] + User::Leave(KErrArgument); + } + + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TUint destUse = src->Data().Length()/2; + + //compress TWO bytes (16-bit PCM word) into a to 1 byte sample + iPcm16ToMuLaw.Convert(pSrc, pDst, destUse ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = src->Data().Length(); + result.iDstBytesAdded = destUse; + + dst->Data().SetLength(result.iDstBytesAdded); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length()/2 == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16ToMuLawCodec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length()/2 > aDestBuffer->Data().MaxLength()) || + ( aSrcBuffer->Data().Length() % 2 != 0 )) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toMulawhwdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16toMulawhwdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCM16_TO_MULAW_HW_DEVICE_H__ +#define __MMF_PCM16_TO_MULAW_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToMuLawSrcBufferSize = 0x2000; +const TInt KPCM16ToMuLawSinkBufferSize = 0x1000; + +/* +* +* CMMFPcm16ToMulawHwDevice +* +*/ +class CMMFPcm16ToMulawHwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToMulawHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToMulawHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToALawCodec coverts PCM16 to MuLaw +* +*/ +class CMMFPcm16ToMuLawCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToMuLawSrcBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToMuLawSinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioSPcm16ToMuLawCodec iPcm16ToMuLaw; + }; + +#endif // __MMF_PCM16_TO_MULAW_HW_DEVICE_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16topcmU16BEHwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16topcmU16BEHwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,158 @@ +// Copyright (c) 2003-2009 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 "mmfpcm16topcmU16BEHwDevice.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcm16ToPcmU16BEHwDevice* CMMFPcm16ToPcmU16BEHwDevice::NewL() + { + CMMFPcm16ToPcmU16BEHwDevice* self = new (ELeave) CMMFPcm16ToPcmU16BEHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16ToPcmU16BEHwDevice +*/ +CMMFPcm16ToPcmU16BEHwDevice::~CMMFPcm16ToPcmU16BEHwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToPcmU16BEHwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToPcmU16BECodec(); + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +*/ +CMMFSwCodec& CMMFPcm16ToPcmU16BEHwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @pre position of buffer aSrc is 0 +* @pre position of buffer aDst is 0 +* @pre sufficient bytes in output to consume input +* @return 'CMMFSwCodec::TCodecProcessResult' +* this codec has a does not expand or shrink destination data +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToPcmU16BECodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ Check preconsitions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + + TInt noSamples = srcUse/2; // for pcm16 TInt16 + iAudioPcm16ToPcmU16Be.Convert(pSrc, pDst, noSamples ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse; + + dst->Data().SetLength(srcUse); + + //[ Check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16ToPcmU16BECodec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength() ) || + ( aSrcBuffer->Data().Length() % 2 != 0 ) ) // must have pcm16 samples on input + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16topcmU16BEHwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcm16topcmU16BEHwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +// Copyright (c) 2002-2009 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: +// + +#ifndef __MMF_PCM16_TO_PCMU16BE_HW_DEVICE_H__ +#define __MMF_PCM16_TO_PCMU16BE_HW_DEVICE_H__ +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToPCMU16BeSourceBufferSize = 0x1000; +const TInt KPCM16ToPCMU16BeSinkBufferSize = KPCM16ToPCMU16BeSourceBufferSize; + +/* +* +* CMMFPcm16ToPcmU16BEHwDevice +* +*/ +class CMMFPcm16ToPcmU16BEHwDevice: public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToPcmU16BEHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToPcmU16BEHwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToPcmU16BECodec comverts PCM16 to pcm16 unsigned big endian +* +*/ +class CMMFPcm16ToPcmU16BECodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToPCMU16BeSourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToPCMU16BeSinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcm16ToPcmU16BECodec iAudioPcm16ToPcmU16Be ; + }; + +#endif //__MMF_PCM16_TO_PCMU16BE_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16PcmS8HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16PcmS8HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,159 @@ +// Copyright (c) 2003-2009 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 "mmfpcmS16PcmS8HwDevice.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcmS16ToPcmS8HwDevice* CMMFPcmS16ToPcmS8HwDevice::NewL() + { + CMMFPcmS16ToPcmS8HwDevice* self = new (ELeave) CMMFPcmS16ToPcmS8HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcmS16ToPcmS8HwDevice +*/ +CMMFPcmS16ToPcmS8HwDevice::~CMMFPcmS16ToPcmS8HwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcmS16ToPcmS8HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcmS16ToPcmS8Codec(); + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcmS16ToPcmS8HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @param aSamples +* +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcmS16ToPcmS8Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[Check Preconditions] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + TInt noSamples = srcUse/2; + + //compress TWO bytes (16-bit PCM word) into a to 1 byte sample + iAudioPcmS16ToPcmS8.Convert(pSrc, pDst, noSamples ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse/2; + + dst->Data().SetLength(result.iDstBytesAdded); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length()/2 == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcmS16ToPcmS8Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length()/2 > aDestBuffer->Data().MaxLength() ) && + ( aSrcBuffer->Data().Length() % 2 == 0 ) ) // must have pcm16 samples on input + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16PcmS8HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16PcmS8HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2002-2009 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: +// + +#ifndef __MMF_PCMS16_TO_PCMS8_HW_DEVICE_H__ +#define __MMF_PCMS16_TO_PCMS8_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToPCM8SourceBufferSize = 0x1000; +const TInt KPCM16ToPCM8SinkBufferSize = 0x800; + +/* +* +* class CMMFPcmS16ToPcmS8HwDevice +* +*/ +class CMMFPcmS16ToPcmS8HwDevice: public CMMFSwCodecWrapper + { +public: + static CMMFPcmS16ToPcmS8HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcmS16ToPcmS8HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcmS16ToPcmS8Codec converts Pcms16 to Pcm 8 signed +* +*/ +class CMMFPcmS16ToPcmS8Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToPCM8SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToPCM8SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcmS16ToPcmS8Codec iAudioPcmS16ToPcmS8; + }; + +#endif //__MMF_PCMS16_TO_PCMS8_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16topcmU16Codec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16topcmU16Codec.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,162 @@ +// Copyright (c) 2003-2009 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 "mmfpcmS16topcmU16Codec.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcm16ToPcmU16HwDevice* CMMFPcm16ToPcmU16HwDevice::NewL() + { + CMMFPcm16ToPcmU16HwDevice* self = new (ELeave) CMMFPcm16ToPcmU16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm16ToPcmU16HwDevice +* +*/ +CMMFPcm16ToPcmU16HwDevice::~CMMFPcm16ToPcmU16HwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm16ToPcmU16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm16ToPcmU16CodecCodec(); + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcm16ToPcmU16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return 'CMMFSwCodec::TCodecProcessResult' +* this codec has a does not expand or shrink destination data +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm16ToPcmU16CodecCodec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[Check Preconditions] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + + TInt noSamples = srcUse/2; + iAudioPcm16ToPcmU16.Convert(pSrc, pDst, noSamples); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse; + + dst->Data().SetLength(srcUse); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 + // src data length is even + // dst data length is even ie pcm16 samples ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm16ToPcmU16CodecCodec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength() ) || + ( aSrcBuffer->Data().Length() % 2 != 0 ) ) // must have pcm16 samples on input + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16topcmU16Codec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS16topcmU16Codec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2002-2009 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: +// + +#ifndef __MMF_PCMS16_TO_PCMU16_HW_DEVICE_H__ +#define __MMF_PCMS16_TO_PCMU16_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM16ToPCMU16SourceBufferSize = 0x1000; +const TInt KPCM16ToPCMU16SinkBufferSize = KPCM16ToPCMU16SourceBufferSize; + +/* +* +* class CMMFPcm16ToPcmU16HwDevice +* +*/ +class CMMFPcm16ToPcmU16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm16ToPcmU16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm16ToPcmU16HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm16ToPcmU16CodecCodec converts Pcm16 to Pcm16 unsigned +* +*/ +class CMMFPcm16ToPcmU16CodecCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM16ToPCMU16SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM16ToPCMU16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcm16ToPcmU16Codec iAudioPcm16ToPcmU16; + }; + +#endif //__MMF_PCMS16_TO_PCMU16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS8ToPcmS16HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS8ToPcmS16HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,157 @@ +// Copyright (c) 2003-2009 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 "mmfpcmS8ToPcmS16HwDevice.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcm8ToPcm16HwDevice* CMMFPcm8ToPcm16HwDevice::NewL() + { + CMMFPcm8ToPcm16HwDevice* self = new (ELeave) CMMFPcm8ToPcm16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcm8ToPcm16HwDevice +*/ +CMMFPcm8ToPcm16HwDevice::~CMMFPcm8ToPcm16HwDevice() + { + } + +/** +* +* ConstructL +* +*/ +void CMMFPcm8ToPcm16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcm8ToPcm16Codec(); + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcm8ToPcm16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return 'CMMFSwCodec::TCodecProcessResult' +* this codec expands 1 byte to 2 bytes +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcm8ToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ check preconditions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt noSamples = src->Data().Length(); + iAudioPcm8ToPcm16.Convert(pSrc, pDst, noSamples ); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + TInt dstBytesAdded = noSamples *sizeof(TInt16); + result.iSrcBytesProcessed = src->Data().Length(); + result.iDstBytesAdded = dstBytesAdded; + dst->Data().SetLength(dstBytesAdded); + + //[ check post conditions ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length()/2, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // 2 here signifies sizeof TInt16 + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); // pcm output + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcm8ToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( aSrcBuffer->Data().Length() * 2 > aDestBuffer->Data().MaxLength() ) + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS8ToPcmS16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmS8ToPcmS16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + + +#ifndef __MMF_PCMS8_TO_PCMS16_HW_DEVICE_H__ +#define __MMF_PCMS8_TO_PCMS16_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCM8ToPCM16SourceBufferSize = 0x0800; +const TInt KPCM8ToPCM16SinkBufferSize = 0x1000; //sink buffer length is twice source + +/* +* +* class CMMFPcm8ToPcm16HwDevice +* +*/ +class CMMFPcm8ToPcm16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcm8ToPcm16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcm8ToPcm16HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcm8ToPcm16Codec converts pcm8 to pcm16 +* +*/ +class CMMFPcm8ToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCM8ToPCM16SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCM8ToPCM16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcm8ToPcm16Codec iAudioPcm8ToPcm16 ; + }; + +#endif //__MMF_PCMS8_TO_PCMS16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16BeToPcmS16HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16BeToPcmS16HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,161 @@ +// Copyright (c) 2003-2009 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 "mmfpcmU16BeToPcmS16HwDevice.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcmU16BeToPcmS16HwDevice* CMMFPcmU16BeToPcmS16HwDevice::NewL() + { + CMMFPcmU16BeToPcmS16HwDevice* self = new (ELeave) CMMFPcmU16BeToPcmS16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcmU16BeToPcmS16HwDevice +* +*/ +CMMFPcmU16BeToPcmS16HwDevice::~CMMFPcmU16BeToPcmS16HwDevice() + { + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcmU16BeToPcmS16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ConstructL +* +*/ +void CMMFPcmU16BeToPcmS16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcmU16BeToPcmS16Codec(); + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return CMMFSwCodec::TCodecProcessResult +* this codec has a does not expand or shrink destination data +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcmU16BeToPcmS16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ check preconditions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + TInt noSamples = srcUse/2; + iAudioPcmU16BeToPcmS16.Convert(pSrc, pDst, noSamples); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse; + + dst->Data().SetLength(srcUse); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 + // src data length is even + // dst data length is even ie pcm16 samples ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcmU16BeToPcmS16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength() ) || + ( aSrcBuffer->Data().Length() % 2 != 0 ) ) // must have pcm16 samples on input + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16BeToPcmS16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16BeToPcmS16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCMU16BE_TO_PCM16_HW_DEVICE_H__ +#define __MMF_PCMU16BE_TO_PCM16_HW_DEVICE_H__ +#include +#include "MMFAudioCodec.h" +#include + +const TInt KPCMU16BeToPCM16SourceBufferSize = 0x1000; +const TInt KPCMU16BeToPCM16SinkBufferSize = KPCMU16BeToPCM16SourceBufferSize; + +/* +* +* class CMMFPcmU16BeToPcmS16HwDevice +* +*/ +class CMMFPcmU16BeToPcmS16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcmU16BeToPcmS16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcmU16BeToPcmS16HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcmU16BeToPcmS16Codec converts Pcm16 Big endian to Pcm16 +* +*/ +class CMMFPcmU16BeToPcmS16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCMU16BeToPCM16SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCMU16BeToPCM16SinkBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioPcmU16BeToPcmS16Codec iAudioPcmU16BeToPcmS16; + }; + +#endif //__MMF_PCMU16BE_TO_PCM16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16TopcmS16HwDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16TopcmS16HwDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,160 @@ +// Copyright (c) 2003-2009 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 "mmfpcmU16TopcmS16HwDevice.h" + +/** + * + * Returns the created hw device for passing audio through audio. + * for the wins implementation this would always be pcm16 although + * this is effectively a null hw device that will pass any datatype through + * @return "CMMFPcm16ToPcmU16BEHwDevice" + * + */ +CMMFPcmU16ToPcm16HwDevice* CMMFPcmU16ToPcm16HwDevice::NewL() + { + CMMFPcmU16ToPcm16HwDevice* self = new (ELeave) CMMFPcmU16ToPcm16HwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** +* +* ~CMMFPcmU16ToPcm16HwDevice +* +*/ +CMMFPcmU16ToPcm16HwDevice::~CMMFPcmU16ToPcm16HwDevice() + { + } + +/** +* +* Codec +* @return 'CMMFSwCodec&' +* +*/ +CMMFSwCodec& CMMFPcmU16ToPcm16HwDevice::Codec() + { + return *iCodec; + } + +/** +* +* ConstructL +* +*/ +void CMMFPcmU16ToPcm16HwDevice::ConstructL() + { + iCodec = new (ELeave) CMMFPcmU16ToPcm16Codec(); + } + +/** +* +* ProcessL +* @param aSrc +* @param aDst +* @return CMMFSwCodec::TCodecProcessResult +* this codec has a does not expand or shrink destination data +*/ +CMMFSwCodec::TCodecProcessResult CMMFPcmU16ToPcm16Codec::ProcessL(const CMMFBuffer& aSrc, CMMFBuffer& aDst) + { + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = STATIC_CAST(const CMMFDataBuffer*, &aSrc); + CMMFDataBuffer* dst = STATIC_CAST(CMMFDataBuffer*, &aDst); + + //[ check preconditions ] + if( !CheckPreconditions( src, dst )) + { + //[ precondition violation ] + User::Leave( KErrArgument ); + } + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + TUint8* pSrc = CONST_CAST(TUint8*,src->Data().Ptr()); + TUint8* pDst = CONST_CAST(TUint8*,dst->Data().Ptr()); + + TInt srcUse = src->Data().Length(); + TInt noSamples = srcUse/2; + iAudioU16ToS16Pcm.Convert(pSrc, pDst, noSamples); + + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = srcUse; + result.iDstBytesAdded = srcUse; + dst->Data().SetLength(srcUse); + + //[ post conditions + // srcbytes/2 == destbytes added + // pos src == 0 + // pos dest == 0 + // src data length is even + // dst data length is even ie pcm16 samples ] + __ASSERT_DEBUG( (src->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( (dst->Position() == 0), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() == dst->Data().Length(), TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( dst->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + __ASSERT_DEBUG( src->Data().Length() % 2 == 0, TMmfAudioCodecPanicsNameSpace::Panic( TMmfAudioCodecPanicsNameSpace::EPostConditionViolation )); + + return result; + } + +/** +* +* Preconditions +* This methos tests the preconditions of the ProcessL method +* @return TBool ETrue for sucess and EFalse for failure of the preconditions +* +**/ +TBool CMMFPcmU16ToPcm16Codec::CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ) + { + TBool result = EFalse; + + if(! aSrcBuffer ) + { + return result; + } + + if( ! aDestBuffer ) + { + return result; + } + + // Check position of src and dest are 0 + if( aSrcBuffer->Position() ) + { + return result; + } + + // Check position of src and dest are 0 + if( aDestBuffer->Position() ) + { + return result; + } + + // check there are sufficient bytes in the output to consume the input + if( ( aSrcBuffer->Data().Length() > aDestBuffer->Data().MaxLength() ) || + ( aSrcBuffer->Data().Length() % 2 != 0 ) ) // must have pcm16 samples on input + { + return result; + } + + result = ETrue; // preconditions have been satisfied + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16TopcmS16HwDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/plugin/audio/mmfpcmU16TopcmS16HwDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2002-2003 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: +* +*/ + +#ifndef __MMF_PCMU16_TO_PCM16_HW_DEVICE_H__ +#define __MMF_PCMU16_TO_PCM16_HW_DEVICE_H__ + +#include +#include "MMFAudioCodec.h" +#include + + +const TInt KPCMU16ToPCM16SourceBufferSize = 0x1000; +const TInt KPCMU16ToPCM16SinkBufferSize = KPCMU16ToPCM16SourceBufferSize; + +/* +* +* class CMMFPcmU16ToPcm16HwDevice +* +*/ +class CMMFPcmU16ToPcm16HwDevice : public CMMFSwCodecWrapper + { +public: + static CMMFPcmU16ToPcm16HwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + ~CMMFPcmU16ToPcm16HwDevice(); +private: + void ConstructL(); + }; + +/* +* +* class CMMFPcmU16ToPcm16Codec converts Pcm16 Unsigned to Pcm16 +* +*/ +class CMMFPcmU16ToPcm16Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize() {return KPCMU16ToPCM16SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KPCMU16ToPCM16SourceBufferSize;}; +private: + TBool CheckPreconditions( const CMMFDataBuffer* aSrcBuffer, CMMFDataBuffer* aDestBuffer ); +private: + TMMFAudioU16ToS16PcmCodec iAudioU16ToS16Pcm ; + }; + +#endif //__MMF_PCMU16_TO_PCM16_HW_DEVICE_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MdaHwInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MdaHwInfo.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MDAHWINFO_H__ +#define __MDAHWINFO_H__ + +#include + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +class CMdaHwInfo : public CBase + { + +public: + static CMdaHwInfo* NewL(); + ~CMdaHwInfo(); + inline RMdaDevSound::TSoundFormatsSupportedBuf& GetPlayFormatsSupported() {return iPlayFormatsSupported;} + inline RMdaDevSound::TCurrentSoundFormatBuf& GetPlayFormat() {return iPlayFormat;} + inline RMdaDevSound::TSoundFormatsSupportedBuf& GetRecordFormatsSupported() { return iRecordFormatsSupported;} + inline RMdaDevSound::TCurrentSoundFormatBuf& GetRecordFormat() { return iRecordFormat;} + +protected: + CMdaHwInfo(); +private: + void ConstructL(); + void GetHwInfoL(); + + RMdaDevSound::TSoundFormatsSupportedBuf iPlayFormatsSupported; + RMdaDevSound::TCurrentSoundFormatBuf iPlayFormat; + RMdaDevSound::TSoundFormatsSupportedBuf iRecordFormatsSupported; + RMdaDevSound::TCurrentSoundFormatBuf iRecordFormat; + RMdaDevSound iDevice; + + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicy.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,104 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __MMFAUDIOPOLICY_H__ +#define __MMFAUDIOPOLICY_H__ + +#include +#include +#include "MmfAudioPolicyRequest.h" +#include +#include "MdaHwInfo.h" +#include "MmfDevSoundEventHandler.h" +#include +#include + +/** +Panic category and codes for the AudioPolicy +@internalTechnology +*/ +_LIT(KMMFAudioPolicyPanicCategory, "MMFAudioPolicy"); +enum TMMFAudioPolicyPanicCodes + { + EMMFAudioPolicyRequestArrayOverflow, + EMMFAudioPolicySessionEventQueueOverflow + }; + +class CAudioPolicy; // declared here. +/****************************************************************************** +* Class Name: CAudioPolicy +* +* Description: This class is ultimately implemented by the product team based +* on their requirements for audio behavior in the face of +* multiple audio requests simultaneously. The reference +* implementation is a simple priority scheme. If a request is +* a higher priority, it gets played, even if termination of a +* running request of lower prioirity is required. +******************************************************************************/ + +class CMMFAudioPolicyServer; + +NONSHARABLE_CLASS( CAudioPolicy ): public CBase +/** +*@internalTechnology +*/ + { +public: + + IMPORT_C static CAudioPolicy* NewL(CMMFAudioPolicyServer* aAudioPolicyServer); + void RemoveSessionFromList(CMMFAudioPolicyRequest* aAudioPolicyRequest); + ~CAudioPolicy(); + void MakeRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest); + void ModifyEntry(TInt aPolicySessionId,const TMMFAudioPolicyState aNewState); + void RemoveFromList(TInt aPolicySessionId, TBool aAllowTimerRestart=ETrue); + void LaunchRequest(TInt aSessionId); + void ReserveClientNumL(TInt aNum); + void NotifyNextClient(); + TInt SetNotification(TInt aSessionId,TUid aEventType); + inline CMdaHwInfo* MdaHwInfo(void) {return iMdaHwInfo;} +protected: + CAudioPolicy(CMMFAudioPolicyServer* aAudioPolicyServer); +private: + enum {EGranularity=8}; + typedef CMMFAudioPolicyRequest* PtrPolicyRequest; + typedef CArrayFixFlat CPolicyReqPtrArray; + CPolicyReqPtrArray* iAudioPolicyRequestArray; + + CMMFAudioPolicyServer* iAudioPolicyServer; + CMdaHwInfo* iMdaHwInfo; + TInt iNotifiedSessionId; // latest attemped session Id + TInt iSessionIdAwaitingForDevsound; + TInt iStopHandledFromSessId; + + void ConstructL(); + + CMMFAudioPolicyRequest* FindPolicyRequestById(TInt aSessionId) const; + TPolicyResponse ProcessRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest); + void HandlePreferences(CMMFAudioPolicyRequest* aAudioPolicyRequest, TInt aPref, TPolicyResponse& aResponse); + void NotifySessionWithTimeout(TInt aPolicySessionIdx, TMMFAudioPolicyEvent::TAudioPolicyEventType aEvent); + TBool IsRegisteredNotification(TInt aSessionId) const; + TInt CheckSessionToNotify(); + }; + +/** +The function panic raises a panic from within the MmfAudioPolicy library +@param The argument is a member of the enumeration TMMFAudioPolicyPanicCodes +*/ +GLDEF_C void Panic(TMMFAudioPolicyPanicCodes aError); + + +#endif + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicyRequest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicyRequest.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,100 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __MMF_AUDIOPOLICYREQUEST_H__ +#define __MMF_AUDIOPOLICYREQUEST_H__ + +#include +#include "MmfPolicyClientServer.h" + +enum TPolicyResponse +{ + EProceed, // resource is available for immediate use + EDenied, // request is denied + EStopThenProceed, // someone must be stopped to honor this request + EResume, + EMix +}; +class CMMFAudioPolicyRequest; // declared here +/****************************************************************************** +* Class Name: CMMFAudioPolicyRequest +* +* Description: This class carries request information from the client to the +* server, upon making a request to proceed with a user's command. +* +******************************************************************************/ + + +NONSHARABLE_CLASS( CMMFAudioPolicyRequest ) : public CBase +/** +*@internalTechnology +*/ + { +public: + CMMFAudioPolicyRequest(); + ~CMMFAudioPolicyRequest(); + + // Accessor methods: + + inline void SetPrioritySettings(const TMMFAudioPolicyPrioritySettings& aPrioritySettings); + + inline TInt Priority() const; + inline void SetPriority(TInt aPriority); + + inline TMMFAudioPolicyState State() const; + inline void SetState(TMMFAudioPolicyState aState); + + inline TMdaPriorityPreference Pref() const; + inline void SetPref(TMdaPriorityPreference aPref); + + inline TInt PolicySessionId() const; + + inline TUid NotificationEvent() const; + inline void SetNotificationEvent(TUid aNotificationEventUid); + inline void ResetNotificationEvent(TUid aNotificationEventUid); + inline void SetEventFlag(TBool aEventFlag); + inline TBool IsEventNotified() const; + + inline TBool SendEventPending() const; + inline void SetSendEventPending(TBool aValue); + + void SetRequestDataL(const TDesC8& aRequestData); + inline const TDesC8& RequestData() const; + + inline TBool Capabilities() const; + inline void SetCapabilities(TBool aCaps); + +private: + + TInt iPriority; + TMdaPriorityPreference iPref; + TMMFAudioPolicyState iState; + TInt iPolicySessionId; + TMMFAudioPolicyPrioritySettings iPrioritySettings; + TUid iNotificationEventUid; + TBool iEventNotified; + TBool iSendEventPending; + HBufC8* iRequestData; + TPtrC8 iReqDataPtr; + + TBool iCapabilities; + + friend class CMMFAudioPolicySession; // Allow this class to use SetSessionId() + inline void SetPolicySessionId(TInt aPolicySessionId); + }; + +#include "MmfAudioPolicyRequest.inl" + +#endif //__MMF_AUDIOPOLICYREQUEST_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicyRequest.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicyRequest.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,95 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef MMFAUDIOPOLICYREQUEST_INL +#define MMFAUDIOPOLICYREQUEST_INL + +inline TInt CMMFAudioPolicyRequest::Priority() const +{ return (iPriority);} + +inline void CMMFAudioPolicyRequest::SetPriority(TInt aPriority) +{ iPriority = aPriority;} + +inline TMdaPriorityPreference CMMFAudioPolicyRequest::Pref() const +{ return (iPref);} + +inline void CMMFAudioPolicyRequest::SetPref(TMdaPriorityPreference aPref) +{ iPref = aPref;} + +inline TMMFAudioPolicyState CMMFAudioPolicyRequest::State() const +{ return (iState);} + +inline void CMMFAudioPolicyRequest::SetState(TMMFAudioPolicyState aState) +{ iState = aState;} + +inline TInt CMMFAudioPolicyRequest::PolicySessionId() const +{ return (iPolicySessionId);} + +inline void CMMFAudioPolicyRequest::SetPolicySessionId(TInt aPolicySessionId) +{ iPolicySessionId = aPolicySessionId;} + +inline void CMMFAudioPolicyRequest::SetPrioritySettings(const TMMFAudioPolicyPrioritySettings& aPrioritySettings) +{ iPrioritySettings = aPrioritySettings;} + +inline TUid CMMFAudioPolicyRequest::NotificationEvent() const +{ return (iNotificationEventUid);} + +inline void CMMFAudioPolicyRequest::SetNotificationEvent(TUid aNotificationEventUid) + { + iNotificationEventUid.iUid = aNotificationEventUid.iUid; + SetEventFlag(EFalse); + } + +inline void CMMFAudioPolicyRequest::ResetNotificationEvent(TUid /*aNotificationEventUid*/) + { + iNotificationEventUid = KNullUid; + } + +inline void CMMFAudioPolicyRequest::SetEventFlag(TBool aEventFlag) + { + iEventNotified = aEventFlag; + } + +inline TBool CMMFAudioPolicyRequest::IsEventNotified() const + { + return iEventNotified; + } + +inline TBool CMMFAudioPolicyRequest::Capabilities() const + { + return iCapabilities; + } +inline void CMMFAudioPolicyRequest::SetCapabilities(TBool aCaps) + { + iCapabilities = aCaps; + } + +inline TBool CMMFAudioPolicyRequest::SendEventPending() const + { + return iSendEventPending; + } + +inline void CMMFAudioPolicyRequest::SetSendEventPending(TBool aValue) + { + iSendEventPending = aValue; + } + +inline const TDesC8& CMMFAudioPolicyRequest::RequestData() const + { + return iReqDataPtr; + } + +#endif // MMFAUDIOPOLICYREQUEST_INL + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicyServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicyServer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,75 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __MMFAUDIOPOLICYSERVER_H__ +#define __MMFAUDIOPOLICYSERVER_H__ + +#include +#include +#include "MmfAudioPolicy.h" +#include "MmfPolicyClientServer.h" +#include "MmfAudioPolicyStart.h" + +class CMMFAudioPolicyServer; // declared here. + +NONSHARABLE_CLASS( CMMFAudioPolicyServer ): public CMmfIpcServer +/** +*@internalTechnology +*/ + { +public: + static CMMFAudioPolicyServer* NewL(); + ~CMMFAudioPolicyServer(); + CMmfIpcSession* NewSessionL(const TVersion &aVersion) const; + void IncrementSessionId(); + void SendEventToClient(TInt aSessionToAlert,const TMMFAudioPolicyEvent& aEvent); + void LaunchRequest(TInt aSessionId,const TMMFAudioPolicyEvent& aEvent); + inline CAudioPolicy* AudioPolicy() {return iAudioPolicy;}; + inline TInt PolicySessionId() {return iPolicySessionId;}; + static TInt SendNotification(TAny* aAny); + TBool IsTimerActive() const; + + IMPORT_C static TInt StartThread(TAny* aParams); + void IncrementSessionCount(); + void DecrementSessionCount(); + TInt PolicySessionCount(); + + void StopNotificationTimer(); + void StartNotificationTimer(TBool aZeroDelay=EFalse); + +private: + class CNotificationTimer : public CTimer + { + public: + static CNotificationTimer* NewL(TCallBack aCallBack); + private: + virtual void RunL(); + CNotificationTimer(TCallBack aCallBack); + private: + TCallBack iCallBack; + }; + + CMMFAudioPolicyServer(); + void ConstructL(); + static void StartThreadL(TServerStart& aStart); + +private: + TInt iPolicySessionId; + CAudioPolicy* iAudioPolicy; + TInt iPolicySessionCount; + CNotificationTimer* iNotificationTimer; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicySession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicySession.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,111 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __MMFAUDIOPOLICYSESSION_H__ +#define __MMFAUDIOPOLICYSESSION_H__ + +#include +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include "MmfAudioPolicyRequest.h" +#include "MmfPolicyClientServer.h" +#include "MmfDevSoundEventHandler.h" +#include + +class CMMFAudioPolicyEventReceiver : public CBase +/** +*@internalTechnology +*/ + { +public: + static CMMFAudioPolicyEventReceiver* NewL(const RMmfIpcMessage& aMessage); + ~CMMFAudioPolicyEventReceiver(); + void SendEvent(const TMMFAudioPolicyEvent& aEvent); + void SendEvent(const TMMFEvent& aEvent); +private: + CMMFAudioPolicyEventReceiver(const RMmfIpcMessage& aMessage); +private: + RMmfIpcMessage iMessage; + TBool iNeedToCompleteMessage; + }; + +class CAudioPolicy; +class CMMFAudioPolicyServer; + + + + +class CMMFAudioPolicySession : public CMmfIpcSession +/** +*@internalTechnology +*/ + { +public: + static CMMFAudioPolicySession* NewL(); + ~CMMFAudioPolicySession(); + void CreateL(const CMmfIpcServer& aServer); + void ServiceL(const RMmfIpcMessage& aMessage); + CMMFAudioPolicyRequest* AudioPolicyRequest(void) {return iAudioPolicyRequest;}; + TInt PolicySessionId(void) {return iPolicySessionId;}; + void SendEventToClient(const TMMFAudioPolicyEvent& aEvent); + CMMFAudioPolicyServer* Server(); + void ClearEventQ(); + +private: + class TMMFAudioPolicyEventHolder + { + public: + TMMFAudioPolicyEventHolder(const TMMFAudioPolicyEvent& aEvent, TBool aNeedsDeletion) : iEvent(aEvent), + iShallBeDeleted(aNeedsDeletion) {}; + TMMFAudioPolicyEvent iEvent; + const TBool iShallBeDeleted; + TSglQueLink iLink; + }; + +private: + CMMFAudioPolicySession(); + void ConstructL(); + void MakeRequestL(const RMmfIpcMessage& aMessage); + TBool UpdateStateL(const RMmfIpcMessage& aMessage); + TBool ReceiveEventsL(const RMmfIpcMessage& aMessage); + TBool CancelReceiveEvents(); + TBool GetPlayFormatsSupportedL(const RMmfIpcMessage& aMessage); + TBool GetRecordFormatsSupportedL(const RMmfIpcMessage& aMessage); + TBool GetPlayFormatL(const RMmfIpcMessage& aMessage); + TBool GetRecordFormatL(const RMmfIpcMessage& aMessage); + TBool SetDevSoundInfoL(const RMmfIpcMessage& aMessage); + TBool LaunchRequest(); + TBool RequestResourceNotificationL(const RMmfIpcMessage& aMessage); + TBool CancelRequestResourceNotificationL(const RMmfIpcMessage& aMessage); + TBool StopNotificationL(const RMmfIpcMessage& aMessage); + TBool GetResourceNotificationEventL(const RMmfIpcMessage& aMessage) const; + CMMFAudioPolicyServer* iServer; + CMMFAudioPolicyRequest* iAudioPolicyRequest; + CAudioPolicy* iAudioPolicy; + CMMFAudioPolicyEventReceiver* iEventReceiver; + TSglQue iEventsQue; + TInt iPolicySessionId; + TInt iDevSoundId; + TMMFAudioPolicyPrioritySettings iAudioPolicyPrioritySettings; + TMMFAudioPolicyEventHolder iNoMemoryEventHolder; + TBool iNoMemoryEventUsed; + TInt iEventQSize; + }; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicyStart.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicyStart.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2009 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: +// + + + +#ifndef __MMFAUDIOPOLICYSTART_H +#define __MMFAUDIOPOLICYSTART_H + +#include + +_LIT(KAudioPolicyServerName,"!MMFAudioPolicy"); +const TInt KAudioPolicyServerStackSize=0x2000; // 8KB +const TInt KAudioPolicyServerInitHeapSize=0x1000; // 4KB +const TInt KAudioPolicyServerMaxHeapSize=0x1000000; // 16MB + + +const TUint KMMFAudioPolicyVersion=8; +const TUint KMMFAudioPolicyMinorVersionNumber=0; +const TUint KMMFAudioPolicyBuildVersionNumber=1; + + +class TServerStart +/** +*@internalTechnology +*/ + { +public: + TServerStart(RServer2& aPolicyServerHandle); +public: + RServer2& iPolicyServerHandle; + }; + +#include "MmfAudioPolicyStart.inl" +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfAudioPolicyStart.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfAudioPolicyStart.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,20 @@ +// Copyright (c) 2005-2009 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: +// + +inline TServerStart::TServerStart(RServer2& aPolicyServerHandle) + :iPolicyServerHandle(aPolicyServerHandle) + { + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfDevSoundEventHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfDevSoundEventHandler.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,90 @@ +// Copyright (c) 2001-2009 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: +// + + +#ifndef __MMFDEVSOUNDEVENTHANDLER_H +#define __MMFDEVSOUNDEVENTHANDLER_H + +#include +#include +#include "MmfPolicyClientServer.h" + +class CMMFDevSoundSessionXtnd; + +class RMMFAudioPolicyProxy; + + +class TMMFAudioPolicyEvent + { +public: + +/** + Default constructor. + + Provided so this class can be packaged in a TPckgBuf<>. + @since 7.0s +*/ + TMMFAudioPolicyEvent() : iEventType(EMMFAudioPolicyNoEvent), iErrorCode(KErrNone) {}; + + enum TAudioPolicyEventType + { + EMMFAudioPolicyNoEvent = 0, + EMMFAudioPolicySwitchToIdle, + EMMFAudioPolicyPriorityTooLow, + EMMFAudioPolicyResourceNotification + }; + + TMMFAudioPolicyEvent(TAudioPolicyEventType aType, TInt aError, TMMFAudioPolicyState aState) : + iEventType(aType), iErrorCode(aError), iState(aState) {}; + + TAudioPolicyEventType iEventType; + TInt iErrorCode; + TMMFAudioPolicyState iState; + + }; + +typedef TPckgBuf TMMFAudioPolicyEventPckg; + +class CMMFDevSoundEventHandler : public CActive +/** +*@internalTechnology +*/ + { +public: + static CMMFDevSoundEventHandler* NewL(RMMFAudioPolicyProxy* aAudioPolicyProxy); + ~CMMFDevSoundEventHandler(); + void ReceiveEvents(); + void CancelReceiveEvents(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + void SetDevSoundInfo(CMMFDevSoundSessionXtnd* aDevSound); + +private: + void ConstructL(); + CMMFDevSoundEventHandler(RMMFAudioPolicyProxy* aAudioPolicyProxy); +private: + enum {EGranularity=8}; + RMMFAudioPolicyProxy* iAudioPolicyProxy; + TMMFAudioPolicyEventPckg iAudioPolicyEventPckg; + TRequestStatus iRequestStatus; + TInt iDevSoundId; + CMMFDevSoundSessionXtnd* iDevSound; + }; + + + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfDevSoundInfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfDevSoundInfo.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,36 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMF_DEVSOUNDINFO_H__ +#define __MMF_DEVSOUNDINFO_H__ + +#include +#include + + +class TMMFDevSoundInfo +/** +*@internalTechnology +*/ + { +public: + TInt iDevSoundId; + // More to be added for OMAP server + }; + +typedef TPckgBuf TMMFDevSoundInfoPckg; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/MmfPolicyClientServer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/MmfPolicyClientServer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,85 @@ +// Copyright (c) 1999-2009 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: +// + +#ifndef MMFPOLICYCLIENTSERVER_H +#define MMFPOLICYCLIENTSERVER_H + +#include + +// opcodes used in message passing between client and server +enum TMMFPolicyServerRequest + { + EMMFPolicySetDevSoundInfo, + EMMFPolicyMakeRequest, + EMMFPolicyCancelMakeRequest, + EMMFPolicyUpdateState, + EMMFPolicyReceiveEvents, + EMMFPolicyCancelReceiveEvents, + EMMFPolicyGetPlayFormatsSupported, + EMMFPolicyGetRecordFormatsSupported, + EMMFPolicyGetPlayFormat, + EMMFPolicyGetRecordFormat, + EMMFPolicyLaunchRequests, + EMMFPolicyRequestResourceNotification, + EMMFPolicyCancelRequestResourceNotification, + EMMFPolicyStopNotification, + EMMFPolicyGetResourceNotificationEvent + }; + +// All the "play" states must be LOWER in value than EMMFStateStopped! +enum TMMFAudioPolicyState + { + EMMFStatePlayData, // 0 + EMMFStateRecordData, // 1 + EMMFStatePlayTone, // 2 + EMMFStatePlayDTMFString, // 3 + EMMFStatePlayToneSequence, // 4 + EMMFStateStopped, // 5 + EMMFStateClosed, // 6 + EMMFStatePaused, // 7 + EMMFStatePlayDualTone, // 8 + EMMFStateNotified, // 9 + EMMFStateCompleted, // 10 + EMMFStateWaitingForResource,// 11 + EMMFStatePreempted, // 12 + }; + + +class TMMFAudioPolicyPrioritySettings +/** +*@internalTechnology +*/ + { +public: + TInt iPriority; + TMdaPriorityPreference iPref; + TMMFAudioPolicyState iState; + TBool iCapabilities; + }; + +class TMMFResourceNotificationSettings +/** +*@internalTechnology +*/ + { +public: + TUid iNotificationUid; + TBufC8<256> iNotificationDelay; + }; + +typedef TPckgBuf TMMFAudioPolicyPrioritySettingsPckg; +typedef TPckgBuf TMMFAudioPolicyResourceNotificationSettingsPckg; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/Policy/MdaHwInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/Policy/MdaHwInfo.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,70 @@ +// Copyright (c) 2002-2009 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 "MdaHwInfo.h" +#include + +#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + _LIT(KPddFileName,"ESDRV.PDD"); + _LIT(KLddFileName,"ESOUND.LDD"); +#endif + +CMdaHwInfo::~CMdaHwInfo() + { + } + +void CMdaHwInfo::ConstructL() + { + GetHwInfoL(); + } + +CMdaHwInfo* CMdaHwInfo::NewL() + { + CMdaHwInfo* self = new(ELeave)CMdaHwInfo(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return(self); + } + +CMdaHwInfo::CMdaHwInfo() + { + } + +void CMdaHwInfo::GetHwInfoL() + { +//#ifdef __WINS__ @@@ Sound drivers must be present!!! +#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + TInt ret = User::LoadPhysicalDevice(KPddFileName); + if ((ret!=KErrNone) && (ret!=KErrAlreadyExists)) + User::Leave(ret); + ret = User::LoadLogicalDevice(KLddFileName); + if ((ret!=KErrNone) && (ret!=KErrAlreadyExists)) + User::Leave(ret); +#endif//Adapter loads the drivers too. + User::LeaveIfError(iDevice.Open()); + if (!iDevice.Handle()) + User::Leave(KErrBadHandle); + + iDevice.PlayFormatsSupported(iPlayFormatsSupported); + iDevice.GetPlayFormat(iPlayFormat); + iDevice.RecordFormatsSupported(iRecordFormatsSupported); + iDevice.GetRecordFormat(iRecordFormat); + + iDevice.Close(); + +//#endif + + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,429 @@ +// Copyright (c) 2001-2009 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 "MmfAudioPolicy.h" +#include "MmfAudioPolicySession.h" +#include "MmfAudioPolicyServer.h" +#include "MdaHwInfo.h" +#include "MmfAudioPolicyRequest.h" + +/** +*@internalTechnology +*@return if a client owns or wish to own audio resource +*/ +inline TBool IsActiveState(TMMFAudioPolicyState aState) + { + return (aState < EMMFStateStopped || aState==EMMFStateNotified || aState==EMMFStatePlayDualTone); + } + +CAudioPolicy::~CAudioPolicy() + { + delete iMdaHwInfo; + delete iAudioPolicyRequestArray; + } + +void CAudioPolicy::ConstructL() + { + // Create dynamic array for sessions list + iAudioPolicyRequestArray = new(ELeave) CPolicyReqPtrArray(CAudioPolicy::EGranularity); + iMdaHwInfo = CMdaHwInfo::NewL(); + } + +EXPORT_C CAudioPolicy* CAudioPolicy::NewL(CMMFAudioPolicyServer* aAudioPolicyServer) + { + + CAudioPolicy* self = new(ELeave)CAudioPolicy(aAudioPolicyServer); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return(self); + } + +CAudioPolicy::CAudioPolicy(CMMFAudioPolicyServer* aAudioPolicyServer) : + iAudioPolicyServer(aAudioPolicyServer), + iNotifiedSessionId(KErrNotFound), + iSessionIdAwaitingForDevsound(KErrNotFound), + iStopHandledFromSessId(KErrNotFound) + { + } + +void CAudioPolicy::MakeRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest) + { +// since we have a FIFO q, then remove request and re-add it. + RemoveFromList(aAudioPolicyRequest->PolicySessionId(), EFalse); + if (iStopHandledFromSessId==aAudioPolicyRequest->PolicySessionId()) + { + iStopHandledFromSessId=KErrNotFound; + } +// Process Request by looking at priorities, preferences, special states... + TPolicyResponse responseValue = ProcessRequest(aAudioPolicyRequest); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess ID=%d, Priority=%d"),aAudioPolicyRequest->PolicySessionId(),aAudioPolicyRequest->Priority()); +#endif + switch (responseValue) + { + case EDenied: + { + TMMFAudioPolicyEvent responseEvent(TMMFAudioPolicyEvent::EMMFAudioPolicyPriorityTooLow, KErrInUse,EMMFStateWaitingForResource); + // the client won't be notified until he has request so, so we can set its state anyway + aAudioPolicyRequest->SetState( EMMFStateWaitingForResource ); + iAudioPolicyServer->SendEventToClient(aAudioPolicyRequest->PolicySessionId(), responseEvent); + } + break; + case EProceed: + { + iAudioPolicyServer->StopNotificationTimer(); + TMMFAudioPolicyEvent responseEvent(TMMFAudioPolicyEvent::EMMFAudioPolicyNoEvent, KErrNone, aAudioPolicyRequest->State()); + iAudioPolicyServer->SendEventToClient(aAudioPolicyRequest->PolicySessionId(), responseEvent); + } + break; + case EStopThenProceed: + { + iAudioPolicyServer->StopNotificationTimer(); + iSessionIdAwaitingForDevsound=aAudioPolicyRequest->PolicySessionId(); + // we have to wait for devsound to stop client(s), then notify that one + } + break; + case EResume: + case EMix: + default: + ASSERT(EFalse); + } + TRAPD(err, iAudioPolicyRequestArray->AppendL(aAudioPolicyRequest) ); + __ASSERT_ALWAYS(err==KErrNone, Panic(EMMFAudioPolicyRequestArrayOverflow) ); // we reserved space, so shouldn't hit this + } + +TPolicyResponse CAudioPolicy::ProcessRequest(CMMFAudioPolicyRequest* aAudioPolicyRequest) + { + // If there is no other item on list, return with proceed + if (iAudioPolicyRequestArray->Count()==0) + { + return EProceed; + } + + TPolicyResponse responseValue(EProceed); + TInt requestPriority = aAudioPolicyRequest->Priority(); + + TBool requestCaps = aAudioPolicyRequest->Capabilities(); + + // Iterate through list and compare priorities: + // QUEST: state checking shall be done as well? + for (TInt index = 0; index < iAudioPolicyRequestArray->Count(); index++) + { + CMMFAudioPolicyRequest& currentReq=*(*iAudioPolicyRequestArray)[index]; + if (!IsActiveState(currentReq.State()) ) // this request is inactive + { + continue; + } + // If there's even one on the list w/ a higher priority deny request and leave: + + if (currentReq.Capabilities() > requestCaps) + { + responseValue = EDenied; + break; + } + else if(currentReq.Capabilities() == requestCaps) + { + if(currentReq.Priority() >= requestPriority) + { + responseValue = EDenied; + break; + } + } + if (currentReq.State()==EMMFStateWaitingForResource || currentReq.State()==EMMFStatePreempted) + { + continue; + } + // we need to stop active client since new request is of higher priority + TMMFAudioPolicyEvent freezeEvent(TMMFAudioPolicyEvent::EMMFAudioPolicyPriorityTooLow, KErrInUse, EMMFStatePaused); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess ID=%d, State=%d Has been preempted"),currentReq.PolicySessionId(),currentReq.State()); +#endif + currentReq.SetState( EMMFStatePreempted ); + currentReq.SetEventFlag(EFalse); + iAudioPolicyServer->SendEventToClient(currentReq.PolicySessionId(), freezeEvent); + responseValue = EStopThenProceed; + } + + return responseValue; + } + +void CAudioPolicy::ModifyEntry(TInt aPolicySessionId,const TMMFAudioPolicyState aNewState) + { + CMMFAudioPolicyRequest* sessionEntry=FindPolicyRequestById(aPolicySessionId); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess ID=%d, Old State=%d New State=%d"),aPolicySessionId,sessionEntry?sessionEntry->State():-1, aNewState); +#endif + // some client took over resource, so update its state and cancel timer + if (IsActiveState(aNewState)) + { + if (sessionEntry) + { + sessionEntry->SetState(aNewState); + sessionEntry->SetEventFlag(EFalse); + } + iAudioPolicyServer->StopNotificationTimer(); + iNotifiedSessionId =KErrNotFound; + ASSERT(iSessionIdAwaitingForDevsound==KErrNotFound); // we shouldn't have a client waiting to be notified + if (iStopHandledFromSessId==aPolicySessionId) + { + iStopHandledFromSessId=KErrNotFound; + } + return; + } + if (iNotifiedSessionId==aPolicySessionId) // if client that was notified, then stop timer. + { + iAudioPolicyServer->StopNotificationTimer(); + } + if (sessionEntry==NULL) // to cope with erroneous behaviour of devsound + { + return; + } + // we have update from the client, if we have other clients waiting we should notify them + if ( (aNewState == EMMFStatePaused || (aNewState == EMMFStateStopped && iStopHandledFromSessId!=aPolicySessionId) ) + && sessionEntry->State()!=EMMFStateStopped && sessionEntry->State()!=EMMFStateWaitingForResource) + { + if (aNewState == EMMFStateStopped) // to eliminate duplicate stop events + { + iStopHandledFromSessId=aPolicySessionId; + } + if (sessionEntry->State()==EMMFStatePreempted) + { + sessionEntry->SetState(EMMFStateWaitingForResource); + } + + if (iSessionIdAwaitingForDevsound==aPolicySessionId) + { + iSessionIdAwaitingForDevsound=KErrNotFound; + } + + if (aNewState == EMMFStatePaused || aNewState == EMMFStateStopped) // devsound should free, so notify waiting client + { + if (iSessionIdAwaitingForDevsound!=KErrNotFound) // we have a client waiting for Devsound, so notify it + { + NotifySessionWithTimeout(iSessionIdAwaitingForDevsound, TMMFAudioPolicyEvent::EMMFAudioPolicyNoEvent); + iSessionIdAwaitingForDevsound=KErrNotFound; + } + else if (!iAudioPolicyServer->IsTimerActive()) // do not try to notify if we're still waiting for response + { + const TInt sessionIdToNotify = CheckSessionToNotify(); + if(sessionIdToNotify != KErrNotFound) + { + // set the state as notified + NotifySessionWithTimeout(sessionIdToNotify, TMMFAudioPolicyEvent::EMMFAudioPolicyResourceNotification); + } + } + } + } + // we update state to passive only if the client hasn't been stopped by us, so as not loose its waiting indication + if (sessionEntry->State()!=EMMFStateWaitingForResource) + { + sessionEntry->SetState(aNewState); + } + } + +void CAudioPolicy::NotifySessionWithTimeout(TInt aPolicySessionId, TMMFAudioPolicyEvent::TAudioPolicyEventType aEvent) + { + CMMFAudioPolicyRequest* sessionEntry=FindPolicyRequestById(aPolicySessionId); + ASSERT(sessionEntry); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sending timed not. ID=%d, State=%d Event=%d"),aPolicySessionId,sessionEntry->State(), aEvent); +#endif + const TMMFAudioPolicyEvent eventToSend(aEvent, KErrNone, sessionEntry->State()); + sessionEntry->SetEventFlag(ETrue); + iAudioPolicyServer->StartNotificationTimer(); + iNotifiedSessionId = aPolicySessionId; + iAudioPolicyServer->SendEventToClient(aPolicySessionId, eventToSend); + } + +void CAudioPolicy::RemoveFromList(TInt aPolicySessionId, TBool aAllowTimerRestart) + { + if (aPolicySessionId==KErrNotFound) + { + return; + } + for (TInt index = iAudioPolicyRequestArray->Count(); index-- ;) + { + // Find correct entry to remove + if ( (*iAudioPolicyRequestArray)[index]->PolicySessionId() == aPolicySessionId) + { + if (iSessionIdAwaitingForDevsound==aPolicySessionId) + { + iSessionIdAwaitingForDevsound=KErrNotFound; + } + if (iNotifiedSessionId==aPolicySessionId && iAudioPolicyServer->IsTimerActive()) + { + iNotifiedSessionId=KErrNotFound; + // the session we were waiting for disconnected so try to immediately notify another one + iAudioPolicyServer->StopNotificationTimer(); + if (iAudioPolicyRequestArray->Count() > 1 && aAllowTimerRestart) + { + iAudioPolicyServer->StartNotificationTimer(ETrue); + } + } + else if(!iAudioPolicyServer->IsTimerActive()) + { + if (iAudioPolicyRequestArray->Count() > 1 && aAllowTimerRestart) + { + iAudioPolicyServer->StartNotificationTimer(ETrue); + } + } + iAudioPolicyRequestArray->Delete(index); + return; + } + } + } + +void CAudioPolicy::HandlePreferences(CMMFAudioPolicyRequest* /*aAudioPolicyRequest*/, TInt /*aPref*/, TPolicyResponse& /*aResponse*/) + { + } + +// this is weird, but devsound +// does Stop() if a client is denied access to resource +// then calls this routine to indicate that resource became available +void CAudioPolicy::LaunchRequest(TInt aSessionId) + { + ASSERT(iSessionIdAwaitingForDevsound!=aSessionId); + ModifyEntry(aSessionId, EMMFStateStopped); + } + +void CAudioPolicy::ReserveClientNumL(TInt aNum) + { + iAudioPolicyRequestArray->SetReserveL(aNum); + } + +/** +@internalTechnology + +This function raises a panic + +@param aError + one of the several panics codes that may be raised by this dll + +@panic EMMFAudioPolicyRequestArrayOverflow is raised when policyrequest array is full +*/ +GLDEF_C void Panic(TMMFAudioPolicyPanicCodes aPanicCode) + { + User::Panic(KMMFAudioPolicyPanicCategory, aPanicCode); + } + +// checks based on the session ,Is the session is registered for Notification +TBool CAudioPolicy::IsRegisteredNotification(TInt aSessionId) const + { + TUid event; + for (TInt index = 0; index < iAudioPolicyRequestArray->Count(); index++) + { + if((*iAudioPolicyRequestArray)[index]->PolicySessionId() == aSessionId) + { + event = (*iAudioPolicyRequestArray)[index]->NotificationEvent(); + if (event == KMMFEventCategoryAudioResourceAvailable) + { + // only when the client is registered for KMMFEventCategoryAudioResourceAvailable event + return ETrue; + } + break; + } + } + return EFalse; + } + +// get the next highest priority of the client to notify +TInt CAudioPolicy::CheckSessionToNotify() + { + TInt nextHighestPriority= -100; + TInt sessionToNotify = KErrNotFound; + + // get the max priority and set the Index + for (TInt attempt=2; attempt-- && sessionToNotify==KErrNotFound;) + { + + for (TInt index = 0; index < iAudioPolicyRequestArray->Count(); ++index) + { + CMMFAudioPolicyRequest& currentReq=*(*iAudioPolicyRequestArray)[index]; + if((nextHighestPriority <= currentReq.Priority()) + && (currentReq.NotificationEvent() == KMMFEventCategoryAudioResourceAvailable) + && (!currentReq.IsEventNotified()) + && currentReq.State()==EMMFStateWaitingForResource) + { + nextHighestPriority = currentReq.Priority(); + sessionToNotify = currentReq.PolicySessionId(); + } + } + // we tried to notify every session once, so reset flag and try again. + if (sessionToNotify==KErrNotFound) + { + for (TInt i=iAudioPolicyRequestArray->Count(); i--;) + { + (*iAudioPolicyRequestArray)[i]->SetEventFlag(EFalse); + } + } + } + return sessionToNotify; + } + +// send the message to the server +void CAudioPolicy::NotifyNextClient() + { + const TInt sessionIdToNotify = CheckSessionToNotify(); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess ID %d didn't continue within timeout, Next ID=%d"), iNotifiedSessionId, sessionIdToNotify); +#endif + iNotifiedSessionId = KErrNotFound; + if(sessionIdToNotify != KErrNotFound) + { + NotifySessionWithTimeout(sessionIdToNotify, TMMFAudioPolicyEvent::EMMFAudioPolicyResourceNotification); + } + } + +// Set in the AudiopolicyRequestArray the uid registered +TInt CAudioPolicy::SetNotification(TInt aSessionId, TUid aEventType) + { + if (KMMFEventCategoryAudioResourceAvailable!=aEventType) + { + return EFalse; + } + for (TInt index = iAudioPolicyRequestArray->Count(); index-- ; ) + { + CMMFAudioPolicyRequest& currentReq=*(*iAudioPolicyRequestArray)[index]; + if(currentReq.PolicySessionId() == aSessionId) + { + currentReq.SetNotificationEvent(aEventType); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess ID %d state=%d requested resource notification"), aSessionId, currentReq.State()); +#endif + if (!IsActiveState(currentReq.State())) + { + currentReq.SetState(EMMFStateWaitingForResource); + } + return ETrue; + } + } + return EFalse; + } + +CMMFAudioPolicyRequest* CAudioPolicy::FindPolicyRequestById(TInt aSessionId) const + { + for (TInt index = iAudioPolicyRequestArray->Count(); index-- ; ) + { + if((*iAudioPolicyRequestArray)[index]->PolicySessionId() == aSessionId) + { + return (*iAudioPolicyRequestArray)[index]; + } + } + return NULL; + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicyProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicyProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,211 @@ +// Copyright (c) 2009 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 +#include +#include "mmfAudioPolicyProxy.h" +#include "MmfAudioPolicyStart.h" +#include "MmfBase.hrh" +#include "MmfDevSoundInfo.h" +#include "MmfAudioPolicyServer.h" + + + +EXPORT_C TInt RMMFAudioPolicyProxy::Open(RServer2& aPolicyServerHandle) + { + ASSERT(aPolicyServerHandle.Handle()); + + // Server is already running and attempt to create a session + // 4 message slots + TInt err = CreateSession(aPolicyServerHandle, TVersion(KMMFAudioPolicyVersion, + KMMFAudioPolicyMinorVersionNumber, + KMMFAudioPolicyBuildVersionNumber)); + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::CreateServer(RServer2& aPolicyServerHandle) + { + TServerStart start(aPolicyServerHandle); + TThreadFunction serverFunc = CMMFAudioPolicyServer::StartThread; + RThread server; + TInt err = server.Create(_L(""),serverFunc, KAudioPolicyServerStackSize, + KAudioPolicyServerInitHeapSize, KAudioPolicyServerMaxHeapSize, + &start, EOwnerProcess); + if(err != KErrNone) + { + return err; + } + // Synchronise with the server + TRequestStatus reqStatus; + server.Rendezvous(reqStatus); + if (reqStatus!=KRequestPending) + { + server.Kill(0); + } + else + { + // Start the test harness + server.Resume(); + // Server will call the reciprocal static synchronise call + } + User::WaitForRequest(reqStatus); // wait for start or death + server.Close(); + if(reqStatus.Int() != KErrNone) + { + return reqStatus.Int(); + } + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::SetDevSoundInfo(TMMFDevSoundInfo& aDevSoundInfo) + { + TMMFDevSoundInfoPckg psPckg(aDevSoundInfo); + return SendReceive(EMMFPolicySetDevSoundInfo, psPckg); + } + +EXPORT_C void RMMFAudioPolicyProxy::MakeRequest(TMMFAudioPolicyPrioritySettings& aPrioritySettings) + { + iPsPckg().iState = aPrioritySettings.iState; + iPsPckg().iPref = aPrioritySettings.iPref; + iPsPckg().iPriority = aPrioritySettings.iPriority; + iPsPckg().iCapabilities = aPrioritySettings.iCapabilities; + SendReceive(EMMFPolicyMakeRequest, iPsPckg); + } + +EXPORT_C TInt RMMFAudioPolicyProxy::UpdateState(TMMFAudioPolicyPrioritySettings& aPrioritySettings) + { + TMMFAudioPolicyPrioritySettingsPckg psPckg(aPrioritySettings); + return SendReceive(EMMFPolicyUpdateState, psPckg); + } + +EXPORT_C void RMMFAudioPolicyProxy::ReceiveEvents(TMMFAudioPolicyEventPckg& aEventPckg, TRequestStatus& aStatus) + { + SendReceiveResult(EMMFPolicyReceiveEvents, aEventPckg, aStatus); + } + +EXPORT_C TInt RMMFAudioPolicyProxy::CancelReceiveEvents() + { + return SendReceive(EMMFPolicyCancelReceiveEvents); + } + +EXPORT_C TInt RMMFAudioPolicyProxy::GetPlayFormatsSupported(RMdaDevSound::TSoundFormatsSupportedBuf& aPlayFormatsSupported) + { + RMdaDevSound::TSoundFormatsSupportedBuf playFormatsSupported; + TInt err = SendReceiveResult(EMMFPolicyGetPlayFormatsSupported, playFormatsSupported); + if (!err) + aPlayFormatsSupported = playFormatsSupported; + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::GetRecordFormatsSupported(RMdaDevSound::TSoundFormatsSupportedBuf& aRecordFormatsSupported) + { + RMdaDevSound::TSoundFormatsSupportedBuf recordFormatsSupported; + TInt err = SendReceiveResult(EMMFPolicyGetRecordFormatsSupported, recordFormatsSupported); + if (!err) + aRecordFormatsSupported = recordFormatsSupported; + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::GetPlayFormat(RMdaDevSound::TCurrentSoundFormatBuf& aPlayFormat) + { + RMdaDevSound::TCurrentSoundFormatBuf playFormat; + TInt err = SendReceiveResult(EMMFPolicyGetPlayFormat, playFormat); + if (!err) + aPlayFormat = playFormat; + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::GetRecordFormat(RMdaDevSound::TCurrentSoundFormatBuf& aRecordFormat) + { + RMdaDevSound::TCurrentSoundFormatBuf recordFormat; + TInt err = SendReceiveResult(EMMFPolicyGetRecordFormat, recordFormat); + if (!err) + aRecordFormat = recordFormat; + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::LaunchRequests() + { + return SendReceive(EMMFPolicyLaunchRequests); + } + +EXPORT_C TInt RMMFAudioPolicyProxy::RequestResourceNotification(TUid aNotificationEventUid, const TDesC8& aNotificationDelay) + { + TUid eventType = KNullUid; + TMMFAudioPolicyResourceNotificationSettingsPckg pckg; + pckg().iNotificationUid = eventType; + TInt err = SendReceiveResult(EMMFPolicyGetResourceNotificationEvent, pckg); + eventType = pckg().iNotificationUid; + if(!err) + { + if(eventType != aNotificationEventUid ) + { + pckg().iNotificationUid = aNotificationEventUid; + pckg().iNotificationDelay = aNotificationDelay; + return SendReceive(EMMFPolicyRequestResourceNotification, pckg); + } + else + { + return KErrAlreadyExists; + } + } + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::CancelRequestResourceNotification(TUid aNotificationEventUid) + { + TUid eventType = KNullUid; + TMMFAudioPolicyResourceNotificationSettingsPckg pckg; + pckg().iNotificationUid = eventType; + TInt err = SendReceiveResult(EMMFPolicyGetResourceNotificationEvent, pckg); + eventType = pckg().iNotificationUid; + if(!err) + { + if(eventType == aNotificationEventUid ) + { + pckg().iNotificationUid = aNotificationEventUid; + return SendReceive(EMMFPolicyCancelRequestResourceNotification, pckg); + } + else + { + return KErrCancel; + } + } + return err; + } + +EXPORT_C TInt RMMFAudioPolicyProxy::StopNotification() + { + return SendReceive(EMMFPolicyStopNotification); + } + +EXPORT_C TInt RMMFAudioPolicyProxy::IsRegisteredResourceNotification(TUid aEventType) + { + TUid eventType = KNullUid; + TMMFAudioPolicyResourceNotificationSettingsPckg pckg; + pckg().iNotificationUid = eventType; + TInt err = SendReceiveResult(EMMFPolicyGetResourceNotificationEvent, pckg); + if(err != KErrNone) + { + return err; + } + eventType = pckg().iNotificationUid; + if(eventType == aEventType) + { + return KErrNone; + } + return KErrNotSupported; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicyServer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicyServer.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2000-2009 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 +#include "MmfAudioPolicyServer.h" +#include "MmfAudioPolicyStart.h" +#include "MmfAudioPolicySession.h" + + +#if defined(_DEBUG) && defined(__WINS__) + const TInt KTimeOutInterval =2*1000000; // 2 seconds +#else + const TInt KTimeOutInterval =1000000; // 1 second +#endif + +CMMFAudioPolicyServer* CMMFAudioPolicyServer::NewL() + { + CMMFAudioPolicyServer* s = new(ELeave) CMMFAudioPolicyServer(); + CleanupStack::PushL(s); + s->ConstructL(); + CleanupStack::Pop(); + return s; + } + +CMMFAudioPolicyServer::CMMFAudioPolicyServer() : + CMmfIpcServer(EPriorityStandard) + { + } + +void CMMFAudioPolicyServer::ConstructL() + { + // Create AudioPolicy singleton + iAudioPolicy = CAudioPolicy::NewL(this); + TCallBack callBack(SendNotification,this); + iNotificationTimer = CNotificationTimer::NewL(callBack); + // Call base class to Start server + StartL(KNullDesC); + } + +CMMFAudioPolicyServer::~CMMFAudioPolicyServer() + { + if(iNotificationTimer != NULL) + { + StopNotificationTimer(); + } + delete iAudioPolicy; + delete iNotificationTimer; + } + +CMmfIpcSession* CMMFAudioPolicyServer::NewSessionL(const TVersion& aVersion) const + { + TVersion v(KMMFAudioPolicyVersion,KMMFAudioPolicyMinorVersionNumber,KMMFAudioPolicyBuildVersionNumber); + if(!User::QueryVersionSupported(v, aVersion)) + User::Leave(KErrNotSupported); + + CMMFAudioPolicySession* aAudioPolicySession = CMMFAudioPolicySession::NewL(); + return aAudioPolicySession; + } + +void CMMFAudioPolicyServer::IncrementSessionId() + { + iPolicySessionId++; + } + +void CMMFAudioPolicyServer::SendEventToClient(TInt aSessionToAlert, const TMMFAudioPolicyEvent& aEvent) + { +// For the session requested, send event to client + iSessionIter.SetToFirst(); + CMMFAudioPolicySession* session = static_cast(iSessionIter++); + ASSERT(session != NULL); + do + { + if (session->PolicySessionId() == aSessionToAlert) + { + session->SendEventToClient(aEvent); + return; // Finished + } + session = static_cast(iSessionIter++); + } while (session != NULL); + ASSERT(EFalse); // invalid session Id + } + +void CMMFAudioPolicyServer::LaunchRequest(TInt aSessionId,const TMMFAudioPolicyEvent& aEvent) + { + SendEventToClient(aSessionId, aEvent); + } + +void CMMFAudioPolicyServer::IncrementSessionCount() + { + iPolicySessionCount++; + } + +CMMFAudioPolicyServer::CNotificationTimer *CMMFAudioPolicyServer::CNotificationTimer::NewL(TCallBack aCallBack) + { + CNotificationTimer* self = new(ELeave) CNotificationTimer(aCallBack); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; + } + +CMMFAudioPolicyServer::CNotificationTimer::CNotificationTimer(TCallBack aCallBack) +: CTimer(EPriorityHigh),iCallBack(aCallBack) + { + CActiveScheduler::Add(this); + } + +void CMMFAudioPolicyServer::CNotificationTimer::RunL() + { + iCallBack.CallBack(); + } + +void CMMFAudioPolicyServer::DecrementSessionCount() + { + iPolicySessionCount--; + } + +TInt CMMFAudioPolicyServer::PolicySessionCount() + { + return iPolicySessionCount; + } + +void CMMFAudioPolicyServer::StartNotificationTimer(TBool aZeroDelay) + { + iNotificationTimer->After(aZeroDelay? 0 : KTimeOutInterval); + } + +void CMMFAudioPolicyServer::StopNotificationTimer() + { + iNotificationTimer->Cancel(); + } + +TInt CMMFAudioPolicyServer::SendNotification(TAny* aAny) + { + CMMFAudioPolicyServer* policyServer = reinterpret_cast(aAny); + policyServer->iAudioPolicy->NotifyNextClient(); + return KErrNone; + } + +TBool CMMFAudioPolicyServer::IsTimerActive() const + { + return iNotificationTimer->IsActive(); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicySession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/Policy/MmfAudioPolicySession.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,396 @@ +// Copyright (c) 2000-2009 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 "MmfAudioPolicySession.h" +#include "MmfPolicyClientServer.h" +#include "MmfAudioPolicyServer.h" +#include "MmfDevSoundInfo.h" + + +const TInt KEventQLimit=16; // maximum number of pending events per session + +CMMFAudioPolicySession* CMMFAudioPolicySession::NewL() + { + CMMFAudioPolicySession* self = new(ELeave) CMMFAudioPolicySession(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CMMFAudioPolicySession::ConstructL() + { + iAudioPolicyRequest = new (ELeave) CMMFAudioPolicyRequest(); + } + +CMMFAudioPolicySession::CMMFAudioPolicySession() : iEventsQue(_FOFF(TMMFAudioPolicyEventHolder,iLink)), + iNoMemoryEventHolder(TMMFAudioPolicyEvent(TMMFAudioPolicyEvent::EMMFAudioPolicyResourceNotification, KErrNoMemory, EMMFStateCompleted), EFalse) + { + } + +void CMMFAudioPolicySession::CreateL(const CMmfIpcServer& aServer) + { + iServer = STATIC_CAST(CMMFAudioPolicyServer*, (CONST_CAST(CMmfIpcServer*, &aServer))); + iServer->IncrementSessionCount(); + CMmfIpcSession::CreateL(aServer); + iServer->IncrementSessionId(); + iPolicySessionId = iServer->PolicySessionId(); + // Get ptr to AudioPolicy from the server + iAudioPolicy = iServer->AudioPolicy(); + iAudioPolicy->ReserveClientNumL(iServer->PolicySessionCount()); + } + +CMMFAudioPolicyServer* CMMFAudioPolicySession::Server() + { + return STATIC_CAST(CMMFAudioPolicyServer*, iServer); + } + +CMMFAudioPolicySession::~CMMFAudioPolicySession() + { + delete iEventReceiver; + iEventReceiver=NULL; + ClearEventQ(); + iAudioPolicyPrioritySettings.iState = EMMFStateClosed; + // Have session's CMMFAudioPolicyRequest object removed from list + if (iAudioPolicy != NULL) + { + iAudioPolicy->RemoveFromList(iPolicySessionId); + } + delete iAudioPolicyRequest; + if (iServer != NULL) + { + iServer->DecrementSessionCount(); + iServer->StopNotificationTimer(); + } + } + +void CMMFAudioPolicySession::ClearEventQ() + { + while (!iEventsQue.IsEmpty()) + { + TMMFAudioPolicyEventHolder* heldEvent = iEventsQue.First(); + iEventsQue.Remove(*heldEvent); + if (heldEvent == &iNoMemoryEventHolder) + { + iNoMemoryEventUsed = EFalse; + } + if (heldEvent->iShallBeDeleted) + { + delete heldEvent; + } + --iEventQSize; + } + } + +void CMMFAudioPolicySession::ServiceL(const RMmfIpcMessage& aMessage) + { + if (iEventQSize > KEventQLimit) + { + aMessage.Panic(KMMFAudioPolicyPanicCategory, EMMFAudioPolicySessionEventQueueOverflow); + return; + } + + TBool complete = EFalse; + switch(aMessage.Function()) + { + case EMMFPolicyMakeRequest: + MakeRequestL(aMessage); + aMessage.Complete(KErrNone); + break; + case EMMFPolicySetDevSoundInfo: + complete = SetDevSoundInfoL(aMessage); + break; + case EMMFPolicyUpdateState: + complete = UpdateStateL(aMessage); + break; + case EMMFPolicyReceiveEvents: + complete = ReceiveEventsL(aMessage); + break; + case EMMFPolicyCancelReceiveEvents: + complete = CancelReceiveEvents(); + break; + case EMMFPolicyGetPlayFormatsSupported: + complete = GetPlayFormatsSupportedL(aMessage); + break; + case EMMFPolicyGetRecordFormatsSupported: + complete = GetRecordFormatsSupportedL(aMessage); + break; + case EMMFPolicyGetPlayFormat: + complete = GetPlayFormatL(aMessage); + break; + case EMMFPolicyGetRecordFormat: + complete = GetRecordFormatL(aMessage); + break; + case EMMFPolicyLaunchRequests: + complete = LaunchRequest(); + break; + case EMMFPolicyRequestResourceNotification: + complete = RequestResourceNotificationL(aMessage); + break; + case EMMFPolicyCancelRequestResourceNotification: + complete = CancelRequestResourceNotificationL(aMessage); + break; + case EMMFPolicyStopNotification: + complete = StopNotificationL(aMessage); + break; + case EMMFPolicyGetResourceNotificationEvent: + complete = GetResourceNotificationEventL(aMessage); + break; + default: + User::Leave(KErrNotSupported); + break; + } + if(complete) + { + aMessage.Complete(KErrNone); + } + } + +void CMMFAudioPolicySession::MakeRequestL(const RMmfIpcMessage& aMessage) + { + TMMFAudioPolicyPrioritySettingsPckg settingsPckg; + MmfMessageUtil::ReadL(aMessage, 0, settingsPckg); + + iAudioPolicyRequest->SetPriority(settingsPckg().iPriority); + iAudioPolicyRequest->SetPref(settingsPckg().iPref); + iAudioPolicyRequest->SetState(settingsPckg().iState); + + iAudioPolicyRequest->SetCapabilities(settingsPckg().iCapabilities); + + // Set session Id in Request + iAudioPolicyRequest->SetPolicySessionId(iPolicySessionId); + iAudioPolicy->MakeRequest(iAudioPolicyRequest); + } + +TBool CMMFAudioPolicySession::UpdateStateL(const RMmfIpcMessage& aMessage) + { + TMMFAudioPolicyPrioritySettingsPckg settingsPckg; + MmfMessageUtil::ReadL(aMessage, 0, settingsPckg); + + iAudioPolicy->ModifyEntry(iPolicySessionId, settingsPckg().iState); + return ETrue; + } + +void CMMFAudioPolicySession::SendEventToClient(const TMMFAudioPolicyEvent& aEvent) + { + if (iEventReceiver) + { + iEventReceiver->SendEvent(aEvent); + delete iEventReceiver; + iEventReceiver=NULL; + } + else + { + if (++iEventQSize > KEventQLimit) // check if Q is not full + { + return; // we'll panic that bad client later + } + TMMFAudioPolicyEventHolder* heldEvent = new TMMFAudioPolicyEventHolder(aEvent, ETrue); + + if (heldEvent==NULL && !iNoMemoryEventUsed) + { + heldEvent=&iNoMemoryEventHolder; + iNoMemoryEventUsed = ETrue; + } + if (heldEvent) + { + iEventsQue.AddLast(*heldEvent); + } + } + } + +TBool CMMFAudioPolicySession::SetDevSoundInfoL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundInfoPckg devSoundInfoPckg; + MmfMessageUtil::ReadL(aMessage, 0, devSoundInfoPckg); + iDevSoundId = devSoundInfoPckg().iDevSoundId; + return ETrue; + } + +TBool CMMFAudioPolicySession::ReceiveEventsL(const RMmfIpcMessage& aMessage) + { + if (iEventReceiver) + User::Leave(KErrAlreadyExists); + iEventReceiver = CMMFAudioPolicyEventReceiver::NewL(aMessage); +#if defined(ALLOW_POLICY_DEBUG) + RDebug::Print(_L("Sess. ID=%d listen to events"),iPolicySessionId); +#endif + //send the next cached event (if any) to the client + if (!iEventsQue.IsEmpty()) + { + TMMFAudioPolicyEventHolder* heldEvent = iEventsQue.First(); + iEventReceiver->SendEvent(heldEvent->iEvent); + iEventsQue.Remove(*heldEvent); + if (heldEvent == &iNoMemoryEventHolder) + { + iNoMemoryEventUsed = EFalse; + } + --iEventQSize; + if (heldEvent->iShallBeDeleted) + { + delete heldEvent; + } + delete iEventReceiver; + iEventReceiver=NULL; + } + return EFalse; + } + +TBool CMMFAudioPolicySession::CancelReceiveEvents() + { + delete iEventReceiver; + iEventReceiver = NULL; + return ETrue; + } + +TBool CMMFAudioPolicySession::GetPlayFormatsSupportedL(const RMmfIpcMessage& aMessage) + { + RMdaDevSound::TSoundFormatsSupportedBuf aPlayFormatsSupported; + aPlayFormatsSupported = iAudioPolicy->MdaHwInfo()->GetPlayFormatsSupported(); + MmfMessageUtil::WriteL(aMessage, 0, aPlayFormatsSupported); + return ETrue; + } + +TBool CMMFAudioPolicySession::GetRecordFormatsSupportedL(const RMmfIpcMessage& aMessage) + { + RMdaDevSound::TSoundFormatsSupportedBuf aRecordFormatsSupported; + aRecordFormatsSupported = iAudioPolicy->MdaHwInfo()->GetRecordFormatsSupported(); + MmfMessageUtil::WriteL(aMessage, 0, aRecordFormatsSupported); + return ETrue; + } + +TBool CMMFAudioPolicySession::GetPlayFormatL(const RMmfIpcMessage& aMessage) + { + RMdaDevSound::TCurrentSoundFormatBuf aPlayFormat; + aPlayFormat = iAudioPolicy->MdaHwInfo()->GetPlayFormat(); + MmfMessageUtil::WriteL(aMessage, 0, aPlayFormat); + return ETrue; + } + +TBool CMMFAudioPolicySession::GetRecordFormatL(const RMmfIpcMessage& aMessage) + { + RMdaDevSound::TCurrentSoundFormatBuf aRecordFormat; + aRecordFormat = iAudioPolicy->MdaHwInfo()->GetRecordFormat(); + MmfMessageUtil::WriteL(aMessage, 0, aRecordFormat); + return ETrue; + } + +TBool CMMFAudioPolicySession::LaunchRequest() + { + iAudioPolicy->LaunchRequest( iAudioPolicyRequest->PolicySessionId() ); + return ETrue; + } + +TBool CMMFAudioPolicySession::RequestResourceNotificationL(const RMmfIpcMessage& aMessage) + { + TMMFAudioPolicyResourceNotificationSettingsPckg notificationPckg; + MmfMessageUtil::ReadL(aMessage, 0, notificationPckg); + iAudioPolicyRequest->SetNotificationEvent(notificationPckg().iNotificationUid); + iAudioPolicyRequest->SetRequestDataL(notificationPckg().iNotificationDelay); + iAudioPolicy->SetNotification(iPolicySessionId,notificationPckg().iNotificationUid); + return ETrue; + } + +TBool CMMFAudioPolicySession::CancelRequestResourceNotificationL(const RMmfIpcMessage& aMessage) + { + TMMFAudioPolicyResourceNotificationSettingsPckg notificationPckg; + MmfMessageUtil::ReadL(aMessage, 0, notificationPckg); + iAudioPolicyRequest->ResetNotificationEvent(notificationPckg().iNotificationUid); + iAudioPolicy->SetNotification(iPolicySessionId,KNullUid); + return ETrue; + } + +TBool CMMFAudioPolicySession::StopNotificationL(const RMmfIpcMessage& /*aMessage*/) + { + iServer->StopNotificationTimer(); + return ETrue; + } + +TBool CMMFAudioPolicySession::GetResourceNotificationEventL(const RMmfIpcMessage& aMessage) const + { + TMMFAudioPolicyResourceNotificationSettingsPckg notificationPckg; + notificationPckg().iNotificationUid = iAudioPolicyRequest->NotificationEvent(); + MmfMessageUtil::WriteL(aMessage, 0, notificationPckg); + return ETrue; + } + +CMMFAudioPolicyEventReceiver* CMMFAudioPolicyEventReceiver::NewL(const RMmfIpcMessage& aMessage) + { + return new(ELeave) CMMFAudioPolicyEventReceiver(aMessage); + } + +CMMFAudioPolicyEventReceiver::~CMMFAudioPolicyEventReceiver() + { + if (iNeedToCompleteMessage) + { + iMessage.Complete(KErrDied); + } + } + +void CMMFAudioPolicyEventReceiver::SendEvent(const TMMFAudioPolicyEvent& aEvent) + { + TMMFAudioPolicyEventPckg eventpckg(aEvent); + TInt err = MmfMessageUtil::Write(iMessage, 0, eventpckg); + iMessage.Complete(err); + iNeedToCompleteMessage = EFalse; + } + +void CMMFAudioPolicyEventReceiver::SendEvent(const TMMFEvent& aEvent) + { + TMMFEventPckg eventpckg(aEvent); + TInt err = MmfMessageUtil::Write(iMessage, 0, eventpckg); + iMessage.Complete(err); + iNeedToCompleteMessage = EFalse; + } + +CMMFAudioPolicyEventReceiver::CMMFAudioPolicyEventReceiver(const RMmfIpcMessage& aMessage) : + iMessage(aMessage), iNeedToCompleteMessage(ETrue) + { + } + +CMMFAudioPolicyRequest::CMMFAudioPolicyRequest(): + iPolicySessionId(KErrNotFound), + iReqDataPtr(KNullDesC8) + { + iNotificationEventUid = KNullUid; + } + +CMMFAudioPolicyRequest::~CMMFAudioPolicyRequest() + { + delete iRequestData; + } + +void CMMFAudioPolicyRequest::SetRequestDataL(const TDesC8& aRequestData) + { + iReqDataPtr.Set(KNullDesC8); + if (aRequestData.Length() == 0) + { + return; + } + if (iRequestData==NULL || (iRequestData && iRequestData->Des().MaxLength()Des().Copy(aRequestData); + } + iReqDataPtr.Set(*iRequestData); + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/server/mmfAudioPolicyProxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/server/mmfAudioPolicyProxy.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2001-2009 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: +// + +#ifndef __MMFAUDIOPOLICYPROXY_H__ +#define __MMFAUDIOPOLICYPROXY_H__ + +#include +#include +#include "MmfAudioPolicySession.h" + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +class RMMFAudioPolicyProxy; // declared here. + +class CMMFAudioPolicyRequest; +class TMMFDevSoundInfo; + +NONSHARABLE_CLASS( RMMFAudioPolicyProxy ): public RMmfSessionBase +/** +*@internalTechnology +*/ + { +public: + IMPORT_C TInt Open(RServer2& aPolicyServerHandle); + IMPORT_C TInt CreateServer(RServer2& aPolicyServerHandle); + IMPORT_C TInt SetDevSoundInfo(TMMFDevSoundInfo& aDevSoundInfo); + IMPORT_C void MakeRequest(TMMFAudioPolicyPrioritySettings& aPrioritySettings); + IMPORT_C TInt UpdateState(TMMFAudioPolicyPrioritySettings& aPrioritySettings); + IMPORT_C void ReceiveEvents(TMMFAudioPolicyEventPckg& aEventPckg, TRequestStatus& aStatus); + IMPORT_C TInt CancelReceiveEvents(); + IMPORT_C TInt GetPlayFormatsSupported(RMdaDevSound::TSoundFormatsSupportedBuf& aPlayFormatsSupported); + IMPORT_C TInt GetRecordFormatsSupported(RMdaDevSound::TSoundFormatsSupportedBuf& aRecordFormatsSupported); + IMPORT_C TInt GetPlayFormat(RMdaDevSound::TCurrentSoundFormatBuf& aPlayFormat); + IMPORT_C TInt GetRecordFormat(RMdaDevSound::TCurrentSoundFormatBuf& aRecordFormat); + IMPORT_C TInt LaunchRequests(); + IMPORT_C TInt RequestResourceNotification(TUid aNotificationEventUid, const TDesC8& aNotificationData = KNullDesC8); + IMPORT_C TInt CancelRequestResourceNotification(TUid aNotificationEventUid); + IMPORT_C TInt StopNotification(); + IMPORT_C TInt IsRegisteredResourceNotification(TUid aEventType); +private: + TMMFAudioPolicyPrioritySettingsPckg iPsPckg; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/101FFA53.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/101FFA53.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2005-2009 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 "ecom/registryinfo.rh" +#include "mmf/plugin/mmfdevsound.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KMmfUidDevSoundRefPluginDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidDevSoundPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidDevSoundRefPlugin; + version_no = 1; + display_name = "Reference DevSound"; + opaque_data = "0;"; + default_data="*"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/DevSoundUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/DevSoundUtility.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,525 @@ +// Copyright (c) 2001-2009 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: +// Class that provides API to list ECOM plugin implementation IDs +// +// + +#include +#include +#include +#include +#include +#include +#include "DevSoundUtility.h" +#include //needed for CleanupResetAndDestroyPushL() +#include +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +#include +#include +#include +#include +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + +_LIT(KFixedSequenceResourceFile, "Z:\\Resource\\DevSound\\FixedSequence.rsc"); +const TInt KFourCCStringLength = 9; + +inline TMMFRawPackage::TMMFRawPackage(TInt aDerivedSize) +#pragma warning( disable : 4355 ) // 'this' : used in base member initializer list +: iThis((TUint8*)this,aDerivedSize,aDerivedSize) +#pragma warning( default : 4355 ) + { + } + +inline TPtr8& TMMFRawPackage::Package() + { + ((TMMFRawPackage*)this)->iThis.Set((TUint8*)this,iThis.Length(),iThis.MaxLength()); + return iThis; + } + +inline const TPtr8& TMMFRawPackage::Package() const + { + ((TMMFRawPackage*)this)->iThis.Set((TUint8*)this,iThis.Length(),iThis.MaxLength()); + return iThis; + } + +inline void TMMFRawPackage::SetSize(TInt aDerivedSize) + { + iThis.Set((TUint8*)this,aDerivedSize,aDerivedSize); + } + +inline TMMFToneFixedSequenceNames::TMMFToneFixedSequenceNames() : +TMMFRawPackage(sizeof(TMMFToneFixedSequenceNames)) {} + +#ifdef _UNICODE +class TNameBuf : public TBufCBase16 +#else +class TNameBuf : public TBufCBase8 +#endif + { + friend class HMMFToneFixedSequenceNames; + }; + +HMMFToneFixedSequenceNames::HMMFToneFixedSequenceNames() + { + iCount = 0; + } + +HMMFToneFixedSequenceNames* HMMFToneFixedSequenceNames::AddNameL(const TDesC& aName) +// Append a copy of the supplied descriptor to the end of the +// current heap cell. This will involve a realloc that will normally +// result in the object moving + { + TInt size = Package().Length(); + TInt desSize = aName.Size() + sizeof(TInt); + if (desSize&3) + desSize = ((desSize+4)&(~3)); // Must round up to word boundary to keep aligned + HMMFToneFixedSequenceNames* self = REINTERPRET_CAST(HMMFToneFixedSequenceNames*,User::ReAllocL(STATIC_CAST(TAny*,this),size + desSize)); + TUint8* newDesPtr = REINTERPRET_CAST(TUint8*,self) + size; + Mem::FillZ(newDesPtr,desSize); + TNameBuf* newDes = REINTERPRET_CAST(TNameBuf*,newDesPtr); + newDes->Copy(aName,aName.Length()); + self->SetSize(size+desSize); + self->iCount++; + return self; + } + + +/****************************************************************** + * CMMFDevSoundUtility + ******************************************************************/ +CMMFDevSoundUtility::CMMFDevSoundUtility() + { + // No default implementation + } + + +CMMFDevSoundUtility::~CMMFDevSoundUtility() + { + delete iInfo; + delete iFixedSequenceNames; + } + +CMMFDevSoundUtility* CMMFDevSoundUtility::NewL() + { + CMMFDevSoundUtility* self = NewLC(); + CleanupStack::Pop(); + return self; + } + +CMMFDevSoundUtility* CMMFDevSoundUtility::NewLC() + { + CMMFDevSoundUtility* self = new(ELeave) CMMFDevSoundUtility(); + CleanupStack::PushL(self); + self->ConstructL(); + // Leave it on Cleanupstack + return self; + } + +void CMMFDevSoundUtility::ConstructL() + { + iFixedSequenceNames = new (ELeave) HMMFToneFixedSequenceNames; + } + +void CMMFDevSoundUtility::SeekUsingFourCCL(TUid aInterfaceUid, RImplInfoPtrArray& aPlugInArray, const TFourCC& aSrcDataType, const TFourCC& aDstDataType, const TDesC& aPreferredSupplier) + { + + // Create a match string using the two FourCC codes. + _LIT8(KEmptyFourCCString, " , "); + TBufC8 fourCCString(KEmptyFourCCString); + TPtr8 fourCCPtr = fourCCString.Des(); + TPtr8 fourCCPtr1(&fourCCPtr[0], 4); + TPtr8 fourCCPtr2(&fourCCPtr[5], 4 ); + aSrcDataType.FourCC(&fourCCPtr1); + aDstDataType.FourCC(&fourCCPtr2); + + MmPluginUtils::FindImplementationsL(aInterfaceUid, aPlugInArray, fourCCPtr); + + // If more than one match. Narrow the search by preferred supplier + if((aPlugInArray.Count() > 1) && aPreferredSupplier.Length()) + { + SelectByPreference( aPlugInArray, aPreferredSupplier ); + } + + // If there are no plugins, return failure + if(aPlugInArray.Count() == 0) + { + User::Leave( KErrNotFound ); + } + } + + +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +void CMMFDevSoundUtility::FindHwDeviceAdapterL(TUid aInterfaceUid, RImplInfoPtrArray& aPlugInArray) + { + // Create a match string using the two FourCC codes. + _LIT8(KAdapterMatch, "*"); + + MmPluginUtils::FindImplementationsL(aInterfaceUid, aPlugInArray, KAdapterMatch); + + // If there are no plugins, return failure + + if(aPlugInArray.Count() == 0) + { + User::Leave( KErrNotFound ); + } + } + +void CMMFDevSoundUtility::SeekCodecPluginsL(RArray& aSupportedDataTypes, TMMFState aState, TBool aAppend) + { + _LIT8(KPCM16FourCCString, " P16"); + //check argument precondition for aState + if ((aState != EMMFStatePlaying) && (aState != EMMFStateRecording)) + { + User::Leave(KErrArgument); + } + + if (!aAppend) + { + aSupportedDataTypes.Reset(); //clear any existing data in aSupportedDataTypes array if not appending + } + + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + if (aState == EMMFStatePlaying) + { + customMatchData->SetMatchType(EMatchOutputDataFormat); + customMatchData->SetOutputDataL(KPCM16FourCCString); + } + else + { + customMatchData->SetMatchType(EMatchInputDataFormat); + customMatchData->SetInputDataL(KPCM16FourCCString); + } + + customMatchData->SetImplementationType(TUid::Uid(KUidAudioCodec)); + + HBufC8* package = customMatchData->NewPackLC(); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + TInt err = KErrNone; + MmPluginUtils::FindImplementationsL(TUid::Uid(KUidMdfProcessingUnit), ecomArray, *package, TUid::Uid(KUidCodecApiResolverImplementation)); + + for (TInt i=0 ; i < ecomArray.Count() ; i++) + { + CCodecApiOpaqueData* data = NULL; + TRAP(err, data = CCodecApiOpaqueData::NewL(ecomArray[i]->OpaqueData())); + // simply ignore plugins that we can't parse the opaque data. They should not cause other plugins + // to fall over + if (err == KErrNone) + { + const TDesC8* dataType; + if (aState == EMMFStatePlaying) + { + dataType = &data->InputDataType(); + } + else + { + dataType = &data->OutputDataType(); + } + TFourCC fourCC(*dataType); + delete data; + aSupportedDataTypes.AppendL(fourCC); + } + } + CleanupStack::PopAndDestroy(3, customMatchData); + } +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + +/* + * local function to disable items which do not match the preferred supplier. + * Note that at least one enabled item is returned (if there was an enabled item to begin with) which + * may not match the preferred supplier. + * + */ +void CMMFDevSoundUtility::SelectByPreference( RImplInfoPtrArray& aPlugInArray, const TDesC& aPreferredSupplier ) + { + + // Use the Disabled flag to eliminated all currently enabled matches that + // do not match the preferred supplier. + TInt firstEnabled = -1 ; // to ensure that we return something valid + TInt matchCount = 0 ; + for ( TInt ii = 0 ; ii < aPlugInArray.Count() ; ii++ ) + { + if ( !( aPlugInArray[ii]->Disabled() ) ) + { + if ( firstEnabled == -1 ) + firstEnabled = ii ; + if ( aPlugInArray[ii]->DisplayName().FindF( aPreferredSupplier ) == KErrNotFound ) + aPlugInArray[ii]->SetDisabled( ETrue ) ; + else + matchCount++ ; + } + } + + // If there are no matches then re-enable the first enabled + if ( matchCount == 0 ) + aPlugInArray[firstEnabled]->SetDisabled( EFalse ) ; + else if ( matchCount > 1 ) + { + // find the latest version from more than one match + TInt highestVersionIndex = -1 ; + for ( TInt ii = 0 ; ii < aPlugInArray.Count() ; ii++ ) + { + if ( !( aPlugInArray[ii]->Disabled() ) ) // only interested in enabled elements + { + if ( highestVersionIndex == -1 ) + { // first match. Store this. Keep it enabled + highestVersionIndex = ii ; + } + else if ( aPlugInArray[ii]->Version() > aPlugInArray[highestVersionIndex]->Version() ) + { // a new leader. Disable the previous leader. Keep this one. + aPlugInArray[highestVersionIndex]->SetDisabled( ETrue ) ; + highestVersionIndex = ii ; + } + else // we already have a higher version. + aPlugInArray[ii]->SetDisabled( ETrue ) ; + } + } + } + } + + +/* + * SeekHwDevicePluginsL + * This method looks for hwDevicePlugins that support the state given in aState which + * must be either EMMFStatePlaying or EMMFStateRecording + * For each HwDevice plugin found the datatype as indicated by its fourCC code + * from the default_data field in the resource file is added to the array of aSupportedDataTypes + * + * @internalComponent + * + * @param "RArray& aSupportedDataTypes" + * an array of fourCC codes that has a fourCC code added to for each hardware device found + * + * @param "TMMFState aState" + * must be set to EMMFStatePlaying if seeking HwDevice plugins that support play and + * EMMFStateRecording if seeking HwDevice plugins that support record + * + * @leave KErrArgument if aState is not EMMFStatePlaying or EMMFStateRecording else leaves + * with standard symbian OS error code + */ +void CMMFDevSoundUtility::SeekHwDevicePluginsL(RArray& aSupportedDataTypes, TMMFState aState) + { + //check argument precondition for aState + if ((aState != EMMFStatePlaying) && (aState != EMMFStateRecording)) + { + User::Leave(KErrArgument); + } + + aSupportedDataTypes.Reset(); //clear any existing data in aSupportedDataTypes array + + RImplInfoPtrArray plugInArray ; // Array to return hw device plugin resource info + CleanupResetAndDestroyPushL(plugInArray); + + TUid KUidMmfHWPluginInterfaceCodec = {KMmfUidPluginInterfaceHwDevice}; + + MmPluginUtils::FindImplementationsL(KUidMmfHWPluginInterfaceCodec, plugInArray); + + TUint numberOfHwDevicePlugins = plugInArray.Count(); + + //if have hwdevice plugin resource entries then scan entries + //matching on a datatype of pcm16 as the destination datatype for play and the + //source datatype for record + //if a match is found and isn't already in list of supported data types + //then add it to the list + if (numberOfHwDevicePlugins) + { + CImplementationInformation* hwDeviceResourceEntry = NULL; + _LIT8(KPCM16FourCCString, " P16"); + TBufC8 fourCCStringPCM16(KPCM16FourCCString); + TPtr8 fourCCPtrPCM16 = fourCCStringPCM16.Des(); + TUint entryNumber = 0; + + //check each resource entry for dst 4CC = P16 for play and src 4CC = P16 for record + for (TUint hwDeviceEntry = 0; hwDeviceEntry < numberOfHwDevicePlugins; hwDeviceEntry++) + { + hwDeviceResourceEntry = plugInArray[hwDeviceEntry]; + if (IsDataTypeMatch(hwDeviceResourceEntry, fourCCPtrPCM16, aState)) + {//resource entry data field has dest/src datatype ' P16' ie pcm16 for play/record + TPtrC8 fourCCPtr(0,0); + if (aState == EMMFStatePlaying)//then datatype supported 4CC is left 4 chars + { + fourCCPtr.Set(hwDeviceResourceEntry->DataType().Left(KFourCCLength)); + } + else if (aState == EMMFStateRecording) //then datatype supported 4CC is right 4 chars + { + fourCCPtr.Set(hwDeviceResourceEntry->DataType().Right(KFourCCLength)); + } + TFourCC fourCCEntry(fourCCPtr); + //need to check if entry already exists to prevent duplicate entries + entryNumber = aSupportedDataTypes.Count(); + TBool alreadyExists = EFalse; + for (TUint fourCCEntryNumber = 0; fourCCEntryNumber < entryNumber; fourCCEntryNumber++) + { + if (aSupportedDataTypes[fourCCEntryNumber]==fourCCEntry) + { + alreadyExists = ETrue;//we already have this 4CC in the supported data types + break; + } + } + if (!alreadyExists) + { + TInt err = aSupportedDataTypes.Append(fourCCEntry); + if (err) + {//note we don't destroy array because we don't own it + //but we do reset it as it is incomplete + aSupportedDataTypes.Reset(); + User::Leave(err); + } + } + }//if (IsDataTypeMatch(hwDeviceResourceEntry, fourCCPtrPCM16, aState)) + }//for (TUint hwDeviceEntry = 0; hwDeviceEntry < numberOfHwDevicePlugins; hwDeviceEntry++) + }//if (numberOfHwDevicePlugins) + + CleanupStack::PopAndDestroy(&plugInArray); + } + + +/* + * IsDataTypeMatch + * This method takes a given resource entry from a hardware device and determines + * whether the hwdevice plugin is a data type match for playing or recording + * depending on the setting of aState + * The method matchs the default_data field from the hw device resource entry matching + * it with the aHwMatchFourCC code. + * + * @internalComponent + * + * @param "CImplementationInformation aHwDeviceResourceEntry" + * the hw device resource entry that is to be checked + * whether it can be used to play or record + * + * @param "TDesC8& aHwMatchFourCC + * the data type fourCC code to match to that the hardware device that must convert to for + * playing and convert from for recording - for the reference DevSound this is always ' P16' ie pcm16 + * + * @param "TMMFState aState" + * this determines whether the match is for playing or recording and should take + * either the values EMMFStatePlaying or EMMFStateRecording + * + * @return ETrue if a match for play or record else EFalse + */ +TBool CMMFDevSoundUtility::IsDataTypeMatch(CImplementationInformation* aHwDeviceResourceEntry,const TDesC8& aHwMatchFourCC, TMMFState aState) + { + TBool match = EFalse; + // extra length safety check to remove adapter plugins and incorrect ones + if (aHwDeviceResourceEntry->DataType().Length()>=KFourCCStringLength) + { + if (aState == EMMFStatePlaying) + {//play need to match with the right four characters + match = (!(aHwMatchFourCC.Match(aHwDeviceResourceEntry->DataType().Right(KFourCCLength))==KErrNotFound)); + } + else if (aState == EMMFStateRecording) + {//record need to match with the left four characters + match = (!(aHwMatchFourCC.Match(aHwDeviceResourceEntry->DataType().Left(KFourCCLength))==KErrNotFound)); + } + } + return match; + } + + +/** + * Populate fixed sequences + * + */ +void CMMFDevSoundUtility::InitializeFixedSequenceL(CPtrC8Array** aFixedSequences) + { + + RFs fsSession; + User::LeaveIfError(fsSession.Connect()); + CleanupClosePushL(fsSession); + + // Open the resource file + RResourceFile resourceFile; + resourceFile.OpenL(fsSession, KFixedSequenceResourceFile); + CleanupClosePushL(resourceFile); + + // Allocate buffer to hold resource data in binary format + iInfo = resourceFile.AllocReadL(FIXED_TONE_SEQUENCE); + + TResourceReader reader; + reader.SetBuffer(iInfo); + + // Create array to hold fixed sequences data + CPtrC8Array* tempSequences = new(ELeave) CPtrC8Array(8); // granularity + CleanupStack::PushL(tempSequences); + + // First word gives number of entries + TInt numberOfEntries = reader.ReadUint16(); + ASSERT(!(numberOfEntries&1)); // Should have atleast one entry + + // There must be an even number entries as each sequence structure + // is made of a name string and a data string (SEQUENCE_NAME and SEQUENCE_DATA) + + HMMFToneFixedSequenceNames* names = new (ELeave) HMMFToneFixedSequenceNames; + CleanupStack::PushL(names); + for (TInt i=0;iAddNameL(reader.ReadTPtrC()); + if (names != newNames) + { // May have moved so fixup cleanupstack reference + CleanupStack::Pop(); + names = newNames; + CleanupStack::PushL(names); + } + TInt len = reader.ReadUint16(); + TPtrC8 tempTPtrC8(REINTERPRET_CAST(const TUint8*,reader.Ptr()),len<<1); + tempSequences->AppendL(tempTPtrC8); + reader.Advance(len<<1); + } + CleanupStack::Pop(); // names + + // Delete the old fixed sequence names + delete iFixedSequenceNames; + iFixedSequenceNames = NULL; + iFixedSequenceNames = names; + + *aFixedSequences = tempSequences; + CleanupStack::Pop(tempSequences); + CleanupStack::PopAndDestroy(2); // resourceFile, fsSession + } + +TBool CMMFDevSoundUtility::RecognizeSequence(const TDesC8& aData) + { + // Reference plug-in only supports its own sequence format + _LIT8(KSequenceSignature,"SQNC"); + if (aData.Length() > 4) + { + if (aData.Left(4) == KSequenceSignature) + return ETrue; + } + // Didn't recognise + return EFalse; + } + +const TDesC& CMMFDevSoundUtility::FixedSequenceName(TInt aSequenceNumber) + { + ASSERT(iFixedSequenceNames); // Defect if this not true when previous was true + ASSERT((aSequenceNumber>=0)&&(aSequenceNumberiCount)); + + // Ptr to first descriptor + TUint8* ptr = REINTERPRET_CAST(TUint8*,&(iFixedSequenceNames->iCount))+sizeof(TInt); + TDesC* desPtr = REINTERPRET_CAST(TDesC*,ptr); // First des + while (aSequenceNumber--) + { + TInt size = desPtr->Size(); + if (size&3) + size = ((size+4)&(~3)); + ptr += sizeof(TInt) + size; + desPtr = REINTERPRET_CAST(TDesC*,ptr); // Next des + } + return *desPtr; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/DevSoundUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/DevSoundUtility.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,107 @@ +// Copyright (c) 2001-2009 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: +// File: DevSoundUtility.h +// Author: Vasudevan Ramachandraiah +// Date: July 16, 2002 +// Class that provides API to list ECOM plugin implementation IDs +// (c) Nokia Inc. +// Revisions: +// Date: Author Description +// +// + +#ifndef __MMFDEVSOUNDUTILITY_H +#define __MMFDEVSOUNDUTILITY_H + +#include +#include + +#include "mmfutilities.h" // For TFourCC + +#define KFourCCLength 4 + +class TMMFRawPackage +/** +*@internalTechnology +*/ + { +public: + inline TPtr8& Package(); + inline const TPtr8& Package() const; +protected: + TMMFRawPackage(TInt aDerivedSize); + inline void SetSize(TInt aDerivedSize); +protected: + TPtr8 iThis; + }; + + +class TMMFToneFixedSequenceNames : public TMMFRawPackage +/** +*@internalTechnology +*/ + { +public: + inline TMMFToneFixedSequenceNames(); +public: + TInt iCount; + }; + + +class HMMFToneFixedSequenceNames : public TMMFToneFixedSequenceNames +/** +*@internalTechnology +*/ + { +public: + HMMFToneFixedSequenceNames(); + HMMFToneFixedSequenceNames* AddNameL(const TDesC& aName); + }; + + +class CMMFDevSoundUtility : public CBase +/** +*internalTechnology +*/ + { +public: + // Destructor + ~CMMFDevSoundUtility(); + static CMMFDevSoundUtility* NewL(); + static CMMFDevSoundUtility* NewLC(); + + void SeekUsingFourCCL(TUid aInterfaceUid, RImplInfoPtrArray& aPlugInArray, const TFourCC& aSrcDataType, const TFourCC& aDstDataType, const TDesC& aPreferredSupplier); + void SelectByPreference(RImplInfoPtrArray& aPlugInArray, const TDesC& aPreferredSupplier); + void SeekHwDevicePluginsL(RArray& aSupportedDataTypes, TMMFState aState); + +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API + void FindHwDeviceAdapterL(TUid aInterfaceUid, RImplInfoPtrArray& aPlugInArray); + void SeekCodecPluginsL(RArray& aSupportedDataTypes, TMMFState aState, TBool aAppend); +#endif // SYMBIAN_MULTIMEDIA_CODEC_API + + void InitializeFixedSequenceL(CPtrC8Array** aFixedSequences); + TBool RecognizeSequence(const TDesC8& aData); + const TDesC& FixedSequenceName(TInt aSequenceNumber); + +private: + CMMFDevSoundUtility(); + void ConstructL(); + TBool IsDataTypeMatch(CImplementationInformation* hwDeviceResourceEntry,const TDesC8& fourCCPtrPCM16, TMMFState aState); + +private: + HMMFToneFixedSequenceNames* iFixedSequenceNames; + HBufC8* iInfo; + } ; + +#endif // __MMFDEVSOUNDUTILITY_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/FixedSequence.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/FixedSequence.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,288 @@ +// Copyright (c) 2007-2009 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: +// Definitions required for tone sequences +// +// + +// Signature definitions +#define SEQ_SIG1 0x5153 +#define SEQ_SIG2 0x434E +#define SEQ_SIG SEQ_SIG1,SEQ_SIG2, // Signature = "SQNC" ASCII + +// Commands +#define SEQ_CMD_RET -1 +#define SEQ_CMD_STARTLOOP -2, +#define SEQ_CMD_ENDLOOP -3, + +// Useful values +// Note frequencies +#define SEQ_FREQ_A0 440 +#define SEQ_FREQ_AsBf0 466 // 466.1637615 A#, Bb +#define SEQ_FREQ_B0 494 // 493.8833013 +#define SEQ_FREQ_C0 523 // 523.2511306 +#define SEQ_FREQ_CsDf0 554 // 554.365262 C#, Db, etc. +#define SEQ_FREQ_D0 587 // 587.3295358 +#define SEQ_FREQ_DsEf0 622 // 622.2539674 +#define SEQ_FREQ_E0 659 // 659.2551138 +#define SEQ_FREQ_F0 698 // 698.4564629 +#define SEQ_FREQ_FsGf0 740 // 739.9888454 +#define SEQ_FREQ_G0 784 // 783.990872 +#define SEQ_FREQ_GsAf0 831 // 830.6093952 +#define SEQ_FREQ_A1 880 +#define SEQ_FREQ_AsBf1 932 // 932.327523 +#define SEQ_FREQ_B1 988 // 987.7666025 +#define SEQ_FREQ_C1 1047 // 1046.502261 +#define SEQ_FREQ_CsDf1 1109 // 1108.730524 +#define SEQ_FREQ_D1 1175 // 1174.659072 +#define SEQ_FREQ_DsEf1 1245 // 1244.507935 +#define SEQ_FREQ_E1 1319 // 1318.510228 +#define SEQ_FREQ_F1 1397 // 1396.912926 +#define SEQ_FREQ_FsGf1 1480 // 1479.977691 +#define SEQ_FREQ_G1 1568 // 1567.981744 +#define SEQ_FREQ_GsAf1 1661 // 1661.21879 +#define SEQ_FREQ_A2 1760 +#define SEQ_FREQ_AsBf2 1865 // 1864.655046 +#define SEQ_FREQ_B2 1976 // 1975.533205 +#define SEQ_FREQ_C2 2093 // 2093.004522 +#define SEQ_FREQ_CsDf2 2217 // 2217.461048 +#define SEQ_FREQ_D2 2349 // 2349.318143 +#define SEQ_FREQ_DsEf2 2489 // 2489.01587 +#define SEQ_FREQ_E2 2673 // 2637.020455 +#define SEQ_FREQ_F2 2794 // 2793.825851 +#define SEQ_FREQ_FsGf2 2960 // 2959.955382 +#define SEQ_FREQ_G2 3136 // 3135.963488 +#define SEQ_FREQ_GsAf2 3322 // 3322.437581 +#define SEQ_FREQ_A3 3520 +#define SEQ_FREQ_AsBf3 3729 // 3729.310092 + +// Volume defines +#define SEQ_VOL_F 32767 // Forte = Loud +#define SEQ_VOL_MF 24575 // Mezzo forte = Medium loud +#define SEQ_VOL_MP 16383 // Mezzo piano = Medium soft +#define SEQ_VOL_P 8191 // Piano = Soft + +// Macros for defining sequences +#define SEQ_DATA(A) SEQ_SIG A SEQ_CMD_RET +#define SEQ_VAL(N) N, +#define SEQ_LOOP(NUMBEROFTIMES,DATA) SEQ_CMD_STARTLOOP SEQ_VAL(NUMBEROFTIMES) DATA SEQ_CMD_ENDLOOP +#define SEQ_TONE(DUR,F1,V1) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(0) SEQ_VAL(0) +#define SEQ_2TONES(DUR,F1,V1,F2,V2) SEQ_VAL(DUR) SEQ_VAL(F1) SEQ_VAL(V1) SEQ_VAL(F2) SEQ_VAL(V2) +#define SEQ_SILENCE(DUR) SEQ_VAL(DUR) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0) SEQ_VAL(0) +// DUR = number samples@8kHz hence 8000 = 1 second +// F1/F2 = frequency in Hz - can use note definitions above +// V1/V1 = volume in range 0-32767 - can use volume definitions above +// When playing two tones, sum of volumes should not be greater than 32767 +// e.g. can use MF+P or MP+MP + +STRUCT SEQUENCE_NAME + { + LTEXT name; // leading-byte counted text string + } + +STRUCT SEQUENCE_DATA + { + LEN WORD WORD data[]; // Array of 16bit data values + } + +STRUCT SEQUENCE_ARRAY + { + STRUCT sequences[]; + } + +RESOURCE SEQUENCE_ARRAY fixed_tone_sequence + { + // + // Contains the sequences supported by the device (with localisable names) + // + sequences = + { + SEQUENCE_NAME + { + // + // A loud piercing sequence that alternates between two toned "warbles" + // Duration: 5 seconds + // + name="Rings"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_LOOP + ( + 2, + SEQ_LOOP + ( + 11, + SEQ_TONE(250,SEQ_FREQ_GsAf2,SEQ_VOL_F) + SEQ_TONE(250,SEQ_FREQ_DsEf2,SEQ_VOL_F) + ) + SEQ_LOOP + ( + 11, + SEQ_TONE(250,SEQ_FREQ_DsEf2,SEQ_VOL_F) + SEQ_TONE(250,SEQ_FREQ_GsAf1,SEQ_VOL_F) + ) + SEQ_SILENCE(6000) + ) + SEQ_SILENCE(6000) + ) + }; + }, + SEQUENCE_NAME + { + // + // A pleasant bell-like sequence based on clock chimes + // Duration: 5 seconds + // + name="Chimes"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_2TONES(2500,SEQ_FREQ_E1,SEQ_VOL_MP,SEQ_FREQ_E1+5,SEQ_VOL_MP) + SEQ_2TONES(2500,SEQ_FREQ_C1,SEQ_VOL_MP,SEQ_FREQ_C1+5,SEQ_VOL_MP) + SEQ_2TONES(2500,SEQ_FREQ_D1,SEQ_VOL_MP,SEQ_FREQ_D1+5,SEQ_VOL_MP) + SEQ_2TONES(6250,SEQ_FREQ_G0,SEQ_VOL_MF,SEQ_FREQ_G0+5,SEQ_VOL_P) + SEQ_SILENCE(1250) + SEQ_2TONES(2500,SEQ_FREQ_G0,SEQ_VOL_MP,SEQ_FREQ_G0+5,SEQ_VOL_MP) + SEQ_2TONES(2500,SEQ_FREQ_D1,SEQ_VOL_MP,SEQ_FREQ_D1+5,SEQ_VOL_MP) + SEQ_2TONES(2500,SEQ_FREQ_E1,SEQ_VOL_MF,SEQ_FREQ_E1+5,SEQ_VOL_P) + SEQ_2TONES(7500,SEQ_FREQ_C1,SEQ_VOL_MP,SEQ_FREQ_C1+5,SEQ_VOL_MP) + SEQ_SILENCE(10000) + ) + }; + }, + SEQUENCE_NAME + { + // + // A quiet sequence similar to a digital watch alarm + // Duration: 2.5 seconds + // + name="Signal"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_LOOP + ( + 3, + SEQ_LOOP + ( + 3, + SEQ_TONE(328,SEQ_FREQ_AsBf3,SEQ_VOL_MF) + SEQ_SILENCE(339) + ) + SEQ_SILENCE(2333) + ) + SEQ_SILENCE(6998) + ) + }; + }, + SEQUENCE_NAME + { + // + // Sounds like a fanfare played on an electric organ + // Duration: 2.6 seconds + // + name="Fanfare"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_2TONES(2000,SEQ_FREQ_DsEf1,SEQ_VOL_MP,SEQ_FREQ_DsEf0,SEQ_VOL_MP) + SEQ_2TONES(2000,SEQ_FREQ_GsAf1,SEQ_VOL_MP,SEQ_FREQ_GsAf0,SEQ_VOL_MP) + SEQ_2TONES(1000,SEQ_FREQ_C2,SEQ_VOL_MP,SEQ_FREQ_C1,SEQ_VOL_MP) + SEQ_2TONES(1000,SEQ_FREQ_GsAf1,SEQ_VOL_MF,SEQ_FREQ_GsAf0,SEQ_VOL_P) + SEQ_2TONES(2000,SEQ_FREQ_DsEf1,SEQ_VOL_MP,SEQ_FREQ_DsEf0,SEQ_VOL_MP) + SEQ_2TONES(2000,SEQ_FREQ_GsAf1,SEQ_VOL_MP,SEQ_FREQ_GsAf0,SEQ_VOL_MP) + SEQ_2TONES(4000,SEQ_FREQ_C2,SEQ_VOL_MP,SEQ_FREQ_C1,SEQ_VOL_MP) + SEQ_2TONES(4000,SEQ_FREQ_GsAf1,SEQ_VOL_MF,SEQ_FREQ_GsAf0,SEQ_VOL_P) + SEQ_SILENCE(4000) + ) + }; + }, + SEQUENCE_NAME + { + // + // Pleasant two-tone chimes + // Duration: 4 seconds + // + name="Bells"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_LOOP + ( + 2, + SEQ_2TONES(4000,SEQ_FREQ_E1,SEQ_VOL_MP,SEQ_FREQ_C1,SEQ_VOL_MP) + SEQ_2TONES(8000,SEQ_FREQ_C1,SEQ_VOL_MP,SEQ_FREQ_G0,SEQ_VOL_MP) + ) + SEQ_SILENCE(8000) + ) + }; + }, + SEQUENCE_NAME + { + // + // Cavalry charge + // Duration: 2 seconds + // + name="Cavalry"; + }, + SEQUENCE_DATA + { + data = + { + SEQ_DATA + ( + SEQ_LOOP + ( + 2, + SEQ_2TONES(1333,SEQ_FREQ_A2,SEQ_VOL_MP,SEQ_FREQ_A1,SEQ_VOL_MP) + SEQ_SILENCE(667) + SEQ_2TONES(333,SEQ_FREQ_A2,SEQ_VOL_MP,SEQ_FREQ_A1,SEQ_VOL_MP) + SEQ_SILENCE(333) + ) + SEQ_LOOP + ( + 2, + SEQ_2TONES(1333,SEQ_FREQ_E2,SEQ_VOL_MP,SEQ_FREQ_E1,SEQ_VOL_MP) + SEQ_SILENCE(667) + SEQ_2TONES(333,SEQ_FREQ_CsDf2,SEQ_VOL_MP,SEQ_FREQ_CsDf1,SEQ_VOL_MP) + SEQ_SILENCE(333) + ) + SEQ_2TONES(2667,SEQ_FREQ_A2,SEQ_VOL_MP,SEQ_FREQ_A1,SEQ_VOL_MP) + SEQ_SILENCE(2667) + ) + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/MmfBase.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/MmfBase.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ + +// SoundDev Mmfbase.hrh + +// Copyright (c) 2009 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: +// + +#ifndef __SoundDevMmfBase_hrh +#define __SoundDevMmfBase_hrh + +#include "../../../inc/mmf/common/mmfbase.hrh" + +#endif // __SoundDevMmfBase_hrh diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/MmfDevSoundEventHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/MmfDevSoundEventHandler.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,135 @@ +// Copyright (c) 2001-2009 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 "MmfDevSoundEventHandler.h" +#include "mmfAudioPolicyProxy.h" + +#include "MmfDevSoundSessionXtnd.h" + +CMMFDevSoundEventHandler* CMMFDevSoundEventHandler::NewL(RMMFAudioPolicyProxy* aAudioPolicyProxy) + { + CMMFDevSoundEventHandler* self = new(ELeave) CMMFDevSoundEventHandler(aAudioPolicyProxy); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +CMMFDevSoundEventHandler::CMMFDevSoundEventHandler(RMMFAudioPolicyProxy* aAudioPolicyProxy) : + CActive(EPriorityLow), iAudioPolicyProxy(aAudioPolicyProxy) + { + CActiveScheduler::Add(this); + } + +void CMMFDevSoundEventHandler::ConstructL() + { + } + +void CMMFDevSoundEventHandler::SetDevSoundInfo(CMMFDevSoundSessionXtnd* aDevSound) + { + iDevSound = aDevSound; + iDevSoundId++; + aDevSound->SetDevSoundId(iDevSoundId); + } + +CMMFDevSoundEventHandler::~CMMFDevSoundEventHandler() + { + Cancel(); + } + +void CMMFDevSoundEventHandler::ReceiveEvents() + { + iAudioPolicyProxy->ReceiveEvents(iAudioPolicyEventPckg, iStatus); + SetActive(); + } + +void CMMFDevSoundEventHandler::CancelReceiveEvents() + { + Cancel(); + } + +void CMMFDevSoundEventHandler::RunL() + { + TMMFAudioPolicyEvent aEvent; + aEvent.iEventType = iAudioPolicyEventPckg().iEventType; + aEvent.iErrorCode = iAudioPolicyEventPckg().iErrorCode; + aEvent.iState = iAudioPolicyEventPckg().iState; + + // Determine whether or not to call on client to send event or call on other + // SoundDevice's to start play/record functions: + if ( (aEvent.iEventType == TMMFAudioPolicyEvent::EMMFAudioPolicySwitchToIdle) + || (aEvent.iEventType == TMMFAudioPolicyEvent::EMMFAudioPolicyNoEvent) ) + { + // Determine what to do, based on state: + switch (aEvent.iState) + { + case EMMFStatePlayData: + iDevSound->StartPlayDataL(); + break; + case EMMFStateRecordData: + iDevSound->StartRecordDataL(); + break; + case EMMFStatePlayTone: + iDevSound->StartPlayToneL(); + break; + case EMMFStatePlayDualTone: + iDevSound->StartPlayDualToneL(); + break; + case EMMFStatePlayDTMFString: + iDevSound->StartPlayDTMFStringL(); + break; + case EMMFStatePlayToneSequence: + iDevSound->StartPlayToneSequenceL(); + break; + default: + ASSERT(EFalse); + break; + } // End switch + } + else if(aEvent.iEventType == TMMFAudioPolicyEvent::EMMFAudioPolicyResourceNotification) + { + TMMFEvent event; + event.iErrorCode = aEvent.iErrorCode; + event.iEventType = KMMFEventCategoryAudioResourceAvailable; + iDevSound->SendEvent(event); + } + else + { + ASSERT(aEvent.iEventType == TMMFAudioPolicyEvent::EMMFAudioPolicyPriorityTooLow); + //Create a TMMFEvent element for client: + //NB KErrInUse, KErrDied OR KErrAccessDenied may be returned by the + //policy server to indicate that the sound device is in use by another + //higher priority client. + TMMFEvent event; + event.iErrorCode = aEvent.iErrorCode; + iDevSound->SendEvent(event); + } + // Set self up to receive more events: + iAudioPolicyProxy->ReceiveEvents(iAudioPolicyEventPckg, iStatus); + SetActive(); + } + +void CMMFDevSoundEventHandler::DoCancel() + { + iAudioPolicyProxy->CancelReceiveEvents(); + } + +TInt CMMFDevSoundEventHandler::RunError(TInt aError) + { + TMMFEvent event; + event.iErrorCode = aError;//should probably have an appropriate event type here too? + iDevSound->SendEventToClient(event); + return KErrNone; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/ToneGenerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/ToneGenerator.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,917 @@ +// Copyright (c) 1997-2009 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: +// This file contains an implementation of the ToneGenerator interface +// that converts all tone generation requests in to sampled audio +// data to be played through the normal local sampled audio interface +// +// + +#include "ToneGenerator.h" +#include +#include + +/****************************************************************************** +* Tone Generators +* +* The following classes are used to generate simple frequency/duration tones, +* DTMF, and SymbianOS tone sequences in a WINS environment. The below code +* should only be considered for WINS. +******************************************************************************/ + +// this defines the maximum possible amplitude allowed for TSineGen::SetFrequency() +const TInt KMaxAmplitude = 0x8000; + +// default number of samples for trailing silence following a Tone +const TInt KDefaultTrailingSilenceSamples = 20; + +// +// Sine tone generator +// + +const TInt16 TSineGen::SineTable[KMaxSineTable] = + { + 0, 804, 1607, 2410, 3211, 4011, 4807, 5601, + 6392, 7179, 7961, 8739, 9511, 10278, 11038, 11792, + 12539, 13278, 14009, 14732, 15446, 16150, 16845, 17530, + 18204, 18867, 19519, 20159, 20787, 21402, 22004, 22594, + 23169, 23731, 24278, 24811, 25329, 25831, 26318, 26789, + 27244, 27683, 28105, 28510, 28897, 29268, 29621, 29955, + 30272, 30571, 30851, 31113, 31356, 31580, 31785, 31970, + 32137, 32284, 32412, 32520, 32609, 32678, 32727, 32757, + 32767, 32757, 32727, 32678, 32609, 32520, 32412, 32284, + 32137, 31970, 31785, 31580, 31356, 31113, 30851, 30571, + 30272, 29955, 29621, 29268, 28897, 28510, 28105, 27683, + 27244, 26789, 26318, 25831, 25329, 24811, 24278, 23731, + 23169, 22594, 22004, 21402, 20787, 20159, 19519, 18867, + 18204, 17530, 16845, 16150, 15446, 14732, 14009, 13278, + 12539, 11792, 11038, 10278, 9511, 8739, 7961, 7179, + 6392, 5601, 4807, 4011, 3211, 2410, 1607, 804, + 0, -804, -1607, -2410, -3211, -4011, -4807, -5601, + -6392, -7179, -7961, -8739, -9511,-10278,-11038,-11792, + -12539,-13278,-14009,-14732,-15446,-16150,-16845,-17530, + -18204,-18867,-19519,-20159,-20787,-21402,-22004,-22594, + -23169,-23731,-24278,-24811,-25329,-25831,-26318,-26789, + -27244,-27683,-28105,-28510,-28897,-29268,-29621,-29955, + -30272,-30571,-30851,-31113,-31356,-31580,-31785,-31970, + -32137,-32284,-32412,-32520,-32609,-32678,-32727,-32757, + -32767,-32757,-32727,-32678,-32609,-32520,-32412,-32284, + -32137,-31970,-31785,-31580,-31356,-31113,-30851,-30571, + -30272,-29955,-29621,-29268,-28897,-28510,-28105,-27683, + -27244,-26789,-26318,-25831,-25329,-24811,-24278,-23731, + -23169,-22594,-22004,-21402,-20787,-20159,-19519,-18867, + -18204,-17530,-16845,-16150,-15446,-14732,-14009,-13278, + -12539,-11792,-11038,-10278, -9511, -8739, -7961, -7179, + -6392, -5601, -4807, -4011, -3211, -2410, -1607, -804, + }; + +const TInt16 TSineGen::IncTable[KMaxSineTable] = + { + 804, 803, 803, 801, 800, 796, 794, + 791, 787, 782, 778, 772, 767, 760, 754, + 747, 739, 731, 723, 714, 704, 695, 685, + 674, 663, 652, 640, 628, 615, 602, 590, + 575, 562, 547, 533, 518, 502, 487, 471, + 455, 439, 422, 405, 387, 371, 353, 334, + 317, 299, 280, 262, 243, 224, 205, 185, + 167, 147, 128, 108, 89, 69, 49, 30, + 10, -10, -30, -49, -69, -89, -108, -128, + -147, -167, -185, -205, -224, -243, -262, -280, + -299, -317, -334, -353, -371, -387, -405, -422, + -439, -455, -471, -487, -502, -518, -533, -547, + -562, -575, -590, -602, -615, -628, -640, -652, + -663, -674, -685, -695, -704, -714, -723, -731, + -739, -747, -754, -760, -767, -772, -778, -782, + -787, -791, -794, -796, -800, -801, -803, -803, + -804, -804, -803, -803, -801, -800, -796, -794, + -791, -787, -782, -778, -772, -767, -760, -754, + -747, -739, -731, -723, -714, -704, -695, -685, + -674, -663, -652, -640, -628, -615, -602, -590, + -575, -562, -547, -533, -518, -502, -487, -471, + -455, -439, -422, -405, -387, -371, -353, -334, + -317, -299, -280, -262, -243, -224, -205, -185, + -167, -147, -128, -108, -89, -69, -49, -30, + -10, 10, 30, 49, 69, 89, 108, 128, + 147, 167, 185, 205, 224, 243, 262, 280, + 299, 317, 334, 353, 371, 387, 405, 422, + 439, 455, 471, 487, 502, 518, 533, 547, + 562, 575, 590, 602, 615, 628, 640, 652, + 663, 674, 685, 695, 704, 714, 723, 731, + 739, 747, 754, 760, 767, 772, 778, 782, + 787, 791, 794, 796, 800, 801, 803, 803, + 804 + }; + +void TSineGen::SetFrequency(TInt aFrequency,TInt aAmplitude) +// +// Given the frequency set iStep. +// Reset iPosition to the equivalent of 0 degrees. +// In the special case of aFrequency==4KHz set iPosition to 90 degrees. +// + { + + if (aAmplitude>(1<<15)) + iAmplitude=(1<<15); + else if (aAmplitude<-(1<<15)) + iAmplitude=-(1<<15); + else + iAmplitude=aAmplitude; +// +// There are 256 entries in the sine table to traverse 360 degrees. +// The codec requires samples at a rate of 8000 per second. +// Thus for a 1Hz tone the step will be 256/8000 or 4/125. +// Now we need need the integer part of the result to end up in +// the MSB so we need to multiply by 2^24. This gives the formula +// step = (f*4*2^24)/125 or (f*2^26)/125. +// Our highest frequency is 4KHz so that the term (f*2^26) exceeds +// a 32 bit result by 4000/2^6 (2^6 is the number of significant bits +// left after a multiply by 2^26). i.e. 6 bits. We overcome this by +// having 6 bits less in the fraction, so the new formula becomes +// ((f*2^20)/125)*2^6. This still gives us 20 significant bits in the +// fraction. +// + + iStep=(((TUint)aFrequency<<20)/125)<<6; + iPosition=(aFrequency==4000 ? 0x40000000 : 0); + } + +TInt TSineGen::NextSample() +// +// Generate the next sample using linear interpolation +// + { + TUint pos=iPosition>>24; + TInt amp=((IncTable[pos]*((iPosition&0x00ffffff)>>20))); + amp>>=4; + amp+=SineTable[pos]; + amp=(amp*iAmplitude)>>15; + iPosition+=iStep; + return(amp); + } + +void TSineWave::Generate(TInt16* aDest,TInt aCount) +// +// Called when more samples need to be generated. +// + { + while (aCount--) + { + *aDest++=STATIC_CAST(TInt16,iGen1.NextSample()+iGen2.NextSample()); + } + } + +void TSineWave::SetFrequency(TInt aFrequency,TInt aAmplitude) +// +// Set to generate a single frequency +// + { + SetFrequency(aFrequency,aAmplitude,0,0); + } + +void TSineWave::SetFrequency(TInt aFrequency1,TInt aAmplitude1,TInt aFrequency2,TInt aAmplitude2) +// +// Set to generate two frequencies +// + { + iGen1.SetFrequency(aFrequency1,aAmplitude1); + iGen2.SetFrequency(aFrequency2,aAmplitude2); + } + +// +// TMdaToneGenerator +// + +void TMdaToneGenerator::Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp) +// +// Set up this tone generator to generate data at the desired sample rate +// and number of channels (typically mono/stereo) +// + { + iRate = aRate; + iChannels = aChannels; + iSamplesLeft = 0; + iIncompleteVolume = 0; + iRampUpRemainder = 0; + iRampUp = ETrue; // Default ramping to on as it is normally useful + iRampDown = ETrue; + iIncompleteRampDown = EFalse; + iIncompleteRampUp = EFalse; + iRepeats = aRepeats; + iSilenceBetweenRepeats = aSilence; + iRampUpCount = aRampUp; + iRampUpLeft = aRampUp; + iAfterRepeatSilence = EFalse; + } + +LOCAL_C void RampVolume(TInt16* aData,TInt aCount,TInt aStartVol,TInt aEndVol) +// +// Simple function to ramp down the volume of some samples +// Typically used to prevent "clicking" artifacts at the beginning/end of tones +// + { + TInt step = (aEndVol - aStartVol)/aCount; + while (aCount--) + { + TInt data = TInt(*aData) * aStartVol; + *aData++ = TInt16(data>>15); + aStartVol += step; + } + } + +TInt TMdaToneGenerator::FillBuffer(TDes8& aBuffer) +// +// Fill the supplied buffer with tone data +// Sets the buffer length to zero if there is no more data to play +// The buffer must have a max length of at least one sample * channels +// e.g. 2 bytes mono, 4 bytes stereo +// + { + const TInt KRampUpSamples = 50; + const TInt KRampDownSamples = 50; + + ASSERT(aBuffer.MaxLength()>= (iChannels<<1)); + aBuffer.SetMax(); + + TBool silence; + TInt samples = 0; // + TInt used = 0; // Data used + TInt avail = aBuffer.Length(); // Data filled + TInt count = 0; // Data to be converted + TBool rampUp = EFalse; + + TMdaPtr8 fill; + fill.Set(aBuffer); // Pointer to data left to be filled + + // + // The rest of this function will loop around continually until the buffer + // is filled or there is no more data to play + // + +Restart: + silence = EFalse; // Reset + if (iSamplesLeft == 0) + { + if (iTrailingSilence == 0) + { + TInt error = GetNextTone(); + if (error) + return error; + + rampUp = ETrue; + if ((iSamplesLeft==0)&&(iTrailingSilence==0)) + { + if ((iSilenceBetweenRepeats)&&(!iAfterRepeatSilence)) + { + iTrailingSilence = iSilenceBetweenRepeats; + iAfterRepeatSilence = ETrue; + goto Restart; + } + else + { + if ((iRepeats>0)||(iRepeats==KMdaRepeatForever)) + { + iAfterRepeatSilence = EFalse; + if (iRepeats>0) + iRepeats--; + + Reset(); + goto Restart; + } + } + // No more to play + goto Finished; + } + goto Restart; + } + else + { + silence = ETrue; + samples = iTrailingSilence; + } + } + else + samples = iSamplesLeft; + + count = Min(samples,avail>>1); + fill.SetLength(count<<1); + + if (!silence) + { // Generate wave + iSineWave.Generate(REINTERPRET_CAST(TInt16*,&fill[0]),count); + + if (iRampUp) + { + // Ramp up volume at beginning of tone + if (rampUp) + { // Fade in first few samples + if(count < KRampUpSamples) + { + // Partial rampup due to being at the end of the buffer + TInt fadeInLength = Min(KRampUpSamples,(fill.Length()>>1)); + iIncompleteVolume = (count*((1<<15)/KRampUpSamples)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,0,iIncompleteVolume); + iRampUpRemainder = fadeInLength; + iIncompleteRampUp = ETrue; + } + else + { + // Normal rampup + TInt fadeInLength = Min(Min(KRampUpSamples,iSamplesLeft),(fill.Length()>>1)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,0,1<<15); + iIncompleteRampUp = EFalse; + } + } + else if (iIncompleteRampUp) + { + // Completing partial rampup at the start of a new buffer + TInt fadeInLength = Min(Min((KRampUpSamples-iRampUpRemainder),iSamplesLeft),(fill.Length()>>1)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,iIncompleteVolume,1<<15); + iIncompleteRampUp = EFalse; + } + } + if (iRampDown) + { // Ramp down volume at end of tone + if ((iSamplesLeft-count) < KRampDownSamples) + { + if(iSamplesLeft-count == 0) + { + // Fade out last few samples + TInt startVolume = 1<<15;; + TInt fadeOutLength = Min(Min(KRampDownSamples,iSamplesLeft),(fill.Length()>>1)); + + if(iIncompleteRampDown) + { + // Completing partial rampdown at the start of a new buffer + startVolume -= iIncompleteVolume; + iIncompleteRampDown = EFalse; + } + + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&(fill.Right(fadeOutLength<<1))[0]))),fadeOutLength,startVolume,0); + } + else if(iSamplesLeft-count > 0) + { + // Partial rampdown due to being at the end of the buffer + TInt rampDifference = (KRampDownSamples-(iSamplesLeft-count)); + TInt fadeOutLength = Min(Min(rampDifference,iSamplesLeft),(fill.Length()>>1)); + iIncompleteVolume = ((rampDifference*(1<<15))/KRampDownSamples); + + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&(fill.Right(fadeOutLength<<1))[0]))),fadeOutLength,1<<15,(1<<15)-iIncompleteVolume); + + iIncompleteRampDown = ETrue; + } + } + } + iSamplesLeft -= count; + } + else + { // Generate silence + fill.FillZ(count<<1); + iTrailingSilence -= count; + } + + used += count<<1; + avail -= count<<1; + fill.Shift(count<<1); + + if (avail>(iChannels<<1)) + goto Restart; + +Finished: + + aBuffer.SetLength(used); + + // Do any ramp up that is required + if (iRampUpLeft>0) + { + TInt words = iRampUpLeft * iChannels; + words = Min(words,used>>1); + if (words>0) // In case buffer has zero length... + { + TInt left = iRampUpLeft * iChannels; + TInt rampup = iRampUpCount * iChannels; + iRampUpLeft -= words/iChannels; + TInt16* sample = REINTERPRET_CAST(TInt16*,&aBuffer[0]); + while (words--) + { + TInt32 sampleValue = static_cast((*sample)*(rampup-(left--))); + *sample++ = static_cast(sampleValue/rampup); + } + } + } + + return KErrNone; + } + +TInt TMdaToneGenerator::DurationToSamples(const TTimeIntervalMicroSeconds& aDuration) +// +// Convert the given duration to a sample count using the current settings +// + { + const TInt64 KTInt64OneMilion = 1000000; + + // Calculate duration as samples + TInt64 microSeconds(aDuration.Int64()); // MSVC doesn't like "aDuration.Int64()" in line below + TInt64 dur = ((TInt64(iRate) * TInt64(iChannels) * microSeconds) / KTInt64OneMilion); + if (I64HIGH(dur)>0) + return KMaxTInt; // Ridiculous! + else + return I64LOW(dur); + } + +// +// TMdaSimpleToneGenerator +// + +void TMdaSimpleToneGenerator::Reset() + { + iPlayed = EFalse; + } + +void TMdaSimpleToneGenerator::SetFrequencyAndDuration(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) +// +// Store the frequency and duration of the specified sine tone +// + { + iFrequency = aFrequency; + iDuration = aDuration; + iPlayed = EFalse; + } + +TInt TMdaSimpleToneGenerator::GetNextTone() +// +// Simple implementation - just sets the supplied frequency and duration +// + { + // This class only plays one tone for the specified duration + if (!iPlayed) + { + iSamplesLeft = I64LOW((iDuration.Int64() * TInt64(iRate))/1000000); + iSineWave.SetFrequency(iFrequency,1<<14); + iPlayed = ETrue; + iTrailingSilence = 20; // Just to stop clicking + } + return KErrNone; + } + +// +// TMdaDualToneGenerator +// + +void TMdaDualToneGenerator::Reset() + { + iPlayed = EFalse; + } + +void TMdaDualToneGenerator::SetFrequencyAndDuration(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + // Store the frequencies and duration of the specified dual tone + iFrequencyOne = aFrequencyOne; + iFrequencyTwo = aFrequencyTwo; + iDuration = aDuration; + iPlayed = EFalse; + } + +// +// This is called by TMdaToneGenerator::FillBuffer() +// to calculate the number of samples (iSamplesLeft) that will be needed +// for the tone to be played and to initialize the sine wave generator. +// If the tone has already been played, then leaves iSamplesLeft +// unmodified (should be zero) to indicate that it has finished. +// +TInt TMdaDualToneGenerator::GetNextTone() + { + // This class only plays one tone for the specified duration + if (!iPlayed) + { + iSamplesLeft = I64LOW((iDuration.Int64() * TInt64(iRate))/KOneMillionMicroSeconds); + iSineWave.SetFrequency(iFrequencyOne, KMaxAmplitude/2, iFrequencyTwo, KMaxAmplitude/2); + iPlayed = ETrue; + iTrailingSilence = KDefaultTrailingSilenceSamples; // Just to stop clicking + } + return KErrNone; + } +// +// TMdaDTMFGenerator +// + +const TInt KRecalculateToneLengths = KMinTInt; + +void TMdaDTMFGenerator::Reset() + { + iChar = 0; + } + +void TMdaDTMFGenerator::SetToneDurations(const TTimeIntervalMicroSeconds32 aOn, + const TTimeIntervalMicroSeconds32 aOff, + const TTimeIntervalMicroSeconds32 aPause) +// +// Setup the DTMF tone durations +// aOn can be == -1 indicating should play first tone indefinately +// + { + ASSERT(aOn.Int() >=-1); + ASSERT(aOff.Int()>=0); + ASSERT(aPause.Int()>=0); + + iOn = aOn; + iOff = aOff; + iPause = aPause; + + iOnSamples = KRecalculateToneLengths; // Must recalculate these later + } + +void TMdaDTMFGenerator::SetString(const TDesC& aDTMFString) +// +// Store the DTMF string to be played +// No need to validate it as it will already have been checked +// + { + iChar = 0; + iDTMFString = &aDTMFString; + } + +const TUint8 KDtmfVolumeTable[4][4]= +// +// Relative strengths to assign to different DTMF tones +// +// This is only important if DTMFs are being played through a speaker +// and need to be machine-recognisable. This table compensates for frequency +// drop-off in the speaker and can boost the relative volume of some +// frequencies so they are still within tolerance. +// +// The values normally need to be determined using a frequency analyser on +// the hardware +// +// Each column == same low frequency (697, 770, 852, 941 Hz) +// Each row == same high frequency (1209, 1336, 1477, 1633 Hz) +// +// The value are interpreted as ratios: +// 0 == 100% low +// 7f == 50% low, 50% high +// ff == 100% high +// + { + {38,27,29,37}, + {46,36,36,46}, + {62,47,49,58}, + {70,56,60,68} + }; + +const TUint8 KDtmfTone697=0x0; +const TUint8 KDtmfTone770=0x1; +const TUint8 KDtmfTone852=0x2; +const TUint8 KDtmfTone941=0x3; + +const TUint8 KDtmfTone1209=0x00; +const TUint8 KDtmfTone1336=0x10; +const TUint8 KDtmfTone1477=0x20; +const TUint8 KDtmfTone1633=0x30; + +const TUint8 KDtmfToneTable[16]= + { + KDtmfTone941|KDtmfTone1336,//0 + KDtmfTone697|KDtmfTone1209,//1 + KDtmfTone697|KDtmfTone1336,//2 + KDtmfTone697|KDtmfTone1477,//3 + KDtmfTone770|KDtmfTone1209,//4 + KDtmfTone770|KDtmfTone1336,//5 + KDtmfTone770|KDtmfTone1477,//6 + KDtmfTone852|KDtmfTone1209,//7 + KDtmfTone852|KDtmfTone1336,//8 + KDtmfTone852|KDtmfTone1477,//9 + + KDtmfTone697|KDtmfTone1633,//A + KDtmfTone770|KDtmfTone1633,//B + KDtmfTone852|KDtmfTone1633,//C + KDtmfTone941|KDtmfTone1633,//D + KDtmfTone941|KDtmfTone1209,//E or * + KDtmfTone941|KDtmfTone1477,//F or # + }; + +TInt TMdaDTMFGenerator::GetNextTone() +// +// Setup frequency/duration/silence settings for next DTMF tone +// Supported characters are 0-9 A-F * # , and any kind of white space +// + { + TBool onlyPlayFirstTone = EFalse; + + if (iOnSamples == KRecalculateToneLengths) + { + // Must recalculate tone durations as samples + + // Handle special case where tone on duration negative + // - meaning play first character indefinately + if (iOn.Int()>=0) + iOnSamples = DurationToSamples(TInt64(iOn.Int())); + else + { + onlyPlayFirstTone = ETrue; + iOnSamples = -1; + } + + iOffSamples = DurationToSamples(TInt64(iOff.Int())); + iPauseSamples = DurationToSamples(TInt64(iPause.Int())); + } + + ASSERT(iDTMFString); + + if (iChar==iDTMFString->Length()) + return KErrNone; // Finished. Nothing to do + + TInt highFrequency = 0; + TInt highVolume = 0; + TInt lowFrequency = 0; + TInt lowVolume =0; + +Retry: + TChar c((*iDTMFString)[iChar++]); + if ((TUint)c=='#' || (TUint)c=='*' || c.IsHexDigit()) + { + TInt tableIndex; + switch ((TUint)c) + { + case '*': + tableIndex=14; + break; + case '#': + tableIndex=15; + break; + default: + if (c.IsDigit()) + tableIndex=(TUint)c-'0'; + else //letter + { + c.UpperCase(); + tableIndex=(TUint)c-'A'+10; + } + } + TInt high=KDtmfToneTable[tableIndex]&0xf0; + TInt low=KDtmfToneTable[tableIndex]&0x0f; + switch(high) + { + case KDtmfTone1209: + highFrequency=1209; + break; + case KDtmfTone1336: + highFrequency=1336; + break; + case KDtmfTone1477: + highFrequency=1477; + break; + default://KDtmfTone1633: + highFrequency=1633; + break; + } + switch(low) + { + case KDtmfTone697: + lowFrequency=697; + break; + case KDtmfTone770: + lowFrequency=770; + break; + case KDtmfTone852: + lowFrequency=852; + break; + default://KDtmfTone941: + lowFrequency=941; + break; + } + high>>=4; + const TUint8* dtmfVolumes=&KDtmfVolumeTable[0][0]; + TInt volume=dtmfVolumes[((low)<<2)+(high)]<<7; + highVolume = volume; + lowVolume = (1<<15)-volume; + + iTrailingSilence = iOffSamples; + iSamplesLeft = iOnSamples; + } + else if ((TUint)c==',') + { + iTrailingSilence = iPauseSamples; + iSamplesLeft = 0; + } + else if (c.IsSpace()) + { + if (iChar < iDTMFString->Length()) + goto Retry; + } + else + return KErrCorrupt; + + if (iOnSamples < 0) // Play only first character for ever + { + iTrailingSilence = 0; + iSamplesLeft = iRate * iChannels; // One second of samples + iChar = 0; // Reset so this character is played again next time + iRampDown = EFalse; + if (!onlyPlayFirstTone) + { + iRampUp = EFalse; + // This is not the first time around so we should not + // reset the tone generator - it will already have the + // correct settings and setting them again would cause + // an audible discontinuity + return KErrNone; + } + } + + iSineWave.SetFrequency(highFrequency,highVolume,lowFrequency,lowVolume); + return KErrNone; + } + +// +// TMdaSequenceGenerator +// + +// +// Sequence constants +// + +//const TInt KMaxFixedSequenceStack=KMaxSequenceStack;//Max nesting level of FixedSequences * 2 +#ifdef _DEBUG +const TInt16 KFixedSequenceSignatureOne='S'+('Q'<<8); +const TInt16 KFixedSequenceSignatureTwo='N'+('C'<<8); +#endif // _DEBUG + +const TInt KFixedSequenceFunctionReturn=-1; +const TInt KFixedSequenceFunctionStartLoop=-2; +const TInt KFixedSequenceFunctionEndLoop=-3; + +void TMdaSequenceGenerator::Reset() + { + iInstructionPtr = REINTERPRET_CAST(const TInt16*,&((*iSequenceData)[0])); + iInstructionPtr += 2; // Skip signature + iStackIndex = 0; + } + +void TMdaSequenceGenerator::SetSequenceData(const TDesC8& aSequenceData) +// +// Store the sequence data to be played +// No need to validate it as it will already have been checked +// + { + iSequenceData = &aSequenceData; + iInstructionPtr = REINTERPRET_CAST(const TInt16*,&aSequenceData[0]); + iLastInstruction = iInstructionPtr + (iSequenceData->Length()>>1) - 1; + + // These are asserts because this should not be called if signature not present + ASSERT(*iInstructionPtr == KFixedSequenceSignatureOne); + ASSERT(*(iInstructionPtr+1) == KFixedSequenceSignatureTwo); + + iInstructionPtr += 2; // Skip signature + + iStackIndex = 0; + } + +TInt TMdaSequenceGenerator::GetNextTone() +// +// + { + ASSERT(iInstructionPtr); // Sanity check + + TInt ret = KRequestPending; + while (ret == KRequestPending) + { + if (iInstructionPtr > iLastInstruction) + ret = KErrCorrupt; + else if (*iInstructionPtr<=0) + { + switch (*iInstructionPtr) + { + case KFixedSequenceFunctionReturn: // End of sequence + ret = KErrNone; + break; + + case KFixedSequenceFunctionStartLoop: + if (iStackIndex>2) // Validate - can only nest twice + ret = KErrCorrupt; + else if ((iInstructionPtr+2) > iLastInstruction) + ret = KErrCorrupt; // Don't run off end of sequence + else + { + iStack[iStackIndex++]=(TInt)(iInstructionPtr+2); + iStack[iStackIndex++]=(TInt)*(iInstructionPtr+1); + iInstructionPtr+=2; + } + break; + + case KFixedSequenceFunctionEndLoop: + if (iStackIndex==0) // Validate - must already be nested + ret = KErrCorrupt; + else + { + if ((--iStack[iStackIndex-1])!=0) + iInstructionPtr=(TInt16*)iStack[iStackIndex-2]; + else + { + iStackIndex-=2; + iInstructionPtr++; + } + } + break; + + default: // Bad sequence + ret = KErrCorrupt; + } + } + else + { + if ((iInstructionPtr+5) > iLastInstruction) + ret = KErrCorrupt; // Don't run off end of sequence + else + { + iSamplesLeft = *iInstructionPtr++; + TInt freqOne = *iInstructionPtr++; + TInt volOne = *iInstructionPtr++; + TInt freqTwo = *iInstructionPtr++; + TInt volTwo = *iInstructionPtr++; + + if ((volOne> 1<<15)||(volTwo > 1<<15)) + ret = KErrCorrupt; + else + { + iSineWave.SetFrequency(freqOne,volOne,freqTwo,volTwo); + ret = KErrNone; + } + } + } + } + return ret; + } + +// --------------------------------- +// Code to generate sine table files used by tone generator +// Optionally called from InitL() +// #define GENERATE_SINE_TABLES 1 +#ifdef GENERATE_SINE_TABLES +LOCAL_C GenerateSineTableL() + { + _LIT(KSineFile,"sine.txt"); + _LIT(KSineIncFile,"sineinc.txt"); + + RFile file; + file.Replace(MdaManager::Fs(),KSineFile,EFileWrite); + CleanupClosePushL(file); + + RFile file2; + file2.Replace(MdaManager::Fs(),KSineIncFile,EFileWrite); + CleanupClosePushL(file2); + + const TReal pi=3.141592653589; + const TReal twopi=pi*2; + const TReal samples = 256.0; + const TReal step = twopi/samples; + + TBuf8<128> sinebuffer; + TBuf8<128> incbuffer; + TReal res; + TInt first=0; + TInt last=KMaxTInt; + TInt current; + _LIT8(KFormat,"%6d,"); + _LIT8(KNewLine,"\n"); + + for(TReal angle=0.0;angle<=(twopi-step);) // Copes with rounding errors + { + sinebuffer.Zero(); + incbuffer.Zero(); + for (int i=0;i<8;i++) + { + User::LeaveIfError(Math::Sin(res,angle)); + current = TInt(KMaxTInt16*res); + sinebuffer.AppendFormat(KFormat,current); + if (last != KMaxTInt) + incbuffer.AppendFormat(KFormat,current-last); + else + first = current; + last = current; + angle += step; + } + sinebuffer.Append(KNewLine); + incbuffer.Append(KNewLine); + file.Write(sinebuffer); + file2.Write(incbuffer); + } + + // Write fine difference to incbuffer - differnece between first and last + incbuffer.Zero(); + incbuffer.AppendFormat(KFormat,first-last); + incbuffer.Append(KNewLine); + file2.Write(incbuffer); + + CleanupStack::PopAndDestroy(2); + } +#endif +//------------------------------- diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/sounddevice/ToneGenerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/sounddevice/ToneGenerator.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,226 @@ +// Copyright (c) 1997-2009 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: +// + +#ifndef __TONEGENERATOR_H__ +#define __TONEGENERATOR_H__ + +#include + +// +// Sine tone generator +// + +const TInt KMaxSineTable = 256; +const TUint KToneBufferSize = 8192; + +// one second in microseconds +const TInt KOneMillionMicroSeconds = 1000000; + + +class TSineGen +/** +*@internalTechnology +*/ + { +public: + void SetFrequency(TInt aFrequency,TInt aAmplitude); + TInt NextSample(); +private: + TUint iPosition; + TUint iStep; + TInt iAmplitude; + static const TInt16 SineTable[KMaxSineTable]; + static const TInt16 IncTable[KMaxSineTable]; + }; + +class TSineWave +/** +*@internalTechnology +*/ + { +public: + void Generate(TInt16* aDest,TInt aCount); + void SetFrequency(TInt aFrequency,TInt aAmplitude); + void SetFrequency(TInt aFrequency1,TInt aAmplitude1,TInt aFrequency2,TInt aAmplitude2); +private: + TSineGen iGen1; + TSineGen iGen2; + }; + +// +// Tone synthesis interface +// Defines the abstract interface for tone synthesis +// Capable of filling buffers with audio data +// + +class MMdaToneSynthesis +/** +*@internalTechnology +*/ + { +public: + // Allocate necessary resources for this kind of synthesis + virtual void Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp)=0; + // Begin generating data from start again + virtual void Reset()=0; + // Fill supplied buffer with next block of 16bit PCM audio data + virtual TInt FillBuffer(TDes8& aBuffer)=0; + }; + +// +// Tone generator base class +// + +class TMdaToneGenerator : public MMdaToneSynthesis + { +public: + virtual void Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp); + virtual TInt FillBuffer(TDes8& aBuffer); +protected: + virtual TInt GetNextTone()=0; + // + TInt DurationToSamples(const TTimeIntervalMicroSeconds& aDuration); +protected: + TSineWave iSineWave; + TInt iRate; + TInt iChannels; + TInt iSamplesLeft; + TInt iTrailingSilence; + TBool iRampUp; + TBool iRampDown; + TBool iIncompleteRampDown; + TBool iIncompleteRampUp; + TInt iIncompleteVolume; + TInt iRampUpRemainder; + TInt iRepeats; + TInt iSilenceBetweenRepeats; + TBool iAfterRepeatSilence; + TInt iRampUpCount; + TInt iRampUpLeft; + }; + +// +// Simple tone synthesis +// + +class TMdaSimpleToneGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + void SetFrequencyAndDuration(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + virtual void Reset(); + virtual TInt GetNextTone(); +private: + TTimeIntervalMicroSeconds iDuration; + TInt iFrequency; + TBool iPlayed; + }; + + +/** + * Dual tone synthesis + * Generates a tone consisting of two sine waves of different + * frequencies summed together. + * + * @internalTechnology + */ +class TMdaDualToneGenerator : public TMdaToneGenerator + { +public: + void SetFrequencyAndDuration(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + virtual void Reset(); + virtual TInt GetNextTone(); +private: + TTimeIntervalMicroSeconds iDuration; + TInt iFrequencyOne; + TInt iFrequencyTwo; + TBool iPlayed; + }; + +// +// DTMF tone synthesis +// + +class TMdaDTMFGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + virtual void Reset(); + void SetToneDurations( const TTimeIntervalMicroSeconds32 aOn, + const TTimeIntervalMicroSeconds32 aOff, + const TTimeIntervalMicroSeconds32 aPause); + void SetString(const TDesC& aDTMFString); +private: + virtual TInt GetNextTone(); +private: + const TDesC* iDTMFString; + TTimeIntervalMicroSeconds32 iOn; + TTimeIntervalMicroSeconds32 iOff; + TTimeIntervalMicroSeconds32 iPause; + TInt iOnSamples; + TInt iOffSamples; + TInt iPauseSamples; + TInt iChar; + TBool iPlayToneOff; + }; + +// +// Tone sequence synthesis +// + +const TInt KMaxSequenceStack = 6; +class TMdaSequenceGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + virtual void Reset(); + void SetSequenceData(const TDesC8& aSequenceData); +private: + virtual TInt GetNextTone(); +private: + const TDesC8* iSequenceData; + const TInt16* iInstructionPtr; + const TInt16* iLastInstruction; + TInt iStack[KMaxSequenceStack]; + TInt iStackIndex; + }; + +const TInt KBufferLength = 0x1000; + +// Public Media Server includes + +class TMdaPtr8 : public TPtr8 //needed for this WINS Impl of Tone Gen + { +public: + TMdaPtr8() + : TPtr8(0,0,0) {}; + inline void Set(const TDes8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.MaxLength()); }; + inline void SetLengthOnly(const TDes8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); }; + inline void Set(const TPtrC8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); }; + inline void Shift(TInt aOffset) + { SetLength(Length()-aOffset); iMaxLength-=aOffset; iPtr+=aOffset; }; + }; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecConvertDataPath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecConvertDataPath.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,383 @@ +// Copyright (c) 2003-2009 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: +// source\server\mmfswcodecconvertdatapath.cpp +// +// + +#include "mmfSwCodecConvertDataPath.h" +#include +#include + + +CMMFSwCodecConvertDataPath* CMMFSwCodecConvertDataPath::NewL() + { + CMMFSwCodecConvertDataPath* self = new(ELeave) CMMFSwCodecConvertDataPath; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +void CMMFSwCodecConvertDataPath::ConstructL() + { + iDataPathConverter = new (ELeave) CDataPathConverter(*this,CActive::EPriorityUserInput); + } + + +CMMFSwCodecConvertDataPath::~CMMFSwCodecConvertDataPath() + { + delete iDataPathConverter; + if (iCodec) + { + delete iSourceBuffer; + if (!iCodec->IsNullCodec()) + delete iSinkBuffer; + } + } + + +TInt CMMFSwCodecConvertDataPath::SetObserver(MMMFHwDeviceObserver& aObserver) + { + TInt error; + if (iHwDeviceObserver) + { + error = KErrAlreadyExists; + } + else + { + iHwDeviceObserver = &aObserver; + error = KErrNone; + } + return error; + } + + +TInt CMMFSwCodecConvertDataPath::AddCodec(CMMFSwCodec& aCodec) + { + if (iCodec) + return KErrNotSupported; //doesn't support multiple codecs + + TInt err = KErrNone; + iCodec = &aCodec; + + iSourceBufferSize = iCodec->SourceBufferSize(); + iSinkBufferSize = iCodec->SinkBufferSize(); + + if ((!iSourceBufferSize)||(!iSinkBufferSize)) + err = KErrArgument; //codec plugin has not specified buffer size + + if (err == KErrNone) + { + TRAP(err,iSourceBuffer = CMMFDataBuffer::NewL(iSourceBufferSize)); + } + + if (err == KErrNone) + { + // Allocate data buffer + if (iCodec->IsNullCodec()) + {//don't need a separate sink buffer if null codec + iSinkBuffer = NULL; //sink buffer is the sound device buffer + } + else + {//need a separate sink buffer for the codec + TRAP(err,iSinkBuffer = CMMFDataBuffer::NewL(iSinkBufferSize)); + } + } + return err; + } + + +TInt CMMFSwCodecConvertDataPath::Start() + { + TInt startError = KErrNone; + if (!iCodec) + {//check that a codec has been added + startError = KErrNotReady; + } + if (!startError) + { + // Start the player objects + iSourceBuffer->SetLastBuffer(EFalse); + iDataPathConverter->Start(); + iState = EPlaying; + iNoMoreSourceData = EFalse; + } + return startError; + } + + + +void CMMFSwCodecConvertDataPath::Stop() + { + iDataPathConverter->Cancel(); + iState = EStopped; + } + + +void CMMFSwCodecConvertDataPath::Pause() + {//pause is equivalent to stop for a data transfer + iDataPathConverter->Cancel(); + iState = EStopped; + } + +/*** Main play loop ***/ + +void CMMFSwCodecConvertDataPath::FillSourceBufferL() + { + STATIC_CAST(CMMFDataBuffer*, iSourceBuffer)->SetRequestSizeL(iSourceBufferSize); + + // Ask immediately for data from the observer + User::LeaveIfError(iHwDeviceObserver->FillThisHwBuffer(*iSourceBuffer)); + } + + /** + * BufferFilledL. + * (from MDataSink) + * + * called by the CMMFDataPath's MDataSource when it has filled the buffer + * @internalComponent + * @param aBuffer + * + */ +void CMMFSwCodecConvertDataPath::BufferFilledL(CMMFDataBuffer& aBuffer) + { + iSourceBuffer = &aBuffer; + iSourceBuffer->SetStatus(EFull); + + //need to check that the buffer size is not 0 - + //if so assume we've reached the end of the data + if (!iSourceBuffer->BufferSize()) + {//no buffer - could be end of source or could be that the source has no data + //also need to check the sink buffer is available else there is still some + //stuff to do before the sink buffer is freed + if (iSinkBuffer->Status()==EAvailable) + { + iNoMoreSourceData = ETrue; + } + } + else + { + if (iSourceBuffer->LastBuffer()) //also check last buffer flag + iNoMoreSourceData = ETrue; + iDataPathConverter->ChangeConvertState(CDataPathConverter::EFillingSinkBuffer); + } + } + +/* + * FillSinkBufferL + * + * Function to take the data from an already full source buffer and by using + * a codec if necessary fills the sink buffer + * @internalComponent + */ +void CMMFSwCodecConvertDataPath::FillSinkBufferL() + { + CMMFSwCodec::TCodecProcessResult codecProcessResult; + + if (iCodec->IsNullCodec()) + {//no codec so data can be sent direct to sink + iSinkBuffer = iSourceBuffer; + iSinkBuffer->SetStatus(EFull); //sink buffer is full + } + else + { + //pass buffer to codec for processing + codecProcessResult = iCodec->ProcessL(*iSourceBuffer, *iSinkBuffer); + if (iSourceBuffer->LastBuffer()) //if source is last buffer so is sink + iSinkBuffer->SetLastBuffer(ETrue); + if ((!iSinkBuffer->BufferSize())&&(codecProcessResult.iDstBytesAdded)) + {//the codec has added data but not set the buffer length + iSinkBuffer->Data().SetLength(codecProcessResult.iDstBytesAdded); + } + + //only supports EProcessComplete + switch (codecProcessResult.iCodecProcessStatus) + { + case CMMFSwCodec::TCodecProcessResult::EProcessComplete: + //finished procesing source data - all data in sink buffer + { + iSourceBuffer->SetStatus(EAvailable); //source buffer is now avaialble + iSinkBuffer->SetStatus(EFull); //sink buffer is full + } + break; + case CMMFSwCodec::TCodecProcessResult::EDstNotFilled: + //could be the last buffer in which case dst might not get filled + { + iSourceBuffer->SetStatus(EAvailable); //source buffer is now avaialble + iSinkBuffer->SetStatus(EFull); //sink buffer is full + } + break; + case CMMFSwCodec::TCodecProcessResult::EEndOfData: + //no more data - send what we've got to the sink + //note we can't always rely on this - in many cases the codec will not know when + //it has reached the end of data. + { + iSourceBuffer->SetStatus(EAvailable); //source buffer is now avaialble + iSinkBuffer->SetStatus(EFull);//sink buffer may not really be 'full' but its as full as it going to get + //doesn't matter if sink buffer is not full + } + break; + default: + Panic(EMMFSwCodecWrapperBadCodec); //should never get here - bad codec + } + } + iDataPathConverter->ChangeConvertState(CDataPathConverter::EEmptyingSinkBuffer); + } + + +void CMMFSwCodecConvertDataPath::EmptySinkBufferL() + { + User::LeaveIfError(iHwDeviceObserver->EmptyThisHwBuffer(*iSinkBuffer)); + } + + +void CMMFSwCodecConvertDataPath::BufferEmptiedL(const CMMFDataBuffer& aBuffer) + { + if (&aBuffer != iSinkBuffer) + User::Leave(KErrArgument); + if (!iNoMoreSourceData) + iDataPathConverter->ChangeConvertState(CDataPathConverter::EFillingSourceBuffer); + else //no more source data so signal EOF + SoundDeviceException(KErrEof); + } + +void CMMFSwCodecConvertDataPath::SoundDeviceException(TInt aError) + { + // Inform the observer of the exception condition + iHwDeviceObserver->Error(aError); + + Stop(); + + // Let the observer know we're fully stopped + iHwDeviceObserver->Stopped(); + } + +RMdaDevSound& CMMFSwCodecConvertDataPath::Device() + { + return iDummyDevSound;//convert doesn't have a RMdaDevSound + } + +/*** End of main play loop ***/ + + + + +/************************************************************************ + * CDataPathConverter + * This class performs the main data transfer between the source and the sink + * This is done in a separate class as opposed to CMMFSwCodecConvertDataPath + * because the class needs to be an active object to avoid recursive call stacks + * in cases where the source and sink are not active objects - which is + * the case with descriptors. Making CMMFSwCodecConvertDataPath derive + * from CActive is less desirable as it would involve multiple inheretence + ************************************************************************/ + +CMMFSwCodecConvertDataPath::CDataPathConverter::CDataPathConverter(CMMFSwCodecConvertDataPath& aParent, TInt aPriority) +: CActive(aPriority), iParent(aParent) + { + CActiveScheduler::Add(this); + iConvertState = EIdle; + } + + +CMMFSwCodecConvertDataPath::CDataPathConverter::~CDataPathConverter() + { + Cancel(); + } + +/** + * Start + * + * Starts active scheduler 'play' loop + * @internalComponent + */ +void CMMFSwCodecConvertDataPath::CDataPathConverter::Start() + { + // If we're not already active, complete a request on ourselves to kick off the state machine + if (iConvertState == EIdle) + iConvertState = EFillingSourceBuffer; + if (!IsActive()) + { + TRequestStatus* stat = &iStatus; + User::RequestComplete(stat, KErrNone); + SetActive(); + } + } + + +void CMMFSwCodecConvertDataPath::CDataPathConverter::ChangeConvertState(TConvertState aNewConvertState) + { + TRequestStatus* stat = &iStatus; + //change state + iConvertState = aNewConvertState; + if (!IsActive()) + { + User::RequestComplete(stat, KErrNone); + SetActive(); + } + } + +/*** Main Convert Loop ***/ + +void CMMFSwCodecConvertDataPath::CDataPathConverter::FillSourceBufferL() + { + iParent.FillSourceBufferL(); + } + +void CMMFSwCodecConvertDataPath::CDataPathConverter::FillSinkBufferL() + { + iParent.FillSinkBufferL(); + } + +void CMMFSwCodecConvertDataPath::CDataPathConverter::EmptySinkBufferL() + { + iParent.EmptySinkBufferL(); + } + +/*** End of main convert loop ***/ + + +void CMMFSwCodecConvertDataPath::CDataPathConverter::RunL() + { + switch (iConvertState) + { + case EFillingSourceBuffer: + FillSourceBufferL(); + break; + case EFillingSinkBuffer: + FillSinkBufferL(); + break; + case EEmptyingSinkBuffer: + EmptySinkBufferL(); + break; + case EIdle: + break; + } + } + +void CMMFSwCodecConvertDataPath::CDataPathConverter::DoCancel() + { + //don't need to do anything as we don't have any async requests to other objects + } + +TInt CMMFSwCodecConvertDataPath::CDataPathConverter::RunError(TInt aError) + { + iParent.SoundDeviceException(aError); + return KErrNone; + } + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecConvertDataPath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecConvertDataPath.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,100 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECCONVERTDATAPATH_H__ +#define __MMFSWCODECCONVERTDATAPATH_H__ + +#include + +#include "mmfSwCodecDataPath.h" + +/** + * Derived class for convert datapath internal to the Sw codec wrapper + * @internalComponent + */ +class CMMFSwCodecConvertDataPath : public CMMFSwCodecDataPathX + { +public: + static CMMFSwCodecConvertDataPath* NewL(); + virtual ~CMMFSwCodecConvertDataPath(); + virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver); + virtual TInt AddCodec(CMMFSwCodec& aCodec); + virtual TInt Start(); + virtual void Stop(); + virtual void Pause(); + virtual void BufferFilledL(CMMFDataBuffer& aBuffer); + virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer); + virtual void SoundDeviceException(TInt aError); + virtual RMdaDevSound& Device(); + void FillSourceBufferL(); + void FillSinkBufferL(); + void EmptySinkBufferL(); +private: + CMMFSwCodecConvertDataPath() {}; + void ConstructL(); +private: + /** + * Private class for the convert datapath that is an active object + * used to drive the conversion. This class performs the main data transfer + * between the source and the sink. + * This is done in a separate class as opposed to CMMFSwCodecConvertDataPath + * because the class needs to be an active object to avoid recursive call stacks + * in cases where the source and sink are not active objects - which is + * the case with descriptors. Making CMMFSwCodecConvertDataPath derive + * from CActive is less desirable as it would involve multiple inheretence + * @internalComponent + */ + class CDataPathConverter : public CActive + { + public: + enum TConvertState + { + EIdle, + EFillingSourceBuffer, + EFillingSinkBuffer, + EEmptyingSinkBuffer + }; + public: + CDataPathConverter(CMMFSwCodecConvertDataPath& aParent, TInt aPriority); + ~CDataPathConverter(); + void Start(); + void BufferFilledL(CMMFDataBuffer& aBuffer); + void BufferEmptiedL(CMMFDataBuffer& aBuffer); + void ChangeConvertState(TConvertState aNewConvertState); + //CActive + virtual void RunL(); + virtual TInt RunError(TInt aError); + virtual void DoCancel(); + private: + void FillSourceBufferL(); + void FillSinkBufferL(); + void EmptySinkBufferL(); + private: + TConvertState iConvertState; + CMMFSwCodecConvertDataPath& iParent; + CMMFDataBuffer* iSourceBuffer; + }; +private: + CDataPathConverter* iDataPathConverter; + CMMFDataBuffer* iSourceBuffer; + CMMFDataBuffer* iSinkBuffer; + TBool iNoMoreSourceData; + TUint iSinkBufferSize; + TUint iSourceBufferSize; + RMdaDevSound iDummyDevSound;//don't need a devsound for convert + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2003-2009 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: +// source\server\mmfswcodecdatapath.cpp +// +// + +#include "mmfSwCodecDataPath.h" + + +CMMFSwCodecDataPath::~CMMFSwCodecDataPath() + { + + } + +/** +Retrieves a custom interface to the device. +Usually the derived class should +return the implementation for this. + +@param aInterface + Interface UID, defined with the custom interface. + +@return NULL + +*/ +TAny* CMMFSwCodecDataPath::CustomInterface(TUid /*aInterface*/) + { + return NULL; + } + + + +/* + * CycleAudioBufferL + * + * Sets up a usable buffer for passing to MMF + * + * This method has been written such that it must allocate a new buffer before + * replacing the existing one. The purpose of this is to force creation of a + * new buffer. Simply deleting and then re-allocing may result in the same + * address being used. + * + * Only cycles if there is enough memory + * + */ +#ifdef __CYCLE_MMF_DATABUFFERS__ +CMMFDataBuffer* CMMFSwCodecDataPath::CycleAudioBuffer(CMMFDataBuffer* aBuffer) + { + CMMFDataBuffer* buffer = NULL; + TUint bufferSize = aBuffer->Data().MaxLength(); + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + TRAPD(err, buffer = CreateTransferBufferL(bufferSize, static_cast(aBuffer))); +#else + TRAPD(err,buffer = CMMFDataBuffer::NewL(bufferSize)); + + if (err == KErrNone) + { + delete aBuffer; + } +#endif + if (err != KErrNone) + {//there was a problem creating buffer eg OOM so use same buffer + buffer = aBuffer; + } + + return buffer; + + } +#endif + +/* + * DoCleanupRHandleBase + * + * This method will initially Close the handle and then delete it. + * + */ +#ifdef __USE_MMF_TRANSFERBUFFERS__ +inline static void DoCleanupRHandleBase(TAny* aRHandleBase) + { + ASSERT(aRHandleBase); + RHandleBase* rHandleBase = STATIC_CAST(RHandleBase*, aRHandleBase); + TRAPD(error, rHandleBase->Close()); + delete aRHandleBase; + } + +CMMFTransferBuffer* CMMFSwCodecDataPath::CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer) + { + CMMFTransferBuffer* buffer = NULL; + + RTransferBuffer* transBuffer = new (ELeave) RTransferBuffer; + + TCleanupItem bufferCleanupItem(DoCleanupRHandleBase, transBuffer); //closes and deletes. + CleanupStack::PushL(bufferCleanupItem); + + RTransferWindow* transWindow = new (ELeave) RTransferWindow; + + TCleanupItem windowCleanupItem(DoCleanupRHandleBase, transWindow); //closes and deletes. + CleanupStack::PushL(windowCleanupItem); + + User::LeaveIfError(transBuffer->Create(aBufferSize)); + User::LeaveIfError(transWindow->Create(aBufferSize)); + User::LeaveIfError(transWindow->MapInBuffer(*transBuffer)); + + buffer = CMMFTransferBuffer::NewL(*transWindow); + + delete aOldBuffer; //closes RTransferWindow + delete iTransferWindow; + + if(iTransferBuffer) + { + iTransferBuffer->Close(); + } + delete iTransferBuffer; + + iTransferBuffer = transBuffer; + iTransferWindow = transWindow; + + CleanupStack::Pop(transWindow); + CleanupStack::Pop(transBuffer); + + return buffer; + } +#endif + + +#ifdef __USE_MMF_PTRBUFFERS__ +CMMFPtrBuffer* CMMFSwCodecDataPath::CreatePtrBufferL(TUint aBufferSize) + { + CMMFPtrBuffer* buffer = NULL; + if (iPtrBufferMemoryBlock) + { + delete iPtrBufferMemoryBlock;//incase already exisits + iPtrBufferMemoryBlock = NULL; + } + iPtrBufferMemoryBlock = HBufC8::NewL(aBufferSize); + TPtr8 ptrMemoryBlock(iPtrBufferMemoryBlock->Des()); + buffer = CMMFPtrBuffer::NewL(ptrMemoryBlock); + return buffer; + } +#endif // __USE_MMF_PTRBUFFERS__ + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecDataPath.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,139 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECDATAPATH_H__ +#define __MMFSWCODECDATAPATH_H__ + +#include +#include + + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include + _LIT(KPddFileName,"ESDRV.PDD"); + _LIT(KLddFileName,"ESOUND.LDD"); +#endif + +class MMMFHwDeviceObserver; +class CMMFSwCodec; + +/* +Interface for setting desired sample rate, channels and for setting Gain/Volume +*/ +const TUid KUidSwSetParamInterface = {0x1028707E}; +class MSwSetParamInterface + { +public: + virtual TInt SetSampleRate(TInt aSampleRate)=0; + virtual TInt SetNumChannels(TInt aNumChannels)=0; + virtual TInt SetGain(TInt aGain)=0; + virtual TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize)=0; + }; + +/* + * Interface for discovering various parameters + */ +const TUid KUidSwInfoInterface = {0x1028707F}; +class MSwInfoInterface + { +public: + virtual TInt GetSupportedSampleRates(RArray& aSupportedSampleRates)=0; + }; + +/** + * Base class for the datapath internal to the Sw codec wrapper + * @internalComponent + */ +class CMMFSwCodecDataPath : public CBase + { +public: + enum TSwCodecDataPathState + { + EStopped, + EPlaying, + EPaused + }; +public: + virtual ~CMMFSwCodecDataPath(); + virtual TInt SetObserver(MMMFHwDeviceObserver& aHwObserver) = 0; + virtual TInt AddCodec(CMMFSwCodec& aCodec) = 0; + virtual TInt Start() = 0; + virtual void Stop() = 0; + virtual void Pause() = 0; + virtual RMdaDevSound& Device() = 0; + virtual void BufferFilledL(CMMFDataBuffer& aBuffer) = 0; + virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer) = 0; + virtual void SoundDeviceException(TInt aError) = 0; + virtual TSwCodecDataPathState State() const = 0; + virtual TAny* CustomInterface(TUid aInterfaceId); +protected: + CMMFSwCodecDataPath() {}; + inline void Panic(TInt aPanicCode); + void ConstructL(); + +#ifdef __CYCLE_MMF_DATABUFFERS__ + CMMFDataBuffer* CycleAudioBuffer(CMMFDataBuffer* aBuffer); +#endif + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + CMMFTransferBuffer* CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer); +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + CMMFPtrBuffer* CreatePtrBufferL(TUint aBufferSize); +#endif + +protected: + MMMFHwDeviceObserver* iHwDeviceObserver; + CMMFSwCodec* iCodec; +#ifdef __USE_MMF_TRANSFERBUFFERS__ + RTransferBuffer* iTransferBuffer; + RTransferWindow* iTransferWindow; +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + HBufC8* iPtrBufferMemoryBlock; +#endif + }; + +/** + * Internal panic + * @internalComponent + */ +inline void CMMFSwCodecDataPath::Panic(TInt aPanicCode) + { + _LIT(KMMFSwCodecWrapperPanicCategory, "MMFSwCodecWrapper"); + User::Panic(KMMFSwCodecWrapperPanicCategory, aPanicCode); + } + +/** + * Extended datapath class with state info + * @internalComponent + */ +class CMMFSwCodecDataPathX : public CMMFSwCodecDataPath + { +protected: + CMMFSwCodecDataPathX(): CMMFSwCodecDataPath() {} + + // from CMMFSwCodecDataPath + TSwCodecDataPathState State() const {return iState;} + + TSwCodecDataPathState iState; + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecPlayDataPath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecPlayDataPath.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,752 @@ +// Copyright (c) 2003-2009 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: +// source\server\mmfswcodecplaydatapath.cpp +// +// + +#include "mmfSwCodecPlayDataPath.h" +#include +#include +#include +#include "mmfSwCodecUtility.h" + +const TInt KBytesPerSample = 2; +const TInt KMaxBytesInSec = 192000; //considering maximum samplerate 96KHz +CMMFSwCodecPlayDataPath* CMMFSwCodecPlayDataPath::NewL() + { + CMMFSwCodecPlayDataPath* self = new(ELeave) CMMFSwCodecPlayDataPath; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +void CMMFSwCodecPlayDataPath::ConstructL() + { + iAudioPlayer = new (ELeave) CDataPathPlayer(*this,CActive::EPriorityUserInput); + iSoundDeviceErrorReceiver = new (ELeave) CSoundDevPlayErrorReceiver(*this, CActive::EPriorityUserInput); + iUtility = CMMFSwCodecUtility::NewL(); + iVbrFlag = EFalse; + } + + +CMMFSwCodecPlayDataPath::~CMMFSwCodecPlayDataPath() + { + delete iAudioPlayer; + delete iSoundDeviceErrorReceiver; + delete iUtility; + + iSoundDevice.Close(); + + if (iCodec) + { + delete iSourceBuffer; + if (!iCodec->IsNullCodec()) + { + delete iSoundDeviceBuffer; + } + } + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + delete iTransferWindow; + + if(iTransferBuffer) + { + iTransferBuffer->Close(); + delete iTransferBuffer; + } +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + delete iPtrBufferMemoryBlock; +#endif + } + + +TInt CMMFSwCodecPlayDataPath::SetObserver(MMMFHwDeviceObserver& aObserver) + { + TInt error; + if (iHwDeviceObserver) + { + error = KErrAlreadyExists; + } + else + { + iHwDeviceObserver = &aObserver; + error = KErrNone; + } + return error; + } + + +TInt CMMFSwCodecPlayDataPath::AddCodec(CMMFSwCodec& aCodec) + { + if (iCodec) + return KErrNotSupported; //doesn't support multiple codecs + + TInt err = KErrNone; + + iCodec = &aCodec; + + // Allocate data buffer + iSourceBufferSize = iCodec->SourceBufferSize(); + iSoundDevBufferSize = iCodec->SinkBufferSize(); + + if ((!iSourceBufferSize)||(!iSoundDevBufferSize)) + err = KErrArgument; //codec plugin has not specified buffer size + + if (err == KErrNone) + { +#ifdef __USE_MMF_TRANSFERBUFFERS__ + TRAP(err,iSourceBuffer = CreateTransferBufferL(iSourceBufferSize, static_cast(iSourceBuffer))); +#endif +#ifdef __USE_MMF_PTRBUFFERS__ + TRAP(err,iSourceBuffer = CreatePtrBufferL(iSourceBufferSize)); +#else + TRAP(err,iSourceBuffer = CMMFDataBuffer::NewL(iSourceBufferSize)); +#endif + } + + if (err == KErrNone) + { + if (iCodec->IsNullCodec()) + {//use source buffer for sound device buffer + iSoundDeviceBuffer = NULL; + } + else + {//codec needs separate source and sound device buffers + TRAP(err,iSoundDeviceBuffer = CMMFDataBuffer::NewL(iSoundDevBufferSize)); + } + } + return err; + } + + +TInt CMMFSwCodecPlayDataPath::Start() + { + TInt startError = KErrNone; + + if (!iCodec) + {//check that a codec has been added + startError = KErrNotReady; + } + if ((!iSoundDevice.Handle())&&(!startError)) + {//check that the sound drivers can be opened + startError = iSoundDevice.Open(); + } + + if (iState == EPaused) + {//we are paused so need to resume play + if (!startError) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CMMFSwCodecPlayDataPath::Start-Resume")); +#endif + iAudioPlayer->ResumePlaying(); + iState = EPlaying; + } + } + else if (!startError) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CMMFSwCodecPlayDataPath::Start-Normal")); +#endif + // get sample rate and channels from RMdaDevSound + RMdaDevSound::TCurrentSoundFormatBuf format; + iSoundDevice.GetPlayFormat(format); + iSampleRate = format().iRate; + iChannels = format().iChannels; + + iNoMoreSourceData = EFalse; + iNoMoreSoundDeviceData = EFalse; + iSourceBuffer->SetLastBuffer(EFalse); + iBytesPlayed = 0; + iState = EPlaying; + iSoundDeviceErrorReceiver->Start(); + TRAP(startError,FillSourceBufferL()); //get initial buffer of audio data + if (startError == KErrNone) + { + // Start the player objects + iAudioPlayer->Start(); + } + else + {//failed to start up correctly go back to stopped state + iState = EStopped; + iSoundDeviceErrorReceiver->Stop(); + } + } + return startError; + } + + +// *** Main Play Loop *** + +void CMMFSwCodecPlayDataPath::FillSourceBufferL() + {//asks observer to fill the source buffer + // Ask immediately for data from the observer +#ifdef __CYCLE_MMF_DATABUFFERS__ + // Create a new buffer to replicate INC021405 Play-EOF-Play on HwAccelerated solution Panics + // If the creation fails, we carry on regardless as the original buffer will not have been + // destroyed. Must do this as alloc fail tests will not run. + if(iSourceBuffer) + { + iSourceBuffer = CycleAudioBuffer(iSourceBuffer); + } +#endif // __CYCLE_MMF_DATABUFFERS__ + User::LeaveIfError(iHwDeviceObserver->FillThisHwBuffer(*iSourceBuffer)); + + } + + +void CMMFSwCodecPlayDataPath::BufferFilledL(CMMFDataBuffer& aBuffer) + {//call back from observer to indicate buffer has been filled + if (iState == EStopped) + User::Leave(KErrNotReady);//ok if paused? + + iSourceBuffer = &aBuffer; + iSourceBuffer->SetStatus(EFull); +#ifdef _SCW_DEBUG + RDebug::Print(_L("CMMFSwCodecPlayDataPath::BufferFilledL")); +#endif + + //need to check that the buffer size is not 0 - if so assume we've reached the end of the data + if (!iSourceBuffer->BufferSize()) + {//no buffer - could be end of source or could be that the source has no data?? + iNoMoreSourceData = ETrue; +#ifdef _SCW_DEBUG + RDebug::Print(_L("CMMFSwCodecPlayDataPath::BufferFilledL-NoMoreSourceData")); +#endif + } + //even if the buffer size is 0 we still + //need to perform the following to get the sound device callback + FillSoundDeviceBufferL(); //get buffer in pcm16 format for sound device + + /* iVbrFlag is added to datapath to avail the alternative dataflow wherein datapath makes sure that + destinationbuffer is filled to its maximum length before sending it to the sound driver. + Sending the buffer directly to the device causes underflow incase of Vorbis codecs.*/ + if (iVbrFlag) + { + /*There are two cases we need to deal here + 1. When the output of the codec is 0 for header data. + in that case, repeat till actual decoding of ogg packets and pages. + 2. When destination buffer is not filled even to its half length, get next source buffer + and decode it. This is to avoid underflows when ever we receive little pcm for a + a given source buffer. + */ + if (iSoundDeviceBuffer->Data().Length() < iSoundDeviceBuffer->Data().MaxLength()/2 && !(iSoundDeviceBuffer->LastBuffer())) + { + iSourceBuffer->SetStatus(EAvailable); //source buffer is now available + iSoundDeviceBuffer->SetPosition(iSoundDeviceBuffer->Data().Length());//this indicates the available space in the buffer to the codec + FillSourceBufferL(); + return; + } + else //data is sufficient to avoid underflows + { + iSoundDeviceBuffer->SetPosition(0); + if(iSoundDeviceBuffer->Data().Length()==0 && iSoundDeviceBuffer->LastBuffer()) + { + iNoMoreSoundDeviceData = ETrue; + } + } + } + + // attenuate the amplitude of the samples if volume ramping has been changed + // and is non-zero + if (iCustomInterface) + { + TTimeIntervalMicroSeconds volumeRamp = iCustomInterface->VolumeRamp(); + if (volumeRamp != iVolumeRamp) + { + iVolumeRamp = volumeRamp; + if (iVolumeRamp.Int64() != 0) + { + iUtility->ConfigAudioRamper( + iVolumeRamp.Int64(), + iSampleRate, + iChannels); + iRampAudioSample = ETrue; + } + else + { + iRampAudioSample = EFalse; + } + + } + if (iRampAudioSample) + iRampAudioSample = iUtility->RampAudio(iSoundDeviceBuffer); + } + + iAudioPlayer->PlayData(*iSoundDeviceBuffer); //play data to sound drivers + + if (iSourceBuffer->LastBuffer())//check last buffer flag + { + iNoMoreSourceData = ETrue; +#ifdef _SCW_DEBUG + RDebug::Print(_L("CMMFSwCodecPlayDataPath::BufferFilledL-LBNoMoreSourceData")); +#endif + } + } + + +void CMMFSwCodecPlayDataPath::FillSoundDeviceBufferL() + {//use CMMFSwCodec to fill the sound device buffer + + CMMFSwCodec::TCodecProcessResult codecProcessResult; + + if (iCodec->IsNullCodec()) + {//no codec so data can be sent direct to sink + iSoundDeviceBuffer = iSourceBuffer; + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + else + { + //pass buffer to codec for processing + codecProcessResult = iCodec->ProcessL(*iSourceBuffer, *iSoundDeviceBuffer); + + if (iSourceBuffer->LastBuffer()) //if source is last buffer so is sound dev + iSoundDeviceBuffer->SetLastBuffer(ETrue); + if ((!iSoundDeviceBuffer->BufferSize())&&(codecProcessResult.iDstBytesAdded)) + {//the codec has added data but not set the buffer length + iSoundDeviceBuffer->Data().SetLength(codecProcessResult.iDstBytesAdded); + } + //only supports EProcessComplete + switch (codecProcessResult.iCodecProcessStatus) + { + case CMMFSwCodec::TCodecProcessResult::EProcessComplete: + //finished procesing source data - all data in sink buffer + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; +#ifdef SYMBIAN_VARIABLE_BITRATE_CODEC + case CMMFSwCodec::TCodecProcessResult::EProcessIncomplete: + //finished procesing source data - all data in sink buffer + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; +#endif + case CMMFSwCodec::TCodecProcessResult::EDstNotFilled: + //could be the last buffer in which case dst might not get filled + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; + case CMMFSwCodec::TCodecProcessResult::EEndOfData: + //no more data - send what we've got to the sink + //note we can't always rely on this - in many cases the codec will not know when + //it has reached the end of data. + { + iSoundDeviceBuffer->SetStatus(EFull);//sink buffer may not really be 'full' but its as full as it going to get + iNoMoreSourceData = ETrue; + //doesn't matter if sink buffer is not full + } + break; + default: + Panic(EMMFSwCodecWrapperBadCodec); //should never get here - bad codec + } + } + } + + +void CMMFSwCodecPlayDataPath::BufferEmptiedL(const CMMFDataBuffer& aBuffer) + {//call back from CDataPathPlayer when the sound device buffer has been emptied + if (&aBuffer != iSoundDeviceBuffer) + Panic(EMMFSwCodecWrapperBadBuffer); + if(iVbrFlag && (iSourceBuffer->Status() == EUnAvailable || iNoMoreSourceData)) + {//No more source data. Play rest of the decoded data.Inform codec not to consider the source buffer + if(iSourceBuffer->Status()!=EUnAvailable) + { + iSourceBuffer->SetStatus(EUnAvailable); + } + FillSoundDeviceBufferL(); + if(iSoundDeviceBuffer->BufferSize() > 0) + { + // attenuate the amplitude of the samples if volume ramping has been changed + // and is non-zero + if (iCustomInterface) + { + TTimeIntervalMicroSeconds volumeRamp = iCustomInterface->VolumeRamp(); + if (volumeRamp != iVolumeRamp) + { + iVolumeRamp = volumeRamp; + if (iVolumeRamp.Int64() != 0) + { + iUtility->ConfigAudioRamper(iVolumeRamp.Int64(), iSampleRate, iChannels); + iRampAudioSample = ETrue; + } + else + { + iRampAudioSample = EFalse; + } + + } + if (iRampAudioSample) + { + iRampAudioSample = iUtility->RampAudio(iSoundDeviceBuffer); + } + + } + iAudioPlayer->PlayData(*iSoundDeviceBuffer); //play data to sound drivers + return; + } + else + { + if(iNoMoreSourceData) + { + iNoMoreSoundDeviceData = ETrue; + } + iSourceBuffer->SetStatus(EAvailable); + } + } + if (!iNoMoreSourceData) + FillSourceBufferL(); + } + +//*** End of Main Play Loop *** + + +void CMMFSwCodecPlayDataPath::Stop() + { + iAudioPlayer->Cancel(); + iSoundDeviceErrorReceiver->Cancel(); + iSoundDevice.Close(); + +#ifdef __CYCLE_MMF_DATABUFFERS__ + // Create a new buffer to replicate INC021405 Play-EOF-Play on HwAccelerated solution Panics + // If the creation fails, we carry on regardless as the original buffer will not have been + // destroyed. Must do this as alloc fail tests will not run. + if(iSourceBuffer) + { + iSourceBuffer = CycleAudioBuffer(iSourceBuffer); + } +#endif // __CYCLE_MMF_DATABUFFERS__ + + iState = EStopped; + } + + +void CMMFSwCodecPlayDataPath::Pause() + { + //since a pause can happen anyway in the datatransfer -need to set to a known + //state so that when play is resumed the behaviour is predictable + if (iSoundDevice.Handle()) + { + iSoundDevice.PausePlayBuffer(); //needs new LDD + iState = EPaused; +#ifdef _SCW_DEBUG + RDebug::Print(_L("Pause")); +#endif + } + else + {//an error must have occured + iState = EStopped; + } + } + + +TInt CMMFSwCodecPlayDataPath::EmptyBuffers() + { + TInt error = KErrNone; + if (iSoundDevice.Handle() == 0) + { + error = KErrNotReady; + } + else + { + iAudioPlayer->Cancel(); + iSoundDevice.CancelPlayData(); + iSoundDeviceErrorReceiver->Stop(); + iState = EStopped; + } + return error; + } + + +RMdaDevSound& CMMFSwCodecPlayDataPath::Device() + { + return iSoundDevice; + } + + +void CMMFSwCodecPlayDataPath::SoundDeviceException(TInt aError) + { + if(iIgnoreUnderflow) + { + if(!iVbrFlag && aError==KErrUnderflow && !iNoMoreSourceData) + { + //ignore underflow + return; + } + //for VBR codec data,no more source does not mean that no more sounddevice data + //so ignore underflows till the last buffer is played from the codec + else if(iVbrFlag && aError==KErrUnderflow && !iNoMoreSoundDeviceData) + { + //ignore underflow + return; + } + } + + //this sends a request to the hw device observer usually Devsound + //to update the bytes played + //it is done here so that the sound driver can be closed prior to + //updating the plicy and sending the error back + TUid uidUpdateBytesPlayed; + uidUpdateBytesPlayed.iUid = KMmfHwDeviceObserverUpdateBytesPlayed; + TPtrC8 dummy(0,0); + iHwDeviceObserver->MsgFromHwDevice(uidUpdateBytesPlayed,dummy); + + //this closes RMdaDevSound. + Stop(); + + //inform devsound so it can update policy + iHwDeviceObserver->Stopped(); + + // Inform the observer of the exception condition + // We inform the hw device observer after the policy has been + // updated incase the observer relied on the error to assume + // the policy has been updated + iHwDeviceObserver->Error(aError); + } + + +void CMMFSwCodecPlayDataPath::SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface) + { + iCustomInterface = &aCustomInterface; + } + +/** +Retrieves a custom interface to the device. +The reference CMMFSwCodecWrapper supports two custom interfaces, +MEmptyBuffersCustomInterface and MSetVbrFlagCustomInterface + +@param aInterface + Interface UID, defined with the custom interface. + aInterface = KMmfUidEmptyBuffersCustomInterface for MEmptyBuffersCustomInterface, + KSetVbrFlagCustomInterfaceTypeUid for MSetVbrFlagCustomInterface + +@return A pointer to the interface implementation, or NULL if the device can not + implement the interface requested. The return value must be cast to the + correct type by the user. +*/ +TAny* CMMFSwCodecPlayDataPath::CustomInterface(TUid aInterface) + { + TAny* ret = NULL; + if (aInterface.iUid == KMmfUidEmptyBuffersCustomInterface) + { + MEmptyBuffersCustomInterface* result = static_cast (this); + ret = static_cast(result); + } + else if(aInterface.iUid == KSetVbrFlagCustomInterfaceTypeUid) + { + SetVbrFlag(); + } + if (aInterface == KTimePlayedCustomInterfaceTypeUid) + { + MTimePlayedCustomInterface* result = static_cast (this); + ret = static_cast(result); + } + if (aInterface == KIgnoreUnderflowCustomInterfaceTypeUid) + { + MIgnoreUnderflowEventsCustomInterface* result = static_cast (this); + ret = static_cast(result); + } + return ret; + } + +/** +Used to set iVbrFlag on the datapath. + +This method is used to set the iVbrFlag in datapath. This flag is added to datapath to avail the +alternative dataflow wherein datapath makes sure that destinationbuffer is filled to its maximum length +before sending it to the sound driver. Sending the buffer directly to the device causes underflow incase of VBR codecs. +*/ +void CMMFSwCodecPlayDataPath::SetVbrFlag() + { + iVbrFlag = ETrue; + } + +TInt CMMFSwCodecPlayDataPath::GetTimePlayed(TTimeIntervalMicroSeconds& aTime) + { + if(iSoundDevice.Handle()) + { + TInt bytes = iSoundDevice.BytesPlayed(); + //Work around for overflow of bytes played from driver. + //This code will be removed when Base provides the TimePlayed() API which returns the play time + //Assuming GetTimePlayed() gets called in an interval not more than 3 secs, reset driver's bytes played when it is near KMaxInt + if(bytes > (KMaxTInt - 3*KMaxBytesInSec)) + { + iBytesPlayed = iBytesPlayed+bytes; + iSoundDevice.ResetBytesPlayed(); + bytes = 0; + } + TInt64 samplesPlayed = (iBytesPlayed+bytes)/(KBytesPerSample*iChannels); + aTime = (samplesPlayed*1000000)/iSampleRate; + } + else + { + aTime = 0; + } + + return KErrNone; + } + +void CMMFSwCodecPlayDataPath::IgnoreUnderflowEvents() + { + iIgnoreUnderflow = ETrue; + } +/************************************************************************ + * CDataPathPlayer * + ************************************************************************/ + +CDataPathPlayer::CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority) +: CActive(aPriority), iParent(aParent) + { + CActiveScheduler::Add(this); + } + + +CDataPathPlayer::~CDataPathPlayer() + { + Cancel(); + } + + +void CDataPathPlayer::Start() + { + // No implementation + } + + +void CDataPathPlayer::ResumePlaying() + { + if (iParent.Device().Handle()) + { + //should be ok to call this even if we are active + iParent.Device().ResumePlaying(); + iResumePlaying = ETrue; + } +#ifdef _SCW_DEBUG + RDebug::Print(_L("Playing Resumed")); +#endif + } + + +void CDataPathPlayer::PlayData(const CMMFDataBuffer& aData) + { + iDataFromSource = &aData; + if (!IsActive()) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CDataPathPlayer::PlayData")); +#endif + iParent.Device().PlayData(iStatus,(STATIC_CAST(const CMMFDataBuffer*, iDataFromSource))->Data()); + SetActive(); + } + } + + +void CDataPathPlayer::Stop() + { + if (!IsActive()) + iParent.Device().FlushPlayBuffer(); // Otherwise won't be flushed + Cancel(); + iParent.SoundDeviceException(KErrCancel); + } + + +void CDataPathPlayer::RunL() + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CDataPathPlayer::RunL error[%d]"), iStatus.Int()); +#endif + if (iStatus.Int()!=KErrNone) + { + iParent.SoundDeviceException(iStatus.Int()); + } + else + { + iParent.BufferEmptiedL(static_cast(*iDataFromSource)); + iResumePlaying = EFalse; + } + } + + +TInt CDataPathPlayer::RunError(TInt aError) + { + Error(aError); + return KErrNone; + } + + +void CDataPathPlayer::DoCancel() + { + if (iParent.Device().Handle()) + { + iParent.Device().CancelPlayData(); + iParent.Device().FlushPlayBuffer(); + } + } + + +void CDataPathPlayer::Error(TInt aError) + { + iParent.SoundDeviceException(aError); + } + + +/************************************************************************ + * CSoundDevPlayErrorReceiver * + ************************************************************************/ + +CSoundDevPlayErrorReceiver::CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority) +: CActive(aPriority), iParent(aParent) + { + CActiveScheduler::Add(this); + } + +CSoundDevPlayErrorReceiver::~CSoundDevPlayErrorReceiver() + { + Cancel(); + } + +void CSoundDevPlayErrorReceiver::Start() + { + iParent.Device().NotifyPlayError(iStatus); + SetActive(); + } + +void CSoundDevPlayErrorReceiver::Stop() + { + Cancel(); + } + +void CSoundDevPlayErrorReceiver::RunL() + { + TInt reason = iStatus.Int(); + Start(); + // An error has been returned +#ifdef _SCW_DEBUG + RDebug::Print(_L("CSoundDevPlayErrorReceiver::RunL[%d]"), reason); +#endif + iParent.SoundDeviceException(reason); + } + +void CSoundDevPlayErrorReceiver::DoCancel() + { + iParent.Device().CancelNotifyPlayError(); + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecPlayDataPath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecPlayDataPath.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,136 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECPLAYDATAPATH_H__ +#define __MMFSWCODECPLAYDATAPATH_H__ + + +#include "mmfSwCodecDataPath.h" +#include + + +class CMMFSwCodecPlayDataPath; //fwd ref +class CMMFSwCodecUtility; // fwd ref +class MEmptyBuffersCustomInterface; // fwd ref +class MSetVbrFlagCustomInterface; // fwd ref + +/** + * Active object used by the CMMFSwCodecPlayDataPath to send data to the sound + * driver This particular active object encapsulates the asynchronous play + * function, where a buffer of data is sent to the WINS audio device, and the + * active object's RunL is called when the buffer has been consumed by the + * WINS audio device. + * @internalComponent + */ +class CDataPathPlayer : public CActive + { +public: + CDataPathPlayer(CMMFSwCodecPlayDataPath& aParent, TInt aPriority); + ~CDataPathPlayer(); + void Start(); + void ResumePlaying(); + void PlayData(const CMMFDataBuffer& aData); + void Stop(); + virtual void RunL(); + virtual TInt RunError(TInt aError); + virtual void DoCancel(); + virtual void Error(TInt aError); +private: + CMMFSwCodecPlayDataPath& iParent; + const CMMFDataBuffer* iDataFromSource; + TBool iResumePlaying; + }; + +/* +* Active object used by CMMFSwCodecPlayDataPath to listening for error messages +* from the WINS audio device. If this object's RunL is called, playback has +* been terminated for some reason. The active object then +* notifies its parent the datapath, so that proper cleanup and client +* notification can occur. +* @internalComponent +*/ +class CSoundDevPlayErrorReceiver : public CActive + { +public: + CSoundDevPlayErrorReceiver(CMMFSwCodecPlayDataPath& aParent, TInt aPriority); + ~CSoundDevPlayErrorReceiver(); + void Start(); + void Stop(); + virtual void RunL(); + virtual void DoCancel(); +private: + CMMFSwCodecPlayDataPath& iParent; + }; + + +/** + * Derived class for play datapath internal to the Sw codec wrapper + * @internalComponent + */ +class CMMFSwCodecPlayDataPath : public CMMFSwCodecDataPathX, + public MEmptyBuffersCustomInterface, + public MSetVbrFlagCustomInterface, + public MTimePlayedCustomInterface, + public MIgnoreUnderflowEventsCustomInterface + { +public: + static CMMFSwCodecPlayDataPath* NewL(); + virtual ~CMMFSwCodecPlayDataPath(); + virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver); + virtual TInt AddCodec(CMMFSwCodec& aCodec); + virtual TInt Start(); + virtual void Stop(); + virtual void Pause(); + virtual void BufferFilledL(CMMFDataBuffer& aBuffer); + virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer); + virtual void SoundDeviceException(TInt aError); + virtual RMdaDevSound& Device(); + virtual void SetPlayCustomInterface(MPlayCustomInterface& aCustomInterface); + virtual TInt EmptyBuffers(); + virtual TAny* CustomInterface(TUid aInterfaceId); + //From MSetVbrFlagCustomInterface + virtual void SetVbrFlag(); + virtual TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTime); + virtual void IgnoreUnderflowEvents(); +protected: + CMMFSwCodecPlayDataPath() {}; + void ConstructL(); + void FillSourceBufferL(); + void FillSoundDeviceBufferL(); +protected: + CDataPathPlayer* iAudioPlayer; + CSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver; + RMdaDevSound iSoundDevice; + CMMFDataBuffer* iSourceBuffer; + CMMFDataBuffer* iSoundDeviceBuffer; + TBool iNoMoreSourceData; + TBool iSinkCanReceive; + TUint iSourceBufferSize; + TUint iSoundDevBufferSize; + CMMFSwCodecUtility* iUtility; + TBool iRampAudioSample; + MPlayCustomInterface* iCustomInterface; // not owned + TTimeIntervalMicroSeconds iVolumeRamp; + // DEF048512 + TInt iSampleRate; + TInt iChannels; + TBool iVbrFlag; + TInt64 iBytesPlayed; + TBool iNoMoreSoundDeviceData; + TBool iIgnoreUnderflow; + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecRecordDataPath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecRecordDataPath.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,702 @@ +// Copyright (c) 2003-2009 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: +// source\server\mmfswcodecrecorddatapath.cpp +// +// + +#include "mmfSwCodecRecordDataPath.h" +#include +#include + +#ifdef SYMBIAN_SCW_DEBUG + +const TText* const KStateNames[] = // must agree with TRecordState + { + _S("ERecordStateCreated"), + _S("ERecordStateFailed"), + _S("ERecordStateRecording"), + _S("ERecordStateSendingBuffer"), + _S("ERecordStateSendingPartialBuffer"), + _S("ERecordStateEmptiedPartialBuffer"), + _S("ERecordStateRecordingPaused"), + _S("ERecordStateSendingBufferPaused"), + _S("ERecordStateSendingPartialBufferPaused"), + _S("ERecordStateEmptiedPartialBufferPaused"), + }; + +static const TText* StateName(TInt aState) + { + return KStateNames[aState]; + } + +#endif // SYMBIAN_SCW_DEBUG + +// Table of next state used when resuming or pausing. +const CMMFSwCodecRecordDataPath::TRecordState CMMFSwCodecRecordDataPath::KResumePauseTable[] = + { + ERecordStateCreated, //ERecordStateCreated // note order here is important - see State(), RecordOrPause() etc + ERecordStateFailed, //ERecordStateFailed + ERecordStateRecordingPaused, //ERecordStateRecording + ERecordStateSendingBufferPaused, //ERecordStateSendingBuffer + ERecordStateSendingPartialBufferPaused, //ERecordStateSendingPartialBuffer + ERecordStateEmptiedPartialBufferPaused, //ERecordStateEmptiedPartialBuffer + ERecordStateRecording, //ERecordStateRecordingPaused + ERecordStateSendingBuffer, //ERecordStateSendingBufferPaused + ERecordStateSendingPartialBuffer, //ERecordStateSendingPartialBufferPaused + ERecordStateEmptiedPartialBuffer, //ERecordStateEmptiedPartialBufferPaused + }; + + +CMMFSwCodecRecordDataPath* CMMFSwCodecRecordDataPath::NewL() + { + CMMFSwCodecRecordDataPath* self = new(ELeave) CMMFSwCodecRecordDataPath; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +void CMMFSwCodecRecordDataPath::ConstructL() + { + iAudioInput = MAudioInput::CreateL(*this); + TCallBack callback(Callback, this); + iAsyncCallback = new (ELeave) CAsyncCallBack(callback, CActive::EPriorityStandard); + } + +CMMFSwCodecRecordDataPath::CMMFSwCodecRecordDataPath(): + iShadowData(NULL, 0, 0) + { + ASSERT(iState==ERecordStateCreated); // assume this value is 0, so no need to assign + } + +CMMFSwCodecRecordDataPath::~CMMFSwCodecRecordDataPath() + { + if (iAudioInput) + { + iAudioInput->Release(); + } + + delete iCodecBuffer; + delete iInputBuffer; + delete iAsyncCallback; + } + + +TInt CMMFSwCodecRecordDataPath::SetObserver(MMMFHwDeviceObserver& aObserver) + { + TInt error; + if (iHwDeviceObserver) + { + error = KErrAlreadyExists; + } + else + { + iHwDeviceObserver = &aObserver; + error = KErrNone; + } + return error; + } + + +TInt CMMFSwCodecRecordDataPath::AddCodec(CMMFSwCodec& aCodec) + { + TInt err = KErrNone; + + if (iCodec) + { + err = KErrNotSupported; //doesn't support multiple codecs + } + + if (!err) + { + iCodec = &aCodec; + + iSinkBufferSize = iCodec->SinkBufferSize(); + iAudioInputBufferSize = iCodec->SourceBufferSize(); // the buffer size we want from the input device + + if (!iSinkBufferSize || !iAudioInputBufferSize) + { + err = KErrArgument; //codec plugin has not specified buffer size + } + } + + if (!err) + { + // Allocate data buffer + if (iCodec->IsNullCodec()) + {//don't need a separate sink buffer if null codec + iSinkBuffer = NULL; //sink buffer is the sound device buffer + iAudioInputBufferSize = iSinkBufferSize; // the audio input buffer becomes the sink buffer + } + else + {//need a separate sink buffer for the codec - this is the buffer passed to our client + ASSERT(!iCodecBuffer); // can't happen because can only call AddCodec once + TRAP(err,iCodecBuffer = CMMFDataBuffer::NewL(iSinkBufferSize)); + iSinkBuffer = iCodecBuffer; + } + } + if (!err) + { + ASSERT(!iInputBuffer); // can't happen because can only call AddCodec once + TRAP(err,iInputBuffer = CMMFPtrBuffer::NewL()); + } + if (!err) + { + // point iSinkBuffer at the right place + if (iCodec->IsNullCodec()) + { + iSinkBuffer = iInputBuffer; + } + else + { + iSinkBuffer = iCodecBuffer; + } + } + return err; + } + + +TInt CMMFSwCodecRecordDataPath::Start() + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::Start() state=%s"), StateName(iState)); +#endif + TInt err = KErrNone; + if (!iCodec) + {//check that a codec has been added + err = KErrNotReady; + } + if (!err) + { + switch (iState) + { + case ERecordStateCreated: + { + TAudioInputParams params; + params.iInitialGain = iGain; + params.iSampleRate = iSampleRate; + params.iNumChannels = iNumChannels; + params.iNominalBufferSize = iAudioInputBufferSize; + err = iAudioInput->Initialize(params); + if (!err) + { + err = iAudioInput->Start(); + if (err) + { + iAudioInput->Close(); + ASSERT(iState == ERecordStateCreated); // end up in same state + } + else + { + iState = ERecordStateRecording; + iInputHasFinished = EFalse; + iRecordedBytesCount = 0; //used for debug purposes + } + } + } + break; + case ERecordStateRecordingPaused: + case ERecordStateSendingPartialBufferPaused: + case ERecordStateEmptiedPartialBufferPaused: + { + // effectively in paused state, resume and switch to equivalent state + iAudioInput->Resume(); + iInputHasFinished = EFalse; + iState = KResumePauseTable[iState]; + } + break; + case ERecordStateSendingBufferPaused: + { + iAudioInput->Resume(); + if (iInputHasFinished) + { + iState = ERecordStateRecording; // as we follow InputHasFinished, we don't wait for the buffer + iInputHasFinished = EFalse; + } + else + { + // effectively in paused state, resume and switch to equivalent state + iState = KResumePauseTable[iState]; + } + } + break; + case ERecordStateFailed: + default: + { + // anything else assume already recording and ignore + } + break; + } + } + +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::Start(%d) state=%s"), err, StateName(iState)); +#endif + return err; + } + + +void CMMFSwCodecRecordDataPath::InputBufferAvailable(const TDesC8& aBuffer) + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::InputBufferAvailable(%d) state=%s"), aBuffer.Length(), StateName(iState)); +#endif + ASSERT(iState==ERecordStateRecording || iState==ERecordStateRecordingPaused); + iInputData = &aBuffer; + TUint length = aBuffer.Length(); + // Update bytes recorded + iRecordedBytesCount += length; + + //buffer ok can send to sink + iInputOffset = 0; + TRAPD(err,ProcessBufferL(EFalse)); //convert to sink data type using codec + if (err != KErrNone) + { + iHwDeviceObserver->Error(err); + } +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::InputBufferAvailable state=%s"), StateName(iState)); +#endif + } + +void CMMFSwCodecRecordDataPath::InputFinished() + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::InputFinished state=%s"), StateName(iState)); +#endif + ASSERT(iState==ERecordStateRecording || iState==ERecordStateRecordingPaused); + iInputOffset = 0; + iInputHasFinished = ETrue; + TRAPD(err,ProcessBufferL(ETrue)); // finish off any conversion + if (err != KErrNone) + { + iHwDeviceObserver->Error(err); + } +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::InputFinished state=%s"), StateName(iState)); +#endif + } + +void CMMFSwCodecRecordDataPath::InputError(TInt aError) + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::InputBufferAvailable(%d) state=%s"), aError, StateName(iState)); +#endif + if (iState!=ERecordStateFailed) + { + iState = ERecordStateFailed; + if (iHwDeviceObserver) + { + // Inform the observer of the exception condition + // Assume it will subsequently call Stop(), and thus update policy + iHwDeviceObserver->Error(aError); + } + } +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::InputBufferAvailable() state=%s"), StateName(iState)); +#endif + } + + +/* + * FillSinkBufferL + * + * Function to take the data from an already full source buffer and by using + * a codec if necessary fills the sink buffer + * If aLastBuffer, treat as a last buffer with zero length + */ +void CMMFSwCodecRecordDataPath::ProcessBufferL(TBool aLastBuffer) + { + ASSERT(iState==ERecordStateRecording || iState==ERecordStateRecordingPaused || + iState==ERecordStateEmptiedPartialBuffer || iState==ERecordStateEmptiedPartialBufferPaused); // only valid states + if (iCodec->IsNullCodec()) + {//no codec so sound device buffer can be used directly as sink buffer + ASSERT(iSinkBuffer==iInputBuffer); // just assume this + if (aLastBuffer) + { + iShadowData.Set(NULL, 0, 0); + iInputBuffer->SetPtr(iShadowData); + iInputBuffer->SetLastBuffer(ETrue); + } + else + { + iShadowData.Set(const_cast(iInputData->Ptr()), iInputData->Length(), iInputData->Length()); + iInputBuffer->SetPtr(iShadowData); + iInputBuffer->SetLastBuffer(EFalse); + } + iInputBuffer->SetStatus(EFull); //sink buffer is "full" + TRecordState oldState = iState; + switch (iState) + { + case ERecordStateRecording: + iState = ERecordStateSendingBuffer; + break; + case ERecordStateRecordingPaused: + iState = ERecordStateSendingBufferPaused; + break; + case ERecordStateEmptiedPartialBuffer: + case ERecordStateEmptiedPartialBufferPaused: + ASSERT(EFalse); // Technically these can occur but not if IsNullCodec is true, Complete is effectively always true + break; + } + TInt err = iHwDeviceObserver->EmptyThisHwBuffer(*iSinkBuffer); //pass onto sink + if (err) + { + iState = oldState; // rewind + User::Leave(err); + } + } + else + { + ASSERT(iSinkBuffer==iCodecBuffer); // sink and codec buffers are synonym, so just talk to iSinkBuffer + if (aLastBuffer) + { + iShadowData.Set(NULL, 0, 0); + iInputBuffer->SetPtr(iShadowData); // empty buffer + iInputBuffer->SetLastBuffer(ETrue); + } + else + { + TPtrC8 tempData = iInputData->Mid(iInputOffset); + iShadowData.Set(const_cast(tempData.Ptr()), tempData.Length(), tempData.Length()); + iInputBuffer->SetPtr(iShadowData); + iInputBuffer->SetLastBuffer(EFalse); + } + //pass buffer to codec for processing + CMMFSwCodec::TCodecProcessResult codecProcessResult = iCodec->ProcessL(*iInputBuffer, *iSinkBuffer); + if ((!iSinkBuffer->BufferSize())&&(codecProcessResult.iDstBytesAdded)) + {//the codec has added data but not set the buffer length + iSinkBuffer->Data().SetLength(codecProcessResult.iDstBytesAdded); + } + //only supports EProcessComplete + TRecordState oldState = iState; + TInt err = KErrNone; + switch (codecProcessResult.iCodecProcessStatus) + { + case CMMFSwCodec::TCodecProcessResult::EProcessComplete: //finished procesing source data - all data in sink buffer + case CMMFSwCodec::TCodecProcessResult::EDstNotFilled: //finished procesing source data - sink buffer not full could be EOF + case CMMFSwCodec::TCodecProcessResult::EEndOfData: //no more data - send what we've got to the sink + { + iSinkBuffer->SetStatus(EFull); // treat sink buffer as full + iState = IsPaused() ? ERecordStateSendingBufferPaused : ERecordStateSendingBuffer; + err = EmptyBufferL(); + break; + } + case CMMFSwCodec::TCodecProcessResult::EProcessIncomplete: + { + // codec has not yet finished with input - send buffer and come back around + iSinkBuffer->SetStatus(EFull); // treat sink buffer as full + iInputOffset = codecProcessResult.iSrcBytesProcessed; + iState = IsPaused() ? ERecordStateSendingPartialBufferPaused : ERecordStateSendingPartialBuffer; + err = EmptyBufferL(); + break; + } + default: + Panic(EMMFSwCodecWrapperBadCodec); //should never get here - bad codec + } + if (err) + { + iState = oldState; // rewind prior to handle + User::Leave(err); + } + } + } + +TInt CMMFSwCodecRecordDataPath::EmptyBufferL() + { + // This code supports an assumption made by the vorbis encoder, which assumes it can safely generate empty buffers. + // VbrFlag here implies the vorbis encoder. + // TODO: Replace this with a generic solution - e.g. on EDstNotFilled we request a buffer from AudioInput instead + // of calling the client back. + if(iVbrFlag) + { + if(!iSinkBuffer->Data().Length() && !iInputBuffer->LastBuffer()) + { + BufferEmptiedL(STATIC_CAST(CMMFDataBuffer&, *iSinkBuffer)); + return KErrNone; + } + } + TInt err = iHwDeviceObserver->EmptyThisHwBuffer(*iSinkBuffer); //pass onto sink + return err; + } + +void CMMFSwCodecRecordDataPath::BufferEmptiedL(const CMMFDataBuffer& aBuffer) + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::BufferEmptiedL() state=%s"), StateName(iState)); +#endif + if (&aBuffer != iSinkBuffer) + { + // we are only single buffering at the moment... + Panic(EMMFSwCodecWrapperBadBuffer); + } + ASSERT(iState==ERecordStateSendingBuffer || iState==ERecordStateSendingBufferPaused || + iState==ERecordStateSendingPartialBuffer || iState==ERecordStateSendingPartialBufferPaused || + iState==ERecordStateFailed); + switch (iState) + { + case ERecordStateSendingBuffer: + case ERecordStateSendingBufferPaused: + { + iState = (iState==ERecordStateSendingBuffer) ? ERecordStateRecording : ERecordStateRecordingPaused; + if (!iInputHasFinished) + { + iAudioInput->BufferAck(); + } + break; + } + case ERecordStateSendingPartialBuffer: + case ERecordStateSendingPartialBufferPaused: + { + iState = (iState==ERecordStateSendingPartialBuffer) ? + ERecordStateEmptiedPartialBuffer : ERecordStateEmptiedPartialBufferPaused; + RequestCallback(); // go back around to ensure next callback to client is asynchronous + break; + } + default: + { + // anything else just ignore - e.g. are waiting for Stop following an error + } + } +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::BufferEmptiedL() state=%s"), StateName(iState)); +#endif + } + +// Async callback support - used on PartialBuffer::BufferEmptiedL() transition + +void CMMFSwCodecRecordDataPath::RequestCallback() + { + iAsyncCallback->CallBack(); + } + +TInt CMMFSwCodecRecordDataPath::Callback(TAny* aPtr) + { + CMMFSwCodecRecordDataPath* self = static_cast(aPtr); + return self->DoCallback(); + } + +TInt CMMFSwCodecRecordDataPath::DoCallback() + { + ASSERT(iState==ERecordStateEmptiedPartialBuffer || iState==ERecordStateEmptiedPartialBufferPaused); // only legal ones + TRAPD(err,ProcessBufferL(EFalse)); + if (err != KErrNone) + { + iHwDeviceObserver->Error(err); + } + return err; + } + +void CMMFSwCodecRecordDataPath::Stop() + { +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::Stop() state=%s"), StateName(iState)); +#endif + iAudioInput->Close(); + iState = ERecordStateCreated; +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::Stop() state=%s"), StateName(iState)); +#endif + } + + +void CMMFSwCodecRecordDataPath::Pause() + { + // flush it anyway, whether we're active or not + // if we are active, then this should result in a call to RunL() pretty soon + //note that the Pause() in the context of record means buffers are + //continued to be obtained from the sound driver that have already + //been recorded - it just doesn't record any new audio data +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("CMMFSwcodecRecordDataPath::Pause state=%s"), StateName(iState)); +#endif + switch (iState) + { + case ERecordStateRecording: + case ERecordStateSendingBuffer: + case ERecordStateSendingPartialBuffer: + case ERecordStateEmptiedPartialBuffer: + { + iAudioInput->Pause(); + iState = KResumePauseTable[iState]; + } + break; + default: ; + // do nothing - treat as no-op + } +#ifdef SYMBIAN_SCW_DEBUG + RDebug::Print(_L("End CMMFSwcodecRecordDataPath::Pause state=%s"), StateName(iState)); +#endif + } + + +RMdaDevSound& CMMFSwCodecRecordDataPath::Device() + { + ASSERT(EFalse); // TODO should not be called - future remove if we can + return iDummyDevSound; + } + + +TUint CMMFSwCodecRecordDataPath::RecordedBytesCount() + { + return iRecordedBytesCount; + } + +/** +Retrieves a custom interface to the device. +The reference CMMFSwCodecWrapper supports one custom interfaces, +MSetVbrFlagCustomInterface + +@param aInterface + Interface UID, defined with the custom interface. + aInterface = KSetVbrFlagCustomInterfaceTypeUid for MSetVbrFlagCustomInterface. + + +@return A pointer to the interface implementation, or NULL if the device can not + implement the interface requested. The return value must be cast to the + correct type by the user. +*/ +TAny* CMMFSwCodecRecordDataPath::CustomInterface(TUid aInterface) + { + TAny* ret = NULL; + + if(aInterface.iUid == KSetVbrFlagCustomInterfaceTypeUid) + { + SetVbrFlag(); + } + else if (aInterface == KUidSwSetParamInterface) + { + MSwSetParamInterface* self = this; + return self; + } + else if (aInterface == KUidSwInfoInterface) + { + MSwInfoInterface* self = this; + return self; + } + return ret; + } + +/** +Used to set iVbrFlag on the datapath. + +This method is used to set the iVbrFlag in datapath. This flag is added to datapath to avail the +alternative dataflow wherein datapath makes sure that destinationbuffer is filled to its maximum length +before sending it to the sound driver. Sending the buffer directly to the device causes underflow incase of VBR codecs. +*/ +void CMMFSwCodecRecordDataPath::SetVbrFlag() + { + iVbrFlag = ETrue; // TODO this is seemingly redundant in a record case and could be pruned + } + +// MSwSetParamInterface - set various parameters etc + +TInt CMMFSwCodecRecordDataPath::SetSampleRate(TInt aSampleRate) + { + iSampleRate = aSampleRate; + return KErrNone; + } + +TInt CMMFSwCodecRecordDataPath::SetNumChannels(TInt aNumChannels) + { + iNumChannels = aNumChannels; + return KErrNone; + } + +TInt CMMFSwCodecRecordDataPath::SetGain(TInt aGain) + { + iGain = aGain; // cache here so would be used on next Initialize() + TInt error = KErrNone; + if (iAudioInput) + { + MAIParamInterface* paramInterface = static_cast(iAudioInput->Interface(KUidAIParamInterface)); + if (paramInterface) + { + error = paramInterface->SetGain(aGain); + } + } + return error; + } + +TInt CMMFSwCodecRecordDataPath::GetBufferSizes(TInt& aMinSize, TInt& aMaxSize) + { + TInt error = KErrNotReady; + if (iAudioInput) + { + MAIParamInterface* paramInterface = static_cast(iAudioInput->Interface(KUidAIParamInterface)); + if (paramInterface) + { + error = paramInterface->GetBufferSizes(aMinSize, aMaxSize); + } + } + return error; + } + +TInt CMMFSwCodecRecordDataPath::GetSupportedSampleRates(RArray& aSupportedSampleRates) + { + TInt error = KErrNotReady; + if (iAudioInput) + { + MAIParamInterface* paramInterface = static_cast(iAudioInput->Interface(KUidAIParamInterface)); + if (paramInterface) + { + error = paramInterface->GetSupportedSampleRates(aSupportedSampleRates); + } + } + return error; + } + +CMMFSwCodecRecordDataPath::TSwCodecDataPathState CMMFSwCodecRecordDataPath::State() const + { + // Note: code assumes stopped, record and paused states are grouped consecutively + if (iState==ERecordStateCreated) + { + return EStopped; + } + else if (iState >= ERecordStateRecording && iState <= ERecordStateEmptiedPartialBuffer) + { + return EPlaying; + } + else + { + return EPaused; + } + } + +TBool CMMFSwCodecRecordDataPath::RecordOrPause() const + { + // Note: code assumes stopped, record and paused states are grouped consecutively + return iState >= ERecordStateRecording; + } + +TBool CMMFSwCodecRecordDataPath::IsPaused() const + { + // Note: code assumes stopped, record and paused states are grouped consecutively + return iState >= ERecordStateRecordingPaused; + } + +// TODO - these functions are padding out from the old RMdaDevSound scheme. +// They are no longer used here, but are used for playing... + +void CMMFSwCodecRecordDataPath::BufferFilledL(CMMFDataBuffer& /*aBuffer*/) + { + ASSERT(EFalse); + } + +void CMMFSwCodecRecordDataPath::SoundDeviceException(TInt /*aError*/) + { + ASSERT(EFalse); + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecRecordDataPath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecRecordDataPath.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,117 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECRECORDDATAPATH_H__ +#define __MMFSWCODECRECORDDATAPATH_H__ + +#include "mmfSwCodecDataPath.h" +#include +#include "mmfswaudioinput.h" + +class CMMFSwCodecRecordDataPath; //fwd ref +class MSetVbrFlagCustomInterface; // fwd ref + +/** + * Derived class for record datapath internal to the Sw codec wrapper + * @internalComponent + */ +class CMMFSwCodecRecordDataPath : public CMMFSwCodecDataPath, + public MSetVbrFlagCustomInterface, + public MAudioInputObserver, + public MSwSetParamInterface, + public MSwInfoInterface + { + enum TRecordState + { + ERecordStateCreated, // note order here is important - see State(), RecordOrPause() etc + ERecordStateFailed, + ERecordStateRecording, + ERecordStateSendingBuffer, + ERecordStateSendingPartialBuffer, + ERecordStateEmptiedPartialBuffer, + ERecordStateRecordingPaused, + ERecordStateSendingBufferPaused, + ERecordStateSendingPartialBufferPaused, + ERecordStateEmptiedPartialBufferPaused, + }; +public: + static CMMFSwCodecRecordDataPath* NewL(); + virtual ~CMMFSwCodecRecordDataPath(); + + //From CMMFSwCodecDataPath + TInt SetObserver(MMMFHwDeviceObserver &aHwObserver); + TInt AddCodec(CMMFSwCodec& aCodec); + TInt Start(); //record + void Stop(); + void Pause(); + void BufferFilledL(CMMFDataBuffer& aBuffer); + void BufferEmptiedL(const CMMFDataBuffer& aBuffer); + void SoundDeviceException(TInt aError); + RMdaDevSound& Device(); + TUint RecordedBytesCount(); + TAny* CustomInterface(TUid aInterfaceId); + TSwCodecDataPathState State() const; + //From MSetVbrFlagCustomInterface + void SetVbrFlag(); + //From MAudioInputObserver + void InputBufferAvailable(const TDesC8& aBuffer); + void InputFinished(); + void InputError(TInt aError); + //From MSwSetParamInerface + TInt SetSampleRate(TInt aSampleRate); + TInt SetNumChannels(TInt aNumChannels); + TInt SetGain(TInt aGain); + TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize); + //From MSwInfoInterface + TInt GetSupportedSampleRates(RArray& aSupportedSampleRates); + +private: + CMMFSwCodecRecordDataPath(); + void ConstructL(); + void ProcessBufferL(TBool aLastBuffer); + TInt EmptyBufferL(); + + TBool RecordOrPause() const; + TBool IsPaused() const; + + void RequestCallback(); + TInt DoCallback(); + static TInt Callback(TAny* aPtr); + + static const TRecordState KResumePauseTable[]; + +private: + MAudioInput* iAudioInput; + CMMFDataBuffer* iCodecBuffer; + const TDesC8* iInputData; // not owned - cache of past data + TPtr8 iShadowData; // need TPtr8 + TInt iInputOffset; // track how much data we've processed from audio input + CMMFPtrBuffer* iInputBuffer; // select from iInputData + CMMFDataBuffer* iSinkBuffer; // not owned - pointer to buffer to send to client + CAsyncCallBack* iAsyncCallback; + TInt iSampleRate; + TInt iNumChannels; + TInt iGain; + TUint iSinkBufferSize; + TUint iAudioInputBufferSize; + TUint iRecordedBytesCount; + TBool iVbrFlag; + TRecordState iState; + TBool iInputHasFinished; // extension to iState, if we've received InputFinished we don't want to call BufferAck() but signal complete + RMdaDevSound iDummyDevSound; // TODO - remove when Device() is removed. + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecUtility.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecUtility.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,82 @@ +// Copyright (c) 2003-2009 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 +#include "mmfSwCodecUtility.h" + + + +/****************************************************************** + * CMMFSwCodecUtility + ******************************************************************/ +CMMFSwCodecUtility::CMMFSwCodecUtility() + { + } + + +CMMFSwCodecUtility::~CMMFSwCodecUtility() + { + } + +CMMFSwCodecUtility* CMMFSwCodecUtility::NewL() + { + CMMFSwCodecUtility* self = new(ELeave) CMMFSwCodecUtility(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CMMFSwCodecUtility::ConstructL() + { + } + +void CMMFSwCodecUtility::ConfigAudioRamper(TInt64 aRampTime, TInt aSampleRate, TInt aChannels) + { + iRampSamples = I64LOW(((TInt64(aSampleRate) * aRampTime) /1000000 )); // Add this + iRampSamplesLeft = iRampSamples; + iChannels = aChannels; + iRampIncr = 0; + iSkip = ETrue; + } + +TBool CMMFSwCodecUtility::RampAudio(CMMFDataBuffer* aBuffer) + { + TInt i=0; + TInt length = aBuffer->Data().Length()>>1; + TInt16* sample = REINTERPRET_CAST(TInt16*,&aBuffer->Data()[0]); + TInt64 theResult(0); + while ((i < length) && (iRampIncr < iRampSamples)) + { + theResult = sample[i]; + theResult *= iRampIncr; + theResult /= iRampSamples; + sample[i] = STATIC_CAST(TInt16, I64LOW(theResult) ); + + if ((iChannels == 1) || (!iSkip)) + { + iRampIncr++; + } + iSkip = !iSkip; + i++; + } + + if (iRampIncr < iRampSamples) + return ETrue; + else + return EFalse; + + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecUtility.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecUtility.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECUTILITY_H__ +#define __MMFSWCODECUTILITY_H__ + +#include +#include + +/** + * @internalTechnology + */ +class CMMFSwCodecUtility : public CBase + { +public: + // Destructor + ~CMMFSwCodecUtility(); + static CMMFSwCodecUtility* NewL(); + + void ConfigAudioRamper(TInt64 aRampTime, TInt aSampleRate, TInt aChannels); + TBool RampAudio(CMMFDataBuffer* aBuffer); +private: + CMMFSwCodecUtility(); + void ConstructL(); + +private: + TInt iRampSamples; + TInt iRampSamplesLeft; + TInt iChannels; + TInt iRampIncr; + TBool iSkip; + } ; + +#endif // __MMFSWCODECUTILITY_H__ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecWrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecWrapper.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,569 @@ +// Copyright (c) 2003-2009 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 +#include "mmfSwCodecPlayDataPath.h" +#include "mmfSwCodecRecordDataPath.h" +#include "mmfSwCodecConvertDataPath.h" +#include +#include "mmfswcodecwrapperCustomInterfaces.h" +#include + + + +/** + * Internal panic + * @internalComponent + */ +void Panic(TInt aPanicCode) + { + _LIT(KMMFSwCodecWrapperPanicCategory, "MMFSwCodecWrapper"); + User::Panic(KMMFSwCodecWrapperPanicCategory, aPanicCode); + } + + +/** + * This method is not be exported as it is only + * intended to be called within this DLL. + * It's purpose is to assign an RMdaDevSound to the play + * custom interface + * @internalComponent + */ +void TPlayCustomInterface::SetDevice(RMdaDevSound* aDevice) + { + iDevice = aDevice; + } + +void TPlayCustomInterface::SetVolume(TUint aVolume) + { + iVolume = aVolume; + if (iDevice && iDevice->Handle()) + iDevice->SetPlayVolume(iVolume); + } + +/** + * Procedure to get the number of bytes played by the device driver + * If there is no handle available to the device driver then the + * procedure returns the last known value + * @released + * @return number of bytes played + */ +TUint TPlayCustomInterface::BytesPlayed() + { + if(iDevice) + { + if (iDevice->Handle()) + iBytesPlayed = iDevice->BytesPlayed(); + } + return iBytesPlayed; + } + +/** + * Procedure to get the number of bytes recorded by the device + * @released + * @return The number of bytes recorded by an existing datapath. If there + * is no datapath, then the last known number of bytes recorded will be returned. + */ +TUint TRecordCustomInterface::BytesRecorded() + { + if(iDataPath) + { + iBytesRecorded = iDataPath->RecordedBytesCount(); + } + return iBytesRecorded; + } + +/** +Constructor. +*/ +EXPORT_C CMMFSwCodecWrapper::CMMFSwCodecWrapper() + { + } + +/** +Destructor. + +The destructor is called by ECom framework allowing derived classes +to clean up implementation specific resources. The sound +device drivers are freed. +*/ +EXPORT_C CMMFSwCodecWrapper::~CMMFSwCodecWrapper() + { + delete iDataPath; + delete iCodec; + delete iPlayCustomInterface; + delete iRecordCustomInterface; + } + +/** +Initializes the hardware device tasks - in the case of a +sw codec wrapper 'hardware device' this consits of loading the +sound device drivers and creating the CMMFSwCodec. + +@param aDevInfo + Device initialization parameters. + Only the iHwDeviceObserver is used for CMFSwCodecWrapper + derived CMMFHwDevices. +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::Init(THwDeviceInitParams &aDevInfo) + { + + // [ precondition that aDevInfo has a valid observer ] + if (!aDevInfo.iHwDeviceObserver) + return KErrArgument; + + iHwDeviceObserver = aDevInfo.iHwDeviceObserver; +#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER //Adapter loads the drivers + // Try to load the audio physical driver + TInt ret = User::LoadPhysicalDevice(KPddFileName); + if ((ret!=KErrNone) && (ret!=KErrAlreadyExists)) + return ret; + + // Try to load the audio logical driver + ret = User::LoadLogicalDevice(KLddFileName); + if ((ret!=KErrNone) && (ret!=KErrAlreadyExists)) + return ret; +#endif + iCodec = &(Codec()); //create codec + + //[ assert the post condition ] + if (!iCodec) + return KErrNotSupported; + + return KErrNone; + } + + +/** +Starts Encoding or Decoding task(s) based on the parameter specified. + +@param aFuncCmd + The device function specifying the requested service i.e. decode or encode + where EDevEncode = Record, EDevDecode = Play and EDevNullFunc = Convert. +@param aFlowCmd + The device flow directions for requested service. + This parameter is ignored for CMMFSwCodecWrapper CMMFHwDevicePlugins +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::Start(TDeviceFunc aFuncCmd, TDeviceFlow /*aFlowCmd*/) + { + TInt error = KErrNone; + + // [ precondition that aFuncCmd is valid] + if (!((aFuncCmd == EDevEncode)|(aFuncCmd == EDevDecode)|(aFuncCmd == EDevNullFunc))) + return KErrArgument; + + // [ precondition that iCodec is present] + if (!iCodec) + return KErrNotReady; //make sure the codec has been added + + switch (aFuncCmd) + { + case EDevEncode: // Audio record + { + error = StartEncode(); + } + break; + case EDevDecode: // Audio play + { + error = StartDecode(); + } + break; + case EDevNullFunc: //Audio Convert + { + error = StartConvert(); + } + break; + default: + error = KErrNotSupported; + break; + } + + //[ assert the post conditions ] +#ifdef DEBUG + if (!error) + {//only assert if no error otherwise post consitions not valid + __ASSERT_DEBUG(iDataPath, Panic(EMMFSwCodecWrapperNoDataPath)); + if ((aFuncCmd == EDevEncode)||(aFuncCmd == EDevDecode)) + __ASSERT_DEBUG(iDataPath->Device().Handle(), Panic(EMMFSwCodecWrapperNoDevice)); + } +#endif + if(error != KErrNone && iDataPath && aFuncCmd!=EDevEncode) + {//if error happens after opening LDD close it + if (iDataPath->Device().Handle()!= KNullHandle) + { + iDataPath->Device().Close(); + } + } + + return error; + } + + +TInt CMMFSwCodecWrapper::StartDecode() + { + TInt error = KErrNone; + + //[ assert precondition that play custom interface is present] + //if there is no play custom interface then the user of the CMMFSwCodecWrapper + //cannot have set any of the custom settings such as sample rate. + if (!iPlayCustomInterface) + return KErrNotReady; + + //play + if (!iDataPath) + {//create a datapath + TRAP(error,iDataPath = CMMFSwCodecPlayDataPath::NewL()); + //if datapath could not be created, return error code + if (error != KErrNone) + { + return error; + } + + //here we are sure iDataPath has been correctly allocated + iDataPath->SetObserver(*iHwDeviceObserver); + error = iDataPath->AddCodec(*iCodec); + if (error == KErrNone) + { + iDeviceBufferSize = (iCodec->SinkBufferSize()); + static_cast(iDataPath)->SetPlayCustomInterface(*iPlayCustomInterface); + } + else + { + // if could not add codec to datapath, return error code + return error; + } + } + + //Here we know that error is KerrNone, now we can check the state of the datapath + if (iDataPath->State() != CMMFSwCodecDataPath::EPlaying) + {//datapath was created ok and we are not playing + if (iDataPath->State() == CMMFSwCodecDataPath::EStopped) + {//starting from 'fresh so set sound device settings + if (!iDataPath->Device().Handle()) + {//if Device() is called then we need a valid sound device handle + error = iDataPath->Device().Open(); + if (error != KErrNone) + return error; + } + static_cast(iPlayCustomInterface)->SetDevice(&(iDataPath->Device())); + iDataPath->Device().SetPlayVolume(iPlayCustomInterface->Volume()); + RMdaDevSound::TCurrentSoundFormatBuf soundDeviceSettings; + soundDeviceSettings().iRate = iSampleRate; + //this would normally be pcm16 + soundDeviceSettings().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + //1 = mono 2 = stereo + soundDeviceSettings().iChannels = iChannels; + //tell sound driver what buffer size to expect + //it is up the the implementor to make use the device can support + //the required buffer size + soundDeviceSettings().iBufferSize = iDeviceBufferSize; + error = iDataPath->Device().SetPlayFormat(soundDeviceSettings); + }//iDataPath->State() == CMMFSwCodecDataPath::EStopped + //else resuming from pause + if ((error == KErrNone)||(error == KErrInUse)) + error = iDataPath->Start(); + }//status == KErrNone + return error; + } + + +TInt CMMFSwCodecWrapper::StartEncode() + {//record + + //[ assert precondition that record custom interface is present] + //if there is no record custom interface then the user of the CMMFSwCodecWrapper + //cannot have set any of the custom settings such as sample rate. + if (!iRecordCustomInterface) + return KErrNotReady; + + TInt error = KErrNone; + if (!iDataPath) + { + TRAP(error,iDataPath = CMMFSwCodecRecordDataPath::NewL()); + //if datapath could not be created, return error code + if (error != KErrNone) + { + return error; + } + + //here we are sure iDataPath has been correctly allocated + iDataPath->SetObserver(*iHwDeviceObserver); + error = iDataPath->AddCodec(*iCodec); + if (error == KErrNone) + { + iDeviceBufferSize = (iCodec->SourceBufferSize()); + static_cast(iRecordCustomInterface)->SetDataPath(static_cast(iDataPath)); + } + else + { + // if could not add codec to datapath, return error code + return error; + } + } + + //Here we know that error is KerrNone, now we can check the state of the datapath + if (iDataPath->State() != CMMFSwCodecDataPath::EPlaying) + { + if (iDataPath->State() == CMMFSwCodecDataPath::EStopped) + { + MSwSetParamInterface* setParams = + static_cast(iDataPath->CustomInterface(KUidSwSetParamInterface)); + ASSERT(!error); // should not get here if error set + error = setParams->SetGain(iRecordCustomInterface->Gain()); + if (!error) + { + error = setParams->SetNumChannels(iChannels); + } + if (!error) + { + error = setParams->SetSampleRate(iSampleRate); + } + } + if (error == KErrNone) + { + error = iDataPath->Start(); + } + } + return error; + } + + +TInt CMMFSwCodecWrapper::StartConvert() + {//convert + + TInt error = KErrNone; + if (!iDataPath) + { + TRAP(error,iDataPath = CMMFSwCodecConvertDataPath::NewL()); + if (error != KErrNone) + { + return error; + } + } + + //Here we know we are not dereferencing a null pointer as iDataPath has been correctly initialised + iDataPath->SetObserver(*iHwDeviceObserver); + error = iDataPath->AddCodec(*iCodec); + + if (error == KErrNone) + { + error = iDataPath->Start(); + } + + return error; + } + +/** +Temporarily suspends the current task of decoding or encoding. + +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::Pause() + { + // [ precondition that datapath exists ] + if (!iDataPath) + return KErrNotReady; + + iDataPath->Pause(); + return KErrNone; + } + +/** +Stops the current on-going task. + +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::Stop() + { + // [ precondition that datapath exists ] + if (!iDataPath) + return KErrNotReady; + + iDataPath->Stop(); + return KErrNone; + } + + +/** +Stops and deletes the codec. + +This default implementation simply calls DeleteCodec() and then Stop() +but real hardware devices might use this method to free up resources. + +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::StopAndDeleteCodec() + { + TInt stopError = Stop(); + TInt deleteError = DeleteCodec(); + + if (stopError != KErrNone) + return stopError; + else + return deleteError; + } + +/** +Deletes the codec +This default implementation does nothing +but real hardware devices might use this method to free up resources. +@return Error code. KErrNone if successful +*/ +EXPORT_C TInt CMMFSwCodecWrapper::DeleteCodec() + { + return KErrNone; + } + +/** +Call this function to notify hardware device implementation that +data is available in aFillBufferPtr for decoding. + +@param aFillBufferPtr + The data buffer filled by the observer. + +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr) + { + TRAPD(err,iDataPath->BufferFilledL(STATIC_CAST(CMMFDataBuffer&, aFillBufferPtr))); + return err; + } + +/** +Call this function to notify hardware device implementation that +data in aEmptyBufferPtr from encoding is processed. + +@param aBuffer + The data buffer processed by observer. + +@return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::ThisHwBufferEmptied(CMMFBuffer& aBuffer) + { + TRAPD(err,iDataPath->BufferEmptiedL(STATIC_CAST(CMMFDataBuffer&, aBuffer))); + return err; + } + + +/** +Retrieves a custom interface to the device. +The reference CMMFSwCodecWrapper supports two standard custom interfaces, +MPlayCustomInterface and MRecordCustomInterface. + +@param aInterface + Interface UID, defined with the custom interface. + aInterface = KMmfPlaySettingsCustomInterface for MPlayCustomInterface, + aInterface = KMmfRecordSettingsCustomInterface for MRecordCustomInterface. + aInterface = KMmfUidEmptyBuffersCustomInterface for MEmptyBuffersCustomInterface + Actual device implementations of CMMFSwCodecWrapper may do this differently however. +@return A pointer to the interface implementation, or NULL if the device can not + implement the interface requested. The return value must be cast to the + correct type by the user. +*/ +EXPORT_C TAny* CMMFSwCodecWrapper::CustomInterface(TUid aInterface) + { + TAny* ret = NULL; + TInt err = KErrNone; + if (aInterface.iUid == KMmfPlaySettingsCustomInterface) + { + if (!iPlayCustomInterface) + TRAP(err,iPlayCustomInterface = new(ELeave)TPlayCustomInterface()); + if (err) + ret = NULL; + else + ret = static_cast(iPlayCustomInterface); + } + else if (aInterface.iUid == KMmfRecordSettingsCustomInterface) + { + if (!iRecordCustomInterface) + TRAP(err,iRecordCustomInterface = new(ELeave)TRecordCustomInterface()); + if (err) + ret = NULL; + else + ret = static_cast(iRecordCustomInterface); + } + + else if (aInterface.iUid == KMmfUidEmptyBuffersCustomInterface || aInterface == KTimePlayedCustomInterfaceTypeUid || aInterface == KIgnoreUnderflowCustomInterfaceTypeUid) + { + if (!iDataPath) + { + ret = NULL; + } + else + { + ret = static_cast(iDataPath)->CustomInterface(aInterface); + } + } + + return ret; + } + + +/** +Used to configure the sample rate and stereo mode of a CMMFHwDevice plugin. + +The configuration of HwDevices is device specific and is not used in any of the reference +devices that return KErrNotSupported. + +@param aConfig + The device configuration. +*/ +EXPORT_C TInt CMMFSwCodecWrapper::SetConfig(TTaskConfig& aConfig) + { + if (aConfig.iUid != KUidRefDevSoundTaskConfig) + return KErrArgument; + iSampleRate = aConfig.iRate; + + if (aConfig.iStereoMode == ETaskMono) + { + iChannels = 1; + } + else if (aConfig.iStereoMode == ETaskInterleaved || aConfig.iStereoMode == ETaskNonInterleaved) + { + iChannels = 2; + } + else + { + return KErrArgument; + } + return KErrNone; + } + +/** +Used to set iVbrFlag on the datapath. + +This method is used to set the iVbrFlag in datapath. This flag is added to datapath to avail the +alternative dataflow wherein datapath makes sure that destinationbuffer is filled to its maximum length +before sending it to the sound driver. Sending the buffer directly to the device causes underflow incase of VBR codecs. +*/ +EXPORT_C void CMMFSwCodecWrapper::SetVbrFlag() + { + if(iDataPath) + { + TUid cUid = TUid::Uid(KSetVbrFlagCustomInterfaceTypeUid); + iDataPath->CustomInterface(cUid); + } + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinput.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1430 @@ +// Copyright (c) 2003-2009 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: +// mmfswaudioinput.cpp +// +// +#include "mmfswaudioinput.h" +#include "mmfswaudioinputpriv.h" +#include +#include +#include "mmf/utils/rateconvert.h" // if we need to resample +_LIT(KPddFileName,"SOUNDSC.PDD"); +_LIT(KLddFileName,"ESOUNDSC.LDD"); + +#ifdef SYMBIAN_SWCODEC_LOGGING + +const TText* const KStateNames[] = // must agree with TState + { + _S("EStateCreated2"), + _S("EStateInitialized2"), + _S("EStateRecordWait2"), + _S("EStateRecordWaitAck2"), + }; + +static const TText* StateName(TInt aState) + { + return KStateNames[aState]; + } + +const TText* const KRStateNames[] = // must agree with TRunningState + { + _S("ERStateRunning"), + _S("ERStatePaused"), + _S("ERStateFinishing"), + _S("ERStateFinished"), + _S("ERStateFailed"), + }; + +static const TText* RStateName(TInt aState) + { + return KRStateNames[aState]; + } + +#endif // SYMBIAN_SWCODEC_LOGGING + +#ifdef _DEBUG + +static void Panic(TInt aPanic) + { + _LIT(KPanicString, "SwAudioInput"); + User::Panic(KPanicString, aPanic); + } + +void CAudioInput::CheckFullInvariant() + { + CheckInvariant(); + CheckActiveRecorders(); + } + +void CAudioInput::CheckInvariant(TBool aKnownConstructed) + { + // full check would be that each recorder is in one, and only one, queue. + // However, since the queues share the same infrastructure, checking the overall length of queues + // is correct should suffice. During construction or deletion this may obviously vary + TInt totalLength = QLength(iIdleQueue) + QLength(iRecordingQueue) + + QLength(iPendingQueue) + QLength(iBusyQueue); + if (aKnownConstructed) + { + __ASSERT_DEBUG(totalLength==KNumRecorders, Panic(KPanicBadTotalQueueLength)); + } + else + { + __ASSERT_DEBUG(totalLength<=KNumRecorders, Panic(KPanicBadTotalQueueLength2)); + } + __ASSERT_DEBUG(QLength(iBusyQueue)<=1, Panic(KPanicBadTotalQueueLength)); + } + +#else // _DEBUG + +// inline versions that do nothing... + +inline void CAudioInput::CheckFullInvariant() + { + } + +inline void CAudioInput::CheckInvariant(TBool /*aKnownConstructed*/) + { + } + +#endif // _DEBUG + +const TInt KMinBufferSize = 4; // assume a good default? +//Shared chunk driver does not support max. buffer size. 16K is given in order to simulate the old driver behavior. +const TInt KMaxBufferSize = 0x4000; + +//Table that maps given linear value of volume to the corresponding decibel value. +const TUint8 KLinearToDbConstantLookup[] = + { + 0, // 0 + 158, + 170, + 177, + 182, + 186, + 189, + 192, + 194, + 196, + 198, // 10 + 200, + 201, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 210, // 20 + 211, + 212, + 213, + 213, + 214, + 215, + 215, + 216, + 217, + 217, // 30 + 218, + 218, + 219, + 219, + 220, + 220, + 221, + 221, + 222, + 222, // 40 + 223, + 223, + 224, + 224, + 224, + 225, + 225, + 225, + 226, + 226, // 50 + 226, + 227, + 227, + 227, + 228, + 228, + 228, + 229, + 229, + 229, // 60 + 230, + 230, + 230, + 230, + 231, + 231, + 231, + 231, + 232, + 232, // 70 + 232, + 232, + 233, + 233, + 233, + 233, + 234, + 234, + 234, + 234, // 80 + 235, + 235, + 235, + 235, + 235, + 236, + 236, + 236, + 236, + 236, // 90 + 237, + 237, + 237, + 237, + 237, + 237, + 238, + 238, + 238, + 238, // 100 + 238, + 239, + 239, + 239, + 239, + 239, + 239, + 240, + 240, + 240, // 110 + 240, + 240, + 240, + 240, + 241, + 241, + 241, + 241, + 241, + 241, // 120 + 241, + 242, + 242, + 242, + 242, + 242, + 242, + 242, + 243, + 243, // 130 + 243, + 243, + 243, + 243, + 243, + 244, + 244, + 244, + 244, + 244, // 140 + 244, + 244, + 244, + 245, + 245, + 245, + 245, + 245, + 245, + 245, // 150 + 245, + 245, + 246, + 246, + 246, + 246, + 246, + 246, + 246, + 246, // 160 + 246, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, + 247, // 170 + 247, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, + 248, // 180 + 248, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, + 249, // 190 + 249, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, + 250, // 200 + 250, + 250, + 250, + 251, + 251, + 251, + 251, + 251, + 251, + 251, // 210 + 251, + 251, + 251, + 251, + 251, + 252, + 252, + 252, + 252, + 252, // 220 + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 252, + 253, + 253, // 230 + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, + 253, // 240 + 253, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, + 254, // 250 + 254, + 254, + 254, + 254, + 254 + }; + +// rate lookup table + +const TInt KNumSampleRates = 9; + +struct TSampleRateEnumTable + { + TInt iRate; + TSoundRate iRateEnum; + TUint iRateConstant; + }; +//Table that maps given samples per second to the corresponding enums in RSoundSc +const TSampleRateEnumTable KRateEnumLookup[] = + { + {48000,ESoundRate48000Hz,KSoundRate48000Hz}, + {44100,ESoundRate44100Hz,KSoundRate44100Hz}, + {32000,ESoundRate32000Hz,KSoundRate32000Hz}, + {24000,ESoundRate24000Hz,KSoundRate24000Hz}, + {22050,ESoundRate22050Hz,KSoundRate22050Hz}, + {16000,ESoundRate16000Hz,KSoundRate16000Hz}, + {12000,ESoundRate12000Hz,KSoundRate12000Hz}, + {11025,ESoundRate11025Hz,KSoundRate11025Hz}, + {8000, ESoundRate8000Hz, KSoundRate8000Hz} + }; + +// TAudioInputParams + +EXPORT_C TAudioInputParams::TAudioInputParams() : + iSampleRate(0), iNominalBufferSize(0) + { + // none + } + +// CAudioInput + +EXPORT_C MAudioInput* MAudioInput::CreateL(MAudioInputObserver& aObserver) + { + MAudioInput* result = CAudioInput::NewL(aObserver); + return result; + } + +CAudioInput* CAudioInput::NewL(MAudioInputObserver& aObserver) + { + CAudioInput* result = new CAudioInput(aObserver); + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(result); + return result; + } + +CAudioInput::CAudioInput(MAudioInputObserver& aObserver) : + iObserver(aObserver), + iIdleQueue(_FOFF(CRecorder,iLink)), + iRecordingQueue(_FOFF(CRecorder,iLink)), + iPendingQueue(_FOFF(CRecorder,iLink)), + iBusyQueue(_FOFF(CRecorder,iLink)) + { + ASSERT(iState == EStateCreated2); // assume zero'ing initialises correctly + } + +void CAudioInput::Release() +// effective destructor call + { + delete this; + } + +TAny* CAudioInput::Interface(TUid aInterfaceUid) + { + if (aInterfaceUid == KUidAIParamInterface) + { + MAIParamInterface* self = this; + return self; + } + return NULL; + } + +RSoundSc& CAudioInput::RecordSoundDevice() + { + ASSERT(iRecordSoundDevice.Handle()!=0); // should be open + return iRecordSoundDevice; + } + +CAudioInput::~CAudioInput() + { + CheckInvariant(EFalse); // may not be constructed + Cancel(); + for (TInt i = 0; i < KNumRecorders; i++) + { + // just in case, call cancel directly from this point too + // Cancel depends on the active queue, and might not be quite the same. + CRecorder* recorder = iRecorders[i]; + if (recorder) + { + recorder->Cancel(); + } + delete recorder; + } + delete iAsyncCallBack; + iConvBuff.Close(); + iRecordSoundDevice.Close(); + iChunk.Close(); + } + +void CAudioInput::Cancel() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Cancel()")); +#endif + CancelRecorders(); + if (iAsyncCallBack) + { + iAsyncCallBack->Cancel(); + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Cancel()")); +#endif + } + +void CAudioInput::CancelRecorders() +// if a recorder is active, then cancel it. Also move the list if required. + { + CheckInvariant(); // semi-invariant check - this is called from destructor + + CRecorder* recorder; + while (QPop(recorder, iRecordingQueue)) + { + recorder->Cancel(); + iIdleQueue.AddLast(*recorder); + } + CheckFullInvariant(); + } + +void CAudioInput::CancelPendingRecorders() +// take any recorder in the pending queue. ack the buffer and send to idle + { + CheckFullInvariant(); + + CRecorder* recorder; + while (QPop(recorder, iPendingQueue)) + { + recorder->ReleaseBuffer(); + iIdleQueue.AddLast(*recorder); + } + CheckFullInvariant(); + } + +void CAudioInput::CancelBusyRecorder() +// take busy recorder. ack the buffer and send to idle + { + CheckFullInvariant(); + + CRecorder* recorder; + if (QPop(recorder, iBusyQueue)) + { + recorder->ReleaseBuffer(); + iIdleQueue.AddLast(*recorder); + } + CheckFullInvariant(); + } + +void CAudioInput::RecordAllIdle() +// take any recorder in idle queue and set recording + { + CheckFullInvariant(); + + CRecorder* recorder; + while (QPop(recorder, iIdleQueue)) + { + recorder->RecordData(); + iRecordingQueue.AddLast(*recorder); + } + CheckFullInvariant(); + } + +void CAudioInput::ConstructL() + { + for (TInt i = 0; i < KNumRecorders; i++) + { + iRecorders[i] = new (ELeave) CRecorder(*this, i); + iIdleQueue.AddLast(*(iRecorders[i])); + } + iAsyncCallBack = new (ELeave) CAsyncCallBack(CActive::EPriorityStandard); + TCallBack callback(Callback, this); + iAsyncCallBack->Set(callback); + User::LoadPhysicalDevice(KPddFileName); + User::LoadLogicalDevice(KLddFileName); + CheckFullInvariant(); + } + +TInt CAudioInput::Initialize(const TAudioInputParams& aParams) + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Initialize() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + TInt error = KErrNone; + if (iState == EStateCreated2) + { + if (!iRecordSoundDevice.Handle()) + { + error = iRecordSoundDevice.Open(KSoundScRxUnit0); + if (error) + { + Close(); // TODO Close() required? + } + } + if (!error) + { + iBufferLength = aParams.iNominalBufferSize; // will be updated by SetFormat() if required + error = SetFormat(aParams); + if (!error) + { + iRecordBufferConfig.iNumBuffers = KNumRecorders*2; // for each AO we create two buffers + iRecordBufferConfig.iFlags = 0; + iRecordBufferConfig.iBufferSizeInBytes = iBufferLength; + ASSERT(iChunk.Handle()==0); // should not be already open + TPckg bufferConfigBuf( + iRecordBufferConfig); + error = iRecordSoundDevice.SetBufferChunkCreate( + bufferConfigBuf, iChunk); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print( + _L("iRecordBufferConfig.iNumBuffers = [%d]"),iRecordBufferConfig.iNumBuffers); + RDebug::Print( + _L("iRecordBufferConfig.iFlags = [%d]"),iRecordBufferConfig.iFlags); + RDebug::Print( + _L("iRecordBufferConfig.iBufferSizeInBytes = [%d]"),iRecordBufferConfig.iBufferSizeInBytes); +#endif + if (error == KErrNone) + { + ASSERT(iChunk.Handle()); // should now be open + iRecordSoundDevice.GetBufferConfig(bufferConfigBuf); // overwrite iRecordBufferConfig + SetGain(aParams.iInitialGain); + iState = EStateInitialized2; + } + } + } + } + else + { + error = KErrNotReady; + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Initialize(%d) state=%s rstate=%s"), error, StateName( + iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + return error; + } + +void CAudioInput::Close() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Close() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + InternalStop(); // Technically this should not be required, as client should Stop() first, but just in case + if (iState == EStateInitialized2) + { + iRecordSoundDevice.Close(); + iChunk.Close(); + iConvBuff.Close(); + iState = EStateCreated2; + } + ASSERT(iState==EStateCreated2); + ASSERT(QLength(iIdleQueue)==KNumRecorders); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Close() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + } + +TInt CAudioInput::Start() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Start() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + TInt error = KErrNone; + if (iState == EStateInitialized2) + { + RecordAllIdle(); + iState = EStateRecordWait2; + iRState = ERStateRunning; + } + else + { + error = KErrNotReady; + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Start(%d) state=%s rstate=%s"), + error, StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + return error; + } + +void CAudioInput::BufferAck() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::BufferAck() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + ASSERT(iState==EStateRecordWaitAck2); + HandleBufferAck(); + iState = EStateRecordWait2; + RequestCallback(); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::BufferAck() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + } + +void CAudioInput::HandleBufferAck() + { + CRecorder* recorder = QPop(iBusyQueue); + recorder->ReleaseBuffer(); + if (iRState == ERStateRunning) + { + recorder->RecordData(); + iRecordingQueue.AddLast(*recorder); + } + else + { + iIdleQueue.AddLast(*recorder); + if (iRState == ERStatePaused && (QLength(iRecordingQueue)+QLength(iPendingQueue) == 0)) + { + iRState = ERStateFinishing; + } + } + } + +TInt CAudioInput::Pause() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Pause() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + TInt err = KErrNone; // note we are silent if called in wrong state + +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print( + _L("***!pause irecordingquelength %d pendingquelength %d ibusyquelength=%d"), QLength(iRecordingQueue), + QLength(iPendingQueue), QLength(iBusyQueue)); +#endif + if ((iState == EStateRecordWait2 || iState == EStateRecordWaitAck2) && iRState==ERStateRunning) + { + iRecordSoundDevice.Pause(); + + iRState = ERStatePaused; + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Pause(%d) state=%s err=%d"), err, StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + return err; + } + +TInt CAudioInput::Resume() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Resume() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + TInt err = KErrNone; // note we are silent if called in the wrong state + if ((iState == EStateRecordWait2 || iState == EStateRecordWaitAck2) && + ((iRState==ERStatePaused || iRState==ERStateFinishing || iRState==ERStateFinished))) + { + err = RecordSoundDevice().Resume(); + + RecordAllIdle(); + + iRState = ERStateRunning; + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Resume(%d) state=%s rstate=%s"), err, StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + return err; + } + +TInt CAudioInput::Flush() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Flush() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + TInt error = KErrNotReady; + if (iRState==ERStatePaused) + { + if (iState == EStateRecordWait2) + { + InternalFlush(); + ASSERT(iState == EStateRecordWait2); // stay put + error = KErrNone; + } + else if (iState == EStateRecordWaitAck2) + { + InternalFlush(); + iState = EStateRecordWait2; + error = KErrNone; + } + } + #ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Flush(%d) state=%s rstate=%s"), error, StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + return error; + } + +void CAudioInput::Stop() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::Stop() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + InternalStop(); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::Stop() state=%s rstate=%s"), StateName(iState), RStateName(iRState)); +#endif + } + +void CAudioInput::InternalStop() +// This stops all recording and returns pending and busy buffers to idle. Must be called when +// client knows the buffer has been grabbed (e.g. _not_ before error callback) + { + CheckInvariant(); // Can be called from buffer error, so can't check full invariant. + if (iState != EStateInitialized2 && iState != EStateCreated2) + { + InternalFlush(); + iState = EStateInitialized2; + } + CheckFullInvariant(); + ASSERT((QLength(iRecordingQueue) + QLength(iPendingQueue) + + QLength(iBusyQueue))==0); // everything is stopped + } + +void CAudioInput::InternalFlush() + { + CancelRecorders(); + CancelPendingRecorders(); + CancelBusyRecorder(); + } + +void CAudioInput::BufferArrives(CRecorder* aRecorder) + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print( + _L("--->CAudioInput::BufferArrives(%d,%d) state=%s rstate=%s"), aRecorder->Index(), + aRecorder->StatusOrOffset(), StateName(iState), RStateName(iRState)); +#endif + CheckInvariant(); // Can't use CheckFullInvariant() from RunL + ASSERT(iState==EStateRecordWait2 || iState==EStateRecordWaitAck2); + ASSERT(aRecorder->Offset()>=0); // assert we're not here due to an error + iRecordingQueue.Remove(*aRecorder); + iPendingQueue.AddLast(*aRecorder); + if (iState==EStateRecordWait2) + { + RequestCallback(); + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::BufferArrives() state=%s rstate=%s"), + StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + } + +void CAudioInput::UseBuffer(CRecorder* aRecorder) +// incomming buffer is pointed to by iBufPtr. Either directly or via convert, use for callback + { + iBufPtr.Set(iChunk.Base() + aRecorder->Offset(), aRecorder->Length()); + if (iConverter) + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("iBufPtr length [%d] iconvbuff length [%d,%d]"), + iBufPtr.Length(), iConvBuff.Length(), iConvBuff.MaxLength()); +#endif + __DEBUG_ONLY(TInt converted =) iConverter->Convert(iBufPtr, iConvBuff); + // the following assert should check we convert the log. + // Actually we sometimes fail at the end of the operation with what is effectively + // the last buffer. Arguably a driver fault, but there we are + // ASSERT(converted==iBufPtr.Length()); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("iBufPtr length [%d] iconvbuff length after [%d,%d]"), + iBufPtr.Length(), iConvBuff.Length(), iConvBuff.MaxLength()); +#endif + iObserver.InputBufferAvailable(iConvBuff); + } + else + { + iObserver.InputBufferAvailable(iBufPtr); + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("12345 ibufptr = [0x%x]"),iBufPtr.Ptr()); +#endif + } + +void CAudioInput::BufferError(CRecorder* aRecorder, TInt aError) + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print( + _L("--->CAudioInput::BufferError(%d,%d) state=%s rstate=%s"), aRecorder->Index(), + aError, StateName(iState), RStateName(iRState)); +#endif + CheckInvariant(); // Can't use CheckFullInvariant() from RunL + if (aError==KErrCancel || aError==KErrOverflow) + { + // Cancel: sign of a Pause operation. If paused etc, then merely add to idle list. potentially generate finished signal + // if not paused, then not clear but just in case request record again + // Overflow: basically try again, but if paused merely add to idle. Check for last buffer just in case + if (iRState!=ERStateRunning) + { + iRecordingQueue.Remove(*aRecorder); + iIdleQueue.AddLast(*aRecorder); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print( + _L("***! irecordingquelength %d pendingquelength %d ibusyquelength=%d"), QLength(iRecordingQueue), + QLength(iPendingQueue), QLength(iBusyQueue)); +#endif + if (iRState == ERStatePaused && (QLength(iRecordingQueue)+QLength(iPendingQueue)+QLength(iBusyQueue) == 0)) + { + iRState = ERStateFinishing; + RequestCallback(); + } + } + else + { + aRecorder->RecordData(); + } + } + else + { + iRecordingQueue.Remove(*aRecorder); + iIdleQueue.AddLast(*aRecorder); + iRState = ERStateFailed; + iObserver.InputError(aError); + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::BufferError() state=%s rstate=%s"), + StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + } + +TInt CAudioInput::Callback(TAny* aPtr) + { + CAudioInput* self = static_cast (aPtr); + TRAPD(error,self->AsyncCallbackL()); + return error; // TODO really have to handle error + } + +void CAudioInput::RequestCallback() + { + // ensure iAsyncCallBack is active + if (!iAsyncCallBack->IsActive()) + { + iAsyncCallBack->Call(); + } + } + +void CAudioInput::AsyncCallbackL() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::AsyncCallbackL() state=%s rstate=%s"), + StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + ASSERT(iState==EStateRecordWait2 || iState==EStateRecordWaitAck2); // should not occur in other states. Actually ignore in 2nd + if (iState==EStateRecordWait2) + { + if (QLength(iPendingQueue)>0) + { + ASSERT(QLength(iBusyQueue)==0); + iState = EStateRecordWaitAck2; // change state prior to callback, in case sync call from callback + CRecorder* recorder = QPop(iPendingQueue); + iBusyQueue.AddLast(*recorder); + UseBuffer(recorder); + } + else + { + if (iRState == ERStateFinishing) + { + ASSERT(QLength(iRecordingQueue)+QLength(iPendingQueue)+QLength(iBusyQueue) == 0); // should be true + iRState = ERStateFinished; + iObserver.InputFinished(); + } + } + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::AsyncCallbackL() state=%s rstate=%s"), + StateName(iState), RStateName(iRState)); +#endif + CheckFullInvariant(); + } + +TInt CAudioInput::GetBufferSizes(TInt& aMinSize, TInt& aMaxSize) + { + aMinSize = KMinBufferSize; + aMaxSize = KMaxBufferSize; + return KErrNone; + } + +TInt CAudioInput::SetGain(TInt aGain) + { + TInt error = KErrNone; // note: silent if in wrong state + if (iRecordSoundDevice.Handle()) + { + // we have to switch from level to dB value + if(aGain >=0 && aGain<=KSoundMaxVolume) + { + error = iRecordSoundDevice.SetVolume(KLinearToDbConstantLookup[aGain]); + } + else + { + error = KErrArgument; + } + } + return error; + } + +TInt CAudioInput::SetFormat(const TAudioInputParams& aFormat) + { + TInt err = KErrNotFound; + TCurrentSoundFormatV02Buf formatBuf; + TFormatData formatData; + + delete iConverter; + iConverter = NULL; // setting this to NULL indicates we are not using converter. No other flag + + TInt wantedRate = aFormat.iSampleRate; + for (TInt index = 0; index < KNumSampleRates; index++) + { + if (wantedRate == KRateEnumLookup[index].iRate) + { + formatBuf().iRate = KRateEnumLookup[index].iRateEnum; + formatData.iSampleRate = wantedRate; + err = KErrNone; + break; + } + } + + if (err == KErrNone) + { + formatBuf().iChannels = aFormat.iNumChannels; + formatBuf().iEncoding = ESoundEncoding16BitPCM; + formatBuf().iDataFormat = ESoundDataFormatInterleaved; + err = iRecordSoundDevice.SetAudioFormat(formatBuf); +#if defined(SYMBIAN_SOUNDADAPTER_FORCECDRATES) || defined (SYMBIAN_SOUNDADAPTER_FORCESTEREO) + err = KErrNotSupported; // force Negotiate - for debugging +#endif + if (err == KErrNotSupported) + { + // don't support directly. Perhaps can rate convert? + err = NegotiateFormat(aFormat, formatData); + } + } + return err; + } + +TInt CAudioInput::NegotiateFormat(const TAudioInputParams& aFormat, TFormatData &aFormatData) + { + TInt err = KErrNotFound; + TCurrentSoundFormatV02Buf formatBuf; + + TInt origBufferLength = iBufferLength; // cache in case we change + + // find out first what the driver supports + TSoundFormatsSupportedV02Buf supportedFormat; + iRecordSoundDevice.Caps(supportedFormat); + TUint32 supportedRates = supportedFormat().iRates; +#ifdef SYMBIAN_SOUNDADAPTER_FORCECDRATES + supportedRates &= KSoundRate11025Hz | KSoundRate22050Hz + | KSoundRate44100Hz; // only use CD rates - for debugging +#endif + + // For RecordCase: + // We want the next rate above consistently - we go down from this to the requested rate. + // If there is one, we don't support - we _never_ upsample. + // note that the table is given in descending order, so we start with the highest + TInt wantedRate = aFormat.iSampleRate; + TInt takeTheFirst = EFalse; + TInt nextUpValidIndex = -1; + for (TInt index = 0; index < KNumSampleRates; index++) + { + TBool lookingAtRequestedRate = wantedRate + == KRateEnumLookup[index].iRate; + TSoundRate wantedEnum = KRateEnumLookup[index].iRateEnum; + TUint32 equivBitmap = KRateEnumLookup[index].iRateConstant; + TBool isSupported = (equivBitmap & supportedRates) != EFalse; + if (lookingAtRequestedRate || takeTheFirst) + { + if (isSupported) + { + // this rate is supported + formatBuf().iRate = wantedEnum; + aFormatData.iActualRate = KRateEnumLookup[index].iRate; + err = KErrNone; + break; + } + } + else if (!takeTheFirst) + { + // while we are still looking for the rate, want to cache any supported index + // at end of loop, this will be the first rate above ours that is supported + // use for fallback if required + if (isSupported) + { + nextUpValidIndex = index; + } + } + if (lookingAtRequestedRate) + { + // For record we just abort. + break; + } + } + + if (err) + { + // if there is one above the requested rate, use that + if (nextUpValidIndex >= 0) + { + TSoundRate wantedEnum = + KRateEnumLookup[nextUpValidIndex].iRateEnum; + formatBuf().iRate = wantedEnum; + aFormatData.iActualRate = KRateEnumLookup[nextUpValidIndex].iRate; + err = KErrNone; + } + } + + if (err) + { + // should have something! + return err; + } + + aFormatData.iSampleRate = wantedRate; // iSampleRate is our requested/apparent rate, not the device rate. + + TUint32 channelsSupported = supportedFormat().iChannels; +#ifdef SYMBIAN_SOUNDADAPTER_FORCESTEREO + channelsSupported &= KSoundStereoChannel; // don't use mono - for debugging +#endif + + if (aFormat.iNumChannels == 1) + { + aFormatData.iRequestedChannels = 1; + // want mono + if (channelsSupported & KSoundMonoChannel) + { + // mono is supported, as usual + aFormatData.iActualChannels = 1; + } + else if (channelsSupported & KSoundStereoChannel) + { + aFormatData.iActualChannels = 2; + iBufferLength *= 2; // double size, will do stereo->mono + } + else + { + return KErrNotSupported; // should not get this far for real + } + } + else if (aFormat.iNumChannels == 2) + { + aFormatData.iRequestedChannels = 2; + // want stereo + if (channelsSupported & KSoundStereoChannel) + { + // stereo is supported, as usual + aFormatData.iActualChannels = 2; + } + else if (channelsSupported & KSoundMonoChannel) + { + aFormatData.iActualChannels = 1; + iBufferLength /= 2; // halve size, will do mono->stereo + } + else + { + return KErrNotSupported; // should not get this far for real + } + } + else + { + return KErrNotSupported; // unknown number of channels requested! + } + + formatBuf().iChannels = aFormatData.iActualChannels; + + formatBuf().iEncoding = ESoundEncoding16BitPCM; + formatBuf().iDataFormat = ESoundDataFormatInterleaved; + err = iRecordSoundDevice.SetAudioFormat(formatBuf); + + if (!err) + { + ASSERT(!iConverter); // pre-condition at top of function anyway + // when recording we convert from actual to requested + TInt outputRateToUse = aFormatData.iSampleRate; +#ifdef SYMBIAN_SKIP_RESAMPLE_ON_RECORD + // with this macro just channel convert at most + outputRateToUse = aFormatData.iActualRate; +#endif +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::NegotiateFormat: Convert:CreateL from %d/%d to %d/%d"), + aFormatData.iActualRate, aFormatData.iActualChannels, + aFormatData.iSampleRate, aFormatData.iRequestedChannels); +#endif + TRAP(err, iConverter = CChannelAndSampleRateConverter::CreateL(aFormatData.iActualRate, + aFormatData.iActualChannels, + outputRateToUse, + aFormatData.iRequestedChannels)); + } + if (!err && iConverter) + { + err = iConvBuff.Create(origBufferLength); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("iBufferLength length [%d] iconvbuff length [%d,%d]"), + iBufferLength, iConvBuff.Length(), iConvBuff.MaxLength()); +#endif + } + + return err; + } + +TInt CAudioInput::GetSupportedSampleRates(RArray& aSupportedSampleRates) + { + TInt err = KErrNone; + + if (iRecordSoundDevice.Handle()) + { + GetSupportedSampleRates(aSupportedSampleRates, iRecordSoundDevice); + } + else + {//temporarily open the device if we can + RSoundSc tempsound; + err = tempsound.Open(KSoundScRxUnit0); + if (!err) + { + err = GetSupportedSampleRates(aSupportedSampleRates, tempsound); + tempsound.Close(); + } + } + return err; + } + +TInt CAudioInput::GetSupportedSampleRates( + RArray& aSupportedSampleRates, RSoundSc& aSoundDevice) + { + ASSERT(aSoundDevice.Handle()); // parent to ensure this is open + + TInt err = KErrNone; + + TSoundFormatsSupportedV02Buf supportedFormat; + aSoundDevice.Caps(supportedFormat); + TUint32 rates = supportedFormat().iRates; + + for (TInt i = KNumSampleRates - 1; i > 0; i--)//min to max + { + if (rates & KRateEnumLookup[i].iRateConstant) + { + err = aSupportedSampleRates.Append(KRateEnumLookup[i].iRate); + if (err) + { + break; + } + } + } + return err; + } + +TInt CAudioInput::QLength(TSglQue& aQueue) +// count elements in List/Q. Have to use iterator to do this - it seems. + { + TSglQueIter iter(aQueue); + TInt count=0; + while (iter++) + { + // like old-fashioned C string manipulations. iterate through all members + count++; + } + return count; + } + +CAudioInput::CRecorder* CAudioInput::QPop(TSglQue& aQueue) + { + CRecorder* recorder = NULL; + if (! aQueue.IsEmpty()) + { + recorder = aQueue.First(); + aQueue.Remove(*recorder); + } + return recorder; + } + +#ifdef _DEBUG + +// these functions are used in invariant checking only + +void CAudioInput::CheckActiveRecorders(TSglQue& aQueue, TBool aExpected, TInt aPanicCode) +// check that all the elements in the given Q are IsActive() or vice-versa + { + TSglQueIter iter(aQueue); + + CRecorder* recorder; + while ((recorder=iter++)!=NULL) + { + TBool expected = aExpected != EFalse; // ensure these are either true or false + TBool active = recorder->IsActive() != EFalse; + __ASSERT_DEBUG(expected == active, Panic(aPanicCode)); + } + } + +void CAudioInput::CheckActiveRecorders() +// check that all the elements in the recordingQueue are IsActive() etc +// can't be used as CRecorder::RunL() pre-condition + { + CheckActiveRecorders(iRecordingQueue, ETrue, EPanicBusyRecorderNotActive); + CheckActiveRecorders(iIdleQueue, EFalse, EPanicNonBusyRecorderActive); + CheckActiveRecorders(iPendingQueue, EFalse, EPanicNonBusyRecorderActive); + CheckActiveRecorders(iBusyQueue, EFalse, EPanicNonBusyRecorderActive); + } + +#endif // _DEBUG + +// +// CRecorder +// + + +CAudioInput::CRecorder::CRecorder(CAudioInput& aParent, TInt aIndex) : + CActive(EPriorityStandard), iParent(aParent), iIndex(aIndex) + { + CActiveScheduler::Add(this); + } + +CAudioInput::CRecorder::~CRecorder() + { + Cancel(); + } + +void CAudioInput::CRecorder::Cancel() + { + // this override takes into account that ReleaseBuffer must be called - this is not the + // normal pattern where following Cancel() we're not concerned with the results + if (IsActive()) + { + ASSERT(!BufferHeld()); // if active then buffer held should be clear. don't reset then + CActive::Cancel(); + ReleaseBuffer(ETrue); // release - might have been a successful run! + } + else + { + ReleaseBuffer(); // this will release buffer if still outstanding + } + } + +void CAudioInput::CRecorder::RunL() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::CRecorder::RunL(%d, %d)"), Index(), + iStatus.Int()); +#endif + TInt errorOrOffset = iStatus.Int(); // negative -> error. non-negative is offset in chunk + + if (errorOrOffset < 0) + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("errorOrOffset = [%d]"),errorOrOffset); +#endif + // ReleaseBuffer(ETrue); // calls ReleaseBuffer() on error code. Driver requires this, even though seems wrong + iParent.BufferError(this, errorOrOffset); + } + else + { + ASSERT(!iBufferHeld); + iBufferHeld = ETrue; + +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("errorOrOffset = [%d]"),errorOrOffset); +#endif + // If a buffer larger than expected arrives truncate it. + iLength = Min(iLength,iParent.iBufferLength); + iParent.BufferArrives(this); + } +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::CRecorder::RunL(%d)"), Index()); +#endif + } + +void CAudioInput::CRecorder::RecordData() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::CRecorder::RecordData(%d)"), Index()); +#endif + ASSERT(!iBufferHeld); + Deque(); // ensure we append to the AO queue, so if it comes to it we process oldest request first + CActiveScheduler::Add(this); + iLength = iParent.BufferLength(); // TODO do we have to set this first or is it an OUT param purely + iParent.RecordSoundDevice().RecordData(iStatus, iLength); + SetActive(); + +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("###****#####!!!! Buffer length [%d], status [%d] "), iLength, + iStatus.Int()); +#endif +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::CRecorder::RecordData(%d)"), Index()); +#endif + } + +void CAudioInput::CRecorder::DoCancel() + { +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("--->CAudioInput::CRecorder::DoCancel(%d)"), Index()); +#endif + iParent.RecordSoundDevice().Cancel(iStatus); +#ifdef SYMBIAN_SWCODEC_LOGGING + RDebug::Print(_L("<---CAudioInput::CRecorder::DoCancel(%d)"), Index()); +#endif + } + +void CAudioInput::CRecorder::ReleaseBuffer(TBool aDoAnyway) + { + if (iBufferHeld || aDoAnyway) + { + iParent.RecordSoundDevice().ReleaseBuffer(iStatus.Int()); + iBufferHeld = EFalse; + } + } + +TInt CAudioInput::CRecorder::Index() const + { + return iIndex; + } + +TInt CAudioInput::CRecorder::Length() const + { + return iLength; + } + +TBool CAudioInput::CRecorder::IsBusy() const + { + return IsActive() || BufferHeld(); + } + +TBool CAudioInput::CRecorder::BufferHeld() const +// BufferHeld() means we're in control of a passed buffer + { + return iBufferHeld; + } + +TInt CAudioInput::CRecorder::Offset() const +// If we call this, we've discounted errors so can assert non-negative + { + TInt result = StatusOrOffset(); + ASSERT(result>=0); + return result; + } + +TInt CAudioInput::CRecorder::StatusOrOffset() const +// The iStatus assuming is valid + { + ASSERT(!IsActive()); // or would not be valid + TInt result = iStatus.Int(); + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinput.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,115 @@ +// Copyright (c) 2003-2009 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: +// mmfswaudioinput.h +// +// + +#ifndef SWAUDIOINPUT_H +#define SWAUDIOINPUT_H + +#include +#include + + +//TAudioInputParams +//- give sample rate and buffer size +class TAudioInputParams + { +public: + IMPORT_C TAudioInputParams(); + + TInt iSampleRate; + // The sample rate of the data past to the client. Ideally, but not + // necessarily that used on the device + TInt iNumChannels; + // Number of channels to use. 1 = mono. 2 = (interleaved) stereo. + TInt iNominalBufferSize; + // "Full buffers" are to be of this size. (Only the penultimate can be shorter) + TInt iInitialGain; + // Gain to use on start. + }; + +// Observer class for MAudioInput +class MAudioInputObserver + { +public: + virtual void InputBufferAvailable(const TDesC8& aBuffer)=0; + // A buffer of data is available. Assume single buffering + + virtual void InputFinished()=0; + // called following Pause() to say no more data left + + virtual void InputError(TInt aError)=0; + // called on fatal(ish) error. Client should call Stop() and/or Close() + }; + +// Interface to SwWrapper AudioInput +class MAudioInput + { +public: + IMPORT_C static MAudioInput* CreateL(MAudioInputObserver& aObserver); + // Create new object + + virtual void Release()=0; + // destructor call + + virtual TInt Initialize(const TAudioInputParams& aParams)=0; + // Initialize with given properties. synchronous call. + + virtual void Close()=0; + // undo of Initialize() - return to created state. Implied Stop() if required. + + virtual TInt Start()=0; + // Start to record and supply buffers. Only valid if initialized + // subsequently BufferToEmpty() will be called + + virtual void BufferAck()=0; + // The buffer supplied by InputBufferAvailable has been read. + // Client must have stopped reading from the buffer + + virtual TInt Pause()=0; + // pause (temporarily stop) recording. When all buffers have been passed + // InputFinished() is called. + + virtual TInt Resume()=0; + // resume from paused mode. If InputFinished() has not been sent + // already it won't be + + virtual TInt Flush()=0; + // throw away any partially recorded buffers than have not been + // received. Implied BufferAck(). Only legal when paused + + virtual void Stop()=0; + // immediate stop, but does not close. Akin to Cancel() if we are running. + + virtual TAny* Interface(TUid aInterfaceUid)=0; + // for standard extension pattern + }; + +// Parameter access. Do as CI since API not so clear +const TUid KUidAIParamInterface = {0x10287080}; +class MAIParamInterface + { +public: + virtual TInt SetGain(TInt aGain)=0; + // set basic gain + + virtual TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize)=0; + // min and max buffer size supported (or at least recommended) + + virtual TInt GetSupportedSampleRates(RArray& aSupportedSampleRates)=0; + }; + +#endif // SWAUDIOINPUT_H + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinputpriv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfswaudioinputpriv.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,207 @@ +// Copyright (c) 2003-2009 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: +// mmfswaudioinputpriv.h +// +// + +#ifndef SWAUDIOINPUTPRIV_H +#define SWAUDIOINPUTPRIV_H + +#include +#include "mmfswaudioinput.h" +#include +#include +#include + +#define KNumRecorders (2) // 2 for double buffering, 4 quadruple etc + +enum TPanicCodes + { + KPanicBadTotalQueueLength=1, // once constructed, total queue length should be KNumRecorders + KPanicBadTotalQueueLength2, // during construction or delation, total queue length should be <= KNumRecorders + KPanicBadBusyQueueLength, // Busy queue should never exceed length of 1 + EPanicBusyRecorderNotActive, // If in the busy queue, should be active + EPanicNonBusyRecorderActive, // opposite + }; + +//Total Number of sample rates +class CChannelAndSampleRateConverter; // forward dec + +class TRecordSharedChunkBufConfig : public TSharedChunkBufConfigBase + { +public: + TInt iBufferOffsetList[3]; + }; + +NONSHARABLE_CLASS(CAudioInput) : public CBase, + public MAudioInput, + public MAIParamInterface + { + NONSHARABLE_CLASS( CRecorder ) : public CActive + { + public: + CRecorder(CAudioInput& aParent, TInt aIndex); + ~CRecorder(); + void Cancel(); + + void RecordData(); + TInt Index() const; + void ReleaseBuffer(TBool aDoAnyway=EFalse); + TBool IsBusy() const; + TBool BufferHeld() const; + TInt Length() const; + TInt Offset() const; + TInt StatusOrOffset() const; + + TSglQueLink iLink; // used to form queues. Treat as private. + + // from CActive + void RunL(); + void DoCancel(); + private: + CAudioInput& iParent; + const TInt iIndex; + TInt iLength; + TBool iBufferHeld; + }; + +private: + class TFormatData + { + public: + inline TFormatData(): + iSampleRate(8000), iRequestedChannels(1) // default + { + } + public: + TInt iSampleRate; + TInt iActualRate; + TInt iRequestedChannels; + TInt iActualChannels; + }; + +public: + static CAudioInput* NewL(MAudioInputObserver& aObserver); + ~CAudioInput(); + + // from MAudioInput + void Release(); + TInt Initialize(const TAudioInputParams& aParams); + void Close(); + TInt Start(); + void BufferAck(); + TInt Pause(); + TInt Resume(); + TInt Flush(); + void Stop(); + TAny* Interface(TUid aInterfaceUid); + + // from MAIParamInterface + TInt SetGain(TInt aGain); + TInt GetBufferSizes(TInt& aMinSize, TInt& aMaxSize); + TInt GetSupportedSampleRates(RArray& aSupportedSampleRates); + + RSoundSc& RecordSoundDevice(); + void BufferArrives(CRecorder* aRecorder); + void BufferError(CRecorder* aRecorder, TInt aError); + TInt SetFormat(const TAudioInputParams& aFormat); + TInt NegotiateFormat(const TAudioInputParams& aFormat, TFormatData &aFormatData); + TInt GetSupportedSampleRates(RArray& aSupportedSampleRates, RSoundSc& aSoundDevice); + +private: + CAudioInput(MAudioInputObserver& aObserver); + void ConstructL(); + void Cancel(); + + static TInt Callback(TAny* aPtr); + void AsyncCallbackL(); + void RequestCallback(); + + void CancelRecorders(); + void CancelPendingRecorders(); + void CancelBusyRecorder(); + void InternalStop(); + void InternalFlush(); + void RecordAllIdle(); + + void UseBuffer(CRecorder* aRecorder); + void HandleBufferAck(); + + void CheckFullInvariant(); + void CheckInvariant(TBool aKnownConstructed=ETrue); + +#ifdef _DEBUG + void CheckActiveRecorders(); + void CheckActiveRecorders(TSglQue& aQueue, TBool aExpected, TInt aPanicCode); +#endif + + static TInt QLength(TSglQue& aQueue); + CRecorder* QPop(TSglQue& aQueue); + TBool QPop(CRecorder*& aRecorder, TSglQue& aQueue); + + inline TInt BufferLength() const { return iBufferLength; } // TODO required? + +private: + MAudioInputObserver& iObserver; + + enum TState + { + EStateCreated2, + EStateInitialized2, + EStateRecordWait2, + EStateRecordWaitAck2, + }; + + enum TRunningState // when in RecordWait2 or RecordWaitAck2 + { + ERStateRunning, // recording + ERStatePaused, // paused state + ERStateFinishing, // look to do InputFinished() on next tick + ERStateFinished, // InputFinished() sent + ERStateFailed, // InputError() sent + }; + + TState iState; + TRunningState iRState; + TRecordSharedChunkBufConfig iRecordBufferConfig; + RSoundSc iRecordSoundDevice; + RChunk iChunk; + CRecorder* iRecorders[KNumRecorders]; + CAsyncCallBack* iAsyncCallBack; + TInt iBufferLength; // this is the length of buffers we request + CChannelAndSampleRateConverter* iConverter; + TPtrC8 iBufPtr; // this is usually the descriptor sent to the observer + RBuf8 iConvBuff; // extra buffer from when we use a converter + + TSglQue iIdleQueue; // just sitting there + TSglQue iRecordingQueue; // record operation outstanding + TSglQue iPendingQueue; // buffer has been recorded, waiting to be processed + TSglQue iBusyQueue; // mid InputAvailable()/BufferAck() cycle. Length <= 1 + }; + +inline TBool CAudioInput::QPop(CRecorder*& aRecorder, TSglQue& aQueue) +// overload of QPop(), since "while (recorder = QPop(...))" etc gives warnings +// This allows "while (QPop(recorder, ...))" instead + { + CRecorder* recorder = QPop(aQueue); + if (recorder) + { + aRecorder = recorder; + return ETrue; + } + return EFalse; + } + +#endif // SWAUDIOINPUTPRIV_H + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/src/swcodecwrapper/mmfswcodecwrapperCustomInterfaces.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/src/swcodecwrapper/mmfswcodecwrapperCustomInterfaces.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,83 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __MMFSWCODECWRAPPERCUSTOMINTERFACES_H__ +#define __MMFSWCODECWRAPPERCUSTOMINTERFACES_H__ + + +/** + * Implementation of custom interface class for play functionality created by the + * CMMFSwCodecWrapper::CustomInterface() method. It provides + * access to miscellaneous functionality such as volume settings + * Ports of sw codec wrapper may do this differently eg via EAP + * note don't use RMdaDevSound::TCurrentSoundFormatBuf so send + * across the sample rate and channels because 1)it would mean + * mmfswcodecwrapper.h would have to include mdasound.h and 2) + * the buffer size and encoding members are not required 3)3rd party ports + * may not use RMdaDevSound + * Note also that this interface is just a simple interface to get + * and set values. No checking is perfomed on the values sent (hence the + * Set methods do not return an error code.) + * @released + */ +class TPlayCustomInterface : public MPlayCustomInterface + { +public: + TPlayCustomInterface() : iVolume(0),iBytesPlayed(0),iDevice(NULL),iRampDuration(0) {} + void SetVolume(TUint aVolume); + TUint Volume() {return iVolume;}; + TUint BytesPlayed(); + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) {iRampDuration = aRampDuration;}; + TTimeIntervalMicroSeconds& VolumeRamp() {return iRampDuration;}; + void SetDevice(RMdaDevSound* iDevice);//not for use outside codec wrapper +private: + TUint iVolume; + TUint iBytesPlayed; + RMdaDevSound* iDevice; + TTimeIntervalMicroSeconds iRampDuration; + }; + +/** + * Implementation of custom interface class for record functionality created by the + * CMMFSwCodecWrapper::CustomInterface() method. It provides + * access to miscelaneous functionality such as volume settings + * Ports of sw codec wrapper may do this differently eg via EAP + * note don't use RMdaDevSound::TCurrentSoundFormatBuf so send + * across the sample rate and channels because 1)it would mean + * mmfswcodecwrapper.h would have to include mdasound.h and 2) + * the buffer size and encoding members are not required 3)3rd party ports + * may not use RMdaDevSound + * Note also that this interface is just a simple interface to get + * and set values. No checking is perfomed on the values sent. (hence the + * Set methods do not return an error code.) + * @released + */ +class TRecordCustomInterface : public MRecordCustomInterface + { +public: + TRecordCustomInterface() : iGain(0), iBytesRecorded(0), iDataPath(NULL) {} + void SetGain(TUint aGain) {iGain = aGain;}; + void SetDataPath(CMMFSwCodecRecordDataPath* aDataPath){iDataPath = aDataPath;}; + TUint Gain() {return iGain;}; + TUint BytesRecorded(); +private: + TUint iGain; + TUint iBytesRecorded; + CMMFSwCodecRecordDataPath* iDataPath; + }; + + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/BWINS/TSU_MMF_DEVSOUND_CIUU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/BWINS/TSU_MMF_DEVSOUND_CIUU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewTestSuiteL@@YAPAVCTestSuite@@XZ @ 1 NONAME ; class CTestSuite * NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/EABI/TSU_MMF_DEVSOUND_CIUU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/EABI/TSU_MMF_DEVSOUND_CIUU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,105 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + _ZTI20CTestStepCIGsmConfig @ 2 NONAME + _ZTI21CTestStepCISbcEncoder @ 3 NONAME + _ZTI25CTestStepCIPlaybackStatus @ 4 NONAME + _ZTI26CTestStepCIAudioDspControl @ 5 NONAME + _ZTI26CTestStepCIEAacPlusDecoder @ 6 NONAME + _ZTI26CTestStepCISampleBuffering @ 7 NONAME + _ZTI26CTestStepCISetDRMProtected @ 8 NONAME + _ZTI27CTestStepCIAacDecoderConfig @ 9 NONAME + _ZTI28CTestStepCIAudioVibraControl @ 10 NONAME + _ZTI28CTestStepCIG711DecoderConfig @ 11 NONAME + _ZTI28CTestStepCIG711EncoderConfig @ 12 NONAME + _ZTI28CTestStepCIG729DecoderConfig @ 13 NONAME + _ZTI28CTestStepCIG729EncoderConfig @ 14 NONAME + _ZTI28CTestStepCIIlbcDecoderConfig @ 15 NONAME + _ZTI28CTestStepCIIlbcEncoderConfig @ 16 NONAME + _ZTI29CTestStepCIPlaybackStatusInfo @ 17 NONAME + _ZTI30CTestStepCICreateGetTimestamps @ 18 NONAME + _ZTI30CTestStepCIGetTimestampsEnable @ 19 NONAME + _ZTI30CTestStepCISpeechEncoderConfig @ 20 NONAME + _ZTI32CTestStepCICreateSetDRMProtected @ 21 NONAME + _ZTI32CTestStepCIErrorConcealmentIntfc @ 22 NONAME + _ZTI32CTestStepCISbcEncoderApplyConfig @ 23 NONAME + _ZTI33CTestStepCIGetTimestampsForBuffer @ 24 NONAME + _ZTI35CTestStepCICreateBufferFramesConfig @ 25 NONAME + _ZTI35CTestStepCIEAacPlusDecoderGetSetDsm @ 26 NONAME + _ZTI35CTestStepCIEAacPlusDecoderGetSetSbr @ 27 NONAME + _ZTI35CTestStepCIUnderflowAutoStopControl @ 28 NONAME + _ZTI36CTestStepCIAdvancedAacEncodeSettings @ 29 NONAME + _ZTI36CTestStepCIBufferFramesConfigSetBase @ 30 NONAME + _ZTI36CTestStepCISbcEncoderGetSetFrequency @ 31 NONAME + _ZTI37CTestStepCIBufferFramesConfigSetInput @ 32 NONAME + _ZTI37CTestStepCIEAacPlusDecoderApplyConfig @ 33 NONAME + _ZTI38CTestStepCIBufferFramesConfigSetOutput @ 34 NONAME + _ZTI38CTestStepCISbcEncoderGetSetBitpoolSize @ 35 NONAME + _ZTI38CTestStepCISbcEncoderGetSetChannelMode @ 36 NONAME + _ZTI38CTestStepCISbcEncoderGetSetNumOfBlocks @ 37 NONAME + _ZTI39CTestStepCIEAacPlusDecoderGetSetObjType @ 38 NONAME + _ZTI39CTestStepCustominterfaceUnificationUnit @ 39 NONAME + _ZTI40CTestStepCISbcEncoderGetSetNumOfSubbands @ 40 NONAME + _ZTI40CTestSuiteCustomInterfaceUnificationUnit @ 41 NONAME + _ZTI41CTestStepCIEAacPlusDecoderGetSetFrequency @ 42 NONAME + _ZTI41CTestStepCISbcEncoderGetSupportedSubbands @ 43 NONAME + _ZTI42CTestStepCICreateAdvancedAacEncodeSettings @ 44 NONAME + _ZTI43CTestStepCIEAacPlusDecoderGetSetNumChannels @ 45 NONAME + _ZTI43CTestStepCISbcEncoderGetSetAllocationMethod @ 46 NONAME + _ZTI44CTestStepCIPlaybackStatusRequestNotification @ 47 NONAME + _ZTI44CTestStepCISbcEncoderGetSupportedFrequencies @ 48 NONAME + _ZTI44CTestStepCISbcEncoderGetSupportedNumOfBlocks @ 49 NONAME + _ZTI45CTestStepCISbcEncoderGetSupportedBitpoolRange @ 50 NONAME + _ZTI45CTestStepCISbcEncoderGetSupportedChannelModes @ 51 NONAME + _ZTI50CTestStepCISbcEncoderGetSupportedAllocationMethods @ 52 NONAME + _ZTV20CTestStepCIGsmConfig @ 53 NONAME + _ZTV21CTestStepCISbcEncoder @ 54 NONAME + _ZTV25CTestStepCIPlaybackStatus @ 55 NONAME + _ZTV26CTestStepCIAudioDspControl @ 56 NONAME + _ZTV26CTestStepCIEAacPlusDecoder @ 57 NONAME + _ZTV26CTestStepCISampleBuffering @ 58 NONAME + _ZTV26CTestStepCISetDRMProtected @ 59 NONAME + _ZTV27CTestStepCIAacDecoderConfig @ 60 NONAME + _ZTV28CTestStepCIAudioVibraControl @ 61 NONAME + _ZTV28CTestStepCIG711DecoderConfig @ 62 NONAME + _ZTV28CTestStepCIG711EncoderConfig @ 63 NONAME + _ZTV28CTestStepCIG729DecoderConfig @ 64 NONAME + _ZTV28CTestStepCIG729EncoderConfig @ 65 NONAME + _ZTV28CTestStepCIIlbcDecoderConfig @ 66 NONAME + _ZTV28CTestStepCIIlbcEncoderConfig @ 67 NONAME + _ZTV29CTestStepCIPlaybackStatusInfo @ 68 NONAME + _ZTV30CTestStepCICreateGetTimestamps @ 69 NONAME + _ZTV30CTestStepCIGetTimestampsEnable @ 70 NONAME + _ZTV30CTestStepCISpeechEncoderConfig @ 71 NONAME + _ZTV32CTestStepCICreateSetDRMProtected @ 72 NONAME + _ZTV32CTestStepCIErrorConcealmentIntfc @ 73 NONAME + _ZTV32CTestStepCISbcEncoderApplyConfig @ 74 NONAME + _ZTV33CTestStepCIGetTimestampsForBuffer @ 75 NONAME + _ZTV35CTestStepCICreateBufferFramesConfig @ 76 NONAME + _ZTV35CTestStepCIEAacPlusDecoderGetSetDsm @ 77 NONAME + _ZTV35CTestStepCIEAacPlusDecoderGetSetSbr @ 78 NONAME + _ZTV35CTestStepCIUnderflowAutoStopControl @ 79 NONAME + _ZTV36CTestStepCIAdvancedAacEncodeSettings @ 80 NONAME + _ZTV36CTestStepCIBufferFramesConfigSetBase @ 81 NONAME + _ZTV36CTestStepCISbcEncoderGetSetFrequency @ 82 NONAME + _ZTV37CTestStepCIBufferFramesConfigSetInput @ 83 NONAME + _ZTV37CTestStepCIEAacPlusDecoderApplyConfig @ 84 NONAME + _ZTV38CTestStepCIBufferFramesConfigSetOutput @ 85 NONAME + _ZTV38CTestStepCISbcEncoderGetSetBitpoolSize @ 86 NONAME + _ZTV38CTestStepCISbcEncoderGetSetChannelMode @ 87 NONAME + _ZTV38CTestStepCISbcEncoderGetSetNumOfBlocks @ 88 NONAME + _ZTV39CTestStepCIEAacPlusDecoderGetSetObjType @ 89 NONAME + _ZTV39CTestStepCustominterfaceUnificationUnit @ 90 NONAME + _ZTV40CTestStepCISbcEncoderGetSetNumOfSubbands @ 91 NONAME + _ZTV40CTestSuiteCustomInterfaceUnificationUnit @ 92 NONAME + _ZTV41CTestStepCIEAacPlusDecoderGetSetFrequency @ 93 NONAME + _ZTV41CTestStepCISbcEncoderGetSupportedSubbands @ 94 NONAME + _ZTV42CTestStepCICreateAdvancedAacEncodeSettings @ 95 NONAME + _ZTV43CTestStepCIEAacPlusDecoderGetSetNumChannels @ 96 NONAME + _ZTV43CTestStepCISbcEncoderGetSetAllocationMethod @ 97 NONAME + _ZTV44CTestStepCIPlaybackStatusRequestNotification @ 98 NONAME + _ZTV44CTestStepCISbcEncoderGetSupportedFrequencies @ 99 NONAME + _ZTV44CTestStepCISbcEncoderGetSupportedNumOfBlocks @ 100 NONAME + _ZTV45CTestStepCISbcEncoderGetSupportedBitpoolRange @ 101 NONAME + _ZTV45CTestStepCISbcEncoderGetSupportedChannelModes @ 102 NONAME + _ZTV50CTestStepCISbcEncoderGetSupportedAllocationMethods @ 103 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,33 @@ +// Copyright (c) 2007-2009 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: +// Build only if DevSound (not A3F version) is built. +// +// + +PRJ_TESTMMPFILES +../mmpfiles/devsoundciutestdevices.mmp +../mmpfiles/tsu_mmf_devsound_ciu.mmp + + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +../mmpfiles/a3fcistubextn.mmp +#endif + + +PRJ_TESTEXPORTS +// test scripts +../scripts/tsu_mmf_devsound_ciu.script c:/tsu_mmf_devsound_ciu.script + +//iby files +tsu_mmf_devsound_ciu.iby /epoc32/rom/include/tsu_mmf_devsound_ciu.iby diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/group/ciplugins_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/group/ciplugins_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,19 @@ +; Copyright (c) 2010 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: +; +;*Files To Copy... + +"\epoc32\release\armv5\urel\tsu_mmf_devsound_ciu.dll"-"c:\Sys\bin\tsu_mmf_devsound_ciu.dll" + +"\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\DevSoundTest\CIPlugins\scripts\tsu_mmf_devsound_ciu.script"-"c:\tsu_mmf_devsound_ciu.script" diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/group/tsu_mmf_devsound_ciu.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/group/tsu_mmf_devsound_ciu.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,36 @@ +// Copyright (c) 2007-2009 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: +// + + +#ifndef TSU_MMF_DEVSOUND_CIU_IBY +#define TSU_MMF_DEVSOUND_CIU_IBY + +#include + +// debug build + +file=ABI_DIR\DEBUG_DIR\tsu_mmf_devsound_ciu.dll System\Libs\tsu_mmf_devsound_ciu.dll + +data=EPOCROOT##epoc32\data\c\tsu_mmf_devsound_ciu.script \tsu_mmf_devsound_ciu.script + +ECOM_PLUGIN(devsoundciutestdevices.dll,devsoundciutestdevices.rsc) +// added here for convenience +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +ECOM_PLUGIN(a3fcistubextn.dll,a3fcistubextn.rsc) +#endif + +#endif + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/a3fcistubextn.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/a3fcistubextn.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2009 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 "../../a3fcistubextn/a3fcistubextn.hrh" + +TARGET a3fcistubextn.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidA3fCiStubExtnDll + +VENDORID 0x70000001 + +SOURCEPATH ../../a3fcistubextn + +SOURCE a3fcistubextn.cpp + +USERINCLUDE ../../../../../mmhais/a3facl/src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +START RESOURCE a3fcistubextn.rss +TARGET a3fcistubextn.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmfcontrollerframework.lib + +SMPSAFE + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/devsoundciutestdevices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/devsoundciutestdevices.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,76 @@ +// Copyright (c) 2007-2009 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 "../src/devsoundciutestdevices.hrh" + +TARGET devsoundciutestdevices.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidDevsoundCIUTestDevicesDll + +VENDORID 0x70000001 + +SOURCEPATH ../src + +SOURCE playbackstatustestdevice.cpp +SOURCE devsoundciutestdevices.cpp +SOURCE aacdecoderconfigtestdevice.cpp +SOURCE g729decoderconfigtestdevice.cpp +SOURCE g729encoderconfigtestdevice.cpp +SOURCE audiobufferprefilltestdevice.cpp +SOURCE audiovibracontroltestdevice.cpp +SOURCE audiodspcontroltestdevice.cpp +SOURCE speechencoderconfigtestdevice.cpp +SOURCE g711decoderconfigtestdevice.cpp +SOURCE g711encoderconfigtestdevice.cpp +SOURCE ilbcdecoderconfigtestdevice.cpp +SOURCE ilbcencoderconfigtestdevice.cpp +SOURCE errorconcealmenttestdevice.cpp +SOURCE gsmconfigtestdevice.cpp +SOURCE underflowautostopcontroltestdevice.cpp +SOURCE eaacplusdecodertestdevice.cpp +SOURCE sbcencodertestdevice.cpp +SOURCE setdrmprotectedtestdevice.cpp +SOURCE advancedaacencodesettingstestdevice.cpp +SOURCE bufferframesconfigtestdevice.cpp +SOURCE gettimestampstestdevice.cpp + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +SOURCE MMFDevSoundCIMuxDeMuxPluginImp.cpp +#endif + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +START RESOURCE devsoundciutestdevices_a3f.rss +TARGET devsoundciutestdevices.rsc +END +#else +START RESOURCE devsoundciutestdevices.rss +TARGET devsoundciutestdevices.rsc +END +#endif + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY mmfswcodecwrapper.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/tsu_mmf_devsound_ciu.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/mmpfiles/tsu_mmf_devsound_ciu.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2009 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: +// + +TARGET tsu_mmf_devsound_ciu.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID 0x1000008d 0x10273834 +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src + +SOURCE tsu_mmf_devsound_ciu_suite.cpp +SOURCE tsu_mmf_devsound_ciu_step.cpp +SOURCE teststepciplaybackstatus.cpp +SOURCE teststepcieaacplusdecoder.cpp +SOURCE teststepcisbcencoder.cpp +SOURCE teststepcisetdrmprotected.cpp +SOURCE teststepciadvancedaacencodesettings.cpp +SOURCE teststepcigettimestamps.cpp +SOURCE teststepcibufferframesconfig.cpp + +SOURCE teststepciaacdecoderconfig.cpp +SOURCE teststepcig729decoderconfig.cpp +SOURCE teststepcig729encoderconfig.cpp +SOURCE teststepciaudiobufferprefill.cpp +SOURCE teststepciaudiovibracontrol.cpp +SOURCE teststepciaudiodspcontrol.cpp +SOURCE teststepcispeechencoderconfig.cpp +SOURCE teststepcig711decoderconfig.cpp +SOURCE teststepcig711encoderconfig.cpp +SOURCE teststepciilbcdecoderconfig.cpp +SOURCE teststepciilbcencoderconfig.cpp +SOURCE teststepcierrorconcealment.cpp +SOURCE teststepcigsmconfig.cpp +SOURCE teststepciunderflowautostopcontrol.cpp + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY mmcommon.lib +LIBRARY testframeworkclient.lib +LIBRARY mmfdevsound.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/scripts/tsu_mmf_devsound_ciu.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/scripts/tsu_mmf_devsound_ciu.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,582 @@ +// Copyright (c) 2007-2009 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: +// TSU_MMF_DEVSOUND_CIU +// + +PRINT Run all the Custom Interface Unification tests +PRINT + +LOAD_SUITE tsu_mmf_devsound_ciu.dll + +//MSpeechEncoderConfig - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0001-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0001-HP +TEST_COMPLETE + +//MSpeechEncoderConfig - SetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0002-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0002-HP +TEST_COMPLETE + +//MSpeechEncoderConfig - GetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0003-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0003-HP +TEST_COMPLETE + +//MAacDecoderConfig - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0004-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0004-HP +TEST_COMPLETE + +//MAacDecoderConfig - SetAudioConfig +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0005-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0005-HP +TEST_COMPLETE + +// Adv. AAC Encode Settings tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0006-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0006-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0007-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0007-HP +TEST_COMPLETE + +// EAAC+ Decoder tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0008-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0008-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0009-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0009-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0010-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0010-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0011-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0011-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0012-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0012-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0013-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0013-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0014-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0014-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0015-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0015-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0016-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0016-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0017-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0017-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0018-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0018-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0019-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0019-HP +TEST_COMPLETE + +// SBC Encoder tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0020-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0020-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0021-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0021-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0022-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0022-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0023-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0023-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0024-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0024-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0025-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0025-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0026-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0026-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0027-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0027-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0028-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0028-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0029-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0029-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0030-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0030-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0031-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0031-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0032-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0032-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0033-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0033-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0034-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0034-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0035-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0035-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0036-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0036-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0037-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0037-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0038-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0038-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0039-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0039-HP +TEST_COMPLETE + +//MG711DecoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0040-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0040-HP +TEST_COMPLETE + +//MG711DecoderIntfc - SetDecoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0041-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0041-HP +TEST_COMPLETE + +//MG711DecoderIntfc - SetComfortNoiseGeneration +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0042-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0042-HP +TEST_COMPLETE + +//MG711DecoderIntfc - GetComfortNoiseGeneration +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0043-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0043-HP +TEST_COMPLETE + +//MG711DecoderIntfc - SetPacketLossConcealment +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0044-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0044-HP +TEST_COMPLETE + +//MG711EncoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0045-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0045-HP +TEST_COMPLETE + +//MG711EncoderIntfc - SetEncoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0046-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0046-HP +TEST_COMPLETE + +//MG711EncoderIntfc - SetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0047-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0047-HP +TEST_COMPLETE + +//MG711EncoderIntfc - GetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0048-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0048-HP +TEST_COMPLETE + +//MG729DecoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0049-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0049-HP +TEST_COMPLETE + +//MG729DecoderIntfc - BadLsfNextBuffer +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0050-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0050-HP +TEST_COMPLETE + +//MG729EncoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0051-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0051-HP +TEST_COMPLETE + +//MG729EncoderIntfc - SetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0052-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0052-HP +TEST_COMPLETE + +//MG729EncoderIntfc - GetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0053-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0053-HP +TEST_COMPLETE + +//MIlbcDecoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0054-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0054-HP +TEST_COMPLETE + +//MIlbcDecoderIntfc - SetDecoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0055-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0055-HP +TEST_COMPLETE + +//MIlbcDecoderIntfc - SetComfortNoiseGeneration +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0056-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0056-HP +TEST_COMPLETE + +//MIlbcDecoderIntfc - GetComfortNoiseGeneration +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0057-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0057-HP +TEST_COMPLETE + +//MIlbcEncoderIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0058-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0058-HP +TEST_COMPLETE + +//MIlbcEncoderIntfc - SetEncoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0059-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0059-HP +TEST_COMPLETE + +//MIlbcEncoderIntfc - SetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0060-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0060-HP +TEST_COMPLETE + +//MIlbcEncoderIntfc - GetVadMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0061-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0061-HP +TEST_COMPLETE + +//MErrorConcealmentIntfc - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0062-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0062-HP +TEST_COMPLETE + +//MErrorConcealmentIntfc - ConcealErrorForNextBuffer +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0063-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0063-HP +TEST_COMPLETE + +//MErrorConcealmentIntfc - FrameModeRqrdForEC +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0064-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0064-HP +TEST_COMPLETE + +//MErrorConcealmentIntfc - SetFrameMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0065-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0065-HP +TEST_COMPLETE + +//MAudioVibraControl - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0066-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0066-HP +TEST_COMPLETE + +//MAudioVibraControl - StartVibra +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0067-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0067-HP +TEST_COMPLETE + +//MAudioVibraControl - StopVibra +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0068-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0068-HP +TEST_COMPLETE + +//MMMFSampleBuffering - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0069-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0069-HP +TEST_COMPLETE + +//MMMFSampleBuffering - MmsbEnableSampleBufferingBeforePlayback +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0070-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0070-HP +TEST_COMPLETE + +//MMMFSampleBuffering - MmsbDisableSampleBufferingBeforePlayback +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0071-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0071-HP +TEST_COMPLETE + +//MMMFSampleBuffering - MmsbNotifyPlayStarted +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0072-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0072-HP +TEST_COMPLETE + +//MMMFSampleBuffering - MmsbCancelNotifyPlayStarted +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0073-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0073-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0074-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0074-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0075-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0075-HP +TEST_COMPLETE + +//MMMFDSPControl - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0076-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0076-HP +TEST_COMPLETE + +//MMMFDSPControl - MmdspcRequestLossOfSyncNotification +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0077-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0077-HP +TEST_COMPLETE + +//MMMFDSPControl - MmdspcCancelLossOfSyncNotification +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0078-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0078-HP +TEST_COMPLETE + +//MMMFDSPControl - MmdspcGetAudioPlaybackInfo +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0079-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0079-HP +TEST_COMPLETE + +// Set DRM Protected tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0080-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0080-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0081-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0081-HP +TEST_COMPLETE + +// Buffer Frames Config tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0082-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0082-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0083-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0083-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0084-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0084-HP +TEST_COMPLETE + +// Get timestamps tests +// +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0085-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0085-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0086-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0086-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0087-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0087-HP +TEST_COMPLETE + +//MMMFGsmConfig - Instantiating +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0088-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0088-HP +TEST_COMPLETE + +//MMMFGsmConfig - SetConversionFormat +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0089-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0089-HP +TEST_COMPLETE + +//MMMFGsmConfig - ConversionFormat +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0090-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0090-HP +TEST_COMPLETE + +//MMMFUnderflowAutoStopControl - Instantiation +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0091-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0091-HP +TEST_COMPLETE + +//MMMFUnderflowAutoStopControl - MmuascTurnOffUnderflowAutoStop +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0092-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0092-HP +TEST_COMPLETE + +//MAacDecoderConfig - GetSupportedAudioConfigs +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0093-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0093-HP +TEST_COMPLETE + +//MG711DecoderIntfc - GetDecoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0094-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0094-HP +TEST_COMPLETE + +//MG711DecoderIntfc - GetPacketLossConcealment +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0095-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0095-HP +TEST_COMPLETE + +//MIlbcEncoderIntfc - GetDecoderMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0096-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0096-HP +TEST_COMPLETE + +// PlaybackStatus - Make notification request +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0097-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0097-HP +TEST_COMPLETE + +// PlaybackStatus - Cancel notification request +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0098-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0098-HP +TEST_COMPLETE + +// Advanced AAC+ Enocder Config - GetBitrateMode +//! @SYMTestCaseID MM-MMF-DEVSOUNDCI-U-0099-HP + +RUN_TEST_STEP -1, TSU_MMF_DEVSOUND_CIU, MM-MMF-DEVSOUNDCI-U-0099-HP +TEST_COMPLETE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/MMFDevSoundCIMuxDeMuxPluginImp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/MMFDevSoundCIMuxDeMuxPluginImp.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,299 @@ +// Copyright (c) 2008-2009 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 +#include +#include + +#include "devsoundciutestdevices.hrh" +#include "MMFDevSoundCIMuxDeMuxPluginImp.h" + + + +// MUX // + +TInt CMMFDevSoundCIMuxPluginImp::OpenInterface(TUid /*aInterfaceId*/) + { + // attempt to open the interface link with the + // remote slave device + iRemoteHandle = -1; + TUid slaveId = {KUidMmfDevSoundCustomInterfaceDeMuxPlugin}; + + TInt handle = iUtility->OpenSlave(slaveId, KNullDesC8); + if (handle >= 0) + { + iRemoteHandle = handle; + } + + return iRemoteHandle; + } + + +void CMMFDevSoundCIMuxPluginImp::Release() + { + // close the slave device if it exists + if (iRemoteHandle > 0) + { + // we assume the slave is closed correctly + iUtility->CloseSlave(iRemoteHandle); + } + + TUid key = iKey; + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFDevSoundCIMuxPluginImp::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFDevSoundCIMuxPluginImp::CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility) + { + // store a pointer to the the MMFDevSoundCustomMuxUtility class + iUtility = aCustomUtility; + } + + +MMMFDevSoundCustomInterfaceMuxPlugin* CMMFDevSoundCIMuxPluginImp::NewL() + { + CMMFDevSoundCIMuxPluginImp* self = new (ELeave) CMMFDevSoundCIMuxPluginImp; + return self; + } + + +TAny* CMMFDevSoundCIMuxPluginImp::CustomInterface(TUid /*aInterfaceId*/) + { + MMMFDevSoundCIMuxPluginInterface* interface = this; + return interface; + } + + +CMMFDevSoundCIMuxPluginImp::CMMFDevSoundCIMuxPluginImp() + { + } + + +CMMFDevSoundCIMuxPluginImp::~CMMFDevSoundCIMuxPluginImp() + { + } + + +TInt CMMFDevSoundCIMuxPluginImp::DevSoundCIMuxStopHeapFail() + { + TInt result = -1; + + if (iRemoteHandle > 0) + { + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIMuxDemuxStopHeapFail, + KNullDesC8); + } + return result; + } + + +TInt CMMFDevSoundCIMuxPluginImp::DevSoundCIMuxCauseHeapFail(TInt aFailCount) + { + TInt result = -1; + + if (iRemoteHandle > 0) + { + TPckgBuf failCount(aFailCount); + result = iUtility->SendSlaveSyncCommand(iRemoteHandle, + EMMFDevSoundCIMuxDemuxCauseHeapFail, + failCount); + } + return result; + } + +TInt CMMFDevSoundCIMuxPluginImp::DevSoundCIMuxCheckHeapFail() + { + TInt result = -1; + TPckgBuf responsePckg; + + if (iRemoteHandle > 0) + { + result = iUtility->SendSlaveSyncCommandResult(iRemoteHandle, + EMMFDevSoundCIMuxDemuxCheckHeapFail, + KNullDesC8, + responsePckg); + } + + User::LeaveIfError(result); + return responsePckg(); + + } + +// DEMUX // + +TInt CMMFDevSoundCIDemuxPluginImp::OpenInterface(TUid /*aInterfaceId*/) + { + return KErrNone; + } + + +void CMMFDevSoundCIDemuxPluginImp::Release() + { + TUid key = iKey; + + delete this; + + // tell ECom to destroy us + REComSession::DestroyedImplementation(key); + } + + +void CMMFDevSoundCIDemuxPluginImp::PassDestructorKey(TUid aDestructorKey) + { + // store the destructor key + iKey = aDestructorKey; + } + + +void CMMFDevSoundCIDemuxPluginImp::SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget) + { + iTarget = aTarget; + } + + +void CMMFDevSoundCIDemuxPluginImp::CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aCustomUtility) + { + // store a pointer to the MMFDevSoundCustomDeMuxUtility class + iUtility = aCustomUtility; + } + + +void CMMFDevSoundCIDemuxPluginImp::RefreshL() + { + // Nothing to do in this implementation + } + + +MMMFDevSoundCustomInterfaceDeMuxPlugin* CMMFDevSoundCIDemuxPluginImp::NewL() + { + CMMFDevSoundCIDemuxPluginImp* self = new (ELeave) CMMFDevSoundCIDemuxPluginImp; + return self; + } + + +CMMFDevSoundCIDemuxPluginImp::CMMFDevSoundCIDemuxPluginImp() + { + } + + +CMMFDevSoundCIDemuxPluginImp::~CMMFDevSoundCIDemuxPluginImp() + { + // Nothing to do in this implementation + } + + +TInt CMMFDevSoundCIDemuxPluginImp::DoOpenSlaveL(TUid /*aInterface*/, const TDesC8& /*aPackageBuf*/) + { + // Nothing to do in this implementation + return KErrNone; + } + + +void CMMFDevSoundCIDemuxPluginImp::DoCloseSlaveL(TInt /*aHandle*/) + { + // Nothing to do in this implementation + } + +TInt CMMFDevSoundCIDemuxPluginImp::DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage) + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIMuxDemuxCauseHeapFail: + { + result = KErrNone; + TPckgBuf failCount; //Create an empty TPckgBuf to be empty + iUtility->ReadFromInputDesL(aMessage, &failCount); //readFromInputDesL treats this as a descriptor and populates it + User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext, failCount()); + break; + } + case EMMFDevSoundCIMuxDemuxStopHeapFail: + { + result = KErrNone; + User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext,NULL); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return result; + } + + +TInt CMMFDevSoundCIDemuxPluginImp::DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage) //This method returns an error to Client Side + { + TMMFDevSoundCIMessageData data; + TInt result = KErrNotSupported; + + // decode message + iUtility->GetSyncMessageDataL(aMessage, data); + + switch (data.iCommand) + { + case EMMFDevSoundCIMuxDemuxCheckHeapFail: + { + result = KErrNone; + TPckgBuf failCheck; + TAny *testAlloc = User::Alloc(1); + if ( testAlloc == NULL ) + { + failCheck = EFalse; + User::__DbgSetAllocFail(RHeap::EUser,RHeap::EFailNext,NULL); + } + else + { + failCheck = ETrue; + User::Free(testAlloc); + } + iUtility->WriteToOutputDesL(aMessage, failCheck); + break; + } + default: + { + User::Leave(KErrNotSupported); + } + } + return result; + } + + +void CMMFDevSoundCIDemuxPluginImp::DoSendSlaveAsyncCommandL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } + + +void CMMFDevSoundCIDemuxPluginImp::DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& /*aMessage*/) + { + // not used in this interface + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/MMFDevSoundCIMuxDeMuxPluginImp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/MMFDevSoundCIMuxDeMuxPluginImp.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,256 @@ +// Copyright (c) 2008-2009 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: +// Implementation of aac decoder config custom interface pair +// +// + +#ifndef AACDECODERCONFIGCI_H +#define AACDECODERCONFIGCI_H + +#include +#include +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif +#include +#include +#include +#include +#include "devsoundciutestdevices.hrh" + +/** +Enum to represent the method called by this custom interface +@internalComponent +@prototype +@file +*/ +enum TMMFDevSoundCIMuxDemuxCommands + { + EMMFDevSoundCIMuxDemuxCauseHeapFail = 0, + EMMFDevSoundCIMuxDemuxStopHeapFail, + EMMFDevSoundCIMuxDemuxCheckHeapFail + }; + +class MMMFDevSoundCIMuxPluginInterface + { +public: + virtual TInt DevSoundCIMuxCauseHeapFail(TInt aFailCount) =0; + virtual TInt DevSoundCIMuxStopHeapFail() =0; + virtual TInt DevSoundCIMuxCheckHeapFail() =0; + }; + + +/** +Implementation of the DevSound Interface Mux +@internalComponent +@prototype +@file +*/ +class CMMFDevSoundCIMuxPluginImp : public CBase, + public MMMFDevSoundCustomInterfaceMuxPlugin, + public MMMFDevSoundCIMuxPluginInterface + { +public: + + // from MMMFDevSoundCustomInterfaceMuxPlugin + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return one of the system wide error codes + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Complete construction. + Pass additional values from the construction phase, used subsequently by the plugin. + @param aCustomUtility + The custom interface utility used by the plugin to communicate with the remote + server side DeMux plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceMuxUtility* aCustomUtility); + + /** + Return the custom interface + @param aInterfaceId + The UID of the required custom interface + @return the custom interface supported by this plugin + */ + virtual TAny* CustomInterface(TUid aInterfaceId); + + /** + Instantiate a CI Mux class + @return the pointer to the new class, cast to the Mux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceMuxPlugin* NewL(); + + //Specific public method calls for this mux + TInt DevSoundCIMuxStopHeapFail(); + TInt DevSoundCIMuxCauseHeapFail(TInt aFailCount); + TInt DevSoundCIMuxCheckHeapFail(); + +protected: + CMMFDevSoundCIMuxPluginImp(); + ~CMMFDevSoundCIMuxPluginImp(); + +protected: + TUid iKey; + TInt iRemoteHandle; + MMMFDevSoundCustomInterfaceMuxUtility* iUtility; + }; + + +/** +Implementation of the DevSound custom interface DeMux +@internalComponent +@prototype +@file +*/ +class CMMFDevSoundCIDemuxPluginImp : public CBase, + public MMMFDevSoundCustomInterfaceDeMuxPlugin + { +public: + /** + Instantiate a CMMFAacDecoderConfigDeMux class + @return a pointer to the new class cast to the DeMux plugin mixin + @leave This method may leave with one of the system-wide error codes. + */ + static MMMFDevSoundCustomInterfaceDeMuxPlugin* NewL(); + + /** + Attempt to open the interface. + @param aInterfaceId + The UID of the interface to open. + @return a handle to the remote plugin + */ + virtual TInt OpenInterface(TUid aInterfaceId); + + /** + Equivalent to destructor. Called to destroy plugin. + */ + virtual void Release(); + + /** + Pass destructor key. + Called on construction so plugin takes responsibility to call REComSession::DestroyedImplementation() + @param aDestructorKey + The Uid returned by REComSession::CreateImplementationL() or similar + */ + virtual void PassDestructorKey(TUid aDestructorKey); + + /** + Set the target of the custom interface call + @param aTarget + The DevSound to call the custom interface on. + */ + virtual void SetInterfaceTarget(MMMFDevSoundCustomInterfaceTarget* aTarget); + + /** + Complete construction. + @param aUtility + The DeMux utility to use + @leave This method may leave with one of the system-wide error codes. + */ + virtual void CompleteConstructL(MMMFDevSoundCustomInterfaceDeMuxUtility* aUtility); + + /** + Refresh the current custom interface connections + @leave This method may leave with one of the system-wide error codes. + */ + virtual void RefreshL(); + + // from MMMFDevSoundCustomInterfaceDeMuxPlugin + /** + Open the slave + @param aInterface + The UID of the requested interface + @param aPackageBuf + A package of data that can be supplied for initialisation + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoOpenSlaveL(TUid aInterface, const TDesC8& aPackageBuf); + + /** + Close the slave + @param aHandle + The handle of the slave plugin + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoCloseSlaveL(TInt aHandle); + + // original RMessage is supplied so that remote DeMux plugin can extract necessary details + // using DeMux utility + + /** + Relay the synchronous custom command onto the slave + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay the synchronous custom command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave + @return the result of the operation + @leave This method may leave with one of the system-wide error codes. + */ + virtual TInt DoSendSlaveSyncCommandResultL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave + @param aMessage + The IPC message to be sent to the slave + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandL(const RMmfIpcMessage& aMessage); + + /** + Relay an asynchronous command onto the slave and obtain a result + @param aMessage + The IPC message to be sent to the slave@param aMessage + @leave This method may leave with one of the system-wide error codes. + */ + virtual void DoSendSlaveAsyncCommandResultL(const RMmfIpcMessage& aMessage); + +protected: + //Specific public method calls for this demux + ~CMMFDevSoundCIDemuxPluginImp(); + CMMFDevSoundCIDemuxPluginImp(); + +protected: + MMMFDevSoundCustomInterfaceDeMuxUtility* iUtility; + MMMFDevSoundCustomInterfaceTarget* iTarget; + TUid iKey; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/aacdecoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/aacdecoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,210 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include +#include "aacdecoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFAacDecoderConfig implementation +*/ +CMMFAacDecoderConfig* CMMFAacDecoderConfig::NewL() + { + CMMFAacDecoderConfig* self = new(ELeave) CMMFAacDecoderConfig(); + return self; + } + +CMMFAacDecoderConfig::~CMMFAacDecoderConfig() + { + } + +// Actual implementation of method +TInt CMMFAacDecoderConfig::SetAudioConfig(TAudioConfig& aAudioConfig) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt"); + fs.MkDirAll(KFileName); + + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) + { + return err; + } + + TBuf8<4> Line; + Line.Format(_L8("%02d"), aAudioConfig.iAudioObjectType); + + file.Write(Line); + file.Close(); + fs.Close(); + + return err; + } + +// Actual implementation of method +TInt CMMFAacDecoderConfig::GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs) + { + TAudioConfig audioConfig; + audioConfig.iAudioObjectType = TAudioConfig::ESbr; + aSupportedAudioConfigs.Append(audioConfig); + audioConfig.iAudioObjectType = TAudioConfig::EAacLtp; + aSupportedAudioConfigs.Append(audioConfig); + audioConfig.iAudioObjectType = TAudioConfig::EAacSsr; + aSupportedAudioConfigs.Append(audioConfig); + audioConfig.iAudioObjectType = TAudioConfig::EAacLc; + aSupportedAudioConfigs.Append(audioConfig); + audioConfig.iAudioObjectType = TAudioConfig::EAacMain; + aSupportedAudioConfigs.Append(audioConfig); + return KErrNone; + } + + +/* +CAacDecoderConfigTestDevice Implementation +*/ +CMMFHwDevice* CAacDecoderConfigTestDevice::NewL() + { + CAacDecoderConfigTestDevice* self=new(ELeave) CAacDecoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CAacDecoderConfigTestDevice::~CAacDecoderConfigTestDevice() + { + delete iAacDecoderConfig; + } + +CAacDecoderConfigTestDevice::CAacDecoderConfigTestDevice() + { + } + +void CAacDecoderConfigTestDevice::ConstructL() + { + } + +TInt CAacDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CAacDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidAacDecoderConfig) + { + if (!iAacDecoderConfig) + { + TRAPD(err, iAacDecoderConfig = CMMFAacDecoderConfig::NewL()); + if (err == KErrNone && iAacDecoderConfig) + { + MAacDecoderConfig* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CAacDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CAacDecoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CAacDecoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CAacDecoderConfigTestDevice::SetAudioConfig(TAudioConfig& aAudioConfig) + { + TInt result = KErrBadHandle; + + if (iAacDecoderConfig) + { + result = iAacDecoderConfig->SetAudioConfig(aAudioConfig); + } + + return result; + } + +TInt CAacDecoderConfigTestDevice::GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs) + { + TInt result = KErrBadHandle; + + if (iAacDecoderConfig) + { + result = iAacDecoderConfig->GetSupportedAudioConfigs(aSupportedAudioConfigs); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/aacdecoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/aacdecoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,77 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef AACDECODERCONFIGTESTDEVICE_H +#define AACDECODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFAacDecoderConfig : public CBase, + public MAacDecoderConfig + { +public: + //return Pointer to the CMMFAacDecoderConfig class + static CMMFAacDecoderConfig* NewL(); + + //Destructor + ~CMMFAacDecoderConfig(); + + // from MAacDecoderConfig + TInt SetAudioConfig(TAudioConfig& aAudioConfig); + TInt GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs); + }; + + +/* +CAacDecoderConfigTestDevice + +Test hw device used by the +SU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CAacDecoderConfigTestDevice : public CMMFSwCodecWrapper, + public MAacDecoderConfig + { +public: + static CMMFHwDevice* NewL(); + virtual ~CAacDecoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MAacDecoderConfig + TInt SetAudioConfig(TAudioConfig& aAudioConfig); + TInt GetSupportedAudioConfigs(RArray& aSupportedAudioConfigs); + +private: + CAacDecoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFAacDecoderConfig* iAacDecoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/advancedaacencodesettingstestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/advancedaacencodesettingstestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,135 @@ +// Copyright (c) 2007-2009 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 +#include "advancedaacencodesettingstestdevice.h" +#include "cidefine.h" + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CAdvancedAacEncodeSettingsTestDevice::NewL() + { + CAdvancedAacEncodeSettingsTestDevice* self = new(ELeave) CAdvancedAacEncodeSettingsTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CAdvancedAacEncodeSettingsTestDevice::~CAdvancedAacEncodeSettingsTestDevice() + { + } + +/*****************************************************************************/ +CAdvancedAacEncodeSettingsTestDevice::CAdvancedAacEncodeSettingsTestDevice() + { + } + +/*****************************************************************************/ +void CAdvancedAacEncodeSettingsTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CAdvancedAacEncodeSettingsTestDevice::CustomInterface(TUid aInterfaceId) + { + MMMFAdvancedAACEncodeSettings* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidAdvancedAACEncoderSettings) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CAdvancedAacEncodeSettingsTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CAdvancedAacEncodeSettingsTestDevice::SetAACEncodeBitrateMode(TAACBitrateMode aBitrateMode) + { + iBitrateMode = aBitrateMode; + return KErrNone; + } + +TInt CAdvancedAacEncodeSettingsTestDevice::GetAACEncodeBitrateMode(TAACBitrateMode& aBitrateMode) + { + aBitrateMode = iBitrateMode; + return KErrNone; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/advancedaacencodesettingstestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/advancedaacencodesettingstestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef ADVANCEDAACENCODESETTINGSTESTDEVICE_H +#define ADVANCEDAACENCODESETTINGSTESTDEVICE_H + +#include +#include + + +/** +* +* CAdvancedAacEncodeSettingsTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CAdvancedAacEncodeSettingsTestDevice : public CMMFSwCodecWrapper, + public MMMFAdvancedAACEncodeSettings + { +public: + static CMMFHwDevice* NewL(); + virtual ~CAdvancedAacEncodeSettingsTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MMMFAdvancedAACEncodeSettings + virtual TInt SetAACEncodeBitrateMode(TAACBitrateMode aBitrateMode); + virtual TInt GetAACEncodeBitrateMode(TAACBitrateMode& aBitrateMode); + +private: + CAdvancedAacEncodeSettingsTestDevice(); + void ConstructL(); +private: + TAACBitrateMode iBitrateMode; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiobufferprefilltestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiobufferprefilltestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,240 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "audiobufferprefilltestdevice.h" +#include "devsoundciutestdevices.hrh" + +const TInt32 KTenSeconds = 10000000; // Ten seconds + +/* +CMMFSampleBuffering Implementation +*/ +CMMFSampleBuffering* CMMFSampleBuffering::NewL() + { + CMMFSampleBuffering* self = new(ELeave) CMMFSampleBuffering(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CMMFSampleBuffering::CMMFSampleBuffering() : CActive(0) + { + CActiveScheduler::Add(this); + } + +void CMMFSampleBuffering::ConstructL() + { + User::LeaveIfError( iTimer.CreateLocal() ); + } + +CMMFSampleBuffering::~CMMFSampleBuffering() + { + iTimer.Close(); + Cancel(); + } + +//Actual implementation of method MmsbEnableSampleBufferingBeforePlayback +TInt CMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback() + { + return KErrNone; + } + +//Actual implementation of method MmsbDisableSampleBufferingBeforePlayback +TInt CMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback() + { + return KErrNone; + } + +//Actual implementation of method MmsbNotifyPlayStarted +void CMMFSampleBuffering::MmsbNotifyPlayStarted(TRequestStatus& aStatus) + { + // check not already active + ASSERT(!IsActive()); + + iClientStatus = &aStatus; + *iClientStatus = KRequestPending; + + iTimer.After(iStatus, KTenSeconds); + + SetActive(); + } + +//Actual implementation of method MmsbCancelNotifyPlayStarted +void CMMFSampleBuffering::MmsbCancelNotifyPlayStarted() + { + CActive::Cancel(); + } + +//Actual implementation of method RunL +void CMMFSampleBuffering::RunL() + { + TRequestStatus* status = iClientStatus; + User::RequestComplete(status, KErrNotSupported); + } + +//Actual implementation of method DoCancel +void CMMFSampleBuffering::DoCancel() + { + iTimer.Cancel(); + TRequestStatus* status = iClientStatus; + User::RequestComplete(status, KErrCancel); + } + + +/* +CSampleBufferingTestDevice Implementation +*/ +CMMFHwDevice* CSampleBufferingTestDevice::NewL() + { + CSampleBufferingTestDevice* self=new(ELeave) CSampleBufferingTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CSampleBufferingTestDevice::~CSampleBufferingTestDevice() + { + delete iSampleBuffering; + } + +CSampleBufferingTestDevice::CSampleBufferingTestDevice() + { + } + +void CSampleBufferingTestDevice::ConstructL() + { + } + +TInt CSampleBufferingTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CSampleBufferingTestDevice::Stop() + { + return 0; + } + +TInt CSampleBufferingTestDevice::Pause() + { + return 0; + } + +TInt CSampleBufferingTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CSampleBufferingTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidSampleBuffering) + { + if (!iSampleBuffering) + { + TRAPD(err, iSampleBuffering = CMMFSampleBuffering::NewL()); + if (err == KErrNone && iSampleBuffering) + { + MMMFSampleBuffering* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CSampleBufferingTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CSampleBufferingTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CSampleBufferingTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CSampleBufferingTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CSampleBufferingTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CSampleBufferingTestDevice::Codec() + { + return *iCodec; + } + +TInt CSampleBufferingTestDevice::MmsbEnableSampleBufferingBeforePlayback() + { + TInt result = KErrBadHandle; + + if (iSampleBuffering) + { + result = iSampleBuffering->MmsbEnableSampleBufferingBeforePlayback(); + } + + return result; + } + +TInt CSampleBufferingTestDevice::MmsbDisableSampleBufferingBeforePlayback() + { + TInt result = KErrBadHandle; + + if (iSampleBuffering) + { + result = iSampleBuffering->MmsbDisableSampleBufferingBeforePlayback(); + } + + return result; + } + +void CSampleBufferingTestDevice::MmsbNotifyPlayStarted(TRequestStatus& aStatus) + { + if (iSampleBuffering) + { + iSampleBuffering->MmsbNotifyPlayStarted(aStatus); + } + } + +void CSampleBufferingTestDevice::MmsbCancelNotifyPlayStarted() + { + if (iSampleBuffering) + { + iSampleBuffering->MmsbCancelNotifyPlayStarted(); + } + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiobufferprefilltestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiobufferprefilltestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,93 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef AUDIOBUFFERFILLTESTDEVICE_H +#define AUDIOBUFFERFILLTESTDEVICE_H + +#include +#include + + +class CMMFSampleBuffering : public CActive, + public MMMFSampleBuffering + { +public: + //return Pointer to the CMMFSampleBuffering class + static CMMFSampleBuffering* NewL(); + + //Destructor + ~CMMFSampleBuffering(); + + // from MMMFSampleBuffering + TInt MmsbEnableSampleBufferingBeforePlayback(); + TInt MmsbDisableSampleBufferingBeforePlayback(); + void MmsbNotifyPlayStarted(TRequestStatus& aStatus); + void MmsbCancelNotifyPlayStarted(); + + // from CActive + void RunL(); + void DoCancel(); + +private: + CMMFSampleBuffering(); + void ConstructL(); + +private: + RTimer iTimer; + TRequestStatus* iClientStatus; + }; + + +/* +CSampleBufferingTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CSampleBufferingTestDevice : public CMMFSwCodecWrapper, + public MMMFSampleBuffering + { +public: + static CMMFHwDevice* NewL(); + virtual ~CSampleBufferingTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MMMFSampleBuffering + TInt MmsbEnableSampleBufferingBeforePlayback(); + TInt MmsbDisableSampleBufferingBeforePlayback(); + void MmsbNotifyPlayStarted(TRequestStatus& aStatus); + void MmsbCancelNotifyPlayStarted(); + +private: + CSampleBufferingTestDevice(); + void ConstructL(); + +private: + CMMFSampleBuffering* iSampleBuffering; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiodspcontroltestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiodspcontroltestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,197 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include +#include "audiodspcontroltestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFAudioDspControl implementation +*/ +CMMFAudioDspControl* CMMFAudioDspControl::NewL() + { + CMMFAudioDspControl* self = new(ELeave) CMMFAudioDspControl(); + return self; + } + +CMMFAudioDspControl::~CMMFAudioDspControl() + { + } + +//Actual implementation of method MmdspcGetAudioPlaybackInfo +TInt CMMFAudioDspControl::MmdspcGetAudioPlaybackInfo (TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT) + { + aSamplesPlayed = 999; + aSystemTime = 999; + aB = 999; + aT = 999; + + return KErrNone; + } + +//Actual implementation of method MmdspcAcceptRecordBuffersInvalidFollowingStop +TInt CMMFAudioDspControl::MmdspcAcceptRecordBuffersInvalidFollowingStop() + { + return KErrNone; + } + +//Actual implementation of method MmdspcAcceptPlaybackBuffersInvalidFollowingStop +TInt CMMFAudioDspControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop() + { + return KErrNone; + } + + +/* +implementation +*/ +CMMFHwDevice* CAudioDspControlTestDevice::NewL() + { + CAudioDspControlTestDevice* self=new(ELeave) CAudioDspControlTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CAudioDspControlTestDevice::~CAudioDspControlTestDevice() + { + delete iAudioDspControl; + } + +CAudioDspControlTestDevice::CAudioDspControlTestDevice() + { + } + +void CAudioDspControlTestDevice::ConstructL() + { + } + +TInt CAudioDspControlTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CAudioDspControlTestDevice::Stop() + { + return 0; + } + +TInt CAudioDspControlTestDevice::Pause() + { + return 0; + } + +TInt CAudioDspControlTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CAudioDspControlTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidDSPControl) + { + if (!iAudioDspControl) + { + TRAPD(err, iAudioDspControl = CMMFAudioDspControl::NewL()); + if (err == KErrNone && iAudioDspControl) + { + MMMFDSPControl* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CAudioDspControlTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CAudioDspControlTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CAudioDspControlTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CAudioDspControlTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CAudioDspControlTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CAudioDspControlTestDevice::Codec() + { + return *iCodec; + } + +TInt CAudioDspControlTestDevice::MmdspcGetAudioPlaybackInfo (TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT) + { + TInt result = KErrBadHandle; + + if (iAudioDspControl) + { + result = iAudioDspControl->MmdspcGetAudioPlaybackInfo (aSamplesPlayed, aSystemTime, aB, aT); + } + + return result; + } + +TInt CAudioDspControlTestDevice::MmdspcAcceptRecordBuffersInvalidFollowingStop() + { + TInt result = KErrBadHandle; + + if (iAudioDspControl) + { + result = iAudioDspControl->MmdspcAcceptRecordBuffersInvalidFollowingStop(); + } + + return result; + } + +TInt CAudioDspControlTestDevice::MmdspcAcceptPlaybackBuffersInvalidFollowingStop() + { + TInt result = KErrBadHandle; + + if (iAudioDspControl) + { + result = iAudioDspControl->MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiodspcontroltestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiodspcontroltestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef AUDIODSPCONTROLTESTDEVICE_H +#define AUDIODSPCONTROLTESTDEVICE_H + +#include +#include + + +class CMMFAudioDspControl : public CBase, + public MMMFDSPControl + { +public: + //return Pointer to the CMMFAudioDspControl class + static CMMFAudioDspControl* NewL(); + + //Destructor + ~CMMFAudioDspControl(); + + //from MMMFDSPControl + TInt MmdspcGetAudioPlaybackInfo (TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT); + TInt MmdspcAcceptRecordBuffersInvalidFollowingStop(); + TInt MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + }; + + +/* +CAudioDspControlTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CAudioDspControlTestDevice : public CMMFSwCodecWrapper, + public MMMFDSPControl + { +public: + static CMMFHwDevice* NewL(); + virtual ~CAudioDspControlTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MMMFDSPControl + TInt MmdspcGetAudioPlaybackInfo (TInt64& aSamplesPlayed, TInt64& aSystemTime, TUint& aB, TUint& aT); + TInt MmdspcAcceptRecordBuffersInvalidFollowingStop(); + TInt MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + +private: + CAudioDspControlTestDevice(); + void ConstructL(); + +private: + CMMFAudioDspControl* iAudioDspControl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiovibracontroltestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiovibracontroltestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,173 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "audiovibracontroltestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFAudioVibraControl implementation +*/ +CMMFAudioVibraControl* CMMFAudioVibraControl::NewL() + { + CMMFAudioVibraControl* self = new(ELeave) CMMFAudioVibraControl(); + return self; + } + +CMMFAudioVibraControl::~CMMFAudioVibraControl() + { + } + +//Actual implementation of method StartVibra +TInt CMMFAudioVibraControl::StartVibra() + { + return KErrNone; + } + +//Actual implementation of method StopVibra +TInt CMMFAudioVibraControl::StopVibra() + { + return KErrNone; + } + + +/* +CAudioVibraControlTestDevice implementation +*/ +CMMFHwDevice* CAudioVibraControlTestDevice::NewL() + { + CAudioVibraControlTestDevice* self=new(ELeave) CAudioVibraControlTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CAudioVibraControlTestDevice::~CAudioVibraControlTestDevice() + { + delete iAudioVibraControl; + } + +CAudioVibraControlTestDevice::CAudioVibraControlTestDevice() + { + } + +void CAudioVibraControlTestDevice::ConstructL() + { + } + +TInt CAudioVibraControlTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CAudioVibraControlTestDevice::Stop() + { + return 0; + } + +TInt CAudioVibraControlTestDevice::Pause() + { + return 0; + } + +TInt CAudioVibraControlTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CAudioVibraControlTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidAudioVibraControl) + { + if (!iAudioVibraControl) + { + TRAPD(err, iAudioVibraControl = CMMFAudioVibraControl::NewL()); + if (err == KErrNone && iAudioVibraControl) + { + MAudioVibraControl* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CAudioVibraControlTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CAudioVibraControlTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CAudioVibraControlTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CAudioVibraControlTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CAudioVibraControlTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CAudioVibraControlTestDevice::Codec() + { + return *iCodec; + } + +TInt CAudioVibraControlTestDevice::StartVibra() + { + TInt result = KErrBadHandle; + + if (iAudioVibraControl) + { + result = iAudioVibraControl->StartVibra(); + } + + return result; + } + +TInt CAudioVibraControlTestDevice::StopVibra() + { + TInt result = KErrBadHandle; + + if (iAudioVibraControl) + { + result = iAudioVibraControl->StopVibra(); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiovibracontroltestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/audiovibracontroltestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,77 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef AUDIOVIBRACONTROLTESTDEVICE_H +#define AUDIOVIBRACONTROLTESTDEVICE_H + +#include +#include + + +class CMMFAudioVibraControl : public CBase, + public MAudioVibraControl + { +public: + //return Pointer to the CMMFAudioVibraControl class + static CMMFAudioVibraControl* NewL(); + + //Destructor + ~CMMFAudioVibraControl(); + + // from MAudioVibraControl + TInt StartVibra(); + TInt StopVibra(); + }; + + +/* +CAudioVibraControlTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CAudioVibraControlTestDevice : public CMMFSwCodecWrapper, + public MAudioVibraControl + { +public: + static CMMFHwDevice* NewL(); + virtual ~CAudioVibraControlTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MAudioVibraControl + TInt StartVibra(); + TInt StopVibra(); + +private: + CAudioVibraControlTestDevice(); + void ConstructL(); + +private: + CMMFAudioVibraControl* iAudioVibraControl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/bufferframesconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/bufferframesconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,157 @@ +// Copyright (c) 2007-2009 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 +#include "bufferframesconfigtestdevice.h" +#include "cidefine.h" + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CBufferFramesConfigTestDevice::NewL() + { + CBufferFramesConfigTestDevice* self = new(ELeave) CBufferFramesConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CBufferFramesConfigTestDevice::~CBufferFramesConfigTestDevice() + { + } + +/*****************************************************************************/ +CBufferFramesConfigTestDevice::CBufferFramesConfigTestDevice() + { + } + +/*****************************************************************************/ +void CBufferFramesConfigTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CBufferFramesConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + MMMFBufferFramesConfig* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidBufferFramesConfig) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CBufferFramesConfigTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CBufferFramesConfigTestDevice::MmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) + { + TRAPD(err, DoWriteToFileL(aFrameCount, aSamplesPerFrame)); + return err; + } + +TInt CBufferFramesConfigTestDevice::MmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame) + { + TRAPD(err, DoWriteToFileL(aFrameCount, aSamplesPerFrame)); + return err; + } + +void CBufferFramesConfigTestDevice::DoWriteToFileL(TInt aFrameCount, TInt aSamplesPerFrame) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File doesn't yet exist + // It is the responsibility of the calling test function to delete the file after use + User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); + TBuf8 outputBuf; + outputBuf.Num(aFrameCount); + outputBuf.Append(' '); + outputBuf.AppendNum(aSamplesPerFrame); + User::LeaveIfError(file.Write(outputBuf)); + CleanupStack::PopAndDestroy(2); // fs, file + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/bufferframesconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/bufferframesconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef BUFFERFRAMESCONFIGTESTDEVICE_H +#define BUFFERFRAMESCONFIGTESTDEVICE_H + +#include +#include + + +/** +* +* CBufferFramesConfigTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CBufferFramesConfigTestDevice : public CMMFSwCodecWrapper, public MMMFBufferFramesConfig + { +public: + static CMMFHwDevice* NewL(); + virtual ~CBufferFramesConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MMMFBufferFramesConfig + virtual TInt MmbfcSetNumberOfFramesPerInputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + virtual TInt MmbfcSetNumberOfFramesPerOutputBuffer(TInt aFrameCount, TInt aSamplesPerFrame); + +private: + CBufferFramesConfigTestDevice(); + void ConstructL(); + void DoWriteToFileL(TInt aFrameCount, TInt aSamplesPerFrame); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/cidefine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/cidefine.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef CIDEFINE_H +#define CIDEFINE_H + +#include + +_LIT(KCITestFileName, "c:\\citestfile.txt"); +const TInt KMaxCITestFileDataLength = 1; +const TInt KMaxCITestFileTimeDataLength = 32; +const TInt64 KTimestampPosition = 1234567890; +const TInt64 KTimestampValue = 1098765432; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,103 @@ +// Copyright (c) 2007-2009 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 +#include +#include "devsoundciutestdevices.hrh" +#include "aacdecoderconfigtestdevice.h" +#include "g729encoderconfigtestdevice.h" +#include "g729decoderconfigtestdevice.h" +#include "audiovibracontroltestdevice.h" +#include "audiobufferprefilltestdevice.h" +#include "audiodspcontroltestdevice.h" +#include "speechencoderconfigtestdevice.h" +#include "g711decoderconfigtestdevice.h" +#include "g711encoderconfigtestdevice.h" +#include "ilbcdecoderconfigtestdevice.h" +#include "ilbcencoderconfigtestdevice.h" +#include "errorconcealmenttestdevice.h" +#include "gsmconfigtestdevice.h" +#include "underflowautostopcontroltestdevice.h" +#include "playbackstatustestdevice.h" +#include "sbcencodertestdevice.h" +#include "eaacplusdecodertestdevice.h" +#include "setdrmprotectedtestdevice.h" +#include "advancedaacencodesettingstestdevice.h" +#include "bufferframesconfigtestdevice.h" +#include "gettimestampstestdevice.h" +#include "playbackstatustestdevice.h" +#include "sbcencodertestdevice.h" +#include "eaacplusdecodertestdevice.h" +#include "setdrmprotectedtestdevice.h" +#include "advancedaacencodesettingstestdevice.h" +#include "bufferframesconfigtestdevice.h" +#include "gettimestampstestdevice.h" +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +#include "MMFDevSoundCIMuxDeMuxPluginImp.h" +#endif + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidAacDecoderConfigTestDevice, CAacDecoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidG729EncoderConfigTestDevice, CG729EncoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidG729DecoderConfigTestDevice, CG729DecoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidAudioVibraControlTestDevice, CAudioVibraControlTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSampleBufferingTestDevice, CSampleBufferingTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidAudioDspControlTestDevice, CAudioDspControlTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSpeechEncoderConfigTestDevice, CSpeechEncoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidG711DecoderConfigTestDevice, CG711DecoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidG711EncoderConfigTestDevice, CG711EncoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidIlbcDecoderIntfcTestDevice, CIlbcDecoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidIlbcEncoderIntfcTestDevice, CIlbcEncoderConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidErrorConcealmentIntfcTestDevice, CErrorConcealmentTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidGsmConfigTestDevice, CGsmConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidUnderflowAutoStopControlTestDevice, CUnderflowAutoStopControlTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidPlayBackStatusTestDevice, CPlaybackStatusTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSbcEncoderTestDevice, CSbcEncoderTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidEAacPlusDecoderTestDevice, CEAacPlusDecoderTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSetDrmProtectedTestDevice, CSetDRMProtectedTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidAdvancedAacEncodeSettingsTestDevice, CAdvancedAacEncodeSettingsTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidBufferFramesConfigTestDevice, CBufferFramesConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidGetTimestampsTestDevice, CGetTimestampsTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidPlayBackStatusTestDevice, CPlaybackStatusTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSbcEncoderTestDevice, CSbcEncoderTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidEAacPlusDecoderTestDevice, CEAacPlusDecoderTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidSetDrmProtectedTestDevice, CSetDRMProtectedTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidAdvancedAacEncodeSettingsTestDevice, CAdvancedAacEncodeSettingsTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidBufferFramesConfigTestDevice, CBufferFramesConfigTestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidGetTimestampsTestDevice, CGetTimestampsTestDevice::NewL), +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + IMPLEMENTATION_PROXY_ENTRY(KUidMmfDevSoundCustomInterfaceMuxPlugin, CMMFDevSoundCIMuxPluginImp::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidMmfDevSoundCustomInterfaceDeMuxPlugin, CMMFDevSoundCIDemuxPluginImp::NewL) +#endif + }; + +// +// ImplementationGroupProxy +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + +#ifndef EKA2 +/** DLL Entry point */ +GLDEF_C TInt E32Dll(TDllReason /*aReason*/) + { + return(KErrNone); + } +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,77 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef DEVSOUNDCIUTESTDEVICES_HRH +#define DEVSOUNDCIUTESTDEVICES_HRH + +// These are the ECOM Implementation UIDs for the test Hw device. +#define KUidDevsoundCIUTestDevicesDll 0x10273835 +#define KUidPlayBackStatusTestDevice 0x10273826 +#define KUidAacDecoderConfigTestDevice 0x102825BD +#define KUidG729EncoderConfigTestDevice 0x102825C8 +#define KUidG729DecoderConfigTestDevice 0x102825C9 +#define KUidAudioVibraControlTestDevice 0x102825CA +#define KUidSampleBufferingTestDevice 0x102825CB +#define KUidAudioDspControlTestDevice 0x102825CC +#define KUidSpeechEncoderConfigTestDevice 0x102825E1 +#define KUidG711DecoderConfigTestDevice 0x102825E2 +#define KUidG711EncoderConfigTestDevice 0x102825E3 +#define KUidIlbcDecoderIntfcTestDevice 0x102825E4 +#define KUidIlbcEncoderIntfcTestDevice 0x102825E5 +#define KUidErrorConcealmentIntfcTestDevice 0x102825E6 +#define KUidGsmConfigTestDevice 0x1028261F +#define KUidUnderflowAutoStopControlTestDevice 0x10282620 +#define KUidEAacPlusDecoderTestDevice 0x1027381f +#define KUidSbcEncoderTestDevice 0x102825d0 +#define KUidSetDrmProtectedTestDevice 0x102825d3 +#define KUidAdvancedAacEncodeSettingsTestDevice 0x102825d4 +#define KUidBufferFramesConfigTestDevice 0x102825e8 +#define KUidGetTimestampsTestDevice 0x102825e9 + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#define KUidFormatT001 0x10285BEC +#define KUidFormatT002 0x10285BED +#define KUidFormatT003 0x10285BEE +#define KUidFormatT004 0x10285BEF +#define KUidFormatT005 0x10285BF0 +#define KUidFormatT006 0x10285BF1 +#define KUidFormatT007 0x10285BF2 +#define KUidFormatT008 0x10285BF3 +#define KUidFormatT009 0x10285BF4 +#define KUidFormatT010 0x10285BF5 +#define KUidFormatT011 0x10285BF6 +#define KUidFormatT012 0x10285BF7 +#define KUidFormatT013 0x10285BF8 +#define KUidFormatT014 0x10285BF9 +#define KUidFormatT015 0x10285BFA +#define KUidFormatT016 0x10285BFB +#define KUidFormatT017 0x10285BFC +#define KUidFormatT018 0x10285BFD +#define KUidFormatT019 0x10285BFE +#define KUidFormatT020 0x10285BFF +#define KUidFormatT021 0x10285C00 +#define KUidFormatTEST 0x10285C02 +#define KUidFormatTST1 0x10285CCB +#define KUidFormatTST2 0x10285CCC +#define KUidFormatTST3 0x10285CCD +#define KUidDevSoundCustomInterfaceMux 0x102070ac //Re-used from MmfDevSoundCustomInterface.hrh +#define KUidDevSoundCustomInterfaceDeMux 0x102070ad //Re-used from MmfDevSoundCustomInterface.hrh +#define KUidMmfDevSoundCustomInterfaceMuxPlugin 0x10285C23 +#define KUidMmfDevSoundCustomInterfaceDeMuxPlugin 0x10285C24 + +#endif + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,301 @@ +// Copyright (c) 2007-2009 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 "ecom/registryinfo.rh" +#include +#include "devsoundciutestdevices.hrh" +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidDevsoundCIUTestDevicesDll ; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidPlayBackStatusTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidEAacPlusDecoderTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidSbcEncoderTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidSetDrmProtectedTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidAdvancedAacEncodeSettingsTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidGetTimestampsTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidBufferFramesConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAacDecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG729DecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG729EncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAudioVibraControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidSampleBufferingTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAudioDspControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidSpeechEncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG711DecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG711EncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidIlbcDecoderIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidIlbcEncoderIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidErrorConcealmentIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidGsmConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidUnderflowAutoStopControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices_a3f.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/devsoundciutestdevices_a3f.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,517 @@ +// Copyright (c) 2007-2009 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 "ecom/registryinfo.rh" +#include +#include "devsoundciutestdevices.hrh" +#include +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidDevsoundCIUTestDevicesDll ; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidPlayBackStatusTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T001, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidEAacPlusDecoderTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T002, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidSbcEncoderTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T003, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidSetDrmProtectedTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T004, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidAdvancedAacEncodeSettingsTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T005, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidGetTimestampsTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T006, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidBufferFramesConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T007, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAacDecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T008, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG729DecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T009, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG729EncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T010, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAudioVibraControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T011, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidSampleBufferingTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T012, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidAudioDspControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T013, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidSpeechEncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T014, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG711DecoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T015, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidG711EncoderConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T016, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidIlbcDecoderIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T017, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidIlbcEncoderIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T018, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidErrorConcealmentIntfcTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T019, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidGsmConfigTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T020, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidUnderflowAutoStopControlTestDevice; + version_no = 1; + display_name = "Test Custom Interface Unification Hw Device||Copyright 2006 Symbian Ltd. All Rights Reserved.||"; + default_data = "T021, P16" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KUidA3fFourCCConvertorPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BD7; + version_no = 1; + display_name = "T001"; + default_data = ""; + opaque_data = "T0010x10285BEC"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BD8; + version_no = 1; + display_name = "T002"; + default_data = ""; + opaque_data = "T0020x10285BED"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BD9; + version_no = 1; + display_name = "T003"; + default_data = ""; + opaque_data = "T0030x10285BEE"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDA; + version_no = 1; + display_name = "T004"; + default_data = ""; + opaque_data = "T0040x10285BEF"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDB; + version_no = 1; + display_name = "T005"; + default_data = ""; + opaque_data = "T0050x10285BF0"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDC; + version_no = 1; + display_name = "T006"; + default_data = ""; + opaque_data = "T0060x10285BF1"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDD; + version_no = 1; + display_name = "T007"; + default_data = ""; + opaque_data = "T0070x10285BF2"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDE; + version_no = 1; + display_name = "T008"; + default_data = ""; + opaque_data = "T0080x10285BF3"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BDF; + version_no = 1; + display_name = "T009"; + default_data = ""; + opaque_data = "T0090x10285BF4"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE0; + version_no = 1; + display_name = "T010"; + default_data = ""; + opaque_data = "T0100x10285BF5"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE1; + version_no = 1; + display_name = "T011"; + default_data = ""; + opaque_data = "T0110x10285BF6"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE2; + version_no = 1; + display_name = "T012"; + default_data = ""; + opaque_data = "T0120x10285BF7"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE3; + version_no = 1; + display_name = "T013"; + default_data = ""; + opaque_data = "T0130x10285BF8"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE4; + version_no = 1; + display_name = "T014"; + default_data = ""; + opaque_data = "T0140x10285BF9"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE5; + version_no = 1; + display_name = "T015"; + default_data = ""; + opaque_data = "T0150x10285BFA"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE6; + version_no = 1; + display_name = "T016"; + default_data = ""; + opaque_data = "T0160x10285BFB"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE7; + version_no = 1; + display_name = "T017"; + default_data = ""; + opaque_data = "T0170x10285BFC"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE8; + version_no = 1; + display_name = "T018"; + default_data = ""; + opaque_data = "T0180x10285BFD"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BE9; + version_no = 1; + display_name = "T019"; + default_data = ""; + opaque_data = "T0190x10285BFE"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BEA; + version_no = 1; + display_name = "T020"; + default_data = ""; + opaque_data = "T0200x10285BFF"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285BEB; + version_no = 1; + display_name = "T021"; + default_data = ""; + opaque_data = "T0210x10285C00"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285C03; + version_no = 1; + display_name = "Test"; + default_data = ""; + opaque_data = "TEST0x10285C02"; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceMux; // Mux plugin + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidMmfDevSoundCustomInterfaceMuxPlugin; + version_no = 1; + display_name = "Test MUX Custom Interface||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "10285c23" ; // UID of implementation + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCustomInterfaceDeMux; // DeMux plugin + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidMmfDevSoundCustomInterfaceDeMuxPlugin; + version_no = 1; + display_name = "Test DEMUX Custom Interface||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "10285c24" ; // UID of implementation + opaque_data = ""; + } + }; + } + + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/eaacplusdecodertestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/eaacplusdecodertestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,186 @@ +// Copyright (c) 2007-2009 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 + +#include "eaacplusdecodertestdevice.h" + + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CEAacPlusDecoderTestDevice::NewL() + { + CEAacPlusDecoderTestDevice* self = new(ELeave) CEAacPlusDecoderTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CEAacPlusDecoderTestDevice::~CEAacPlusDecoderTestDevice() + { + } + +/*****************************************************************************/ +CEAacPlusDecoderTestDevice::CEAacPlusDecoderTestDevice() + { + } + +/*****************************************************************************/ +void CEAacPlusDecoderTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CEAacPlusDecoderTestDevice::CustomInterface(TUid aInterfaceId) + { + MEAacPlusDecoderIntfc* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidEAacPlusDecoderIntfc) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CEAacPlusDecoderTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CEAacPlusDecoderTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ + +void CEAacPlusDecoderTestDevice::SetInputSamplingFrequency(TUint aInputSamplingFrequency) + { + iFrequency = aInputSamplingFrequency; + } + +void CEAacPlusDecoderTestDevice::SetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType) + { + iAudioObjectType = aAudioObjectType; + } + +void CEAacPlusDecoderTestDevice::SetNumOfChannels(TUint aNumOfChannels) + { + iNumOfChannels = aNumOfChannels; + } + +void CEAacPlusDecoderTestDevice::SetSbr(TBool aSbrEnabled) + { + iSbrEnabled = aSbrEnabled; + } + +void CEAacPlusDecoderTestDevice::SetDownSampledMode(TBool aDsmEnabled) + { + iDsmEnabled = aDsmEnabled; + } + +TInt CEAacPlusDecoderTestDevice::ApplyConfig() + { + iApplyConfig = ETrue; + return KErrNone; + } + +TInt CEAacPlusDecoderTestDevice::GetInputSamplingFrequency ( TUint& aInputSamplingFrequency ) + { + aInputSamplingFrequency = iFrequency; + return KErrNone; + } + +TInt CEAacPlusDecoderTestDevice::GetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType) + { + aAudioObjectType = iAudioObjectType; + return KErrNone; + } + +TInt CEAacPlusDecoderTestDevice::GetNumOfChannels ( TUint& aNumOfChannels ) + { + aNumOfChannels = iNumOfChannels; + return KErrNone; + } + +TInt CEAacPlusDecoderTestDevice::GetSbr (TBool& aSbrEnabled) + { + aSbrEnabled = iSbrEnabled; + return KErrNone; + } + +TInt CEAacPlusDecoderTestDevice::GetDownSampledMode (TBool& aDsmEnabled) + { + aDsmEnabled = iDsmEnabled; + return KErrNone; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/eaacplusdecodertestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/eaacplusdecodertestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef EAACPLUSDECODERTESTDEVICE_H +#define EAACPLUSDECODERTESTDEVICE_H + +#include +#include + + +/** +* +* CEAacPlusDecoderTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CEAacPlusDecoderTestDevice : public CMMFSwCodecWrapper, public MEAacPlusDecoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CEAacPlusDecoderTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + +// from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MEAacPlusDecoderIntfc + virtual void SetInputSamplingFrequency(TUint aInputSamplingFrequency); + virtual void SetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType aAudioObjectType); + virtual void SetNumOfChannels(TUint aNumOfChannels); + virtual void SetSbr(TBool aSbrEnabled); + virtual void SetDownSampledMode(TBool aDsmEnabled); + virtual TInt ApplyConfig(); + virtual TInt GetInputSamplingFrequency ( TUint& aInputSamplingFrequency ); + virtual TInt GetAudioObjectType(MEAacPlusDecoderIntfc::TAudioObjectType& aAudioObjectType); + virtual TInt GetNumOfChannels ( TUint& aNumOfChannels ); + virtual TInt GetSbr (TBool& aSbrEnabled); + virtual TInt GetDownSampledMode (TBool& aDsmEnabled); + + +private: + CEAacPlusDecoderTestDevice(); + void ConstructL(); +private: + TUint iFrequency; + MEAacPlusDecoderIntfc::TAudioObjectType iAudioObjectType; + TUint iNumOfChannels; + TBool iSbrEnabled; + TBool iDsmEnabled; + TBool iApplyConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/errorconcealmenttestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/errorconcealmenttestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,243 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "errorconcealmenttestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFErrorConcealment implementation +*/ +CMMFErrorConcealment* CMMFErrorConcealment::NewL() + { + CMMFErrorConcealment* self = new(ELeave) CMMFErrorConcealment(); + return self; + } + +CMMFErrorConcealment::~CMMFErrorConcealment() + { + } + +//Actual implementation of method ConcealErrorForNextBuffer +TInt CMMFErrorConcealment::ConcealErrorForNextBuffer() + { + return KErrNone; + } + +//Actual implementation of method SetFrameMode +TInt CMMFErrorConcealment::SetFrameMode(TBool aFrameModeOn) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\errorConcealment.txt"); + fs.MkDirAll(KFileName); + + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) + { + return err; + } + + TBuf8<1> data; + data.Format(_L8("%d"), aFrameModeOn); + + file.Write(data); + file.Close(); + fs.Close(); + + return err; + } + +//Actual implementation of method FrameModeRqrdForEC +TInt CMMFErrorConcealment::FrameModeRqrdForEC(TBool& aFrameModeRqrd) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\errorConcealment.txt"); + + if ( KErrNone != (err = file.Open(fs, KFileName, EFileRead)) ) + { + return err; + } + + TBuf8<1> data; + file.Read(data); + file.Close(); + + fs.Delete(KFileName); + fs.Close(); + + TLex8 lex(data); + lex.Val(aFrameModeRqrd); + + return err; + } + + +/* +CErrorConcealmentTestDevice implementation +*/ +CMMFHwDevice* CErrorConcealmentTestDevice::NewL() + { + CErrorConcealmentTestDevice* self=new(ELeave) CErrorConcealmentTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CErrorConcealmentTestDevice::~CErrorConcealmentTestDevice() + { + delete iErrorConcealment; + } + +CErrorConcealmentTestDevice::CErrorConcealmentTestDevice() + { + } + +void CErrorConcealmentTestDevice::ConstructL() + { + } + +TInt CErrorConcealmentTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CErrorConcealmentTestDevice::Stop() + { + return 0; + } + +TInt CErrorConcealmentTestDevice::Pause() + { + return 0; + } + +TInt CErrorConcealmentTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CErrorConcealmentTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidErrorConcealmentIntfc) + { + if (!iErrorConcealment) + { + TRAPD(err, iErrorConcealment = CMMFErrorConcealment::NewL()); + if (err == KErrNone && iErrorConcealment) + { + MMMFErrorConcealmentIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CErrorConcealmentTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CErrorConcealmentTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CErrorConcealmentTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CErrorConcealmentTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CErrorConcealmentTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CErrorConcealmentTestDevice::Codec() + { + return *iCodec; + } + +TInt CErrorConcealmentTestDevice::ConcealErrorForNextBuffer() + { + TInt result = KErrBadHandle; + + if (iErrorConcealment) + { + result = iErrorConcealment->ConcealErrorForNextBuffer(); + } + + return result; + } + +TInt CErrorConcealmentTestDevice::SetFrameMode(TBool aFrameModeOn) + { + TInt result = KErrBadHandle; + + if (iErrorConcealment) + { + result = iErrorConcealment->SetFrameMode(aFrameModeOn); + } + + return result; + } + +TInt CErrorConcealmentTestDevice::FrameModeRqrdForEC(TBool& aFrameModeRqrd) + { + TInt result = KErrBadHandle; + + if (iErrorConcealment) + { + result = iErrorConcealment->FrameModeRqrdForEC(aFrameModeRqrd); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/errorconcealmenttestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/errorconcealmenttestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef ERRORCONCEALMENTTESTDEVICE_H +#define ERRORCONCEALMENTTESTDEVICE_H + +#include +#include + + +class CMMFErrorConcealment : public CBase, + public MMMFErrorConcealmentIntfc + { +public: + //return Pointer to the CMMFErrorConcealment class + static CMMFErrorConcealment* NewL(); + + //Destructor + ~CMMFErrorConcealment(); + + // from mirror MErrorConcealment method. + TInt ConcealErrorForNextBuffer(); + TInt SetFrameMode(TBool aFrameModeOn); + TInt FrameModeRqrdForEC(TBool& aFrameModeRqrd); + }; + + +/* +CErrorConcealmentTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CErrorConcealmentTestDevice : public CMMFSwCodecWrapper, + public MMMFErrorConcealmentIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CErrorConcealmentTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from mirror MErrorConcealment method. + TInt ConcealErrorForNextBuffer(); + TInt SetFrameMode(TBool aFrameModeOn); + TInt FrameModeRqrdForEC(TBool& aFrameModeRqrd); + +private: + CErrorConcealmentTestDevice(); + void ConstructL(); + +private: + CMMFErrorConcealment* iErrorConcealment; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711decoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711decoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,249 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "g711decoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFG711DecoderConfig implementation +*/ +CMMFG711DecoderConfig* CMMFG711DecoderConfig::NewL() + { + CMMFG711DecoderConfig* self = new(ELeave) CMMFG711DecoderConfig(); + return self; + } + +CMMFG711DecoderConfig::~CMMFG711DecoderConfig() + { + } + +//Actual implementation of method SetDecoderMode +TInt CMMFG711DecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode) + { + iDecodeMode = aDecodeMode; + return KErrNone; + } + +//Actual implementation of method SetDecoderMode +TInt CMMFG711DecoderConfig::GetDecoderMode(TDecodeMode& aDecodeMode) + { + aDecodeMode = iDecodeMode; + return KErrNone; + } + +//Actual implementation of method SetCng +TInt CMMFG711DecoderConfig::SetComfortNoiseGeneration(TBool aCng) + { + iCng = aCng; + return KErrNone; + } + +//Actual implementation of method GetCng +TInt CMMFG711DecoderConfig::GetComfortNoiseGeneration(TBool& aCng) + { + aCng = iCng; + return KErrNone; + } + +//Actual implementation of method SetPlc +TInt CMMFG711DecoderConfig::SetPacketLossConcealment(TBool aPlc) + { + iPlc = aPlc; + return KErrNone; + } +//Actual implementation of method SetPlc +TInt CMMFG711DecoderConfig::GetPacketLossConcealment(TBool& aPlc) + { + aPlc = iPlc; + return KErrNone; + } + +/* +CG711DecoderConfigTestDevice implementation +*/ +CMMFHwDevice* CG711DecoderConfigTestDevice::NewL() + { + CG711DecoderConfigTestDevice* self = new(ELeave) CG711DecoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CG711DecoderConfigTestDevice::~CG711DecoderConfigTestDevice() + { + delete iG711DecoderConfig; + } + +CG711DecoderConfigTestDevice::CG711DecoderConfigTestDevice() + { + } + +void CG711DecoderConfigTestDevice::ConstructL() + { + } + +TInt CG711DecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CG711DecoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidG711DecoderIntfc) + { + if (!iG711DecoderConfig) + { + TRAPD(err, iG711DecoderConfig = CMMFG711DecoderConfig::NewL()); + if (err == KErrNone && iG711DecoderConfig) + { + MG711DecoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CG711DecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CG711DecoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CG711DecoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CG711DecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->SetDecoderMode(aDecodeMode); + } + + return result; + } + +TInt CG711DecoderConfigTestDevice::GetDecoderMode(TDecodeMode& aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->GetDecoderMode(aDecodeMode); + } + + return result; + } + +TInt CG711DecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->SetComfortNoiseGeneration(aCng); + } + + return result; + } + +TInt CG711DecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->GetComfortNoiseGeneration(aCng); + } + + return result; + } + +TInt CG711DecoderConfigTestDevice::SetPacketLossConcealment(TBool aPlc) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->SetPacketLossConcealment(aPlc); + } + + return result; + } + +TInt CG711DecoderConfigTestDevice::GetPacketLossConcealment(TBool& aPlc) + { + TInt result = KErrBadHandle; + + if (iG711DecoderConfig) + { + result = iG711DecoderConfig->GetPacketLossConcealment(aPlc); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711decoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711decoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,90 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef G711DECODERCONFIGTESTDEVICE_H +#define G711DECODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFG711DecoderConfig : public CBase, + public MG711DecoderIntfc + { +public: + //return Pointer to the CMMFG711DecoderConfig class + static CMMFG711DecoderConfig* NewL(); + + //Destructor + ~CMMFG711DecoderConfig(); + + // from MG711DecoderConfig + TInt SetDecoderMode(TDecodeMode aDecodeMode); + TInt GetDecoderMode(TDecodeMode& aDecodeMode); + TInt SetComfortNoiseGeneration(TBool aCng); + TInt GetComfortNoiseGeneration(TBool& aCng); + TInt SetPacketLossConcealment(TBool aPlc); + TInt GetPacketLossConcealment(TBool& aPlc); + +private: + TDecodeMode iDecodeMode; + TBool iCng; + TBool iPlc; + }; + + +/* +CAacDecoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CG711DecoderConfigTestDevice : public CMMFSwCodecWrapper, + public MG711DecoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CG711DecoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MG711DecoderIntfc + TInt SetDecoderMode(TDecodeMode aDecodeMode); + TInt GetDecoderMode(TDecodeMode& aDecodeMode); + TInt SetComfortNoiseGeneration(TBool aCng); + TInt GetComfortNoiseGeneration(TBool& aCng); + TInt SetPacketLossConcealment(TBool aPlc); + TInt GetPacketLossConcealment(TBool& aPlc); + +private: + CG711DecoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFG711DecoderConfig* iG711DecoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711encoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711encoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,218 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "g711encoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFG711EncoderConfig implementation +*/ +CMMFG711EncoderConfig* CMMFG711EncoderConfig::NewL() + { + CMMFG711EncoderConfig* self = new(ELeave) CMMFG711EncoderConfig(); + return self; + } + +CMMFG711EncoderConfig::~CMMFG711EncoderConfig() + { + } + +//Actual implementation of method SetEncoderMode +TInt CMMFG711EncoderConfig::SetEncoderMode(TEncodeMode aEncodeMode) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt"); + fs.MkDirAll(KFileName); + + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) + { + return err; + } + + TBuf8<4> data; + data.Format(_L8("%d"), aEncodeMode); + + file.Write(data); + file.Close(); + fs.Close(); + + return err; + } + +//Actual implementation of method SetVadMode +TInt CMMFG711EncoderConfig::SetVadMode(TBool aVadModeOn) + { + iVadModeOn = aVadModeOn; + return KErrNone; + } + +//Actual implementation of method GetVadMode +TInt CMMFG711EncoderConfig::GetVadMode(TBool& aVadModeOn) + { + aVadModeOn = iVadModeOn; + return KErrNone; + } + + +/* +CG711EncoderConfigTestDevice implementation +*/ +CMMFHwDevice* CG711EncoderConfigTestDevice::NewL() + { + CG711EncoderConfigTestDevice* self=new(ELeave) CG711EncoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CG711EncoderConfigTestDevice::~CG711EncoderConfigTestDevice() + { + delete iG711EncoderConfig; + } + +CG711EncoderConfigTestDevice::CG711EncoderConfigTestDevice() + { + } + +void CG711EncoderConfigTestDevice::ConstructL() + { + } + +TInt CG711EncoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CG711EncoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidG711EncoderIntfc) + { + if (!iG711EncoderConfig) + { + TRAPD(err, iG711EncoderConfig = CMMFG711EncoderConfig::NewL()); + if (err == KErrNone && iG711EncoderConfig) + { + MG711EncoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CG711EncoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CG711EncoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CG711EncoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CG711EncoderConfigTestDevice::SetEncoderMode(TEncodeMode aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iG711EncoderConfig) + { + result = iG711EncoderConfig->SetEncoderMode(aEncodeMode); + } + + return result; + } + +TInt CG711EncoderConfigTestDevice::SetVadMode(TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iG711EncoderConfig) + { + result = iG711EncoderConfig->SetVadMode(aVadModeOn); + } + + return result; + } + +TInt CG711EncoderConfigTestDevice::GetVadMode(TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iG711EncoderConfig) + { + result = iG711EncoderConfig->GetVadMode(aVadModeOn); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711encoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g711encoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,82 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef G711ENCODERCONFIGTESTDEVICE_H +#define G711ENCODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFG711EncoderConfig : public CBase, + public MG711EncoderIntfc + { +public: + //return Pointer to the CMMFG711EncoderConfig class + static CMMFG711EncoderConfig* NewL(); + + //Destructor + ~CMMFG711EncoderConfig(); + + // from MG711EncoderIntfc + TInt SetEncoderMode(TEncodeMode aEncodeMode); + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + +private: + TBool iVadModeOn; + }; + + +/* +CG711EncoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CG711EncoderConfigTestDevice : public CMMFSwCodecWrapper, + public MG711EncoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CG711EncoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MG711EncoderIntfc + TInt SetEncoderMode(TEncodeMode aEncodeMode); + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + +private: + CG711EncoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFG711EncoderConfig* iG711EncoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729decoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729decoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "g729decoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFG729DecoderConfig implementation +*/ +CMMFG729DecoderConfig* CMMFG729DecoderConfig::NewL() + { + CMMFG729DecoderConfig* self = new(ELeave) CMMFG729DecoderConfig(); + return self; + } + +CMMFG729DecoderConfig::~CMMFG729DecoderConfig() + { + } + +//Actual implementation of method BadLsfNextBuffer +TInt CMMFG729DecoderConfig::BadLsfNextBuffer() + { + return KErrNone; + } + + +/* +CG729DecoderConfigTestDevice implementation +*/ +CMMFHwDevice* CG729DecoderConfigTestDevice::NewL() + { + CG729DecoderConfigTestDevice* self=new(ELeave) CG729DecoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CG729DecoderConfigTestDevice::~CG729DecoderConfigTestDevice() + { + delete iG729DecoderConfig; + } + +CG729DecoderConfigTestDevice::CG729DecoderConfigTestDevice() + { + } + +void CG729DecoderConfigTestDevice::ConstructL() + { + } + +TInt CG729DecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CG729DecoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidG729DecoderIntfc) + { + if (!iG729DecoderConfig) + { + TRAPD(err, iG729DecoderConfig = CMMFG729DecoderConfig::NewL()); + if (err == KErrNone && iG729DecoderConfig) + { + MG729DecoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CG729DecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CG729DecoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CG729DecoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CG729DecoderConfigTestDevice::BadLsfNextBuffer() + { + TInt result = KErrBadHandle; + + if (iG729DecoderConfig) + { + result = iG729DecoderConfig->BadLsfNextBuffer(); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729decoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729decoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef G729DECODERCONFIGTESTDEVICE_H +#define G729DECODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFG729DecoderConfig : public CBase, + public MG729DecoderIntfc + { +public: + //return Pointer to the CMMFG729DecoderConfig class + static CMMFG729DecoderConfig* NewL(); + + //Destructor + ~CMMFG729DecoderConfig(); + + // from MG729DecoderIntfc + TInt BadLsfNextBuffer(); + }; + + +/* +CG729DecoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CG729DecoderConfigTestDevice : public CMMFSwCodecWrapper, + public MG729DecoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CG729DecoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MG729DecoderIntfc + TInt BadLsfNextBuffer(); + +private: + CG729DecoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFG729DecoderConfig* iG729DecoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729encoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729encoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,223 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "g729encoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + +/* +CMMFG729EncoderConfig implementation +*/ +CMMFG729EncoderConfig* CMMFG729EncoderConfig::NewL() + { + CMMFG729EncoderConfig* self = new(ELeave) CMMFG729EncoderConfig(); + return self; + } + +CMMFG729EncoderConfig::~CMMFG729EncoderConfig() + { + } + +//Actual implementation of method SetVadMode +TInt CMMFG729EncoderConfig::SetVadMode(TBool aVadModeOn) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\g729EncoderConfig.txt"); + fs.MkDirAll(KFileName); + + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) + { + return err; + } + + TBuf8<1> data; + data.Format(_L8("%d"), aVadModeOn); + + file.Write(data); + file.Close(); + fs.Close(); + + return err; + } + +//Actual implementation of method GetVadMode +TInt CMMFG729EncoderConfig::GetVadMode(TBool& aVadModeOn) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\g729EncoderConfig.txt"); + + if ( KErrNone != (err = file.Open(fs, KFileName, EFileRead)) ) + { + return err; + } + + TBuf8<4> data; + file.Read(data); + file.Close(); + + fs.Delete(KFileName); + fs.Close(); + + aVadModeOn = (data.Compare(_L8("0")) == 0) ? EFalse : ETrue; + + return err; + } + + +/* +CG729EncoderConfigTestDevice implementation +*/ +CMMFHwDevice* CG729EncoderConfigTestDevice::NewL() + { + CG729EncoderConfigTestDevice* self=new(ELeave) CG729EncoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CG729EncoderConfigTestDevice::~CG729EncoderConfigTestDevice() + { + delete iG729EncoderConfig; + } + +CG729EncoderConfigTestDevice::CG729EncoderConfigTestDevice() + { + } + +void CG729EncoderConfigTestDevice::ConstructL() + { + } + +TInt CG729EncoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CG729EncoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidG729EncoderIntfc) + { + if (!iG729EncoderConfig) + { + TRAPD(err, iG729EncoderConfig = CMMFG729EncoderConfig::NewL()); + if (err == KErrNone && iG729EncoderConfig) + { + MG729EncoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CG729EncoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CG729EncoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CG729EncoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CG729EncoderConfigTestDevice::SetVadMode(TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iG729EncoderConfig) + { + result = iG729EncoderConfig->SetVadMode(aVadModeOn); + } + + return result; + } + +TInt CG729EncoderConfigTestDevice::GetVadMode(TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iG729EncoderConfig) + { + result = iG729EncoderConfig->GetVadMode(aVadModeOn); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729encoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/g729encoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,77 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef G729ENCODERCONFIGTESTDEVICE_H +#define G729ENCODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFG729EncoderConfig : public CBase, + public MG729EncoderIntfc + { +public: + //return Pointer to the CMMFG729EncoderConfig class + static CMMFG729EncoderConfig* NewL(); + + //Destructor + ~CMMFG729EncoderConfig(); + + // from MG729EncoderIntfc + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + }; + + +/* +CG729EncoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CG729EncoderConfigTestDevice : public CMMFSwCodecWrapper, + public MG729EncoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CG729EncoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MG729EncoderIntfc + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + +private: + CG729EncoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFG729EncoderConfig* iG729EncoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/gettimestampstestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/gettimestampstestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,164 @@ +// Copyright (c) 2007-2009 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 +#include "gettimestampstestdevice.h" +#include "cidefine.h" + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CGetTimestampsTestDevice::NewL() + { + CGetTimestampsTestDevice* self = new(ELeave) CGetTimestampsTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CGetTimestampsTestDevice::~CGetTimestampsTestDevice() + { + } + +/*****************************************************************************/ +CGetTimestampsTestDevice::CGetTimestampsTestDevice() + { + } + +/*****************************************************************************/ +void CGetTimestampsTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CGetTimestampsTestDevice::CustomInterface(TUid aInterfaceId) + { + MMMFGetTimestamps* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidGetTimestamps) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CGetTimestampsTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CGetTimestampsTestDevice::MmgtSetRecordSystemTimestampsEnabled(TBool aEnable) + { + TRAPD(err, DoWriteToFileL(aEnable)); + return err; + } + +TInt CGetTimestampsTestDevice::MmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp) const + { + // Expected position is... + TTimeIntervalMicroSeconds expectedPos = TTimeIntervalMicroSeconds(KTimestampPosition); + if (aBufferPosition == expectedPos) + { + // ...found so return the expected value. + aTimestamp = KTimestampValue; + return KErrNone; + } + else + { + return KErrArgument; + } + } + +void CGetTimestampsTestDevice::DoWriteToFileL(TBool aEnable) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File doesn't yet exist + // It is the responsibility of the calling test function to delete the file after use + User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); + TBuf8 outputBuf; + outputBuf.Num(aEnable); + User::LeaveIfError(file.Write(outputBuf)); + CleanupStack::PopAndDestroy(2); // fs, file + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/gettimestampstestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/gettimestampstestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef GETTIMESTAMPSTESTDEVICE_H +#define GETTIMESTAMPSTESTDEVICE_H + +#include +#include + + +/** +* +* CGetTimestampsTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CGetTimestampsTestDevice : public CMMFSwCodecWrapper, public MMMFGetTimestamps + { +public: + static CMMFHwDevice* NewL(); + virtual ~CGetTimestampsTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MMMFGetTimestamps + virtual TInt MmgtSetRecordSystemTimestampsEnabled(TBool aEnable); + virtual TInt MmgtGetSystemTimestampForBuffer(const TTimeIntervalMicroSeconds& aBufferPosition, + TTime& aTimestamp) const; + +private: + CGetTimestampsTestDevice(); + void ConstructL(); + void DoWriteToFileL(TBool aEnable); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/gsmconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/gsmconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,175 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "gsmconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFGsmConfig implementation +*/ +CMMFGsmConfig* CMMFGsmConfig::NewL() + { + CMMFGsmConfig* self = new(ELeave) CMMFGsmConfig(); + return self; + } + +CMMFGsmConfig::~CMMFGsmConfig() + { + } + +// Actual implementation of method +TInt CMMFGsmConfig::SetConversionFormat(TMMFGsmConversionFormat aConvFormat) + { + iConvFormat = aConvFormat; + return KErrNone; + } + +// Actual implementation of method +TInt CMMFGsmConfig::ConversionFormat(TMMFGsmConversionFormat& aConvFormat) const + { + aConvFormat = iConvFormat; + return KErrNone; + } + + +/* +CGsmConfigTestDevice Implementation +*/ +CMMFHwDevice* CGsmConfigTestDevice::NewL() + { + CGsmConfigTestDevice* self=new(ELeave) CGsmConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CGsmConfigTestDevice::~CGsmConfigTestDevice() + { + delete iGsmConfig; + } + +CGsmConfigTestDevice::CGsmConfigTestDevice() + { + } + +void CGsmConfigTestDevice::ConstructL() + { + } + +TInt CGsmConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CGsmConfigTestDevice::Stop() + { + return 0; + } + +TInt CGsmConfigTestDevice::Pause() + { + return 0; + } + +TInt CGsmConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CGsmConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidGsmConfig) + { + if (!iGsmConfig) + { + TRAPD(err, iGsmConfig = CMMFGsmConfig::NewL()); + if (err == KErrNone && iGsmConfig) + { + MMMFGsmConfig* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CGsmConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CGsmConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CGsmConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CGsmConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CGsmConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CGsmConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CGsmConfigTestDevice::SetConversionFormat(TMMFGsmConversionFormat aConvFormat) + { + TInt result = KErrBadHandle; + + if (iGsmConfig) + { + result = iGsmConfig->SetConversionFormat(aConvFormat); + } + + return result; + } + +TInt CGsmConfigTestDevice::ConversionFormat(TMMFGsmConversionFormat& aConvFormat) const + { + TInt result = KErrBadHandle; + + if (iGsmConfig) + { + result = iGsmConfig->ConversionFormat(aConvFormat); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/gsmconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/gsmconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,80 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef GSMCONFIGTESTDEVICE_H +#define GSMCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFGsmConfig : public CBase, + public MMMFGsmConfig + { +public: + //return Pointer to the CMMFGsmConfig class + static CMMFGsmConfig* NewL(); + + //Destructor + ~CMMFGsmConfig(); + + // from MMMFGsmConfig + TInt SetConversionFormat(TMMFGsmConversionFormat aConvFormat); + TInt ConversionFormat(TMMFGsmConversionFormat& aConvFormat) const; + +private: + TMMFGsmConversionFormat iConvFormat; + }; + + +/* +CGsmConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CGsmConfigTestDevice : public CMMFSwCodecWrapper, + public MMMFGsmConfig + { +public: + static CMMFHwDevice* NewL(); + virtual ~CGsmConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MMMFGsmConfig + TInt SetConversionFormat(MMMFGsmConfig::TMMFGsmConversionFormat aConvFormat); + TInt ConversionFormat(MMMFGsmConfig::TMMFGsmConversionFormat& aConvFormat) const; + +private: + CGsmConfigTestDevice(); + void ConstructL(); + +private: + CMMFGsmConfig* iGsmConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcdecoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcdecoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,217 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "ilbcdecoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + +/* +CMMFIlbcDecoderConfig implementation +*/ +CMMFIlbcDecoderConfig* CMMFIlbcDecoderConfig::NewL() + { + CMMFIlbcDecoderConfig* self = new(ELeave) CMMFIlbcDecoderConfig(); + return self; + } + +CMMFIlbcDecoderConfig::~CMMFIlbcDecoderConfig() + { + } + +//Actual implementation of method SetDecoderMode +TInt CMMFIlbcDecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode) + { + RFs fs; + RFile file; + TInt err = KErrNone; + + if ( KErrNone != (err = fs.Connect()) ) + { + return err; + } + + // this file name will be use on the testStep to compare the stored value. + _LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt"); + fs.MkDirAll(KFileName); + + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) ) + { + return err; + } + + TBuf8<4> data; + data.Format(_L8("%d"), aDecodeMode); + + file.Write(data); + file.Close(); + fs.Close(); + + return err; + } + +//Actual implementation of method SetCng +TInt CMMFIlbcDecoderConfig::SetComfortNoiseGeneration(TBool aCng) + { + iCng = aCng; + return KErrNone; + } + +//Actual implementation of method GetCng +TInt CMMFIlbcDecoderConfig::GetComfortNoiseGeneration(TBool& aCng) + { + aCng = iCng; + return KErrNone; + } + + +/* +CIlbcDecoderConfigTestDevice implementation +*/ +CMMFHwDevice* CIlbcDecoderConfigTestDevice::NewL() + { + CIlbcDecoderConfigTestDevice* self=new(ELeave) CIlbcDecoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CIlbcDecoderConfigTestDevice::~CIlbcDecoderConfigTestDevice() + { + delete iIlbcDecoderConfig; + } + +CIlbcDecoderConfigTestDevice::CIlbcDecoderConfigTestDevice() + { + } + +void CIlbcDecoderConfigTestDevice::ConstructL() + { + } + +TInt CIlbcDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CIlbcDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidIlbcDecoderIntfc) + { + if (!iIlbcDecoderConfig) + { + TRAPD(err, iIlbcDecoderConfig = CMMFIlbcDecoderConfig::NewL()); + if (err == KErrNone && iIlbcDecoderConfig) + { + MIlbcDecoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CIlbcDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CIlbcDecoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CIlbcDecoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CIlbcDecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode) + { + TInt result = KErrBadHandle; + + if (iIlbcDecoderConfig) + { + result = iIlbcDecoderConfig->SetDecoderMode(aDecodeMode); + } + + return result; + } + +TInt CIlbcDecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng) + { + TInt result = KErrBadHandle; + + if (iIlbcDecoderConfig) + { + result = iIlbcDecoderConfig->SetComfortNoiseGeneration(aCng); + } + + return result; + } + +TInt CIlbcDecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng) + { + TInt result = KErrBadHandle; + + if (iIlbcDecoderConfig) + { + result = iIlbcDecoderConfig->GetComfortNoiseGeneration(aCng); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcdecoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcdecoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,83 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef ILBCDECODERCONFIGTESTDEVICE_H +#define ILBCDECODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFIlbcDecoderConfig : public CBase, + public MIlbcDecoderIntfc + { +public: + //return Pointer to the CMMFIlbcDecoderConfig class + static CMMFIlbcDecoderConfig* NewL(); + + //Destructor + ~CMMFIlbcDecoderConfig(); + + // from mirror MIlbcDecoderIntfc method. + TInt SetDecoderMode(TDecodeMode aDecodeMode); + TInt SetComfortNoiseGeneration(TBool aCng); + TInt GetComfortNoiseGeneration(TBool& aCng); + +private: + TDecodeMode iDecodeMode; + TBool iCng; + }; + + +/* +CIlbcDecoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CIlbcDecoderConfigTestDevice : public CMMFSwCodecWrapper, + public MIlbcDecoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CIlbcDecoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from mirror MIlbcDecoderIntfc method. + TInt SetDecoderMode(TDecodeMode aDecodeMode); + TInt SetComfortNoiseGeneration(TBool aCng); + TInt GetComfortNoiseGeneration(TBool& aCng); + +private: + CIlbcDecoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFIlbcDecoderConfig* iIlbcDecoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcencoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcencoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,214 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "ilbcencoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + +/* +CMMFIlbcEncoderConfig implementation +*/ +CMMFIlbcEncoderConfig* CMMFIlbcEncoderConfig::NewL() + { + CMMFIlbcEncoderConfig* self = new(ELeave) CMMFIlbcEncoderConfig(); + return self; + } + +CMMFIlbcEncoderConfig::~CMMFIlbcEncoderConfig() + { + } + +//Actual implementation of method SetEncoderMode +TInt CMMFIlbcEncoderConfig::SetEncoderMode(TEncodeMode aEncodeMode) + { + iEncodeMode = aEncodeMode; + + return KErrNone; + } + +//Actual implementation of method GetEncoderMode +TInt CMMFIlbcEncoderConfig::GetEncoderMode(TEncodeMode& aEncodeMode) + { + aEncodeMode = iEncodeMode; + + return KErrNone; + } + +//Actual implementation of method SetVadMode +TInt CMMFIlbcEncoderConfig::SetVadMode(TBool aVadModeOn) + { + iVadModeOn = aVadModeOn; + return KErrNone; + } + +//Actual implementation of method GetVadMode +TInt CMMFIlbcEncoderConfig::GetVadMode(TBool& aVadModeOn) + { + aVadModeOn = iVadModeOn; + return KErrNone; + } + + +/* +CIlbcEncoderConfigTestDevice implementation +*/ +CMMFHwDevice* CIlbcEncoderConfigTestDevice::NewL() + { + CIlbcEncoderConfigTestDevice* self=new(ELeave) CIlbcEncoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CIlbcEncoderConfigTestDevice::~CIlbcEncoderConfigTestDevice() + { + delete iIlbcEncoderConfig; + } + +CIlbcEncoderConfigTestDevice::CIlbcEncoderConfigTestDevice() + { + } + +void CIlbcEncoderConfigTestDevice::ConstructL() + { + } + +TInt CIlbcEncoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CIlbcEncoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidIlbcEncoderIntfc) + { + if (!iIlbcEncoderConfig) + { + TRAPD(err, iIlbcEncoderConfig = CMMFIlbcEncoderConfig::NewL()); + if (err == KErrNone && iIlbcEncoderConfig) + { + MIlbcEncoderIntfc* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CIlbcEncoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CIlbcEncoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CIlbcEncoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CIlbcEncoderConfigTestDevice::SetEncoderMode(TEncodeMode aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iIlbcEncoderConfig) + { + result = iIlbcEncoderConfig->SetEncoderMode(aEncodeMode); + } + + return result; + } + +TInt CIlbcEncoderConfigTestDevice::GetEncoderMode(TEncodeMode& aEncodeMode) + { + TInt result = KErrBadHandle; + + if (iIlbcEncoderConfig) + { + result = iIlbcEncoderConfig->GetEncoderMode(aEncodeMode); + } + + return result; + } + +TInt CIlbcEncoderConfigTestDevice::SetVadMode(TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iIlbcEncoderConfig) + { + result = iIlbcEncoderConfig->SetVadMode(aVadModeOn); + } + + return result; + } + +TInt CIlbcEncoderConfigTestDevice::GetVadMode(TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iIlbcEncoderConfig) + { + result = iIlbcEncoderConfig->GetVadMode(aVadModeOn); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcencoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/ilbcencoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,85 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef ILBCENCODERCONFIGTESTDEVICE_H +#define ILBCENCODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFIlbcEncoderConfig : public CBase, + public MIlbcEncoderIntfc + { +public: + //return Pointer to the CMMFIlbcEncoderConfig class + static CMMFIlbcEncoderConfig* NewL(); + + //Destructor + ~CMMFIlbcEncoderConfig(); + + // from MIlbcEncoderConfig + TInt SetEncoderMode(TEncodeMode aEncodeMode); + TInt GetEncoderMode(TEncodeMode& aEncodeMode); + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + +private: + TEncodeMode iEncodeMode; + TBool iVadModeOn; + }; + + +/* +CIlbcEncoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CIlbcEncoderConfigTestDevice : public CMMFSwCodecWrapper, + public MIlbcEncoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CIlbcEncoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MIlbcEncoderIntfc + TInt SetEncoderMode(TEncodeMode aEncodeMode); + TInt GetEncoderMode(TEncodeMode& aEncodeMode); + TInt SetVadMode(TBool aVadModeOn); + TInt GetVadMode(TBool& aVadModeOn); + +private: + CIlbcEncoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFIlbcEncoderConfig* iIlbcEncoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/playbackstatustestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/playbackstatustestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,172 @@ +// Copyright (c) 2007-2009 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 + +#include "playbackstatustestdevice.h" +#include "cidefine.h" + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CPlaybackStatusTestDevice::NewL() + { + CPlaybackStatusTestDevice* self=new(ELeave) CPlaybackStatusTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CPlaybackStatusTestDevice::~CPlaybackStatusTestDevice() + { + } + +/*****************************************************************************/ +CPlaybackStatusTestDevice::CPlaybackStatusTestDevice() + { + } + +/*****************************************************************************/ +void CPlaybackStatusTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CPlaybackStatusTestDevice::CustomInterface(TUid aInterfaceId) + { + MMMFPlaybackStatus* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidPlaybackStatus) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CPlaybackStatusTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CPlaybackStatusTestDevice::MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus) + { + aStatus.aInputBytes = 999; + aStatus.aDecodedSamples = 999; + aStatus.aDecodedSamplesPlayed = 999; + aStatus.aSystemTime = 999; + aStatus.aTotalSamplesPlayed = 999; + + return KErrNone; + } + +TInt CPlaybackStatusTestDevice::MmpsRequestLossOfSyncNotification() + { + // Set a flag in a file that the test step can read... + TRAPD(err, WriteSyncNotificationToFileL(ETrue)); + + return err; + } + +TInt CPlaybackStatusTestDevice::MmpsCancelLossOfSyncNotification() + { + // Set a flag in a file that the test step can read... + TRAPD(err, WriteSyncNotificationToFileL(EFalse)); + return err; + } + +// aWriteRequest is set to ETrue when output to file should signify +// call from MmpsRequestLossOfSyncNotification(), otherwise set it to EFalse +// when called from MmpsCancelLossOfSyncNotification() +void CPlaybackStatusTestDevice::WriteSyncNotificationToFileL(TBool aWriteRequest) + { + // File handling + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File doesn't yet exist + // It is the responsibility of the calling test function to delete the file after use + User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); + TBuf8 outputBuf; + outputBuf.Num(aWriteRequest); + User::LeaveIfError(file.Write(outputBuf)); + CleanupStack::PopAndDestroy(2); // fs, file + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/playbackstatustestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/playbackstatustestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef PLAYBACKSTATUSTESTDEVICE_H +#define PLAYBACKSTATUSTESTDEVICE_H + +#include +#include + + +/** +* +* CPlaybackStatusTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +* +*/ +class CPlaybackStatusTestDevice : public CMMFSwCodecWrapper, + public MMMFPlaybackStatus + { +public: + static CMMFHwDevice* NewL(); + virtual ~CPlaybackStatusTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MMMFPlaybackStatus + TInt MmpsGetPlaybackStatusInformation(TMMFPlaybackStatus& aStatus); + TInt MmpsRequestLossOfSyncNotification(); + TInt MmpsCancelLossOfSyncNotification(); + +private: + CPlaybackStatusTestDevice(); + void ConstructL(); + +private: + void WriteSyncNotificationToFileL(TBool aWriteRequest); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/sbcencodertestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/sbcencodertestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,300 @@ +// Copyright (c) 2007-2009 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 + +#include "sbcencodertestdevice.h" + + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CSbcEncoderTestDevice::NewL() + { + CSbcEncoderTestDevice* self = new(ELeave) CSbcEncoderTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CSbcEncoderTestDevice::~CSbcEncoderTestDevice() + { + } + +/*****************************************************************************/ +CSbcEncoderTestDevice::CSbcEncoderTestDevice() + { + } + +/*****************************************************************************/ +void CSbcEncoderTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CSbcEncoderTestDevice::CustomInterface(TUid aInterfaceId) + { + MSbcEncoderIntfc* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidSbcEncoderIntfc) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CSbcEncoderTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CSbcEncoderTestDevice::GetSupportedSamplingFrequencies ( RArray& aSamplingFrequencies ) + { + TInt retVal = KErrNone; + // Assume the strategy is to hard code a set of frequencies... + // + // Reset the input array + aSamplingFrequencies.Reset(); + // Populate the array + TUint value = 0; + for (TInt i = 0; i < 10; i++) + { + retVal = aSamplingFrequencies.Append(value); + if (retVal != KErrNone) + { + break; + } + value += 1000; + } + + return retVal; + } + +TInt CSbcEncoderTestDevice::GetSupportedChannelModes ( RArray& aChannelModes ) + { + TInt retVal = KErrNone; + aChannelModes.Reset(); + retVal = aChannelModes.Append(ESbcChannelMono); + if (retVal == KErrNone) + { + retVal = aChannelModes.Append(ESbcChannelDual); + if (retVal == KErrNone) + { + retVal = aChannelModes.Append(ESbcChannelStereo); + if (retVal == KErrNone) + { + retVal = aChannelModes.Append(ESbcChannelJointStereo); + } + } + } + return retVal; + } + +TInt CSbcEncoderTestDevice::GetSupportedNumOfSubbands ( RArray& aNumOfSubbands ) + { + TInt retVal = KErrNone; + aNumOfSubbands.Reset(); + TUint val = 100; + for (TInt i = 0; i < 5; i++) + { + retVal = aNumOfSubbands.Append(val); + if (retVal != KErrNone) + { + break; + } + val += 100; + } + return retVal; + } + +TInt CSbcEncoderTestDevice::GetSupportedAllocationMethods ( RArray& aAllocationMethods ) + { + TInt retVal = KErrNone; + aAllocationMethods.Reset(); + retVal = aAllocationMethods.Append(ESbcAllocationSNR); + if (retVal == KErrNone) + { + retVal = aAllocationMethods.Append(ESbcAllocationLoudness); + } + return retVal; + } + +TInt CSbcEncoderTestDevice::GetSupportedNumOfBlocks ( RArray& aNumOfBlocks ) + { + TInt retVal = KErrNone; + aNumOfBlocks.Reset(); + TUint val = 1; + for (TInt i = 0; i < 10; i++, val++) + { + retVal = aNumOfBlocks.Append(val); + if (retVal != KErrNone) + { + break; + } + } + return retVal; + } + +TInt CSbcEncoderTestDevice::GetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize) + { + // Arbitrary values + aMinSupportedBitpoolSize = 1; + aMaxSupportedBitpoolSize = 2; + + return KErrNone; + } + +void CSbcEncoderTestDevice::SetSamplingFrequency ( TUint aSamplingFrequency ) + { + iSamplingFrequency = aSamplingFrequency; + } + +void CSbcEncoderTestDevice::SetChannelMode (TSbcChannelMode aChannelMode ) + { + iChannelMode = aChannelMode; + } + +void CSbcEncoderTestDevice::SetNumOfSubbands ( TUint aNumOfSubbands ) + { + iNumOfSubbands = aNumOfSubbands; + } + +void CSbcEncoderTestDevice::SetAllocationMethod (TSbcAllocationMethod aAllocationMethod ) + { + iAllocMethod = aAllocationMethod; + } + +void CSbcEncoderTestDevice::SetBitpoolSize (TUint aBitpoolSize ) + { + iBitpoolSize = aBitpoolSize; + } + +TInt CSbcEncoderTestDevice::ApplyConfig() + { + iApplyConfig = ETrue; + return KErrNone; + } + +TInt CSbcEncoderTestDevice::GetSamplingFrequency ( TUint& aSamplingFrequency ) + { + TInt retVal = KErrNone; + aSamplingFrequency = iSamplingFrequency; + return retVal; + } + +TInt CSbcEncoderTestDevice::GetChannelMode (TSbcChannelMode& aChannelMode ) + { + TInt retVal = KErrNone; + aChannelMode = iChannelMode; + return retVal; + } + +TInt CSbcEncoderTestDevice::GetNumOfSubbands ( TUint& aNumOfSubbands ) + { + TInt retVal = KErrNone; + aNumOfSubbands = iNumOfSubbands; + + return retVal; + } + +TInt CSbcEncoderTestDevice::GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod ) + { + TInt retVal = KErrNone; + aAllocationMethod = iAllocMethod; + return retVal; + } + +TInt CSbcEncoderTestDevice::GetBitpoolSize (TUint& aBitpoolSize ) + { + TInt retVal = KErrNone; + aBitpoolSize = iBitpoolSize; + return retVal; + } + +void CSbcEncoderTestDevice::SetNumOfBlocks ( TUint aNumOfBlocks ) + { + iNumOfBlocks = aNumOfBlocks; + } + +TInt CSbcEncoderTestDevice::GetNumOfBlocks ( TUint& aNumOfBlocks ) + { + TInt retVal = KErrNone; + aNumOfBlocks = iNumOfBlocks; + return retVal; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/sbcencodertestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/sbcencodertestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef SBCENCODERTESTDEVICE_H +#define SBCENCODERTESTDEVICE_H + +#include +#include + + +/** +* +* CSbcEncoderTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CSbcEncoderTestDevice : public CMMFSwCodecWrapper, public MSbcEncoderIntfc + { +public: + static CMMFHwDevice* NewL(); + virtual ~CSbcEncoderTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MSbcEncoderIntfc + virtual TInt GetSupportedSamplingFrequencies ( RArray& aSamplingFrequencies ); + virtual TInt GetSupportedChannelModes ( RArray& aChannelModes ); + virtual TInt GetSupportedNumOfSubbands ( RArray& aNumOfSubbands ); + virtual TInt GetSupportedAllocationMethods ( RArray& aAllocationMethods ); + virtual TInt GetSupportedNumOfBlocks ( RArray& aNumOfBlocks ); + + virtual TInt GetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize); + virtual void SetSamplingFrequency ( TUint aSamplingFrequency ); + virtual void SetChannelMode (TSbcChannelMode aChannelMode ); + virtual void SetNumOfSubbands ( TUint aNumOfSubbands ); + virtual void SetNumOfBlocks ( TUint aNumOfBlocks ); + virtual void SetAllocationMethod (TSbcAllocationMethod aAllocationMethod ); + virtual void SetBitpoolSize (TUint aBitpoolSize ); + virtual TInt ApplyConfig(); + virtual TInt GetSamplingFrequency ( TUint& aSamplingFrequency ); + virtual TInt GetChannelMode (TSbcChannelMode& aChannelMode ); + virtual TInt GetNumOfSubbands ( TUint& aNumOfSubbands ); + virtual TInt GetNumOfBlocks ( TUint& aNumOfBlocks ); + virtual TInt GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod ); + virtual TInt GetBitpoolSize (TUint& aBitpoolSize ); + +private: + CSbcEncoderTestDevice(); + void ConstructL(); +private: + TUint iSamplingFrequency; + TSbcChannelMode iChannelMode; + TUint iNumOfSubbands; + TUint iNumOfBlocks; + TSbcAllocationMethod iAllocMethod; + TUint iBitpoolSize; + TBool iApplyConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/setdrmprotectedtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/setdrmprotectedtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,150 @@ +// Copyright (c) 2007-2009 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 +#include +#include "setdrmprotectedtestdevice.h" +#include "cidefine.h" + +/*****************************************************************************/ +// Implementation + +CMMFHwDevice* CSetDRMProtectedTestDevice::NewL() + { + CSetDRMProtectedTestDevice* self = new(ELeave) CSetDRMProtectedTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/*****************************************************************************/ +CSetDRMProtectedTestDevice::~CSetDRMProtectedTestDevice() + { + } + +/*****************************************************************************/ +CSetDRMProtectedTestDevice::CSetDRMProtectedTestDevice() + { + } + +/*****************************************************************************/ +void CSetDRMProtectedTestDevice::ConstructL() + { + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::Stop() + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::Pause() + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +/*****************************************************************************/ +TAny* CSetDRMProtectedTestDevice::CustomInterface(TUid aInterfaceId) + { + MMMFSetDRMProtected* interface = NULL; + + // DevSound initialisation requires something to be returned for both of + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface + if ((aInterfaceId == KUidSetDRMProtected) || // This interface + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) + { + interface = this; + } + + return interface; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::StopAndDeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::DeleteCodec() + { + return 0; + } + +/*****************************************************************************/ +CMMFSwCodec& CSetDRMProtectedTestDevice::Codec() + { + return *iCodec; + } + +/*****************************************************************************/ +TInt CSetDRMProtectedTestDevice::MmsdpMarkDataAsDRMProtected(TBool aDRMProtected) + { + TRAPD(err, DoWriteToFileL(aDRMProtected)); + return err; + } + +void CSetDRMProtectedTestDevice::DoWriteToFileL(TBool aFlag) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File doesn't yet exist + // It is the responsibility of the calling test function to delete the file after use + User::LeaveIfError(file.Create(fs, KCITestFileName, EFileWrite)); + TBuf8 outputBuf; + outputBuf.Num(aFlag); + User::LeaveIfError(file.Write(outputBuf)); + CleanupStack::PopAndDestroy(2); // fs, file + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/setdrmprotectedtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/setdrmprotectedtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef SETDRMPROTECTEDTESTDEVICE_H +#define SETDRMPROTECTEDTESTDEVICE_H + +#include +#include + +/** +* +* CSetDRMProtectedTestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CSetDRMProtectedTestDevice : public CMMFSwCodecWrapper, public MMMFSetDRMProtected + { +public: + static CMMFHwDevice* NewL(); + virtual ~CSetDRMProtectedTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from MMMFSetDRMProtected + virtual TInt MmsdpMarkDataAsDRMProtected(TBool aDRMProtected); + +private: + CSetDRMProtectedTestDevice(); + void ConstructL(); + void DoWriteToFileL(TBool aFlag); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/speechencoderconfigtestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/speechencoderconfigtestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,238 @@ +/* +* Copyright (c) 2007 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 +#include +#include +#include "speechencoderconfigtestdevice.h" +#include "devsoundciutestdevices.hrh" + +/* +CMMFSpeechEncoderConfig implementation +*/ +CMMFSpeechEncoderConfig* CMMFSpeechEncoderConfig::NewL() + { + CMMFSpeechEncoderConfig* self = new(ELeave) CMMFSpeechEncoderConfig(); + return self; + } + +CMMFSpeechEncoderConfig::~CMMFSpeechEncoderConfig() + { + } + +//Actual implementation of method SetBitrate +TInt CMMFSpeechEncoderConfig::SetBitrate(TUint aBitrate) + { + iBitrate = aBitrate; + return KErrNone; + } + +//Actual implementation of method GetBitrate +TInt CMMFSpeechEncoderConfig::GetBitrate (TUint& aBitrate) + { + aBitrate = iBitrate; + return KErrNone; + } + +//Actual implementation of method GetSupportedBitrates +TInt CMMFSpeechEncoderConfig::GetSupportedBitrates(RArray& aSupportedBitrates) + { + aSupportedBitrates.Append(12345); + aSupportedBitrates.Append(23456); + aSupportedBitrates.Append(34567); + aSupportedBitrates.Append(45678); + aSupportedBitrates.Append(56789); + return KErrNone; + } + +//Actual implementation of method SetVadMode +TInt CMMFSpeechEncoderConfig::SetVadMode(TBool aVadModeOn) + { + iVadModeOn = aVadModeOn; + return KErrNone; + } + +//Actual implementation of method GetVadMode +TInt CMMFSpeechEncoderConfig::GetVadMode(TBool& aVadModeOn) + { + aVadModeOn = iVadModeOn; + return KErrNone; + } + + +/* +CSpeechEncoderConfigTestDevice implementation +*/ +CMMFHwDevice* CSpeechEncoderConfigTestDevice::NewL() + { + CSpeechEncoderConfigTestDevice* self=new(ELeave) CSpeechEncoderConfigTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CSpeechEncoderConfigTestDevice::~CSpeechEncoderConfigTestDevice() + { + delete iSpeechEncoderConfig; + } + +CSpeechEncoderConfigTestDevice::CSpeechEncoderConfigTestDevice() + { + } + +void CSpeechEncoderConfigTestDevice::ConstructL() + { + } + +TInt CSpeechEncoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::Stop() + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::Pause() + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CSpeechEncoderConfigTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidSpeechEncoderConfig) + { + if (!iSpeechEncoderConfig) + { + TRAPD(err, iSpeechEncoderConfig = CMMFSpeechEncoderConfig::NewL()); + if (err == KErrNone && iSpeechEncoderConfig) + { + MSpeechEncoderConfig* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CSpeechEncoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CSpeechEncoderConfigTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CSpeechEncoderConfigTestDevice::Codec() + { + return *iCodec; + } + +TInt CSpeechEncoderConfigTestDevice::SetBitrate(TUint aBitrate) + { + TInt result = KErrBadHandle; + + if (iSpeechEncoderConfig) + { + result = iSpeechEncoderConfig->SetBitrate(aBitrate); + } + + return result; + } + +TInt CSpeechEncoderConfigTestDevice::GetBitrate(TUint& aBitrate) + { + TInt result = KErrBadHandle; + + if (iSpeechEncoderConfig) + { + result = iSpeechEncoderConfig->GetBitrate(aBitrate); + } + + return result; + } + +TInt CSpeechEncoderConfigTestDevice::GetSupportedBitrates(RArray& aSupportedBitrates) + { + TInt result = KErrBadHandle; + + if (iSpeechEncoderConfig) + { + result = iSpeechEncoderConfig->GetSupportedBitrates(aSupportedBitrates); + } + + return result; + } + +TInt CSpeechEncoderConfigTestDevice::SetVadMode(TBool aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iSpeechEncoderConfig) + { + result = iSpeechEncoderConfig->SetVadMode(aVadModeOn); + } + + return result; + } + +TInt CSpeechEncoderConfigTestDevice::GetVadMode(TBool& aVadModeOn) + { + TInt result = KErrBadHandle; + + if (iSpeechEncoderConfig) + { + result = iSpeechEncoderConfig->GetVadMode(aVadModeOn); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/speechencoderconfigtestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/speechencoderconfigtestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,87 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef SPEECHENCODERCONFIGTESTDEVICE_H +#define SPEECHENCODERCONFIGTESTDEVICE_H + +#include +#include + + +class CMMFSpeechEncoderConfig : public CBase, + public MSpeechEncoderConfig + { +public: + //return Pointer to the CMMFSpeechEncoderConfig class + static CMMFSpeechEncoderConfig* NewL(); + + //Destructor + ~CMMFSpeechEncoderConfig(); + + // from mirror MSpeechEncoderConfig method. + TInt SetBitrate (TUint aBitrate); + TInt GetBitrate (TUint& aBitrate); + TInt GetSupportedBitrates (RArray& aSupportedBitrates ); + TInt SetVadMode (TBool aVadModeOn ); + TInt GetVadMode (TBool& aVadModeOn ); + +private: + TUint iBitrate; + TBool iVadModeOn; + }; + + +/* +CSpeechEncoderConfigTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CSpeechEncoderConfigTestDevice : public CMMFSwCodecWrapper, + public MSpeechEncoderConfig + { +public: + static CMMFHwDevice* NewL(); + virtual ~CSpeechEncoderConfigTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // from mirror MSpeechEncoderConfig method. + TInt SetBitrate ( TUint aBitrate ); + TInt GetBitrate (TUint& aBitrate ); + TInt GetSupportedBitrates (RArray& aSupportedBitrates ); + TInt SetVadMode (TBool aVadModeOn ); + TInt GetVadMode (TBool& aVadModeOn ); + +private: + CSpeechEncoderConfigTestDevice(); + void ConstructL(); + +private: + CMMFSpeechEncoderConfig* iSpeechEncoderConfig; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaacdecoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaacdecoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,212 @@ +// Copyright (c) 2007-2009 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 "teststepciaacdecoderconfig.h" + + +TVerdict CTestStepCIAacDecoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0004-HP")) == 0) + { + iTestStepResult = DoTestStep0004L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) == 0) + { + iTestStepResult = DoTestStep0005L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) == 0) + { + iTestStepResult = DoTestStep0093L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0004L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AacDecoderConfig - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAacDecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','0','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidCustomInterfaceDevSoundAacConfig + MAacDecoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAacDecoderConfig)); + + if (ptr) + { + INFO_PRINTF1(_L("MAacDecoderConfig initialized successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MAacDecoderConfig failed to initialize")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0005L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("AacDecoderConfig - SetAudioConfig")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAacDecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','0','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidCustomInterfaceDevSoundAacConfig + MAacDecoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAacDecoderConfig)); + + if (ptr) + { + MAacDecoderConfig::TAudioConfig audioConfig; + + // Set values before call. + audioConfig.iAudioObjectType = MAacDecoderConfig::TAudioConfig::EAacSsr; + + result = ptr->SetAudioConfig(audioConfig); // call method + + if (result == KErrNone) + { + TInt retAudioConfig; + + // This file is created by the test stub, the plugin device + _LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt"); + + ReadFileL(KFileName, retAudioConfig); + + if (retAudioConfig == audioConfig.iAudioObjectType) + { + INFO_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MAacDecoderConfig::SetAudioConfig failed - expected and received mismatch")); + } + } + } + else + { + INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAacDecoderConfig::DoTestStep0093L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("AacDecoderConfig - GetSupportedAudioConfigs")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAacDecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','0','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidCustomInterfaceDevSoundAacConfig + MAacDecoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAacDecoderConfig)); + + if (ptr) + { + RArray audioConfig; + + result = ptr->GetSupportedAudioConfigs(audioConfig); // call method + + if (result == KErrNone) + { + if ( (audioConfig[0].iAudioObjectType == MAacDecoderConfig::TAudioConfig::ESbr) && + (audioConfig[1].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLtp) && + (audioConfig[2].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacSsr) && + (audioConfig[3].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacLc) && + (audioConfig[4].iAudioObjectType == MAacDecoderConfig::TAudioConfig::EAacMain) ) + { + INFO_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed - expected and received mismatch")); + } + } + else + { + ERR_PRINTF2(_L("MAacDecoderConfig::GetSupportedAudioConfigs failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MAacDecoderConfig failed to initialize")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaacdecoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaacdecoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIAACDECODERCONFIG_H +#define TESTSTEPCIAACDECODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIAacDecoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIAacDecoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0004L(); + TVerdict DoTestStep0005L(); + TVerdict DoTestStep0093L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciadvancedaacencodesettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciadvancedaacencodesettings.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,137 @@ +// Copyright (c) 2007-2009 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 "teststepciadvancedaacencodesettings.h" +#include "cidefine.h" + +/*****************************************************************************/ +CTestStepCICreateAdvancedAacEncodeSettings::CTestStepCICreateAdvancedAacEncodeSettings() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0006-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCICreateAdvancedAacEncodeSettings::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAdvancedAacEncodeSettingsTestDevice}; + #else + TFourCC testUID('T','0','0','5'); + #endif + + MMMFAdvancedAACEncodeSettings* interface = NULL; + interface = static_cast( + InitializeAndInstantiateInterfaceL(testUID, KUidAdvancedAACEncoderSettings)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIAdvancedAacEncodeSettings::CTestStepCIAdvancedAacEncodeSettings(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0099-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0007-HP"); + } + } + +/*****************************************************************************/ +TVerdict CTestStepCIAdvancedAacEncodeSettings::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAdvancedAacEncodeSettingsTestDevice}; + #else + TFourCC testUID('T','0','0','5'); + #endif + + MMMFAdvancedAACEncodeSettings* interface = NULL; + interface = static_cast( + InitializeAndInstantiateInterfaceL(testUID, KUidAdvancedAACEncoderSettings)); + + if (interface) + { + MMMFAdvancedAACEncodeSettings::TAACBitrateMode bitrateMode = MMMFAdvancedAACEncodeSettings::EAACBitrateModeFixed; + INFO_PRINTF1(_L("Calling test CI method")); + TInt err = interface->SetAACEncodeBitrateMode(bitrateMode); + + if (iIsGetTest) + { + INFO_PRINTF1(_L("Testing GetAACEncodeBitrateMode")); + } + else + { + INFO_PRINTF1(_L("Testing SetAACEncodeBitrateMode")); + } + + if (err == KErrNone) + { + // Successfully set the mode + INFO_PRINTF1(_L("Set the mode successfully")); + + MMMFAdvancedAACEncodeSettings::TAACBitrateMode testMode; + + err = interface->GetAACEncodeBitrateMode(testMode); + + iTestStepResult = EFail; + if ((err == KErrNone) && (testMode == bitrateMode)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + ERR_PRINTF4(_L("Test CI method failed, error: %d, expected value: %d, actual value: %d"), \ + err, bitrateMode, testMode); + } + } + else + { + ERR_PRINTF2(_L("Test CI method failed, error"), err); + } + } + else + { + WARN_PRINTF1(_L("Failed to retrieve the custom interface.")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciadvancedaacencodesettings.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciadvancedaacencodesettings.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIADVANCEDAACENCODESETTINGS_H +#define TESTSTEPCIADVANCEDAACENCODESETTINGS_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCICreateAdvancedAacEncodeSettings : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCICreateAdvancedAacEncodeSettings(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIAdvancedAacEncodeSettings : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIAdvancedAacEncodeSettings(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiobufferprefill.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiobufferprefill.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,348 @@ +// Copyright (c) 2007-2009 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 "teststepciaudiobufferprefill.h" + +const TInt32 KAfterThreeSeconds = 3000000; // Three seconds +const TInt32 KEveryNinetySeconds = 90000000; // Ninety seconds + + +TVerdict CTestStepCISampleBuffering::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0069-HP")) == 0) + { + iTestStepResult = DoTestStep0069L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0070-HP")) == 0) + { + iTestStepResult = DoTestStep0070L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0071-HP")) == 0) + { + iTestStepResult = DoTestStep0071L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0072-HP")) == 0) + { + iTestStepResult = DoTestStep0072L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0073-HP")) == 0) + { + iTestStepResult = DoTestStep0073L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISampleBuffering::DoTestStep0069L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("SampleBuffering - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSampleBufferingTestDevice}; + #else + TFourCC testUID('T','0','1','2'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMMFSampleBuffering + MMMFSampleBuffering* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSampleBuffering)); + + if (ptr) + { + INFO_PRINTF1(_L("MMMFSampleBuffering instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISampleBuffering::DoTestStep0070L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("SampleBuffering - MmsbEnableSampleBufferingBeforePlayback")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSampleBufferingTestDevice}; + #else + TFourCC testUID('T','0','1','2'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMMFSampleBuffering + MMMFSampleBuffering* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSampleBuffering)); + + if (ptr) + { + result = ptr->MmsbEnableSampleBufferingBeforePlayback(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbEnableSampleBufferingBeforePlayback failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISampleBuffering::DoTestStep0071L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("SampleBuffering - MmsbDisableSampleBufferingBeforePlayback")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSampleBufferingTestDevice}; + #else + TFourCC testUID('T','0','1','2'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMMFSampleBuffering + MMMFSampleBuffering* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSampleBuffering)); + + if (ptr) + { + + result = ptr->MmsbDisableSampleBufferingBeforePlayback(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbDisableSampleBufferingBeforePlayback failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISampleBuffering::DoTestStep0072L() + { + iTestStepResult = EFail; + TInt err; + + INFO_PRINTF1(_L("SampleBuffering - MmsbNotifyPlayStarted")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSampleBufferingTestDevice}; + #else + TFourCC testUID('T','0','1','2'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMMFSampleBuffering + MMMFSampleBuffering* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSampleBuffering)); + + if (ptr) + { + CActiveListener* listener = new(ELeave)CActiveListener; + + listener->InitialiseActiveListener(); + + ptr->MmsbNotifyPlayStarted(listener->iStatus); // call method + + CActiveScheduler::Start(); + + err = listener->iStatus.Int(); + + delete listener; + + if (err == KErrNotSupported) + { + INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFSampleBuffering::MmsbNotifyPlayStarted failed with err %d"), err); + } + } + else + { + INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISampleBuffering::DoTestStep0073L() + { + iTestStepResult = EFail; + TInt err; + + INFO_PRINTF1(_L("SampleBuffering - MmsbCancelNotifyPlayStarted")); + + TCallBack callback(CTestStepCISampleBuffering::Callback, this); + + iTimer = CPeriodic::NewL(EPriorityNormal); + + // Here we use periodic timer to enable us to call MmsbCancelNotifyPlayStarted() after three + // seconds of issuing MmsbNotifyPlayStarted(). Ninety seconds is long enough to stop the timer + // before sending a second MmsbCancelNotifyPlayStarted() . + iTimer->Start(KAfterThreeSeconds, KEveryNinetySeconds, callback); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSampleBufferingTestDevice}; + #else + TFourCC testUID('T','0','1','2'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMMFSampleBuffering + iInterfacePtr = static_cast (iMMFDevSound->CustomInterface(KUidSampleBuffering)); + + if (iInterfacePtr) + { + CActiveListener* listener = new(ELeave) CActiveListener; + listener->InitialiseActiveListener(); + + iInterfacePtr->MmsbNotifyPlayStarted(listener->iStatus); // call method + + CActiveScheduler::Start(); + + err = listener->iStatus.Int(); + + delete listener; + + if (err == KErrCancel) + { + INFO_PRINTF1(_L("MMMFSampleBuffering::MmsbCancelNotifyPlayStarted Successfully completed")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("Device didn't wait for the expected duration err %d"), err); + } + } + else + { + INFO_PRINTF1(_L("MMMFSampleBuffering failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + delete iTimer; + + return iTestStepResult; + } + + +TInt CTestStepCISampleBuffering::Callback(TAny* aAny) + { + CTestStepCISampleBuffering* me = reinterpret_cast(aAny); + me->DoCallback(); + return KErrNone; + } + +void CTestStepCISampleBuffering::DoCallback() + { + iTimer->Cancel(); + iInterfacePtr->MmsbCancelNotifyPlayStarted(); // call method + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiobufferprefill.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiobufferprefill.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIAUDIOBUFFERPREFILL_H +#define TESTSTEPCIAUDIOBUFFERPREFILL_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCISampleBuffering : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISampleBuffering(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0069L(); + TVerdict DoTestStep0070L(); + TVerdict DoTestStep0071L(); + TVerdict DoTestStep0072L(); + TVerdict DoTestStep0073L(); + + static TInt Callback(TAny* aAny); + void DoCallback(); + +private: + MMMFSampleBuffering* iInterfacePtr; + CPeriodic* iTimer; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiodspcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiodspcontrol.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,253 @@ +// Copyright (c) 2007-2009 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 "teststepciaudiodspcontrol.h" + + +TVerdict CTestStepCIAudioDspControl::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) == 0) + { + iTestStepResult = DoTestStep0076L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) == 0) + { + iTestStepResult = DoTestStep0077L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) == 0) + { + iTestStepResult = DoTestStep0078L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) == 0) + { + iTestStepResult = DoTestStep0079L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioDspControl::DoTestStep0076L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AudioDSPControl - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioDspControlTestDevice}; + #else + TFourCC testUID('T','0','1','3'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMFDSPControl + MMMFDSPControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidDSPControl)); + + if (ptr) + { + INFO_PRINTF1(_L("MMMFDSPControl instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioDspControl::DoTestStep0077L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptRecordBuffersInvalidFollowingStop")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioDspControlTestDevice}; + #else + TFourCC testUID('T','0','1','3'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMFDSPControl + MMMFDSPControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidDSPControl)); + + if (ptr) + { + TInt result = KErrGeneral; + + result = ptr->MmdspcAcceptRecordBuffersInvalidFollowingStop(); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptRecordBuffersInvalidFollowingStop failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioDspControl::DoTestStep0078L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AudioDSPControl - MmdspcAcceptPlaybackBuffersInvalidFollowingStop")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioDspControlTestDevice}; + #else + TFourCC testUID('T','0','1','3'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMFDSPControl + MMMFDSPControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidDSPControl)); + + if (ptr) + { + TInt result = KErrGeneral; + + result = ptr->MmdspcAcceptPlaybackBuffersInvalidFollowingStop(); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcAcceptPlaybackBuffersInvalidFollowingStop failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioDspControl::DoTestStep0079L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AudioDSPControl - MmdspcGetAudioPlaybackInfo")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioDspControlTestDevice}; + #else + TFourCC testUID('T','0','1','3'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidMMFDSPControl + MMMFDSPControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidDSPControl)); + + if (ptr) + { + TInt result = KErrGeneral; + TInt64 samplesPlayed = 0; + TInt64 systemTime = 0; + TUint bytesDecoderConsumed = 0; + TUint bytesDecoderDecoded = 0; + + result = ptr->MmdspcGetAudioPlaybackInfo (samplesPlayed, systemTime, bytesDecoderConsumed, bytesDecoderDecoded); // call method + + if ( (result == KErrNone) && + (samplesPlayed == 999) && (systemTime == 999) && + (bytesDecoderConsumed == 999) && (bytesDecoderDecoded == 999) ) + { + INFO_PRINTF1(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFDSPControl::MmdspcGetAudioPlaybackInfo failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFDSPControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiodspcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiodspcontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIAUDIODSPCONTROL_H +#define TESTSTEPCIAUDIODSPCONTROL_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIAudioDspControl : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIAudioDspControl(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0076L(); + TVerdict DoTestStep0077L(); + TVerdict DoTestStep0078L(); + TVerdict DoTestStep0079L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiovibracontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiovibracontrol.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,187 @@ +// Copyright (c) 2007-2009 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 "teststepciaudiovibracontrol.h" + + +TVerdict CTestStepCIAudioVibraControl::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0066-HP")) == 0) + { + iTestStepResult = DoTestStep0066L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0067-HP")) == 0) + { + iTestStepResult = DoTestStep0067L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0068-HP")) == 0) + { + iTestStepResult = DoTestStep0068L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioVibraControl::DoTestStep0066L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("AudioVibraControl - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioVibraControlTestDevice}; + #else + TFourCC testUID('T','0','1','1'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidAudioVibraControl + MAudioVibraControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAudioVibraControl)); + + if (ptr) + { + INFO_PRINTF1(_L("MAudioVibraControl instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioVibraControl::DoTestStep0067L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("AudioVibraControl - StartVibra")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioVibraControlTestDevice}; + #else + TFourCC testUID('T','0','1','1'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidAudioVibraControl + MAudioVibraControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAudioVibraControl)); + + if (ptr) + { + result = ptr->StartVibra(); // call method + + if(result == KErrNone) + { + INFO_PRINTF1(_L("MAudioVibraControl::StartVibra finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MAudioVibraControl::StartVibra failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIAudioVibraControl::DoTestStep0068L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("AudioVibraControl - StopVibra")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidAudioVibraControlTestDevice}; + #else + TFourCC testUID('T','0','1','1'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidAudioVibraControl + MAudioVibraControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidAudioVibraControl)); + + if (ptr) + { + result = ptr->StopVibra(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MAudioVibraControl::StopVibra finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MAudioVibraControl::StopVibra failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MAudioVibraControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiovibracontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciaudiovibracontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIAUDIOVIBRACONTROL_H +#define TESTSTEPCIAUDIOVIBRACONTROL_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIAudioVibraControl : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIAudioVibraControl(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0066L(); + TVerdict DoTestStep0067L(); + TVerdict DoTestStep0068L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcibufferframesconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcibufferframesconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,221 @@ +// Copyright (c) 2007-2009 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 +#include "teststepcibufferframesconfig.h" +#include "cidefine.h" + +/*****************************************************************************/ +CTestStepCICreateBufferFramesConfig::CTestStepCICreateBufferFramesConfig() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0082-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCICreateBufferFramesConfig::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidBufferFramesConfigTestDevice}; + #else + TFourCC testUID('T','0','0','7'); + #endif + + MMMFBufferFramesConfig* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidBufferFramesConfig)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIBufferFramesConfigSetBase::CTestStepCIBufferFramesConfigSetBase() + { + } + +TVerdict CTestStepCIBufferFramesConfigSetBase::DoTestStepL() + { + return EPass; + } + +void CTestStepCIBufferFramesConfigSetBase::DoReadFromFileL(TInt& aFrames, TInt& aSamples) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File should already exist + User::LeaveIfError(file.Open(fs, KCITestFileName, EFileRead)); + TBuf8 inputBuf; + User::LeaveIfError(file.Read(inputBuf)); + // Do some lexical analysis + TLex8 input(inputBuf); + input.Mark(); + input.SkipCharacters(); + if (input.TokenLength() != 0) + { + TInt value; + TLex8 temp(input.MarkedToken()); + User::LeaveIfError(temp.Val(value)); + // succesfully read the first value (the frames count) + aFrames = value; + + input.SkipSpaceAndMark(); + input.SkipCharacters(); + if (input.TokenLength() != 0) + { + temp = input.MarkedToken(); + User::LeaveIfError(temp.Val(value)); + // succesfully read the seconde value (the samples count) + aSamples = value; + } + } + + CleanupStack::PopAndDestroy(); // file + + // It is the responsibility of this function to delete the file after use + User::LeaveIfError(fs.Delete(KCITestFileName)); + + CleanupStack::PopAndDestroy(); // fs + } + + +/*****************************************************************************/ +CTestStepCIBufferFramesConfigSetInput::CTestStepCIBufferFramesConfigSetInput() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0083-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIBufferFramesConfigSetInput::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidBufferFramesConfigTestDevice}; + #else + TFourCC testUID('T','0','0','7'); + #endif + + MMMFBufferFramesConfig* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidBufferFramesConfig)); + + if (interface) + { + TInt frameCount = 6; + TInt samplesPerFrame = 66; + INFO_PRINTF1(_L("Calling test CI method")); + TInt err = interface->MmbfcSetNumberOfFramesPerInputBuffer(frameCount, samplesPerFrame); + TInt testCount = 0; + TInt testSamples = 0; + // Reset test result in case we leave... + iTestStepResult = EFail; + DoReadFromFileL(testCount, testSamples); + if ((err == KErrNone) && (frameCount == testCount) && (samplesPerFrame == testSamples)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + INFO_PRINTF4(_L("Test CI method call failed, error: %d, expected frames: %d, \ + expected samples: %d"), err, frameCount, samplesPerFrame); + INFO_PRINTF3(_L("Actual values: frames: %d, samplesPerFrame: %d"), testCount, testSamples); + } + } + else + { + INFO_PRINTF1(_L("Failed to retrieve the custom interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIBufferFramesConfigSetOutput::CTestStepCIBufferFramesConfigSetOutput() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0084-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIBufferFramesConfigSetOutput::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidBufferFramesConfigTestDevice}; + #else + TFourCC testUID('T','0','0','7'); + #endif + + MMMFBufferFramesConfig* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidBufferFramesConfig)); + + if (interface) + { + TInt frameCount = 9; + TInt samplesPerFrame = 99; + INFO_PRINTF1(_L("Calling test CI method")); + TInt err = interface->MmbfcSetNumberOfFramesPerOutputBuffer(frameCount, samplesPerFrame); + TInt testCount = 0; + TInt testSamples = 0; + // Reset test result in case we leave... + iTestStepResult = EFail; + DoReadFromFileL(testCount, testSamples); + if ((err == KErrNone) && (frameCount == testCount) && (samplesPerFrame == testSamples)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + INFO_PRINTF4(_L("Test CI method call failed, error: %d, expected frames: %d, \ + expected samples: %d"), err, frameCount, samplesPerFrame); + INFO_PRINTF3(_L("Actual values: frames: %d, samplesPerFrame: %d"), testCount, testSamples); + } + } + else + { + INFO_PRINTF1(_L("Failed to retrieve the custom interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcibufferframesconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcibufferframesconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIBUFFERFRAMESCONFIG_H +#define TESTSTEPCIBUFFERFRAMESCONFIG_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCICreateBufferFramesConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCICreateBufferFramesConfig(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIBufferFramesConfigSetBase : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIBufferFramesConfigSetBase(); + TVerdict DoTestStepL(); +protected: + void DoReadFromFileL(TInt& aFrames, TInt& aSamples); + }; + +class CTestStepCIBufferFramesConfigSetInput : public CTestStepCIBufferFramesConfigSetBase + { +public: + CTestStepCIBufferFramesConfigSetInput(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIBufferFramesConfigSetOutput : public CTestStepCIBufferFramesConfigSetBase + { +public: + CTestStepCIBufferFramesConfigSetOutput(); + TVerdict DoTestStepL(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcieaacplusdecoder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcieaacplusdecoder.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,431 @@ +// Copyright (c) 2007-2009 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 "teststepcieaacplusdecoder.h" + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoder::CTestStepCIEAacPlusDecoder() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0008-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIEAacPlusDecoder::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderGetSetFrequency::CTestStepCIEAacPlusDecoderGetSetFrequency(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0015-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0009-HP"); + } + } + +TVerdict CTestStepCIEAacPlusDecoderGetSetFrequency::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + + if (interface) + { + INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Sampling Frequency")); + TUint frequency = 666; + interface->SetInputSamplingFrequency(frequency); + + TUint testFrequency; + TInt err = interface->GetInputSamplingFrequency(testFrequency); + if (err == KErrNone && testFrequency == frequency) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the frequency.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the frequency.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the frequency")); + } + else + { + ERR_PRINTF1(_L("Failed to set the frequency")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderGetSetObjType::CTestStepCIEAacPlusDecoderGetSetObjType(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0016-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0010-HP"); + } + } + +TVerdict CTestStepCIEAacPlusDecoderGetSetObjType::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Object Type")); + + MEAacPlusDecoderIntfc::TAudioObjectType audioObjectType = MEAacPlusDecoderIntfc::EAacLtp; + interface->SetAudioObjectType(audioObjectType); + + MEAacPlusDecoderIntfc::TAudioObjectType testAudioObjectType; + interface->GetAudioObjectType(testAudioObjectType); + if (audioObjectType == testAudioObjectType) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the object type.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the object type.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the object type")); + } + else + { + ERR_PRINTF1(_L("Failed to set the object type")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderGetSetNumChannels::CTestStepCIEAacPlusDecoderGetSetNumChannels(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0017-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0011-HP"); + } + } + +TVerdict CTestStepCIEAacPlusDecoderGetSetNumChannels::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Number of Channels")); + TUint numChannels = 2; + interface->SetNumOfChannels(numChannels); + + TUint testNumChannels; + interface->GetNumOfChannels(testNumChannels); + if (testNumChannels == numChannels) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the number of channels.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the number of channels.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the number of channels")); + } + else + { + ERR_PRINTF1(_L("Failed to set the number of channels")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderGetSetSbr::CTestStepCIEAacPlusDecoderGetSetSbr(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0018-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0012-HP"); + } + } + +TVerdict CTestStepCIEAacPlusDecoderGetSetSbr::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the EAAC+ Decoder's SBR")); + interface->SetSbr(ETrue); + + TBool testSbr = EFalse; + interface->GetSbr(testSbr); + if (testSbr) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got SBR.")); + } + else + { + INFO_PRINTF1(_L("Successfully set SBR.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get SBR.")); + } + else + { + ERR_PRINTF1(_L("Failed to set SBR.")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderGetSetDsm::CTestStepCIEAacPlusDecoderGetSetDsm(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0019-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0013-HP"); + } + } + +TVerdict CTestStepCIEAacPlusDecoderGetSetDsm::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the EAAC+ Decoder's Down Sampled Mode")); + interface->SetDownSampledMode(ETrue); + + TBool testDSM = EFalse; + interface->GetDownSampledMode(testDSM); + if (testDSM) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the DSM.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the DSM.")); + } + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to set the DSM.")); + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIEAacPlusDecoderApplyConfig::CTestStepCIEAacPlusDecoderApplyConfig() + { + + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0014-HP"); + } + +TVerdict CTestStepCIEAacPlusDecoderApplyConfig::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test EAAC+ Decoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidEAacPlusDecoderTestDevice}; + #else + TFourCC testUID('T','0','0','2'); + #endif + + MEAacPlusDecoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidEAacPlusDecoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Applying the config to the EAAC+ Decoder")); + TInt err = interface->ApplyConfig(); + if (err == KErrNone) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully applied the config.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF2(_L("Failed to apply the config, error: %d"), err); + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcieaacplusdecoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcieaacplusdecoder.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,91 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIEAACPLUSDECODER_H +#define TESTSTEPCIEAACPLUSDECODER_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIEAacPlusDecoder : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoder(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIEAacPlusDecoderGetSetFrequency : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderGetSetFrequency(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCIEAacPlusDecoderGetSetObjType : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderGetSetObjType(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCIEAacPlusDecoderGetSetNumChannels : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderGetSetNumChannels(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCIEAacPlusDecoderGetSetSbr : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderGetSetSbr(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCIEAacPlusDecoderGetSetDsm : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderGetSetDsm(TBool aIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCIEAacPlusDecoderApplyConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIEAacPlusDecoderApplyConfig(); + TVerdict DoTestStepL(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcierrorconcealment.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcierrorconcealment.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,270 @@ +// Copyright (c) 2007-2009 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: +// teststepciErrorConcealmentIntfc.cpp +// +// + +#include "teststepcierrorconcealment.h" + + +TVerdict CTestStepCIErrorConcealmentIntfc::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0062-HP")) == 0) + { + iTestStepResult = DoTestStep0062L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0063-HP")) == 0) + { + iTestStepResult = DoTestStep0063L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0064-HP")) == 0) + { + iTestStepResult = DoTestStep0064L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0065-HP")) == 0) + { + iTestStepResult = DoTestStep0065L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIErrorConcealmentIntfc::DoTestStep0062L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("ErrorConcealmentIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidErrorConcealmentIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidCustomInterfaceDevSoundErrorConcealmentIntfc + MMMFErrorConcealmentIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidErrorConcealmentIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc successfully retrieved the interface")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MMMFErrorConcealmentIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIErrorConcealmentIntfc::DoTestStep0063L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc - ConcealErrorForNextBuffer")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidErrorConcealmentIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to initialize with the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidErrorConcealmentIntfc + MMMFErrorConcealmentIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidErrorConcealmentIntfc)); + + if (ptr) + { + result = ptr->ConcealErrorForNextBuffer(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc::ConcealErrorForNextBuffer finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFErrorConcealmentIntfc::ConcealErrorForNextBuffer failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIErrorConcealmentIntfc::DoTestStep0064L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc - SetFrameMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidErrorConcealmentIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidErrorConcealmentIntfc + MMMFErrorConcealmentIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidErrorConcealmentIntfc)); + + TBool frameModeOn = EFalse; + TBool retframeModeOn = ETrue; + + if (ptr) + { + result = ptr->SetFrameMode(frameModeOn); // call method + + if (result == KErrNone) + { + // This file is created by the test stub, the plugin device + _LIT(KFileName, "c:\\temp\\errorConcealment.txt"); + + ReadFileL(KFileName, retframeModeOn); + + if (retframeModeOn == frameModeOn) + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc::SetFrameMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFErrorConcealmentIntfc::SetFrameMode failed with frameModeRqrd %d"), retframeModeOn); + } + } + else + { + ERR_PRINTF2(_L("MMMFErrorConcealmentIntfc::SetFrameMode failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIErrorConcealmentIntfc::DoTestStep0065L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc - FrameModeRqrdForEC")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidErrorConcealmentIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiated the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidErrorConcealmentIntfc + MMMFErrorConcealmentIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidErrorConcealmentIntfc)); + + if (ptr) + { + TBool frameModeRqrd = EFalse; + TInt setFrameModeRqrd = ETrue; + + // This file is created by the test stub, the plugin device + _LIT(KFileName, "c:\\temp\\errorConcealment.txt"); + + // store a value in a file, for the test to read from. + WriteFileL(KFileName, setFrameModeRqrd); + + result = ptr->FrameModeRqrdForEC(frameModeRqrd); // call method + + if ( (result == KErrNone) && (setFrameModeRqrd == frameModeRqrd) ) + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc::FrameModeRqrdForEC finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MMMFErrorConcealmentIntfc::FrameModeRqrdForEC failed with result %d frameModeRqrd %d"), result, frameModeRqrd); + } + } + else + { + INFO_PRINTF1(_L("MMMFErrorConcealmentIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcierrorconcealment.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcierrorconcealment.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIERRORCONCEALMENT_H +#define TESTSTEPCIERRORCONCEALMENT_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIErrorConcealmentIntfc : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIErrorConcealmentIntfc(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0062L(); + TVerdict DoTestStep0063L(); + TVerdict DoTestStep0064L(); + TVerdict DoTestStep0065L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711decoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711decoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,502 @@ +// Copyright (c) 2007-2009 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 "teststepcig711decoderconfig.h" + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0040-HP")) == 0) + { + iTestStepResult = DoTestStep0040L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0041-HP")) == 0) + { + iTestStepResult = DoTestStep0041L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0042-HP")) == 0) + { + iTestStepResult = DoTestStep0042L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0043-HP")) == 0) + { + iTestStepResult = DoTestStep0043L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0044-HP")) == 0) + { + iTestStepResult = DoTestStep0044L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0094-HP")) == 0) + { + iTestStepResult = DoTestStep0094L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0095-HP")) == 0) + { + iTestStepResult = DoTestStep0095L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0040L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("G711DecoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MG711DecoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0041L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - SetDecoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecULaw); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0094L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - GetDecoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + MG711DecoderIntfc::TDecodeMode decodeMode = MG711DecoderIntfc::EDecULaw; + + result = ptr->SetDecoderMode(MG711DecoderIntfc::EDecALaw); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetDecoderMode finished successfully")); + + result = ptr->GetDecoderMode(decodeMode); // call method + + if (MG711DecoderIntfc::EDecALaw == decodeMode) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetDecoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetDecoderMode failed with result %d decodeMode %d"), result, decodeMode); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetDecoderMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0042L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - SetComfortNoiseGeneration")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + TBool cng = ETrue; + + result = ptr->SetComfortNoiseGeneration(cng); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && cng) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + result = ptr->SetComfortNoiseGeneration(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && !cng) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0043L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - GetComfortNoiseGeneration")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + TBool cng = ETrue; + + if (ptr) + { + result = ptr->SetComfortNoiseGeneration(cng); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && cng) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::GetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0044L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - SetPacketLossConcealment")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + TBool plc = ETrue; + + result = ptr->SetPacketLossConcealment(EFalse); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully")); + + result = ptr->GetPacketLossConcealment(plc); + + if ( (result == KErrNone) && (EFalse == plc) ) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d plc %d"), result, plc); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711DecoderConfig::DoTestStep0095L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711DecoderIntfc - GetPacketLossConcealment")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','5'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711DecoderIntfc + MG711DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711DecoderIntfc)); + + if (ptr) + { + TBool plc = ETrue; + + result = ptr->SetPacketLossConcealment(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::SetPacketLossConcealment finished successfully")); + + result = ptr->GetPacketLossConcealment(plc); // call method + + if ( (result == KErrNone) && (EFalse == plc) ) + { + INFO_PRINTF1(_L("MG711DecoderIntfc::GetPacketLossConcealment finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711DecoderIntfc::GetPacketLossConcealment failed with result %d plc %d"), result, plc); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetPacketLossConcealment failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711decoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711decoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIG711DECODERCONFIG_H +#define TESTSTEPCIG711DECODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIG711DecoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIG711DecoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0040L(); + TVerdict DoTestStep0041L(); + TVerdict DoTestStep0042L(); + TVerdict DoTestStep0043L(); + TVerdict DoTestStep0044L(); + TVerdict DoTestStep0094L(); + TVerdict DoTestStep0095L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711encoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711encoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,307 @@ +// Copyright (c) 2007-2009 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 "teststepcig711encoderconfig.h" + + +TVerdict CTestStepCIG711EncoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0045-HP")) == 0) + { + iTestStepResult = DoTestStep0045L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0046-HP")) == 0) + { + iTestStepResult = DoTestStep0046L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0047-HP")) == 0) + { + iTestStepResult = DoTestStep0047L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0048-HP")) == 0) + { + iTestStepResult = DoTestStep0048L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0045L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("G711EncoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','6'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711EncoderIntfc + MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MG711EncoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0046L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711EncoderIntfc - SetEncoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','6'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711EncoderIntfc + MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); + + if (ptr) + { + MG711EncoderIntfc::TEncodeMode encodeMode = MG711EncoderIntfc::EEncULaw; + TInt setEncodeMode = MG711EncoderIntfc::EEncALaw; + + result = ptr->SetEncoderMode(encodeMode) ; // call method + + if (result == KErrNone) + { + // This file is created by the test stub, the plugin device + _LIT(KFileName, "c:\\temp\\g711EncoderConfig.txt"); + + ReadFileL(KFileName, setEncodeMode); + + if (static_cast(setEncodeMode) == encodeMode) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::SetEncoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with encodeMode %d"), encodeMode); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetEncoderMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0047L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711EncoderIntfc - SetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','6'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711EncoderIntfc + MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG711DecoderIntfc::SetVadMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG711EncoderConfig::DoTestStep0048L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G711EncoderIntfc - GetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG711EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','6'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG711EncoderIntfc + MG711EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG711EncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); + + result = ptr->SetVadMode(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && !vadModeOn) + { + INFO_PRINTF1(_L("MG711EncoderIntfc::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); + } + } + else + { + ERR_PRINTF3(_L("MG711EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG711EncoderIntfc::SetVadMode failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG711EncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711encoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig711encoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIG711ENCODERCONFIG_H +#define TESTSTEPCIG711ENCODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIG711EncoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIG711EncoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0045L(); + TVerdict DoTestStep0046L(); + TVerdict DoTestStep0047L(); + TVerdict DoTestStep0048L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729decoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729decoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,131 @@ +// Copyright (c) 2007-2009 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 "teststepcig729decoderconfig.h" + + +TVerdict CTestStepCIG729DecoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0049-HP")) == 0) + { + iTestStepResult = DoTestStep0049L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0050-HP")) == 0) + { + iTestStepResult = DoTestStep0050L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG729DecoderConfig::DoTestStep0049L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("G729DecoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG729DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','0','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG729DecoderIntfc + MG729DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG729DecoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MG729DecoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + INFO_PRINTF1(_L("MG729DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG729DecoderConfig::DoTestStep0050L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G729DecoderIntfc - BadLsfNextBuffer")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG729DecoderConfigTestDevice}; + #else + TFourCC testUID('T','0','0','9'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG729DecoderIntfc + MG729DecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG729DecoderIntfc)); + + if (ptr) + { + result = ptr->BadLsfNextBuffer(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG729DecoderIntfc::BadLsfNextBuffer finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MG729DecoderIntfc::BadLsfNextBuffer failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG729DecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729decoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729decoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIG729DECODERCONFIG_H +#define TESTSTEPCIG729DECODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIG729DecoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIG729DecoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0049L(); + TVerdict DoTestStep0050L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729encoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729encoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,232 @@ +// Copyright (c) 2007-2009 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 "teststepcig729encoderconfig.h" + + +TVerdict CTestStepCIG729EncoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0051-HP")) == 0) + { + iTestStepResult = DoTestStep0051L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0052-HP")) == 0) + { + iTestStepResult = DoTestStep0052L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0053-HP")) == 0) + { + iTestStepResult = DoTestStep0053L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0051L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("G729EncoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG729EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG729EncoderIntfc + MG729EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MG729EncoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0052L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G729EncoderIntfc - SetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG729EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG729EncoderIntfc + MG729EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully")); + return EPass; + } + else + { + ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIG729EncoderConfig::DoTestStep0053L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("G729EncoderIntfc - GetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidG729EncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidG729EncoderIntfc + MG729EncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidG729EncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully")); + + result = ptr->SetVadMode(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MG729EncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && !vadModeOn) + { + INFO_PRINTF1(_L("MG729EncoderIntfc::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result); + } + } + else + { + ERR_PRINTF3(_L("MG729EncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF2(_L("MG729EncoderIntfc::SetVadMode failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MG729EncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729encoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcig729encoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIG729ENCODERCONFIG_H +#define TESTSTEPCIG729ENCODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIG729EncoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIG729EncoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0051L(); + TVerdict DoTestStep0052L(); + TVerdict DoTestStep0053L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigettimestamps.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigettimestamps.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,192 @@ +// Copyright (c) 2007-2009 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 +#include "teststepcigettimestamps.h" +#include "cidefine.h" + +/*****************************************************************************/ +CTestStepCICreateGetTimestamps::CTestStepCICreateGetTimestamps() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0085-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCICreateGetTimestamps::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGetTimestampsTestDevice}; + #else + TFourCC testUID('T','0','0','6'); + #endif + + MMMFGetTimestamps* interface = NULL; + interface = static_cast( + InitializeAndInstantiateInterfaceL(testUID, KUidGetTimestamps)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIGetTimestampsEnable::CTestStepCIGetTimestampsEnable() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0086-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIGetTimestampsEnable::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGetTimestampsTestDevice}; + #else + TFourCC testUID('T','0','0','6'); + #endif + + MMMFGetTimestamps* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidGetTimestamps)); + + if (interface) + { + TBool enabled = ETrue; + INFO_PRINTF1(_L("Calling test CI method")); + TInt err = interface->MmgtSetRecordSystemTimestampsEnabled(enabled); + TBool flag = EFalse; + // Reset test result in case we leave... + iTestStepResult = EFail; + DoReadFromFileL(flag); + if ((err == KErrNone) && (flag == enabled)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + INFO_PRINTF4(_L("Test CI method call failed, error: %d, expected value: %d, \ + actual value: %d"), err, enabled, flag); + } + } + else + { + INFO_PRINTF1(_L("Failed to retrieve the custom interface.")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + +void CTestStepCIGetTimestampsEnable::DoReadFromFileL(TBool& aFlag) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File should already exist + User::LeaveIfError(file.Open(fs, KCITestFileName, EFileRead)); + // Size should be 1! + TInt fileSize = 0; + User::LeaveIfError(file.Size(fileSize)); + if (fileSize != KMaxCITestFileDataLength) + { + User::Leave(KErrCorrupt); + } + TBuf8 inputBuf; + User::LeaveIfError(file.Read(inputBuf)); + TChar val = inputBuf[0]; + aFlag = val.GetNumericValue(); + + CleanupStack::PopAndDestroy(); // file + + // This function is responsible for the deletion of the file after use + User::LeaveIfError(fs.Delete(KCITestFileName)); + + CleanupStack::PopAndDestroy(); // fs + } + +/*****************************************************************************/ +CTestStepCIGetTimestampsForBuffer::CTestStepCIGetTimestampsForBuffer() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0087-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIGetTimestampsForBuffer::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGetTimestampsTestDevice}; + #else + TFourCC testUID('T','0','0','6'); + #endif + + MMMFGetTimestamps* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidGetTimestamps)); + + if (interface) + { + INFO_PRINTF1(_L("Calling test CI method")); + // Test device implementation expects this value: + TTimeIntervalMicroSeconds bufferPosition(KTimestampPosition); + TTime timestamp; + TInt err = interface->MmgtGetSystemTimestampForBuffer(bufferPosition, timestamp); + // and it should return this value: + TTime testTimestamp(KTimestampValue); + if ((err == KErrNone) && (testTimestamp == timestamp)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + INFO_PRINTF3(_L("Expected timestamp: %d, actual timestamp: %d"), \ + timestamp.Int64(), testTimestamp.Int64()); + iTestStepResult = EFail; + } + } + else + { + INFO_PRINTF1(_L("Failed to retrieve the custom interface.")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigettimestamps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigettimestamps.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIGETTIMESTAMPS_H +#define TESTSTEPCIGETTIMESTAMPS_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCICreateGetTimestamps : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCICreateGetTimestamps(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIGetTimestampsEnable : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIGetTimestampsEnable(); + TVerdict DoTestStepL(); +private: + void DoReadFromFileL(TBool& aFlag); + }; + +class CTestStepCIGetTimestampsForBuffer : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIGetTimestampsForBuffer(); + TVerdict DoTestStepL(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigsmconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigsmconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,200 @@ +// Copyright (c) 2007-2009 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 "teststepcigsmconfig.h" + + +TVerdict CTestStepCIGsmConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0088-HP")) == 0) + { + iTestStepResult = DoTestStep0088L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0089-HP")) == 0) + { + iTestStepResult = DoTestStep0089L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0090-HP")) == 0) + { + iTestStepResult = DoTestStep0090L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIGsmConfig::DoTestStep0088L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("GsmConfig - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGsmConfigTestDevice}; + #else + TFourCC testUID('T','0','2','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidGsmConfig + MMMFGsmConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidGsmConfig)); + + if (ptr) + { + INFO_PRINTF1(_L("MMMFGsmConfig instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIGsmConfig::DoTestStep0089L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("GsmConfig - SetConversionFormat")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGsmConfigTestDevice}; + #else + TFourCC testUID('T','0','2','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidGsmConfig + MMMFGsmConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidGsmConfig)); + + if (ptr) + { + result = ptr->SetConversionFormat(MMMFGsmConfig::ENone); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIGsmConfig::DoTestStep0090L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("GsmConfig - ConversionFormat")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidGsmConfigTestDevice}; + #else + TFourCC testUID('T','0','2','0'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidGsmConfig + MMMFGsmConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidGsmConfig)); + + if (ptr) + { + MMMFGsmConfig::TMMFGsmConversionFormat convFormat = MMMFGsmConfig::ENone; + + result = ptr->SetConversionFormat(MMMFGsmConfig::EAlawPCM); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFGsmConfig::SetConversionFormat finished successfully")); + + result = ptr->ConversionFormat(convFormat); + + if ( (result == KErrNone) && (MMMFGsmConfig::EAlawPCM == convFormat) ) + { + INFO_PRINTF1(_L("MMMFGsmConfig::ConversionFormat finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MMMFGsmConfig::SetConversionFormat failed with result %d convFormat"), result, convFormat); + } + } + else + { + ERR_PRINTF2(_L("MMMFGsmConfig::SetConversionFormat failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFGsmConfig failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigsmconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcigsmconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIGSMCONFIG_H +#define TESTSTEPCIGSMCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIGsmConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIGsmConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0088L(); + TVerdict DoTestStep0089L(); + TVerdict DoTestStep0090L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcdecoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcdecoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,329 @@ +// Copyright (c) 2007-2009 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 "teststepciilbcdecoderconfig.h" + + +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0054-HP")) == 0) + { + iTestStepResult = DoTestStep0054L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0055-HP")) == 0) + { + iTestStepResult = DoTestStep0055L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0056-HP")) == 0) + { + iTestStepResult = DoTestStep0056L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0057-HP")) == 0) + { + iTestStepResult = DoTestStep0057L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0054L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("IlbcDecoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcDecoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','7'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcDecoderIntfc + MIlbcDecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0055L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcDecoderIntfc - SetDecoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcDecoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','7'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcDecoderIntfc + MIlbcDecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc)); + + if (ptr) + { + MIlbcDecoderIntfc::TDecodeMode decodeMode = MIlbcDecoderIntfc::E30msFrame; + TInt setDecodeMode = MIlbcDecoderIntfc::E20msFrame; + + result = ptr->SetDecoderMode(decodeMode); // call method + + // This file is created by the test stub, the plugin device + _LIT(KFileName, "c:\\temp\\IlbcDecoderConfig.txt"); + + ReadFileL(KFileName, setDecodeMode); + + if (result == KErrNone) + { + if (static_cast(setDecodeMode) == decodeMode) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetDecoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with decodeMode %d"), decodeMode); + } + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetDecoderMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0056L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcDecoderIntfc - SetComfortNoiseGeneration")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcDecoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','7'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcDecoderIntfc + MIlbcDecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc)); + + if (ptr) + { + TBool cng = ETrue; + + result = ptr->SetComfortNoiseGeneration(cng); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && cng) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + result = ptr->SetComfortNoiseGeneration(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && !cng) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcDecoderConfig::DoTestStep0057L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcDecoderIntfc - GetComfortNoiseGeneration")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcDecoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','7'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcDecoderIntfc + MIlbcDecoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcDecoderIntfc)); + + if (ptr) + { + TBool cng = ETrue; + + result = ptr->SetComfortNoiseGeneration(cng); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetCng finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && cng) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + result = ptr->SetComfortNoiseGeneration(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration finished successfully")); + + result = ptr->GetComfortNoiseGeneration(cng); + + if ( (result == KErrNone) && !cng) + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetComfortNoiseGeneration failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetComfortNoiseGeneration failed with result %d"), result); + } + } + else + { + ERR_PRINTF3(_L("MIlbcDecoderIntfc::GetCng failed with result %d cng %d"), result, cng); + } + } + else + { + ERR_PRINTF2(_L("MIlbcDecoderIntfc::SetCng failed with result %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MIlbcDecoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcdecoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcdecoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIILBCDECODERCONFIG_H +#define TESTSTEPCIILBCDECODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIIlbcDecoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIIlbcDecoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0054L(); + TVerdict DoTestStep0055L(); + TVerdict DoTestStep0056L(); + TVerdict DoTestStep0057L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcencoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcencoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,375 @@ +// Copyright (c) 2007-2009 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 "teststepciilbcencoderconfig.h" + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0058-HP")) == 0) + { + iTestStepResult = DoTestStep0058L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0059-HP")) == 0) + { + iTestStepResult = DoTestStep0059L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0060-HP")) == 0) + { + iTestStepResult = DoTestStep0060L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0061-HP")) == 0) + { + iTestStepResult = DoTestStep0061L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0096-HP")) == 0) + { + iTestStepResult = DoTestStep0096L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0058L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("IlbcEncoderIntfc - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcEncoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidCustomInterfaceDevSoundIlbcEncoderConfig + MIlbcEncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc)); + + if (ptr) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0059L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcEncoderIntfc - SetEncoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcEncoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcEncoderIntfc + MIlbcEncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc)); + + if (ptr) + { + MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E30msFrame; + + result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E20msFrame); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully")); + + result = ptr->GetEncoderMode(encodeMode); + + if (MIlbcEncoderIntfc::E20msFrame == encodeMode) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetEncoderMode failed with result %d encodeMode %d"), result, encodeMode); + } + } + else + { + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result); + } + } + else + { + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0096L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcEncoderIntfc - GetEncoderMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcEncoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcEncoderIntfc + MIlbcEncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc)); + + if (ptr) + { + MIlbcEncoderIntfc::TEncodeMode encodeMode = MIlbcEncoderIntfc::E20msFrame; + + result = ptr->SetEncoderMode(MIlbcEncoderIntfc::E30msFrame); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetEncoderMode finished successfully")); + + result = ptr->GetEncoderMode(encodeMode); // call method + + if (MIlbcEncoderIntfc::E30msFrame == encodeMode) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetEncoderMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MIlbcEncoderIntfc::GetEncoderMode failed with encodeMode %d"), encodeMode); + } + } + else + { + ERR_PRINTF2(_L("MIlbcEncoderIntfc::SetEncoderMode failed with result %d"), result); + } + } + else + { + ERR_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0060L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcEncoderIntfc - SetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcEncoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcEncoderIntfc + MIlbcEncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIIlbcEncoderConfig::DoTestStep0061L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("IlbcEncoderIntfc - GetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidIlbcEncoderIntfcTestDevice}; + #else + TFourCC testUID('T','0','1','8'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidIlbcEncoderIntfc + MIlbcEncoderIntfc* ptr = static_cast (iMMFDevSound->CustomInterface(KUidIlbcEncoderIntfc)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(ETrue); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully")); + + result = ptr->SetVadMode(EFalse); + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && !vadModeOn) + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::GetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + ERR_PRINTF3(_L("MIlbcEncoderIntfc::SetVadMode failed with result %d vadModeOn %d"), result, vadModeOn); + } + } + else + { + INFO_PRINTF1(_L("MIlbcEncoderIntfc failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcencoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciilbcencoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIILBCENCODERCONFIG_H +#define TESTSTEPCIILBCENCODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIIlbcEncoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIIlbcEncoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0058L(); + TVerdict DoTestStep0059L(); + TVerdict DoTestStep0060L(); + TVerdict DoTestStep0061L(); + TVerdict DoTestStep0096L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciplaybackstatus.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciplaybackstatus.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,257 @@ +// Copyright (c) 2007-2009 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 "teststepciplaybackstatus.h" +#include "cidefine.h" + +/*****************************************************************************/ +CTestStepCIPlaybackStatus::CTestStepCIPlaybackStatus() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0074-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIPlaybackStatus::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidPlayBackStatusTestDevice}; + #else + TFourCC testUID('T','0','0','1'); + #endif + + MMMFPlaybackStatus* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidPlaybackStatus)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCIPlaybackStatusInfo::CTestStepCIPlaybackStatusInfo() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0075-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCIPlaybackStatusInfo::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidPlayBackStatusTestDevice}; + #else + TFourCC testUID('T','0','0','1'); + #endif + + MMMFPlaybackStatus* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidPlaybackStatus)); + + if (interface) + { + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + + MMMFPlaybackStatus::TMMFPlaybackStatus status; + + // Set values before call. + status.aInputBytes = 0; + status.aDecodedSamples = 0; + status.aDecodedSamplesPlayed = 0; + status.aSystemTime = 0; + status.aTotalSamplesPlayed = 0; + + interface->MmpsGetPlaybackStatusInformation(status); // call method + + if(status.aInputBytes == 999 && + status.aDecodedSamples == 999 && + status.aDecodedSamplesPlayed == 999 && + status.aSystemTime == 999 && + status.aTotalSamplesPlayed == 999) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the status information.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the status information")); + } + } + else + { + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +/*****************************************************************************/ +CTestStepCIPlaybackStatusRequestNotification::CTestStepCIPlaybackStatusRequestNotification(TBool aIsCancelTest) + : iIsCancelTest(aIsCancelTest) + { + if (iIsCancelTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0098-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0097-HP"); + } + } + +/*****************************************************************************/ +TVerdict CTestStepCIPlaybackStatusRequestNotification::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidPlayBackStatusTestDevice}; + #else + TFourCC testUID('T','0','0','1'); + #endif + + MMMFPlaybackStatus* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidPlaybackStatus)); + + if (interface) + { + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + + iTestStepResult = EFail; + if (iIsCancelTest) + { + DoCancelTestL(*interface); + } + else + { + DoRequestTestL(*interface); + } + } + else + { + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +void CTestStepCIPlaybackStatusRequestNotification::DoRequestTestL(MMMFPlaybackStatus& aInterface) + { + // Make the request. + TInt err = aInterface.MmpsRequestLossOfSyncNotification(); + + if (err == KErrNone) + { + // Get the result + TBool testResult = EFalse; + DoReadFromFileL(testResult); + + if (testResult) + { + // Value should be ETrue! + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully requested the notification.")); + } + else + { + ERR_PRINTF2(_L("Failed to request the notification"), err); + } + } + else + { + ERR_PRINTF2(_L("Failed to request the notification"), err); + } + } + +void CTestStepCIPlaybackStatusRequestNotification::DoCancelTestL(MMMFPlaybackStatus& aInterface) + { + // Make the request. + TInt err = aInterface.MmpsCancelLossOfSyncNotification(); + + if (err == KErrNone) + { + // Get the result + TBool testResult = ETrue; + DoReadFromFileL(testResult); + + if (!testResult) + { + // Value should be EFalse! + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully cancelled the notification.")); + } + else + { + ERR_PRINTF2(_L("Failed to cancel the notification"), err); + } + } + else + { + ERR_PRINTF2(_L("Failed to cancel the notification"), err); + } + } + +void CTestStepCIPlaybackStatusRequestNotification::DoReadFromFileL(TBool& aFlag) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File should already exist + User::LeaveIfError(file.Open(fs, KCITestFileName, EFileRead)); + // Size should be 1! + TInt fileSize = 0; + User::LeaveIfError(file.Size(fileSize)); + if (fileSize != KMaxCITestFileDataLength) + { + User::Leave(KErrCorrupt); + } + TBuf8 inputBuf; + User::LeaveIfError(file.Read(inputBuf)); + TChar val = inputBuf[0]; + aFlag = val.GetNumericValue(); + + CleanupStack::PopAndDestroy(); // file + + // It is the responsibility of this function to delete the file after use + User::LeaveIfError(fs.Delete(KCITestFileName)); + + CleanupStack::PopAndDestroy(); // fs + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciplaybackstatus.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciplaybackstatus.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIPLAYBACKSTATUS_H +#define TESTSTEPCIPLAYBACKSTATUS_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIPlaybackStatus : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIPlaybackStatus(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIPlaybackStatusInfo : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIPlaybackStatusInfo(); + TVerdict DoTestStepL(); + }; + +class CTestStepCIPlaybackStatusRequestNotification : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIPlaybackStatusRequestNotification(TBool aIsCancelTest); + TVerdict DoTestStepL(); +private: + void DoReadFromFileL(TBool& aFlag); + void DoRequestTestL(MMMFPlaybackStatus& aInterface); + void DoCancelTestL(MMMFPlaybackStatus& aInterface); +private: + TBool iIsCancelTest; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisbcencoder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisbcencoder.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,939 @@ +// Copyright (c) 2007-2009 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 "teststepcisbcencoder.h" + +/*****************************************************************************/ +CTestStepCISbcEncoder::CTestStepCISbcEncoder() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0020-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCISbcEncoder::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/****************************************************************************/ +CTestStepCISbcEncoderGetSupportedFrequencies::CTestStepCISbcEncoderGetSupportedFrequencies() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0021-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedFrequencies::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Sampling Frequencies")); + + RArray frequencies; + CleanupClosePushL(frequencies); + TInt err = interface->GetSupportedSamplingFrequencies(frequencies); + + // Data is hard coded in the test HwDevice implementation + // to add 10 values from 0 to 9000 in intervals of 1000. + TBool validValues = ValidateArray(frequencies); + if (err == KErrNone && validValues) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the frequencies.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the frequencies")); + } + CleanupStack::PopAndDestroy(); // frequencies + } + else + { + iTestStepResult = EInconclusive; + INFO_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + + +TBool CTestStepCISbcEncoderGetSupportedFrequencies::ValidateArray(const RArray& aArray) const + { + TBool iTestStepResult = ETrue; + + TInt count = aArray.Count(); + if (count != 10) + { + iTestStepResult = EFalse; + } + else + { + TUint val = 0; + for (TInt i = 0; i < count; i++) + { + if (aArray[i] != val) + { + iTestStepResult = EFalse; + break; + } + val += 1000; + } + } + + return iTestStepResult; + } + +/****************************************************************************/ +CTestStepCISbcEncoderGetSupportedSubbands::CTestStepCISbcEncoderGetSupportedSubbands() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0023-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedSubbands::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Number Of Subbands")); + + RArray subbands; + CleanupClosePushL(subbands); + TInt err = interface->GetSupportedNumOfSubbands(subbands); + + // Data is hard coded in the test HwDevice implementation + // to add 5 values from 100 to 500 in intervals of 100. + TBool validValues = ValidateArray(subbands); + if (err == KErrNone && validValues) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the subbands.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the subbands")); + } + CleanupStack::PopAndDestroy(); // subbands + } + else + { + iTestStepResult = EInconclusive; + INFO_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + + +TBool CTestStepCISbcEncoderGetSupportedSubbands::ValidateArray(const RArray& aArray) const + { + TBool iTestStepResult = ETrue; + + TInt count = aArray.Count(); + if (count != 5) + { + iTestStepResult = EFalse; + } + else + { + TUint val = 100; + for (TInt i = 0; i < count; i++) + { + if (aArray[i] != val) + { + iTestStepResult = EFalse; + break; + } + val += 100; + } + } + + return iTestStepResult; + } + +/****************************************************************************/ +CTestStepCISbcEncoderGetSupportedNumOfBlocks::CTestStepCISbcEncoderGetSupportedNumOfBlocks() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0025-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedNumOfBlocks::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Number Of Supported Blocks")); + + RArray blocks; + CleanupClosePushL(blocks); + TInt err = interface->GetSupportedNumOfBlocks(blocks); + + // Data is hard coded in the test HwDevice implementation + // to add 10 values from 1 to 10 + TBool validValues = ValidateArray(blocks); + if (err == KErrNone && validValues) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the blocks.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the blocks")); + } + CleanupStack::PopAndDestroy(); // blocks + } + else + { + iTestStepResult = EInconclusive; + INFO_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + + +TBool CTestStepCISbcEncoderGetSupportedNumOfBlocks::ValidateArray(const RArray& aArray) const + { + TBool iTestStepResult = ETrue; + + TInt count = aArray.Count(); + if (count != 10) + { + iTestStepResult = EFalse; + } + else + { + TUint val = 1; + for (TInt i = 0; i < count; i++) + { + if (aArray[i] != val) + { + iTestStepResult = EFalse; + break; + } + val++; + } + } + + return iTestStepResult; + } + +/****************************************************************************/ +CTestStepCISbcEncoderGetSupportedChannelModes::CTestStepCISbcEncoderGetSupportedChannelModes() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0022-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedChannelModes::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Channel Modes")); + + RArray modes; + CleanupClosePushL(modes); + TInt err = interface->GetSupportedChannelModes(modes); + + // Data is hard coded in the test HwDevice implementation + // to add the 4 available values + TBool validValues = ValidateArray(modes); + if (err == KErrNone && validValues) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the supported modes.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the supported modes")); + } + CleanupStack::PopAndDestroy(); // modes + } + else + { + iTestStepResult = EInconclusive; + INFO_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + + +TBool CTestStepCISbcEncoderGetSupportedChannelModes::ValidateArray(const RArray& aArray) const + { + TBool iTestStepResult = ETrue; + + TInt count = aArray.Count(); + if (count != 4) + { + iTestStepResult = EFalse; + } + else + { + if ((aArray[0] != MSbcEncoderIntfc::ESbcChannelMono) || + (aArray[1] != MSbcEncoderIntfc::ESbcChannelDual) || + (aArray[2] != MSbcEncoderIntfc::ESbcChannelStereo) || + (aArray[3] != MSbcEncoderIntfc::ESbcChannelJointStereo)) + { + iTestStepResult = EFalse; + } + } + + return iTestStepResult; + } + +/****************************************************************************/ +CTestStepCISbcEncoderGetSupportedAllocationMethods::CTestStepCISbcEncoderGetSupportedAllocationMethods() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0024-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedAllocationMethods::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Allocation Methods")); + + RArray allocMethods; + CleanupClosePushL(allocMethods); + TInt err = interface->GetSupportedAllocationMethods(allocMethods); + + // Data is hard coded in the test HwDevice implementation + // to add the 2 available allocation methods + TBool validValues = ValidateArray(allocMethods); + if (err == KErrNone && validValues) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the allocation methods.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the allocation methods")); + } + CleanupStack::PopAndDestroy(); // allocMethods + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + + +TBool CTestStepCISbcEncoderGetSupportedAllocationMethods::ValidateArray(const RArray< + MSbcEncoderIntfc::TSbcAllocationMethod>& + aArray) const + { + TBool iTestStepResult = ETrue; + + TInt count = aArray.Count(); + if (count != 2) + { + iTestStepResult = EFalse; + } + else + { + if ((aArray[0] != MSbcEncoderIntfc::ESbcAllocationSNR) || + (aArray[1] != MSbcEncoderIntfc::ESbcAllocationLoudness)) + { + iTestStepResult = EFalse; + } + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSupportedBitpoolRange::CTestStepCISbcEncoderGetSupportedBitpoolRange() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0026-HP"); + } + +TVerdict CTestStepCISbcEncoderGetSupportedBitpoolRange::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Getting the SBC Encoder's Supported Bitpool Range")); + TUint minSize = 0; + TUint maxSize = 0; + TInt err = interface->GetSupportedBitpoolRange(minSize, maxSize); + + // Hard coded min and max values in the test device + if ((err == KErrNone) && + (minSize == 1) && + (maxSize == 2)) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully got the bitpool range.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to get the bitpool range")); + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetFrequency::CTestStepCISbcEncoderGetSetFrequency(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0034-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0027-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetFrequency::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Sampling Frequency")); + + TUint frequency = 666; + interface->SetSamplingFrequency(frequency); + + TUint testFreq = 0; + TInt err = interface->GetSamplingFrequency(testFreq); + if (err == KErrNone && (frequency == testFreq)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the frequency.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the frequency.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the frequency")); + } + else + { + ERR_PRINTF1(_L("Failed to set the frequency")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetChannelMode::CTestStepCISbcEncoderGetSetChannelMode(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0035-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0028-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetChannelMode::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Channel Mode")); + MSbcEncoderIntfc::TSbcChannelMode channelMode = MSbcEncoderIntfc::ESbcChannelStereo; + interface->SetChannelMode(channelMode); + + MSbcEncoderIntfc::TSbcChannelMode testChannelMode = MSbcEncoderIntfc::ESbcChannelMono; + TInt err = interface->GetChannelMode(testChannelMode); + if ((err == KErrNone) && (channelMode == testChannelMode)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the channel mode.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the channel mode.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get channel mode")); + } + else + { + ERR_PRINTF1(_L("Failed to set channel mode")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetNumOfSubbands::CTestStepCISbcEncoderGetSetNumOfSubbands(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0036-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0029-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetNumOfSubbands::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Number of Subbands")); + TUint numOfSubbands = 6; + interface->SetNumOfSubbands(numOfSubbands); + + TUint testSubbands = 0; + TInt err = interface->GetNumOfSubbands(testSubbands); + if (err == KErrNone && (testSubbands == numOfSubbands)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got subbands.")); + } + else + { + INFO_PRINTF1(_L("Successfully set subbands.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get subbands.")); + } + else + { + ERR_PRINTF1(_L("Failed to set subbands.")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetNumOfBlocks::CTestStepCISbcEncoderGetSetNumOfBlocks(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0037-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0030-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetNumOfBlocks::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Number of Blocks")); + TUint numOfBlocks = 6; + interface->SetNumOfBlocks(numOfBlocks); + TUint testBlocks = 0; + TInt err = interface->GetNumOfBlocks(testBlocks); + if ((err == KErrNone) && (numOfBlocks == testBlocks)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the number of blocks.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the number of blocks.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the number of blocks.")); + } + else + { + ERR_PRINTF1(_L("Failed to set the number of blocks.")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetAllocationMethod::CTestStepCISbcEncoderGetSetAllocationMethod(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0038-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0031-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetAllocationMethod::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Allocation Method")); + MSbcEncoderIntfc::TSbcAllocationMethod allocationMethod = MSbcEncoderIntfc::ESbcAllocationLoudness; + interface->SetAllocationMethod(allocationMethod); + + MSbcEncoderIntfc::TSbcAllocationMethod testAllocationMethod; + TInt err = interface->GetAllocationMethod(testAllocationMethod); + if ((err == KErrNone) && (allocationMethod == testAllocationMethod)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the allocation method.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the allocation method.")); + } } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the allocation method.")); + } + else + { + ERR_PRINTF1(_L("Failed to set the allocation method.")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderGetSetBitpoolSize::CTestStepCISbcEncoderGetSetBitpoolSize(TBool aIsGetTest) + : iIsGetTest(aIsGetTest) + { + if (iIsGetTest) + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0039-HP"); + } + else + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0032-HP"); + } + } + +TVerdict CTestStepCISbcEncoderGetSetBitpoolSize::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Setting the SBC Encoder's Bitpool Size")); + TUint bitpoolSize = 6; + interface->SetBitpoolSize(bitpoolSize); + + TUint testBitpoolSize = 0; + TInt err = interface->GetBitpoolSize(testBitpoolSize); + if ((err == KErrNone) && (bitpoolSize == testBitpoolSize)) + { + iTestStepResult = EPass; + if (iIsGetTest) + { + INFO_PRINTF1(_L("Successfully got the bitpool size.")); + } + else + { + INFO_PRINTF1(_L("Successfully set the bitpool size.")); + } + } + else + { + iTestStepResult = EFail; + if (iIsGetTest) + { + ERR_PRINTF1(_L("Failed to get the bitpool size.")); + } + else + { + ERR_PRINTF1(_L("Failed to set the bitpool size.")); + } + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISbcEncoderApplyConfig::CTestStepCISbcEncoderApplyConfig() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0033-HP"); + } + +TVerdict CTestStepCISbcEncoderApplyConfig::DoTestStepL() + { + INFO_PRINTF1(_L("Initializing test SBC Encoder CI device")); + + //Initialize - with the UID of our test HwDevice and try to get the interface + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSbcEncoderTestDevice}; + #else + TFourCC testUID('T','0','0','3'); + #endif + + MSbcEncoderIntfc* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSbcEncoderIntfc)); + if (interface) + { + INFO_PRINTF1(_L("Applying the config to the SBC Encoder")); + TInt err = interface->ApplyConfig(); + if (err == KErrNone) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully applied the config.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF2(_L("Failed to apply the config, error: %d"), err); + } + } + else + { + iTestStepResult = EInconclusive; + ERR_PRINTF1(_L("Failed to retrieve the interface.")); + } + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisbcencoder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisbcencoder.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,151 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCISBCENCODER_H +#define TESTSTEPCISBCENCODER_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + +class CTestStepCISbcEncoder : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoder(); + TVerdict DoTestStepL(); + }; + +class CTestStepCISbcEncoderGetSupportedFrequencies : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedFrequencies(); + TVerdict DoTestStepL(); +private: + TBool ValidateArray(const RArray& aArray) const; + }; + +class CTestStepCISbcEncoderGetSupportedSubbands : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedSubbands(); + TVerdict DoTestStepL(); +private: + TBool ValidateArray(const RArray& aArray) const; + }; + +class CTestStepCISbcEncoderGetSupportedNumOfBlocks : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedNumOfBlocks(); + TVerdict DoTestStepL(); +private: + TBool ValidateArray(const RArray& aArray) const; + }; + +class CTestStepCISbcEncoderGetSupportedChannelModes : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedChannelModes(); + TVerdict DoTestStepL(); +private: + TBool ValidateArray(const RArray& aArray) const; + }; + +class CTestStepCISbcEncoderGetSupportedAllocationMethods : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedAllocationMethods(); + TVerdict DoTestStepL(); +private: + TBool ValidateArray(const RArray& aArray) const; + }; + +class CTestStepCISbcEncoderGetSupportedBitpoolRange : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSupportedBitpoolRange(); + TVerdict DoTestStepL(); + }; + +class CTestStepCISbcEncoderGetSetFrequency : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetFrequency(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderGetSetChannelMode : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetChannelMode(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderGetSetNumOfSubbands : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetNumOfSubbands(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderGetSetNumOfBlocks : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetNumOfBlocks(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderGetSetAllocationMethod : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetAllocationMethod(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderGetSetBitpoolSize : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderGetSetBitpoolSize(TBool iIsGetTest); + TVerdict DoTestStepL(); +private: + TBool iIsGetTest; + }; + +class CTestStepCISbcEncoderApplyConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISbcEncoderApplyConfig(); + TVerdict DoTestStepL(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisetdrmprotected.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisetdrmprotected.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,138 @@ +// Copyright (c) 2007-2009 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 +#include "teststepcisetdrmprotected.h" +#include "cidefine.h" + +/*****************************************************************************/ +CTestStepCICreateSetDRMProtected::CTestStepCICreateSetDRMProtected() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0080-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCICreateSetDRMProtected::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSetDrmProtectedTestDevice}; + #else + TFourCC testUID('T','0','0','4'); + #endif + + MMMFSetDRMProtected* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSetDRMProtected)); + + if (interface) + { + iTestStepResult = EPass; + INFO_PRINTF1(_L("Successfully retrieved the interface.")); + } + else + { + iTestStepResult = EFail; + ERR_PRINTF1(_L("Failed to retrieve the interface")); + } + + return iTestStepResult; + } + +/*****************************************************************************/ +CTestStepCISetDRMProtected::CTestStepCISetDRMProtected() + { + iTestStepName = _L("MM-MMF-DEVSOUNDCI-U-0081-HP"); + } + +/*****************************************************************************/ +TVerdict CTestStepCISetDRMProtected::DoTestStepL() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("Initializing test CI device")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSetDrmProtectedTestDevice}; + #else + TFourCC testUID('T','0','0','4'); + #endif + + MMMFSetDRMProtected* interface = NULL; + interface = static_cast(InitializeAndInstantiateInterfaceL(testUID, KUidSetDRMProtected)); + + if (interface) + { + TBool DRMProtected = ETrue; + INFO_PRINTF1(_L("Calling test CI method")); + TInt err = interface->MmsdpMarkDataAsDRMProtected(DRMProtected); + TBool flag = EFalse; + // Reset test result in case we leave... + iTestStepResult = EFail; + DoReadFromFileL(flag); + if ((err == KErrNone) && (flag == DRMProtected)) + { + INFO_PRINTF1(_L("Test CI method call was successful")); + iTestStepResult = EPass; + } + else + { + ERR_PRINTF4(_L("Test CI method failed, error: %d, expected value: %d, actual value: %d"), \ + err, DRMProtected, flag); + } + } + else + { + WARN_PRINTF1(_L("Failed to retrieve the custom interface.")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + +void CTestStepCISetDRMProtected::DoReadFromFileL(TBool& aFlag) + { + RFs fs; + CleanupClosePushL(fs); + User::LeaveIfError(fs.Connect()); + + RFile file; + CleanupClosePushL(file); + + // File should already exist + User::LeaveIfError(file.Open(fs, KCITestFileName, EFileRead)); + // Size should be 1! + TInt fileSize = 0; + User::LeaveIfError(file.Size(fileSize)); + if (fileSize != KMaxCITestFileDataLength) + { + User::Leave(KErrCorrupt); + } + TBuf8 inputBuf; + User::LeaveIfError(file.Read(inputBuf)); + TChar val = inputBuf[0]; + aFlag = val.GetNumericValue(); + + CleanupStack::PopAndDestroy(); // file + + // It is the responsibility of this function to delete the file after use + User::LeaveIfError(fs.Delete(KCITestFileName)); + + CleanupStack::PopAndDestroy(); // fs + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisetdrmprotected.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcisetdrmprotected.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCISETDRMPROTECTED_H +#define TESTSTEPCISETDRMPROTECTED_H + +#include + +// Custom interface definitions +#include +#include + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCICreateSetDRMProtected : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCICreateSetDRMProtected(); + TVerdict DoTestStepL(); + }; + +class CTestStepCISetDRMProtected : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISetDRMProtected(); + TVerdict DoTestStepL(); +private: + void DoReadFromFileL(TBool& aFlag); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcispeechencoderconfig.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcispeechencoderconfig.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,206 @@ +// Copyright (c) 2007-2009 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 "teststepcispeechencoderconfig.h" + + +TVerdict CTestStepCISpeechEncoderConfig::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0001-HP")) == 0) + { + iTestStepResult = DoTestStep0001L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0002-HP")) == 0) + { + iTestStepResult = DoTestStep0002L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0003-HP")) == 0) + { + iTestStepResult = DoTestStep0003L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0001L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("SpeechEncoderConfig - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSpeechEncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','4'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidSpeechEncoderConfig + MSpeechEncoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig)); + + if (ptr) + { + INFO_PRINTF1(_L("MSpeechEncoderConfig instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0002L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("SpeechEncoderConfig - SetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSpeechEncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','4'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidSpeechEncoderConfig + MSpeechEncoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig)); + + if (ptr) + { + TBool vadModeOn = EFalse; + + result = ptr->SetVadMode(vadModeOn); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } + + +TVerdict CTestStepCISpeechEncoderConfig::DoTestStep0003L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("SpeechEncoderConfig - GetVadMode")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidSpeechEncoderConfigTestDevice}; + #else + TFourCC testUID('T','0','1','4'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidSpeechEncoderConfig + MSpeechEncoderConfig* ptr = static_cast (iMMFDevSound->CustomInterface(KUidSpeechEncoderConfig)); + + if (ptr) + { + TBool vadModeOn = ETrue; + + result = ptr->SetVadMode(vadModeOn); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MSpeechEncoderConfig::SetVadMode finished successfully")); + + result = ptr->GetVadMode(vadModeOn); + + if ( (result == KErrNone) && vadModeOn ) + { + INFO_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode finished successfully")); + + iTestStepResult = EPass; + } + else if (result != KErrNone) + { + INFO_PRINTF2(_L("MSpeechEncoderConfig::GetVadMode failed with error %d"), result); + } + else + { + ERR_PRINTF1(_L("MSpeechEncoderConfig::GetVadMode failed - expected and received mismatch")); + } + } + else + { + ERR_PRINTF2(_L("MSpeechEncoderConfig::SetVadMode failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MSpeechEncoderConfig failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcispeechencoderconfig.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepcispeechencoderconfig.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCISPEECHENCODERCONFIG_H +#define TESTSTEPCISPEECHENCODERCONFIG_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCISpeechEncoderConfig : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCISpeechEncoderConfig(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0001L(); + TVerdict DoTestStep0002L(); + TVerdict DoTestStep0003L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciunderflowautostopcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciunderflowautostopcontrol.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,130 @@ +// Copyright (c) 2007-2009 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 "teststepciunderflowautostopcontrol.h" + + +TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStepL() + { + iTestStepResult = ETestSuiteError; + + INFO_PRINTF1(_L("Initializing test CI device")); + + if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0091-HP")) == 0) + { + iTestStepResult = DoTestStep0091L(); + } + else if (iTestStepName.Compare(_L("MM-MMF-DEVSOUNDCI-U-0092-HP")) == 0) + { + iTestStepResult = DoTestStep0092L(); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStep0091L() + { + iTestStepResult = EFail; + + INFO_PRINTF1(_L("UnderflowAutoStopControl - Instantiating")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidUnderflowAutoStopControlTestDevice}; + #else + TFourCC testUID('T','0','2','1'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidunderflowAutoStopControl + MMMFUnderflowAutoStopControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidUnderflowAutoStopControl)); + + if (ptr) + { + INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl instantiated successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF1(_L("MMMFUnderflowAutoStopControl failed to retrieve the interface")); + } + + return iTestStepResult; + } + + +TVerdict CTestStepCIUnderflowAutoStopControl::DoTestStep0092L() + { + iTestStepResult = EFail; + TInt result = KErrGeneral; + + INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl - SetConversionFormat")); + + //Initialize - with the UID of our test HwDevice + #ifndef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + TUid testUID = {KUidUnderflowAutoStopControlTestDevice}; + #else + TFourCC testUID('T','0','2','1'); + #endif + + iTestStepResult = TestInitialize(testUID, EMMFStatePlaying); + + if (iTestStepResult != EPass) + { + INFO_PRINTF1(_L("DevSound failed to instantiate the test device")); + return EInconclusive; + } + + // reset the value as previous test is pass + iTestStepResult = EFail; + + // KUidUnderflowAutoStopControl + MMMFUnderflowAutoStopControl* ptr = static_cast (iMMFDevSound->CustomInterface(KUidUnderflowAutoStopControl)); + + if (ptr) + { + result = ptr->MmuascTurnOffUnderflowAutoStop(); // call method + + if (result == KErrNone) + { + INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl::MmuascTurnOffUnderflowAutoStop finished successfully")); + + iTestStepResult = EPass; + } + else + { + ERR_PRINTF2(_L("MMMFUnderflowAutoStopControl::MmuascTurnOffUnderflowAutoStop failed with error %d"), result); + } + } + else + { + INFO_PRINTF1(_L("MMMFUnderflowAutoStopControl failed to retrieve the interface")); + iTestStepResult = EInconclusive; + } + + return iTestStepResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciunderflowautostopcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/teststepciunderflowautostopcontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TESTSTEPCIUNDERFLOWAUTOSTOPCONTROL_H +#define TESTSTEPCIUNDERFLOWAUTOSTOPCONTROL_H + +#include +#include + +// Custom interface definitions +#include +#include + + +#include "devsoundciutestdevices.hrh" + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +class CTestStepCIUnderflowAutoStopControl : public CTestStepCustominterfaceUnificationUnit + { +public: + CTestStepCIUnderflowAutoStopControl(const TDesC& aTestName):CTestStepCustominterfaceUnificationUnit(aTestName){} + TVerdict DoTestStepL(); + +private: + TVerdict DoTestStep0091L(); + TVerdict DoTestStep0092L(); + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_step.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,468 @@ +// Copyright (c) 2007-2009 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: +// + +// Custom interface definitions +#include +#include + +// Test system includes +#include "tsu_mmf_devsound_ciu_step.h" +#include "tsu_mmf_devsound_ciu_suite.h" + + +/** +CTestStepCustominterfaceUnificationUnit constructor +*/ +CTestStepCustominterfaceUnificationUnit::CTestStepCustominterfaceUnificationUnit() : +iScheduler(NULL) + { + iRes = &iSourceFileName; + } + +CTestStepCustominterfaceUnificationUnit::CTestStepCustominterfaceUnificationUnit(const TDesC& aTestName) : +iScheduler(NULL) + { + iRes = &iSourceFileName; + iTestStepName = aTestName; + } + +/** +CTestStepCustominterfaceUnificationUnit destructor +*/ +CTestStepCustominterfaceUnificationUnit::~CTestStepCustominterfaceUnificationUnit() + { + if (iMMFDevSound) + { + delete iMMFDevSound; + } + if (iActiveListener) + { + delete iActiveListener; + } + if (iScheduler) + { + delete iScheduler; + } + } + +/** +CTestStepCustominterfaceUnificationUnit accessor : set suite + + @param CTestSuiteCustominterfaceUnificationUnit* + The test suite. + */ +void CTestStepCustominterfaceUnificationUnit::SetSuite(CTestSuiteCustomInterfaceUnificationUnit* aSuite) + { + iTestSuite = aSuite; + } + +/** +CTestStepCustominterfaceUnificationUnit accessor : get suite + * + * @return "CTestSuiteCustominterfaceUnificationUnit*" + * The test suite. + */ +CTestSuiteCustomInterfaceUnificationUnit* CTestStepCustominterfaceUnificationUnit::TestSuite() const + { + return iTestSuite; + } + +/** +DoTestStepPreambleL is the preamble function for test steps +It creates an active scheduler and installs it. This is necessary +since we are multithreading and each test step runs in a separate thread. +@return TVerdict which is either EPass or Efail + +The function can leave if there is insufficient memeory +*/ +enum TVerdict CTestStepCustominterfaceUnificationUnit::DoTestStepPreambleL(void) + { + iScheduler = new(ELeave)CActiveScheduler; + CleanupStack::PushL( iScheduler ); + + CActiveScheduler::Install( iScheduler ); + + CleanupStack::Pop(); + + iActiveListener= new(ELeave)CActiveListener; + + INFO_PRINTF1(_L("Creating DevSound Object")); + TRAPD(err, iMMFDevSound = CMMFDevSound::NewL()); + if (err) + { + return EInconclusive; + } + else + { + return EPass; + } + } + +/** +The post amble step cleans up the allocated memory in the preamble +@return TVerdict EPass or EFail +@leave can leave due to insufficient memory +*/ +enum TVerdict CTestStepCustominterfaceUnificationUnit::DoTestStepPostambleL(void) + { + INFO_PRINTF1(_L("Deleting DevSound Object")); + + if (iMMFDevSound) + { + delete iMMFDevSound; + iMMFDevSound = NULL; + } + if (iActiveListener) + { + delete iActiveListener; + iActiveListener = NULL; + } + if (iScheduler) + { + delete iScheduler; + iScheduler = NULL; + } + + return EPass; + } + + +// +// start Callback methods from MDevSoundObserver mixin +// + +/** +InitializeComplete +@param aError +*/ +void CTestStepCustominterfaceUnificationUnit::InitializeComplete (TInt aError) + { + INFO_PRINTF2(_L("DevSound called InitializeComplete with aError = %d"), aError); + TRequestStatus* stat = &(iActiveListener->iStatus); + User::RequestComplete(stat, aError); + iCallbackArray[EInitComplete] ++; + iCallbackError = aError; + } + +/** +ToneFinished +@param aError +*/ +void CTestStepCustominterfaceUnificationUnit::ToneFinished (TInt aError) + { + INFO_PRINTF2(_L("DevSound called ToneFinished with aError = %d"), aError); + TRequestStatus* stat = &(iActiveListener->iStatus); + User::RequestComplete(stat, aError); + iCallbackArray[EToneFinished] ++; + iCallbackError = aError; + } + +/** +BufferToBeFilled +@param aBuffer +*/ +void CTestStepCustominterfaceUnificationUnit::BufferToBeFilled (CMMFBuffer* aBuffer) + { + iBuffer = aBuffer; + TRequestStatus* stat = &(iActiveListener->iStatus); + if (aBuffer != NULL) + { + User::RequestComplete(stat, KErrNone); + iCallbackError = KErrNone; + } + else + { + User::RequestComplete(stat, KErrNotFound); + iCallbackError = KErrNotFound; + } + iCallbackArray[EBuffToFill] ++; + } + +/** +PlayError +@param aError +*/ +void CTestStepCustominterfaceUnificationUnit::PlayError (TInt aError) + { + INFO_PRINTF2(_L("DevSound called PlayError with aError = %d"), aError); + TRequestStatus* stat = &(iActiveListener->iStatus); + User::RequestComplete (stat, aError); + iCallbackError = aError; + iCallbackArray[EPlayError] ++; + } + +/** +BufferToBeEmptied +@param aBuffer +*/ +void CTestStepCustominterfaceUnificationUnit::BufferToBeEmptied (CMMFBuffer* aBuffer) + { + INFO_PRINTF1(_L("DevSound called BufferToBeEmptied")); + iBuffer = aBuffer; + TRequestStatus* stat = &(iActiveListener->iStatus); + if (aBuffer != NULL) + { + User::RequestComplete(stat, KErrNone); + iCallbackError = KErrNone; + } + else + { + User::RequestComplete(stat, KErrNotFound); + iCallbackError = KErrNotFound; + } + iCallbackArray[EBuffToEmpty] ++; + } + +/** +RecordError +@param aError +*/ +void CTestStepCustominterfaceUnificationUnit::RecordError (TInt aError) + { + INFO_PRINTF2(_L("DevSound called RecordError with aError = %d"), aError); + TRequestStatus* stat = &(iActiveListener->iStatus); + User::RequestComplete (stat, aError); + iCallbackError = aError; + iCallbackArray[ERecError] ++; + } + +/** +ConvertError +*/ +void CTestStepCustominterfaceUnificationUnit::ConvertError (TInt /*aError*/) + { + } + +/** +DeviceMessage +*/ +void CTestStepCustominterfaceUnificationUnit::DeviceMessage(TUid, const TDesC8& /*aMsg*/) + { + } + + +// +// start Test methods (called by test cases) +// + +/** +TestInitialize +@param aMode +@return TVerdict +*/ +TVerdict CTestStepCustominterfaceUnificationUnit::TestInitialize(TMMFState aMode) + { + iCallbackError = KErrNone; + iExpectedValue = KErrNone; + INFO_PRINTF1(_L("Initializing DevSound")); + + ResetCallbacks(); + iActiveListener->InitialiseActiveListener(); + // Initialize + TRAPD(err, iMMFDevSound->InitializeL(*this, aMode)); + if (err) + { + WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); + return EInconclusive; + } + else + { + CActiveScheduler::Start(); + if (iCallbackError != iExpectedValue) + { + ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); + return EFail; + } + if (iCallbackArray[EInitComplete] != 1) + { + ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); + return EFail; + } + } + return EPass; + } + +/** +TestInitialize +@param aHwDeviceUid +@param aMode +@return TVerdict +*/ +TVerdict CTestStepCustominterfaceUnificationUnit::TestInitialize(TUid aHwDeviceUid, TMMFState aMode) + { + iCallbackError = KErrNone; + iExpectedValue = KErrNone; + INFO_PRINTF1(_L("Initializing DevSound")); + + ResetCallbacks(); + iActiveListener->InitialiseActiveListener(); + // Initialize + TRAPD(err, iMMFDevSound->InitializeL(*this, aHwDeviceUid, aMode)); + if (err) + { + WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); + return EInconclusive; + } + else + { + CActiveScheduler::Start(); + if (iCallbackError != iExpectedValue) + { + ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); + return EFail; + } + if (iCallbackArray[EInitComplete] != 1) + { + ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); + return EFail; + } + } + return EPass; + } + +/** +TestInitialize +@param aDataType +@param aMode +@return TVerdict +*/ +TVerdict CTestStepCustominterfaceUnificationUnit::TestInitialize(TFourCC& aDataType, TMMFState aMode) + { + iCallbackError = KErrNone; + iExpectedValue = KErrNone; + INFO_PRINTF1(_L("Initializing DevSound")); + + ResetCallbacks(); + iActiveListener->InitialiseActiveListener(); + // Initialize + TRAPD(err, iMMFDevSound->InitializeL(*this, aDataType, aMode)); + if (err) + { + WARN_PRINTF2 (_L("DevSound InitializeL left with error = %d"), err); + return EInconclusive; + } + else + { + CActiveScheduler::Start(); + if (iCallbackError != iExpectedValue) + { + ERR_PRINTF3 (_L("DevSound InitializeComplete returned %d, expected %d"), iCallbackError, iExpectedValue); + return EFail; + } + if (iCallbackArray[EInitComplete] != 1) + { + ERR_PRINTF2 (_L("DevSound InitializeComplete was called %d times, expected 1"), iCallbackArray[EInitComplete]); + return EFail; + } + } + return EPass; + } + +/** + * Initialises dev sound for the given HwDevice uid and tries to instantiate the given interface. + */ +TAny* CTestStepCustominterfaceUnificationUnit::InitializeAndInstantiateInterfaceL(const TUid aHwDeviceUid, const TUid aInterfaceUid) + { + TAny* interface = NULL; + + iTestStepResult = TestInitialize(aHwDeviceUid, EMMFStatePlaying); + + if (iTestStepResult == EPass) + { + INFO_PRINTF1(_L("Successfully initialized DevSound")); + interface = iMMFDevSound->CustomInterface(aInterfaceUid); + } + else + { + ERR_PRINTF1(_L("Failed to initialize DevSound")); + } + + return interface; + } + +/** + * Initialises dev sound for the given FourCC and tries to instantiate the given interface. + */ +TAny* CTestStepCustominterfaceUnificationUnit::InitializeAndInstantiateInterfaceL(TFourCC& aDataType, const TUid aInterfaceUid) + { + TAny* interface = NULL; + + iTestStepResult = TestInitialize(aDataType, EMMFStatePlaying); + + if (iTestStepResult == EPass) + { + INFO_PRINTF1(_L("Successfully initialized DevSound")); + interface = iMMFDevSound->CustomInterface(aInterfaceUid); + } + else + { + ERR_PRINTF1(_L("Failed to initialize DevSound")); + } + + return interface; + } + +/** +ReadFileL +@param aName +@param aData +*/ +void CTestStepCustominterfaceUnificationUnit::ReadFileL(const TDesC &aName, TInt& aData) + { + User::LeaveIfError(iFs.Connect()); + + User::LeaveIfError(iFile.Open(iFs, aName, EFileRead)); + + TBuf8<4> data; + + User::LeaveIfError(iFile.Read(data)); + iFile.Close(); + + iFs.Delete(aName); + iFs.Close(); + + TLex8 lex(data); + lex.Val(aData); + } + +/** +WriteFileL +@param aName +@param aData +*/ +void CTestStepCustominterfaceUnificationUnit::WriteFileL(const TDesC &aName, TInt aData) + { + User::LeaveIfError(iFs.Connect()); + + iFs.MkDirAll(aName); + + User::LeaveIfError(iFile.Replace(iFs, aName, EFileWrite)); + + TBuf8<4> data; + data.Format(_L8("%d"), aData); + + User::LeaveIfError(iFile.Write(data)); + iFile.Close(); + iFs.Close(); + } + +/** +ResetCallbacks +*/ +void CTestStepCustominterfaceUnificationUnit::ResetCallbacks() + { + //Initialize callback array + iCallbackArray.Reset(); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_step.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_step.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,118 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TSU_MMF_DEVSOUND_CIU_STEP_H +#define TSU_MMF_DEVSOUND_CIU_STEP_H + +#include +#include + +#include +#include "devsoundciutestdevices.hrh" + + +/** + * CActiveListener provides the asynchronous operation of an active object + * + */ +class CActiveListener : public CActive + { +public: + CActiveListener() : CActive(CActive::EPriorityIdle) { CActiveScheduler::Add(this); } + void InitialiseActiveListener() { iStatus = KRequestPending; SetActive(); } + // From CActive + virtual void RunL() { CActiveScheduler::Stop(); } + virtual void DoCancel() {}; + }; + +/** + * CTestDevSoundCiuStep, which is the base class for all + * the UnitMMFAudClient suite test steps. + * + * + * + */ +class CTestSuite; +class CTestSuiteCustomInterfaceUnificationUnit; + +class CTestStepCustominterfaceUnificationUnit : public CTestStep, + public MDevSoundObserver + { +public: + CTestStepCustominterfaceUnificationUnit(); + CTestStepCustominterfaceUnificationUnit(const TDesC& aTestName); + ~CTestStepCustominterfaceUnificationUnit(); + + void SetSuite(CTestSuiteCustomInterfaceUnificationUnit* aSuite); + CTestSuiteCustomInterfaceUnificationUnit* TestSuite() const; + void WriteFileL(const TDesC &aName, TInt aData); + void ReadFileL(const TDesC &aName, TInt& aData); + +protected: + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); + + // Callback methods from MDevSoundObserver mixin + void InitializeComplete (TInt aError); + void ToneFinished (TInt aError); + void BufferToBeFilled (CMMFBuffer* aBuffer); + void PlayError (TInt aError); + void BufferToBeEmptied (CMMFBuffer* aBuffer); + void RecordError (TInt aError); + void ConvertError (TInt aError); + void DeviceMessage (TUid aMessageType, const TDesC8& aMsg); + + typedef enum TCallback + { + EInitComplete, + EToneFinished, + EBuffToFill, + EPlayError, + EBuffToEmpty, + ERecError, + EConvertMsg, + EDeviceMsg + } TCallback; + + // Test methods (called by test cases) + TVerdict TestInitialize(TMMFState aMode); + TVerdict TestInitialize(TFourCC& aDataType, TMMFState aMode); + TVerdict TestInitialize(TUid aHwDeviceUid, TMMFState aMode); + + TAny* InitializeAndInstantiateInterfaceL(const TUid aHwDeviceUid, const TUid aInterfaceUid); + TAny* InitializeAndInstantiateInterfaceL(TFourCC& aDataType, const TUid aInterfaceUid); + + // Utility Methods + void ResetCallbacks(); + + CMMFDevSound* iMMFDevSound; +private: + TFixedArray iCallbackArray; + TInt iCallbackError; + TInt iExpectedValue; + // pointer to suite which owns this test + CTestSuiteCustomInterfaceUnificationUnit* iTestSuite; + CActiveScheduler* iScheduler ; + CActiveListener* iActiveListener; + +protected: + TFileName iSourceFileName; + TFileName* iRes; + RFs iFs; + RFile iFile; + CMMFBuffer* iBuffer; // for callback usage + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_suite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_suite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,284 @@ +// Copyright (c) 2007-2009 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 + +//Test system includes +#include "tsu_mmf_devsound_ciu_suite.h" +#include "tsu_mmf_devsound_ciu_step.h" +#include "teststepciplaybackstatus.h" +#include "teststepcieaacplusdecoder.h" +#include "teststepcisbcencoder.h" +#include "teststepciadvancedaacencodesettings.h" +#include "teststepcisetdrmprotected.h" +#include "teststepcigettimestamps.h" +#include "teststepcibufferframesconfig.h" + +#include "teststepciaacdecoderconfig.h" +#include "teststepcig729decoderconfig.h" +#include "teststepcig729encoderconfig.h" +#include "teststepciaudiobufferprefill.h" +#include "teststepciaudiovibracontrol.h" +#include "teststepciaudiodspcontrol.h" +#include "teststepcispeechencoderconfig.h" +#include "teststepcig711decoderconfig.h" +#include "teststepcig711encoderconfig.h" +#include "teststepciilbcdecoderconfig.h" +#include "teststepciilbcencoderconfig.h" +#include "teststepcierrorconcealment.h" +#include "teststepcigsmconfig.h" +#include "teststepciunderflowautostopcontrol.h" + +/** + * + * Create an instance of this test suite. + * + * NewTestSuiteL() is exported at ordinal 1. + * This provides the interface to allow the Test Framework + * to create instances of this test suite. + * + * @return "CTestSuite*" + * The newly created test suite + */ +EXPORT_C CTestSuite* NewTestSuiteL() + { + CTestSuiteCustomInterfaceUnificationUnit* result = new (ELeave) CTestSuiteCustomInterfaceUnificationUnit; + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(result); + return result; + } + +/** + * CTestDevSoundCiuSuite destructor + */ +CTestSuiteCustomInterfaceUnificationUnit::~CTestSuiteCustomInterfaceUnificationUnit() + { + } + +/** +This test suite version string +*/ +_LIT(KTxtVersion,"0.1 (build 1-May-2006)"); + +/** +Get test suite version. + +@return TPtrC, The version string. +*/ +TPtrC CTestSuiteCustomInterfaceUnificationUnit::GetVersion() const + { + return KTxtVersion(); + } + +/** +Add a test step into the suite. + +@param CTestStepCustomInterfaceUnificationUnit* aTestStep + The test step to be added. +*/ +void CTestSuiteCustomInterfaceUnificationUnit::AddTestStepL( CTestStepCustominterfaceUnificationUnit* aTestStep ) + { + // test steps contain a pointer back to the suite which owns them + aTestStep->SetSuite(this); + + // add the step using the base class method + CTestSuite::AddTestStepL(aTestStep); + } + +/** +Initialiser for test suite. + +This creates all the test steps and stores them +inside CTestSuiteCustomInterfaceUnificationUnit +*/ +void CTestSuiteCustomInterfaceUnificationUnit::InitialiseL() + { + // store the name of this test suite + iSuiteName = _L("TSU_MMF_DEVSOUND_CIU"); + + // add test steps + //MSpeechEncoderConfig - Instantiating + AddTestStepL( new(ELeave) CTestStepCISpeechEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0001-HP")) ); + //MSpeechEncoderConfig - SetVadMode + AddTestStepL( new(ELeave) CTestStepCISpeechEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0002-HP")) ); + //MSpeechEncoderConfig - GetVadMode + AddTestStepL( new(ELeave) CTestStepCISpeechEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0003-HP")) ); + //MAacDecoderConfig - Instantiating + AddTestStepL( new(ELeave) CTestStepCIAacDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0004-HP")) ); + //MAacDecoderConfig - SetAudioConfig + AddTestStepL( new(ELeave) CTestStepCIAacDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0005-HP")) ); + // Steps 6 - 7 + // Advanced AAC Encode Settings + AddTestStepL( new(ELeave) CTestStepCICreateAdvancedAacEncodeSettings); + // Test the set method + AddTestStepL( new(ELeave) CTestStepCIAdvancedAacEncodeSettings(EFalse)); + // Steps 8 - 19 + // EAAC+ Decoder + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoder ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetFrequency(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetObjType(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetNumChannels(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetSbr(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetDsm(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderApplyConfig ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetFrequency(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetObjType(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetNumChannels(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetSbr(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCIEAacPlusDecoderGetSetDsm(EFalse) ); + // Steps 20 - 39 + // + // SBC Encoder + AddTestStepL( new(ELeave) CTestStepCISbcEncoder ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedFrequencies ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedSubbands ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedNumOfBlocks ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedChannelModes ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedAllocationMethods ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSupportedBitpoolRange ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetFrequency(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetChannelMode(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetNumOfSubbands(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetNumOfBlocks(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetAllocationMethod(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetBitpoolSize(ETrue) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderApplyConfig ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetFrequency(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetChannelMode(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetNumOfSubbands(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetNumOfBlocks(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetAllocationMethod(EFalse) ); + AddTestStepL( new(ELeave) CTestStepCISbcEncoderGetSetBitpoolSize(EFalse) ); + //MG711DecoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0040-HP")) ); + //MG711DecoderIntfc - SetDecoderMode + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0041-HP")) ); + //MG711DecoderIntfc - SetComfortNoiseGeneration + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0042-HP")) ); + //MG711DecoderIntfc - GetComfortNoiseGeneration + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0043-HP")) ); + //MG711DecoderIntfc - SetPacketLossConcealment + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0044-HP")) ); + //MG711EncoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIG711EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0045-HP")) ); + //MG711EncoderIntfc - SetEncoderMode + AddTestStepL( new(ELeave) CTestStepCIG711EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0046-HP")) ); + //MG711EncoderIntfc - SetVadMode + AddTestStepL( new(ELeave) CTestStepCIG711EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0047-HP")) ); + //MG711EncoderIntfc - GetVadMode + AddTestStepL( new(ELeave) CTestStepCIG711EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0048-HP")) ); + //MG729DecoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIG729DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0049-HP")) ); + //MG729DecoderIntfc - BadLsfNextBuffer + AddTestStepL( new(ELeave) CTestStepCIG729DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0050-HP")) ); + //MG729EncoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIG729EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0051-HP")) ); + //MG729EncoderIntfc - SetVadMode + AddTestStepL( new(ELeave) CTestStepCIG729EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0052-HP")) ); + //MG729EncoderIntfc - GetVadMode + AddTestStepL( new(ELeave) CTestStepCIG729EncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0053-HP")) ); + //MIlbcDecoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIIlbcDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0054-HP")) ); + //MIlbcDecoderIntfc - SetDecoderMode + AddTestStepL( new(ELeave) CTestStepCIIlbcDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0055-HP")) ); + //MIlbcDecoderIntfc - SetComfortNoiseGeneration + AddTestStepL( new(ELeave) CTestStepCIIlbcDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0056-HP")) ); + //MIlbcDecoderIntfc - GetComfortNoiseGeneration + AddTestStepL( new(ELeave) CTestStepCIIlbcDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0057-HP")) ); + //MIlbcEncoderIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIIlbcEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0058-HP")) ); + //MIlbcEncoderIntfc - SetEncoderMode + AddTestStepL( new(ELeave) CTestStepCIIlbcEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0059-HP")) ); + //MIlbcEncoderIntfc - SetVadMode + AddTestStepL( new(ELeave) CTestStepCIIlbcEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0060-HP")) ); + //MIlbcEncoderIntfc - GetVadMode + AddTestStepL( new(ELeave) CTestStepCIIlbcEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0061-HP")) ); + //MErrorConcealmentIntfc - Instantiating + AddTestStepL( new(ELeave) CTestStepCIErrorConcealmentIntfc(_L("MM-MMF-DEVSOUNDCI-U-0062-HP")) ); + //MErrorConcealmentIntfc - ConcealErrorForNextBuffer + AddTestStepL( new(ELeave) CTestStepCIErrorConcealmentIntfc(_L("MM-MMF-DEVSOUNDCI-U-0063-HP")) ); + //MErrorConcealmentIntfc - FrameModeRqrdForEC + AddTestStepL( new(ELeave) CTestStepCIErrorConcealmentIntfc(_L("MM-MMF-DEVSOUNDCI-U-0064-HP")) ); + //MErrorConcealmentIntfc - SetFrameMode + AddTestStepL( new(ELeave) CTestStepCIErrorConcealmentIntfc(_L("MM-MMF-DEVSOUNDCI-U-0065-HP")) ); + //MAudioVibraControl - Instantiating + AddTestStepL( new(ELeave) CTestStepCIAudioVibraControl(_L("MM-MMF-DEVSOUNDCI-U-0066-HP")) ); + //MAudioVibraControl - StartVibra + AddTestStepL( new(ELeave) CTestStepCIAudioVibraControl(_L("MM-MMF-DEVSOUNDCI-U-0067-HP")) ); + //MAudioVibraControl - StopVibra + AddTestStepL( new(ELeave) CTestStepCIAudioVibraControl(_L("MM-MMF-DEVSOUNDCI-U-0068-HP")) ); + //MMMFSampleBuffering - Instantiating + AddTestStepL( new(ELeave) CTestStepCISampleBuffering(_L("MM-MMF-DEVSOUNDCI-U-0069-HP")) ); + //MMMFSampleBuffering - MmsbEnableSampleBufferingBeforePlayback + AddTestStepL( new(ELeave) CTestStepCISampleBuffering(_L("MM-MMF-DEVSOUNDCI-U-0070-HP")) ); + //MMMFSampleBuffering - MmsbDisableSampleBufferingBeforePlayback + AddTestStepL( new(ELeave) CTestStepCISampleBuffering(_L("MM-MMF-DEVSOUNDCI-U-0071-HP")) ); + //MMMFSampleBuffering - MmsbNotifyPlayStarted + AddTestStepL( new(ELeave) CTestStepCISampleBuffering(_L("MM-MMF-DEVSOUNDCI-U-0072-HP")) ); + //MMMFSampleBuffering - MmsbCancelNotifyPlayStarted + AddTestStepL( new(ELeave) CTestStepCISampleBuffering(_L("MM-MMF-DEVSOUNDCI-U-0073-HP")) ); + // MMMFPlaybackStatus + AddTestStepL( new(ELeave) CTestStepCIPlaybackStatus ); + // MMMFPlaybackStatus - MmpsGetPlaybackStatusInformation + AddTestStepL( new(ELeave) CTestStepCIPlaybackStatusInfo ); + //MMMFDSPControl - Instantiating + AddTestStepL( new(ELeave) CTestStepCIAudioDspControl(_L("MM-MMF-DEVSOUNDCI-U-0076-HP")) ); + //MMMFDSPControl - MmdspcRequestLossOfSyncNotification + AddTestStepL( new(ELeave) CTestStepCIAudioDspControl(_L("MM-MMF-DEVSOUNDCI-U-0077-HP")) ); + //MMMFDSPControl - MmdspcCancelLossOfSyncNotification + AddTestStepL( new(ELeave) CTestStepCIAudioDspControl(_L("MM-MMF-DEVSOUNDCI-U-0078-HP")) ); + //MMMFDSPControl - MmdspcGetAudioPlaybackInfo + AddTestStepL( new(ELeave) CTestStepCIAudioDspControl(_L("MM-MMF-DEVSOUNDCI-U-0079-HP")) ); + // Steps 80 - 81 + // Set DRM Protected + AddTestStepL( new(ELeave) CTestStepCICreateSetDRMProtected); + AddTestStepL( new(ELeave) CTestStepCISetDRMProtected); + // Steps 82 - 84 + // Buffer Frames Config + AddTestStepL( new(ELeave) CTestStepCICreateBufferFramesConfig); + AddTestStepL( new(ELeave) CTestStepCIBufferFramesConfigSetInput); + AddTestStepL( new(ELeave) CTestStepCIBufferFramesConfigSetOutput); + // Steps 85 - 87 + // Get timestamps + AddTestStepL( new(ELeave) CTestStepCICreateGetTimestamps); + AddTestStepL( new(ELeave) CTestStepCIGetTimestampsEnable); + AddTestStepL( new(ELeave) CTestStepCIGetTimestampsForBuffer); + //MMMFGsmConfig - Instantiating + AddTestStepL( new(ELeave) CTestStepCIGsmConfig(_L("MM-MMF-DEVSOUNDCI-U-0088-HP")) ); + //MMMFGsmConfig - SetConversionFormat + AddTestStepL( new(ELeave) CTestStepCIGsmConfig(_L("MM-MMF-DEVSOUNDCI-U-0089-HP")) ); + //MMMFGsmConfig - ConversionFormat + AddTestStepL( new(ELeave) CTestStepCIGsmConfig(_L("MM-MMF-DEVSOUNDCI-U-0090-HP")) ); + //MMMFUnderflowAutoStopControl - Instantiation + AddTestStepL( new(ELeave) CTestStepCIUnderflowAutoStopControl(_L("MM-MMF-DEVSOUNDCI-U-0091-HP")) ); + //MMMFUnderflowAutoStopControl - MmuascTurnOffUnderflowAutoStop + AddTestStepL( new(ELeave) CTestStepCIUnderflowAutoStopControl(_L("MM-MMF-DEVSOUNDCI-U-0092-HP")) ); + //MAacDecoderConfig - GetSupportedAudioConfigs + AddTestStepL( new(ELeave) CTestStepCIAacDecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0093-HP")) ); + //MG711DecoderIntfc - GetDecoderMode + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0094-HP")) ); + //MG711DecoderIntfc - GetPacketLossConcealment + AddTestStepL( new(ELeave) CTestStepCIG711DecoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0095-HP")) ); + //MIlbcEncoderIntfc - GetDecoderMode + AddTestStepL( new(ELeave) CTestStepCIIlbcEncoderConfig(_L("MM-MMF-DEVSOUNDCI-U-0096-HP")) ); + // PlaybackStatus - Request Notification + AddTestStepL( new(ELeave) CTestStepCIPlaybackStatusRequestNotification(EFalse) ); + // PlaybackStatus - Cancel request + AddTestStepL( new(ELeave) CTestStepCIPlaybackStatusRequestNotification(ETrue) ); + // Advanced AAC Encode Settings + // Test the get method + AddTestStepL( new(ELeave) CTestStepCIAdvancedAacEncodeSettings(ETrue)); + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_suite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/tsu_mmf_devsound_ciu_suite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,42 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef TSU_MMF_DEVSOUND_CIU_SUITE_H +#define TSU_MMF_DEVSOUND_CIU_SUITE_H + +#include + + +/** +CTestSuiteCustomInterfaceUnificationUnit, which is the base class for +the Custom Interface Unification Unit suite. + + + */ +class CTestStepCustominterfaceUnificationUnit; + +class CTestSuiteCustomInterfaceUnificationUnit : public CTestSuite + { +public: + void InitialiseL(); + virtual ~CTestSuiteCustomInterfaceUnificationUnit(); + void AddTestStepL( CTestStepCustominterfaceUnificationUnit* aTestStep ); + TPtrC GetVersion() const; + +private: + + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/underflowautostopcontroltestdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/underflowautostopcontroltestdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +// Copyright (c) 2007-2009 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 +#include +#include +#include "underflowautostopcontroltestdevice.h" +#include "devsoundciutestdevices.hrh" + + +/* +CMMFUnderflowAutoStopControl implementation +*/ +CMMFUnderflowAutoStopControl* CMMFUnderflowAutoStopControl::NewL() + { + CMMFUnderflowAutoStopControl* self = new(ELeave) CMMFUnderflowAutoStopControl(); + return self; + } + +CMMFUnderflowAutoStopControl::~CMMFUnderflowAutoStopControl() + { + } + +// Actual implementation of method +TInt CMMFUnderflowAutoStopControl::MmuascTurnOffUnderflowAutoStop() + { + return KErrNone; + } + + +/* +CUnderflowAutoStopControlTestDevice Implementation +*/ +CMMFHwDevice* CUnderflowAutoStopControlTestDevice::NewL() + { + CUnderflowAutoStopControlTestDevice* self=new(ELeave) CUnderflowAutoStopControlTestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CUnderflowAutoStopControlTestDevice::~CUnderflowAutoStopControlTestDevice() + { + delete iUnderflowAutoStopCtrl; + } + +CUnderflowAutoStopControlTestDevice::CUnderflowAutoStopControlTestDevice() + { + } + +void CUnderflowAutoStopControlTestDevice::ConstructL() + { + } + +TInt CUnderflowAutoStopControlTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::Stop() + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::Pause() + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + +TAny* CUnderflowAutoStopControlTestDevice::CustomInterface(TUid aInterfaceId) + { + // Just return something non-NULL to keep the + // DevSound initialisation process happy + TAny* ret = static_cast(this); + + // Now for the CIs we want to test... + if (aInterfaceId == KUidUnderflowAutoStopControl) + { + if (!iUnderflowAutoStopCtrl) + { + TRAPD(err, iUnderflowAutoStopCtrl = CMMFUnderflowAutoStopControl::NewL()); + if (err == KErrNone && iUnderflowAutoStopCtrl) + { + MMMFUnderflowAutoStopControl* ptr = this; + ret = static_cast(ptr); + } + else + { + ret = NULL; + } + } + } + + return ret; + } + +TInt CUnderflowAutoStopControlTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::StopAndDeleteCodec() + { + return 0; + } + +TInt CUnderflowAutoStopControlTestDevice::DeleteCodec() + { + return 0; + } + +CMMFSwCodec& CUnderflowAutoStopControlTestDevice::Codec() + { + return *iCodec; + } + +TInt CUnderflowAutoStopControlTestDevice::MmuascTurnOffUnderflowAutoStop() + { + TInt result = KErrBadHandle; + + if (iUnderflowAutoStopCtrl) + { + result = iUnderflowAutoStopCtrl->MmuascTurnOffUnderflowAutoStop(); + } + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/CIPlugins/src/underflowautostopcontroltestdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/CIPlugins/src/underflowautostopcontroltestdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,75 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef UNDERFLOWAUTOSTOPCONTROLTESTDEVICE_H +#define UNDERFLOWAUTOSTOPCONTROLTESTDEVICE_H + +#include +#include + + +class CMMFUnderflowAutoStopControl : public CBase, + public MMMFUnderflowAutoStopControl + { +public: + //return Pointer to the CMMFUnderflowAutoStopControl class + static CMMFUnderflowAutoStopControl* NewL(); + + //Destructor + ~CMMFUnderflowAutoStopControl(); + + // from MMMFUnderflowAutoStopControl + TInt MmuascTurnOffUnderflowAutoStop(); + }; + + +/* +CUnderflowAutoStopControlTestDevice + +Test hw device used by the +TSU_MMF_DEVSOUND_CIU_SUITE unit test harness. +*/ +class CUnderflowAutoStopControlTestDevice : public CMMFSwCodecWrapper, + public MMMFUnderflowAutoStopControl + { +public: + static CMMFHwDevice* NewL(); + virtual ~CUnderflowAutoStopControlTestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // from CMMFSwCodecWrapper + virtual CMMFSwCodec& Codec(); + + // MMMFUnderflowAutoStopControl + TInt MmuascTurnOffUnderflowAutoStop(); + +private: + CUnderflowAutoStopControlTestDevice(); + void ConstructL(); + +private: + CMMFUnderflowAutoStopControl* iUnderflowAutoStopCtrl; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/101F9F50.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/101F9F50.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,68 @@ +// Copyright (c) 2004-2009 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 +#include +#include "TSU_MMF_DEVSOUND_TESTDEVICE_ImplementationUID.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101F9F50; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidTestHwDevice; + version_no = 1; + display_name = "Test Hw Device||Copyright 2004 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = 0x102834C3; + version_no = 1; + display_name = "DevSound test HwDevice1||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "PTST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x102834C4; + version_no = 1; + display_name = "DevSound test HwDevice2||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "PTST, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x102834C5; + version_no = 1; + display_name = "DevSound test HwDevice3||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "PTST, P16" ; // four CC codes + opaque_data = ""; + } + + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/101F9F50_a3f.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/101F9F50_a3f.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,125 @@ +// Copyright (c) 2004-2009 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 +#include +#include +#include "TSU_MMF_DEVSOUND_TESTDEVICE_ImplementationUID.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101F9F50; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice ; // CMMFHwDevice + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidTestHwDevice; + version_no = 1; + display_name = "Test Hw Device||Copyright 2004 Symbian Ltd. All Rights Reserved.||"; + default_data = "TEST, P16" ; // four CC codes + opaque_data = ""; + }, + + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyPlayPolicyUpdateUidValue; + version_no = 1; + display_name = "DevSound test HwDevice1||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "TST1, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyRecordPolicyUpdateUidValue; + version_no = 1; + display_name = "DevSound test HwDevice1||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = " P16,TST1" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyStartPlayUidValue; + version_no = 1; + display_name = "DevSound test HwDevice2||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "TST2, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyStartRecordUidValue; + version_no = 1; + display_name = "DevSound test HwDevice2||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = " P16,TST2" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyPlayDataUidValue; + version_no = 1; + display_name = "DevSound test HwDevice3||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = "TST3, P16" ; // four CC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KTestDummyRecordDataUidValue; + version_no = 1; + display_name = "DevSound test HwDevice3||Copyright 2008 Symbian Ltd. All Rights Reserved.||"; + default_data = " P16,TST3" ; // four CC codes + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + // UID of interface that is implemented + interface_uid = KUidA3fFourCCConvertorPlugin; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285CCE; + version_no = 1; + display_name = "TST1"; + default_data = "" ; + opaque_data = "TST10x10285CCB"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285CCF; + version_no = 1; + display_name = "TST2"; + default_data = "" ; + opaque_data = "TST20x10285CCC"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = 0x10285CD0; + version_no = 1; + display_name = "TST3"; + default_data = "" ; + opaque_data = "TST30x10285CCD"; + } + + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TESTDEVICE_ImplementationUID.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TESTDEVICE_ImplementationUID.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,36 @@ +// Copyright (c) 2004-2009 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: +// TSU_MMF_DEVSOUND_TestDeviceImplementationUID.hrh +// +// + +#ifndef __TSU_MMF_DEVSOUND_TESTDEVICEIMPLEMENTATIONUID_HRH__ +#define __TSU_MMF_DEVSOUND_TESTDEVICEIMPLEMENTATIONUID_HRH__ + + +// These are the ECOM Implementation UIDs for the test Hw device. + +#define KMmfUidTestHwDevice 0x101F9F51 + +#define KTestDummyPlayPolicyUpdateUidValue 0x102834C3 +#define KTestDummyStartPlayUidValue 0x102834C4 +#define KTestDummyPlayDataUidValue 0x102834C5 + +#define KTestDummyRecordPolicyUpdateUidValue 0x10286461 +#define KTestDummyStartRecordUidValue 0x10286462 +#define KTestDummyRecordDataUidValue 0x10286463 + +#endif + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TestDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TestDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,263 @@ +/* +* Copyright (c) 2004 - 2008 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 "TSU_MMF_DEVSOUND_TestDevice.h" +#include "TSU_MMF_DEVSOUND_TESTDEVICE_ImplementationUID.hrh" +#include +#include + +// __________________________________________________________________________ +// Implementation + +CMMFHwDevice* CMMF_TSU_DEVSOUND_TestDevice::NewL() + { + CMMF_TSU_DEVSOUND_TestDevice* self=new(ELeave) CMMF_TSU_DEVSOUND_TestDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CMMF_TSU_DEVSOUND_TestDevice::~CMMF_TSU_DEVSOUND_TestDevice() + { + delete iDummyInterface; + } + +CMMF_TSU_DEVSOUND_TestDevice::CMMF_TSU_DEVSOUND_TestDevice() + { + } + +/** +* +* +*/ +void CMMF_TSU_DEVSOUND_TestDevice::ConstructL() + { + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::Stop() + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::Pause() + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) + { + return 0; + } + + +TAny* CMMF_TSU_DEVSOUND_TestDevice::CustomInterface(TUid aInterfaceId) + { + if(aInterfaceId == KUidHwDeviceSetupInterface) + { + // For MDF + MMdfHwDeviceSetup* setup = static_cast(this); + return setup; + } + + TAny* ret = NULL; + if (!iDummyInterface) + { + iDummyInterface = new TDummyCustomInterface(); + if (!iDummyInterface) + { + ret = NULL; + } + else + { + ret = static_cast(iDummyInterface); + } + } + else + { + ret = static_cast(iDummyInterface); + } + return ret; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::SetConfig(TTaskConfig& /*aConfig*/) + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::StopAndDeleteCodec() + { + return 0; + } + + +TInt CMMF_TSU_DEVSOUND_TestDevice::DeleteCodec() + { + return 0; + } + +// From MMdfHwDeviceSetup +void CMMF_TSU_DEVSOUND_TestDevice::SetDataTypesL(TFourCC /*aSrcType*/, TFourCC /*aDestType*/) + { + } + + +///////// +CTestAudioHwDevice* CTestAudioHwDevice::NewL() + { + CTestAudioHwDevice* self = new(ELeave)CTestAudioHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CTestAudioHwDevice::ConstructL() + { + iCodec = new(ELeave)CMMFTestCodec(); + } + +CMMFSwCodec& CTestAudioHwDevice::Codec() + { + return *iCodec; + } + +TInt CTestAudioHwDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) + { + return KErrAbort; + } + +TInt CTestAudioHwDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return KErrAbort; + } + +CMMFSwCodec::TCodecProcessResult CMMFTestCodec::ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/) + { + return CMMFSwCodec::TCodecProcessResult(); + } +TUint CMMFTestCodec::SourceBufferSize() + { + return KSourceBufferSize; + } + +TUint CMMFTestCodec::SinkBufferSize() + { + return KSinkBufferSize; + } +/////////////// +CTestAudioHwDevice2* CTestAudioHwDevice2::NewL() + { + CTestAudioHwDevice2* self = new(ELeave)CTestAudioHwDevice2(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CTestAudioHwDevice2::ConstructL() + { + iCodec = new(ELeave)CMMFTestCodec(); + } + +CMMFSwCodec& CTestAudioHwDevice2::Codec() + { + return *iCodec; + } + +TInt CTestAudioHwDevice2::SetConfig(TTaskConfig& /*aConfig*/) + { + return KErrAbort; + } +////////////////////////////// +CTestAudioHwDevice3* CTestAudioHwDevice3::NewL() + { + CTestAudioHwDevice3* self = new(ELeave)CTestAudioHwDevice3(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CTestAudioHwDevice3::ConstructL() + { + iCodec = new(ELeave)CMMFTestCodec(); + } + +CMMFSwCodec& CTestAudioHwDevice3::Codec() + { + return *iCodec; + } + +TInt CTestAudioHwDevice3::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + return KErrAbort; + } + +///////////////////////////////// +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidTestHwDevice, CMMF_TSU_DEVSOUND_TestDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x102834C3, CTestAudioHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10286461, CTestAudioHwDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x102834C4, CTestAudioHwDevice2::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10286462, CTestAudioHwDevice2::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x102834C5, CTestAudioHwDevice3::NewL), + IMPLEMENTATION_PROXY_ENTRY(0x10286463, CTestAudioHwDevice3::NewL) + }; + + + + + +// +// ImplementationGroupProxy +// +//////////////////////////////////////////////////////////////////////////////// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TestDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/TSU_MMF_DEVSOUND_TestDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2004 - 2009 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: +* +*/ + + +#ifndef TSU_MMF_DEVSOUND_TESTDEVICE_H +#define TSU_MMF_DEVSOUND_TESTDEVICE_H + +#include +#include +#include + + +class TDummyCustomInterface + { +public: + TDummyCustomInterface() {}; + }; + +/** +* +* CMMF_TSU_DEVSOUND_TestDevice +* +* Test hw device used by the +* TSU_MMF_DEVSOUND_SUITE unit test harness +* This is used to create an asymetry between the play +* and record hardware devices - +* used to detect defects such as DEF45329 +* +*/ +class CMMF_TSU_DEVSOUND_TestDevice : public CMMFHwDevice, MMdfHwDeviceSetup + { +public: + static CMMFHwDevice* NewL(); + virtual ~CMMF_TSU_DEVSOUND_TestDevice(); + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + virtual TInt Stop(); + virtual TInt Pause(); + virtual TInt Init(THwDeviceInitParams& aDevInfo); + virtual TAny* CustomInterface(TUid aInterfaceId); + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + virtual TInt SetConfig(TTaskConfig& aConfig); + virtual TInt StopAndDeleteCodec(); + virtual TInt DeleteCodec(); + + // From MMdfHwDeviceSetup + virtual void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType); + +private: + CMMF_TSU_DEVSOUND_TestDevice(); + void ConstructL(); +private: + TDummyCustomInterface* iDummyInterface; + }; + +class CTestAudioHwDevice : public CMMFSwCodecWrapper + { +public: + static CTestAudioHwDevice* NewL(); + virtual CMMFSwCodec& Codec(); + //override required functions from CMMFSwCodecWrapper + virtual TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + virtual TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); +private: + void ConstructL(); + }; + +class CTestAudioHwDevice2 : public CMMFSwCodecWrapper + { +public: + static CTestAudioHwDevice2* NewL(); + virtual CMMFSwCodec& Codec(); + //override required functions from CMMFSwCodecWrapper + virtual TInt SetConfig(TTaskConfig& aConfig); +private: + void ConstructL(); + }; + +class CTestAudioHwDevice3 : public CMMFSwCodecWrapper + { +public: + static CTestAudioHwDevice3* NewL(); + virtual CMMFSwCodec& Codec(); + //override required functions from CMMFSwCodecWrapper + virtual TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); +private: + void ConstructL(); + }; + +class CMMFTestCodec : public CMMFSwCodec + { +#define KSourceBufferSize 0x400 +#define KSinkBufferSize 0x400 +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + virtual TUint SourceBufferSize(); + virtual TUint SinkBufferSize(); + virtual TBool IsNullCodec() {return ETrue;} + }; + + +#endif // TSU_MMF_DEVSOUND_TESTDEVICE_H diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,20 @@ +// Copyright (c) 2010 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: +// + +PRJ_TESTMMPFILES +../mmpfiles/TSU_MMF_DEVSOUND_TESTDEVICE.mmp + +PRJ_TESTEXPORTS +tsu_mmf_devsound_testdevice.iby /epoc32/rom/include/tsu_mmf_devsound_testdevice.iby diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/group/tsu_mmf_devsound_testdevice.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/group/tsu_mmf_devsound_testdevice.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,22 @@ +// Copyright (c) 2010 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: +// + +#ifndef TSU_MMF_DEVSOUNDTESTDEVICE_IBY +#define TSU_MMF_DEVSOUNDTESTDEVICE_IBY + +ECOM_PLUGIN(tsu_mmf_devsound_testdevice.dll,101f9f50.rsc) + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/mmpfiles/TSU_MMF_DEVSOUND_TESTDEVICE.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/DevsoundTestDevice/mmpfiles/TSU_MMF_DEVSOUND_TESTDEVICE.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2004-2009 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: +// + +target tsu_mmf_devsound_testdevice.dll +CAPABILITY ALL -TCB +targettype plugin + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101F9F50 +VENDORID 0x70000001 + +SOURCEPATH ../ + +SOURCE TSU_MMF_DEVSOUND_TestDevice.cpp + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +start resource 101F9F50_a3f.rss +#else +start resource 101F9F50.rss +#endif +target tsu_mmf_devsound_testdevice.rsc +end + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmfswcodecwrapper.lib + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_01.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_01.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_01.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_01.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_02.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_02.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_02.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_02.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_03.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_03.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_03.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_03.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_04.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_04.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_04.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_04.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_05.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_05.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_05.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_05.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_06.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_06.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_06.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_06.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_07.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_07.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_07.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_07.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_08.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_08.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_08.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_08.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_09.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_09.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_09.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_09.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_10.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_10.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_10.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_10.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_11.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_11.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_11.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_11.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_12.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_12.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_12.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_12.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_13.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_13.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_13.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_13.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_14.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_14.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_14.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_14.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_15.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_15.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_15.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_15.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_16.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_16.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_16.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_16.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_17.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_17.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_17.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_17.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_18.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_18.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_18.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_18.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_19.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_19.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_19.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_19.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_20.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_20.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_20.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_20.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_21.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_21.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_21.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_21.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_22.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_22.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_22.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_22.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_23.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_23.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_23.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_23.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_24.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_24.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_24.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_24.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_25.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_25.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_25.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_25.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_26.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_26.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_26.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_26.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_27.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_27.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_27.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_27.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_28.sbc Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_28.sbc has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_28.wav Binary file devsound/devsoundrefplugin/tsrc/SbcCodec/Data/sbc_test_28.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SBCCODEC.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SBCCODEC.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,82 @@ +// +// Copyright (c) 2004 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: +// + +LOAD_SUITE TSU_MMF_SBCCODEC.dll +#PAUSE_AT_END + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-001-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-001-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-002-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-002-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-010-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-010-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-011-HP + +RUN_TEST_STEP 120000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-011-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-012-HP + +RUN_TEST_STEP 120000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-012-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-013-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-013-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-014-HP + +RUN_TEST_STEP 120000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-014-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-015-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-015-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-016-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-016-HP +TEST_COMPLETE + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SBCCODEC_ALLOC.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SBCCODEC_ALLOC.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// +// Copyright (c) 2004 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: +// + +LOAD_SUITE TSU_MMF_SBCCODEC.dll +#PAUSE_AT_END + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-021-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-021-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-022-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-022-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-023-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-023-HP +TEST_COMPLETE + +#Req. under test REQ2716 +# +//! @SYMTestCaseID MM-MMF-SBCCODEC-U-024-HP + +RUN_TEST_STEP 30000, TSU_MMF_SBCCODEC, MM-MMF-SBCCODEC-U-024-HP +TEST_COMPLETE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodec.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1774 @@ +// Copyright (c) 2004-2009 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 +#include +#include +#include + +#include "TSU_MMF_SbcCodec.h" +#include "TSU_MMF_SbcCodecSuite.h" + +/** + * Size of PCM16 wave file header is 44 + */ +const TInt KWavFileHeaderSize = 44; +/** + * The default buffer size + */ +const TUint KDefaultBufferSize = 4096; + +/** + * UID of sbc encoder ECom plugin + */ +const TUid KSbcCodecPluginUid = { KMmfUidCodecPCM16ToSBC }; +/** + * UID of sbc encoder configuration + */ +const TUid KSbcCodecConfigUid = { KMmfUidSBCConfigure }; + +#ifdef __WINS__ + +_LIT(KSourceFileDir, "c:\\mm\\mmf\\testfiles\\sbc\\"); +_LIT(KOutputFileDir, "c:\\mm\\mmf\\testfiles\\sbc\\"); +_LIT(KReferenceFileDir, "c:\\mm\\mmf\\ref\\sbc\\"); + +#else + +/** + * armv5 directories + * All source and comparison files need to be copied manually onto the flash card. + * This code assumes the flash card is represented by drive E: on the target board. + */ + +/** + * we don't copy all the wave files onto C: as they are too big, leave them on E: + */ +_LIT(KSourceFileDir, "e:\\"); +/** + * This folder keeps all the output files + */ +_LIT(KOutputFileDir, "c:\\sbc\\"); +/** + * This folder keeps all the reference files for comparison + */ +_LIT(KReferenceFileDir, "c:\\sbc\\ref\\"); + +#endif + +// Test source files names +_LIT(KTestWavFile01, "sbc_test_01.wav"); +_LIT(KTestWavFile02, "sbc_test_02.wav"); +_LIT(KTestWavFile03, "sbc_test_03.wav"); +_LIT(KTestWavFile04, "sbc_test_04.wav"); +_LIT(KTestWavFile05, "sbc_test_05.wav"); +_LIT(KTestWavFile06, "sbc_test_06.wav"); +_LIT(KTestWavFile07, "sbc_test_07.wav"); +_LIT(KTestWavFile08, "sbc_test_08.wav"); +_LIT(KTestWavFile09, "sbc_test_09.wav"); +_LIT(KTestWavFile10, "sbc_test_10.wav"); + +_LIT(KTestWavFile11, "sbc_test_11.wav"); +_LIT(KTestWavFile12, "sbc_test_12.wav"); +_LIT(KTestWavFile13, "sbc_test_13.wav"); +_LIT(KTestWavFile14, "sbc_test_14.wav"); +_LIT(KTestWavFile15, "sbc_test_15.wav"); +_LIT(KTestWavFile16, "sbc_test_16.wav"); +_LIT(KTestWavFile17, "sbc_test_17.wav"); +_LIT(KTestWavFile18, "sbc_test_18.wav"); +_LIT(KTestWavFile19, "sbc_test_19.wav"); +_LIT(KTestWavFile20, "sbc_test_20.wav"); + +_LIT(KTestWavFile21, "sbc_test_21.wav"); +_LIT(KTestWavFile22, "sbc_test_22.wav"); +_LIT(KTestWavFile23, "sbc_test_23.wav"); +_LIT(KTestWavFile24, "sbc_test_24.wav"); +_LIT(KTestWavFile25, "sbc_test_25.wav"); +_LIT(KTestWavFile26, "sbc_test_26.wav"); +_LIT(KTestWavFile27, "sbc_test_27.wav"); +_LIT(KTestWavFile28, "sbc_test_28.wav"); + +// Test reference file name +_LIT(KRefSbcFile01, "sbc_test_01.sbc"); +_LIT(KRefSbcFile02, "sbc_test_02.sbc"); +_LIT(KRefSbcFile03, "sbc_test_03.sbc"); +_LIT(KRefSbcFile04, "sbc_test_04.sbc"); +_LIT(KRefSbcFile05, "sbc_test_05.sbc"); +_LIT(KRefSbcFile06, "sbc_test_06.sbc"); +_LIT(KRefSbcFile07, "sbc_test_07.sbc"); +_LIT(KRefSbcFile08, "sbc_test_08.sbc"); +_LIT(KRefSbcFile09, "sbc_test_09.sbc"); +_LIT(KRefSbcFile10, "sbc_test_10.sbc"); + +_LIT(KRefSbcFile11, "sbc_test_11.sbc"); +_LIT(KRefSbcFile12, "sbc_test_12.sbc"); +_LIT(KRefSbcFile13, "sbc_test_13.sbc"); +_LIT(KRefSbcFile14, "sbc_test_14.sbc"); +_LIT(KRefSbcFile15, "sbc_test_15.sbc"); +_LIT(KRefSbcFile16, "sbc_test_16.sbc"); +_LIT(KRefSbcFile17, "sbc_test_17.sbc"); +_LIT(KRefSbcFile18, "sbc_test_18.sbc"); +_LIT(KRefSbcFile19, "sbc_test_19.sbc"); +_LIT(KRefSbcFile20, "sbc_test_20.sbc"); + +_LIT(KRefSbcFile21, "sbc_test_21.sbc"); +_LIT(KRefSbcFile22, "sbc_test_22.sbc"); +_LIT(KRefSbcFile23, "sbc_test_23.sbc"); +_LIT(KRefSbcFile24, "sbc_test_24.sbc"); +_LIT(KRefSbcFile25, "sbc_test_25.sbc"); +_LIT(KRefSbcFile26, "sbc_test_26.sbc"); +_LIT(KRefSbcFile27, "sbc_test_27.sbc"); +_LIT(KRefSbcFile28, "sbc_test_28.sbc"); + +/** + * List of channel mode settings + */ +enum TChannelMode + { + /** + channel mode is Mono + */ + EMono, + /** + channel mode is Dual Channel + */ + EDual, + /** + channel mode is Stereo + */ + EStereo, + /** + channel mode is Joint Stereo + */ + EJoint + }; + +/** + * List of allocation method settings + */ +enum TAllocMethod + { + /** + allocation method is SNR + */ + ESNR, + /** + allocation method is Loudness + */ + ELoud + }; + +/** + * Table of all 28 tests configurations, each row contains the following fields in order + * subbands, block length, sampling frequency, channel mode, allocation method, bitpool + */ +const TInt gSbcConfig[28][6] = + { + // configuration tests (8) + { 4, 16, 48000, EMono, ESNR, 18 }, + { 4, 16, 48000, EDual, ESNR, 16 }, + { 8, 8, 44100, EMono, ELoud, 32 }, + { 8, 8, 44100, EJoint, ELoud, 56 }, + { 8, 4, 32000, EMono, ESNR, 24 }, + { 8, 4, 32000, EStereo, ESNR, 48 }, + { 4, 12, 16000, EMono, ELoud, 20 }, + { 4, 12, 16000, EJoint, ELoud, 42 }, + + // vbr tests (2) + { 4, 16, 44100, EMono, ELoud, 15 }, + { 8, 12, 48000, EJoint, ELoud, 51 }, + + // maximum bit rate tests (8) + { 8, 16, 16000, EMono, ELoud, 128 }, + { 8, 16, 16000, EJoint, ESNR, 249 }, + { 8, 16, 32000, EMono, ELoud, 76 }, + { 8, 16, 32000, EJoint, ESNR, 121 }, + { 8, 16, 44100, EMono, ELoud, 54 }, + { 8, 16, 44100, EJoint, ESNR, 86 }, + { 8, 16, 48000, EMono, ELoud, 49 }, + { 8, 16, 48000, EJoint, ESNR, 78 }, + + // special tests (2) + { 8, 16, 48000, EMono, ESNR, 29 }, + { 8, 16, 44100, EJoint, ESNR, 53 }, + + // typical tests (8) + { 8, 16, 44100, EMono, ELoud, 19 }, + { 8, 16, 48000, EMono, ELoud, 18 }, + { 8, 16, 44100, EJoint, ELoud, 35 }, + { 8, 16, 48000, EJoint, ELoud, 33 }, + { 8, 16, 44100, EMono, ELoud, 31 }, + { 8, 16, 48000, EMono, ELoud, 29 }, + { 8, 16, 44100, EJoint, ELoud, 53 }, + { 8, 16, 48000, EJoint, ELoud, 51 } + }; + +/** + * This function converts number of subbands into TSBCFrameParameters::TSubbands value + * @param "TInt aSubbands" + * number of subbands + * @return "TSBCFrameParameters::TSubbands" + * TSBCFrameParameters::TSubbands value + */ +static inline TSBCFrameParameters::TSubbands GetSubbandsL(TInt aSubbands) + { + switch (aSubbands) + { + case 4: return TSBCFrameParameters::E4Subbands; + case 8: return TSBCFrameParameters::E8Subbands; + } + User::Leave(KErrArgument); + return TSBCFrameParameters::E4Subbands; // just make the compiler happy + } + +/** + * This function converts number of blocks into TSBCFrameParameters::TBlockLength value + * @param "TInt aBlocks" + * number of blocks + * @return "TSBCFrameParameters::TBlockLength" + * TSBCFrameParameters::TBlockLength value + */ +static inline TSBCFrameParameters::TBlockLength GetBlockLengthL(TInt aBlocks) + { + switch (aBlocks) + { + case 4: return TSBCFrameParameters::E4Blocks; + case 8: return TSBCFrameParameters::E8Blocks; + case 12: return TSBCFrameParameters::E12Blocks; + case 16: return TSBCFrameParameters::E16Blocks; + } + User::Leave(KErrArgument); + return TSBCFrameParameters::E4Blocks; //just make the compiler happy + } + +/** + * This function converts sampling frequency value into TSBCFrameParameters::TSamplingFrequency value + * @param "TInt aSampFreq" + * real sampling frequency value + * @return "TSBCFrameParameters::TSamplingFrequency" + * TSBCFrameParameters::TSamplingFrequency value + */ +static inline TSBCFrameParameters::TSamplingFrequency GetSampFreqL(TInt aSampFreq) + { + switch (aSampFreq) + { + case 16000: return TSBCFrameParameters::E16000Hz; + case 32000: return TSBCFrameParameters::E32000Hz; + case 44100: return TSBCFrameParameters::E44100Hz; + case 48000: return TSBCFrameParameters::E48000Hz; + } + User::Leave(KErrArgument); + return TSBCFrameParameters::E16000Hz; // just make the compiler happy + } + +/** + * This function converts ChannelMode enum value into TSBCFrameParameters::TChannelMode value + * @param "TInt aChnlMode" + * ChannelMode enum value + * @return "TSBCFrameParameters::TChannelMode" + * TSBCFrameParameters::TChannelMode value + */ +static inline TSBCFrameParameters::TChannelMode GetChannelModeL(TInt aChnlMode) + { + switch (aChnlMode) + { + case EMono: return TSBCFrameParameters::EMono; + case EDual: return TSBCFrameParameters::EDualChannel; + case EStereo: return TSBCFrameParameters::EStereo; + case EJoint: return TSBCFrameParameters::EJointStereo; + } + User::Leave(KErrArgument); + return TSBCFrameParameters::EMono; // just make the compiler happy + } + +/** + * This function converts AllocMethod enum value into TSBCFrameParameters::TAllocationMethod value + * @param "TInt aAllocMthd" + * AllocMethod enum value + * @return "TSBCFrameParameters::TAllocationMethod" + * TSBCFrameParameters::TAllocationMethod value + */ +static inline TSBCFrameParameters::TAllocationMethod GetAllocMethodL(TInt aAllocMthd) + { + switch (aAllocMthd) + { + case ESNR: return TSBCFrameParameters::ESNR; + case ELoud: return TSBCFrameParameters::ELoudness; + } + User::Leave(KErrArgument); + return TSBCFrameParameters::ESNR; + } + +/** + * This function gets the configuration for one test from SbcConfig[28] + * @param "TInt aTestNumber" + * test number + * @return "TSBCFrameParameters" + * the sbc frame parameters used to configure sbc codec + */ +static TSBCFrameParameters SbcParametersL(TInt aTestNumber) + { + if (aTestNumber < 0 || aTestNumber > 28) + { + User::Leave(KErrArgument); + } + + TSBCFrameParameters param; + param.SetSubbands(GetSubbandsL(gSbcConfig[aTestNumber - 1][0]) ); + param.SetBlockLength(GetBlockLengthL(gSbcConfig[aTestNumber - 1][1]) ); + param.SetSamplingFrequency(GetSampFreqL(gSbcConfig[aTestNumber - 1][2]) ); + param.SetChannelMode(GetChannelModeL(gSbcConfig[aTestNumber - 1][3]) ); + param.SetAllocationMethod(GetAllocMethodL(gSbcConfig[aTestNumber - 1][4]) ); + param.SetBitpool(static_cast(gSbcConfig[aTestNumber - 1][5]) ); + return param; + } + +/** + * Constructor + */ +CTestStep_MMF_SbcCodec::CTestStep_MMF_SbcCodec() + { + } + +/** + * Destructor + */ +CTestStep_MMF_SbcCodec::~CTestStep_MMF_SbcCodec() + { + } + +/** + * This function gets test source file name for one test + * @param "TInt aTestNumber" + * test number + * @return "const TDesC&" + * test file name + */ +const TDesC& CTestStep_MMF_SbcCodec::GetTestFileName(TInt aTestNumber) + { + switch (aTestNumber) + { + case 1 : return KTestWavFile01; + case 2 : return KTestWavFile02; + case 3 : return KTestWavFile03; + case 4 : return KTestWavFile04; + case 5 : return KTestWavFile05; + case 6 : return KTestWavFile06; + case 7 : return KTestWavFile07; + case 8 : return KTestWavFile08; + case 9 : return KTestWavFile09; + case 10: return KTestWavFile10; + + case 11: return KTestWavFile11; + case 12: return KTestWavFile12; + case 13: return KTestWavFile13; + case 14: return KTestWavFile14; + case 15: return KTestWavFile15; + case 16: return KTestWavFile16; + case 17: return KTestWavFile17; + case 18: return KTestWavFile18; + case 19: return KTestWavFile19; + case 20: return KTestWavFile20; + + case 21: return KTestWavFile21; + case 22: return KTestWavFile22; + case 23: return KTestWavFile23; + case 24: return KTestWavFile24; + case 25: return KTestWavFile25; + case 26: return KTestWavFile26; + case 27: return KTestWavFile27; + case 28: return KTestWavFile28; + } + User::Panic(_L("Invalid test number"), KErrArgument); + return KTestWavFile01; + } + +/** + * This function gets test reference file name for one test + * @param "TInt aTestNumber" + * test number + * @return "const TDesC&" + * reference file name + */ +const TDesC& CTestStep_MMF_SbcCodec::GetRefFileName(TInt aTestNumber) + { + switch (aTestNumber) + { + case 1 : return KRefSbcFile01; + case 2 : return KRefSbcFile02; + case 3 : return KRefSbcFile03; + case 4 : return KRefSbcFile04; + case 5 : return KRefSbcFile05; + case 6 : return KRefSbcFile06; + case 7 : return KRefSbcFile07; + case 8 : return KRefSbcFile08; + case 9 : return KRefSbcFile09; + case 10: return KRefSbcFile10; + + case 11: return KRefSbcFile11; + case 12: return KRefSbcFile12; + case 13: return KRefSbcFile13; + case 14: return KRefSbcFile14; + case 15: return KRefSbcFile15; + case 16: return KRefSbcFile16; + case 17: return KRefSbcFile17; + case 18: return KRefSbcFile18; + case 19: return KRefSbcFile19; + case 20: return KRefSbcFile20; + + case 21: return KRefSbcFile21; + case 22: return KRefSbcFile22; + case 23: return KRefSbcFile23; + case 24: return KRefSbcFile24; + case 25: return KRefSbcFile25; + case 26: return KRefSbcFile26; + case 27: return KRefSbcFile27; + case 28: return KRefSbcFile28; + } + User::Panic(_L("Invalid test number"), KErrArgument); + return KRefSbcFile01; + } + +/** + * This function reads source out from source file from a specific position + and fill the srouce into the source buffer. + * @param "const TDesC& aFileName" + * the source file name + * @param "TDes8& aSrcBuffer" + * the source buffer + * @param "TInt aFilePos" + * the file position + * @leave if reading file failed + */ +void CTestStep_MMF_SbcCodec::ReadSourceL(const TDesC& aFileName, TDes8& aSrcBuffer, TInt aFilePos) + { + TFileName srcFileName(KSourceFileDir); + srcFileName.Append(aFileName); + + // connect to file service + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile srcFile; + User::LeaveIfError(srcFile.Open(fs, srcFileName, EFileRead | EFileShareAny) ); + CleanupClosePushL(srcFile); + + aFilePos += KWavFileHeaderSize; // skip wave file header + User::LeaveIfError(srcFile.Seek(ESeekStart, aFilePos) ); + User::LeaveIfError(srcFile.Read(aSrcBuffer) ); + + CleanupStack::PopAndDestroy(2); + } + +/** + * This function writes destination into destination file from a specific position. + * @param "const TDesC& aFileName" + * the destination file name + * @param "TDes8& aDstBuffer" + * the destination buffer + * @param "TInt aFilePos" + * the file position + * @leave if writing file failed + */ +void CTestStep_MMF_SbcCodec::WriteDstToFileL(const TDesC& aFileName, const TDes8& aDstBuffer, TInt aFilePos) + { + TFileName dstFileName(KOutputFileDir); + dstFileName.Append(aFileName); + + // connect to file service + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile dstFile; + TInt err = dstFile.Open(fs, dstFileName, EFileWrite); + if (err == KErrNotFound) // file does not exist - create it + { + err = dstFile.Create(fs, dstFileName, EFileWrite); + } + if (err != KErrNone) + { + User::Leave(err); + } + CleanupClosePushL(dstFile); + + User::LeaveIfError(dstFile.Seek(ESeekStart, aFilePos) ); + User::LeaveIfError(dstFile.Write(aDstBuffer) ); + + CleanupStack::PopAndDestroy(2); + } + +/** + * This function compares two files to check if they are the same. + * @param "const TDesC& aFileName" + * the compare and reference files name + * @return "TInt" + * 0: two files are the same + * -1: two files are NOT the same + * @leave if reading tow files failed + */ +TInt CTestStep_MMF_SbcCodec::CompareFileL(const TDesC& aFileName) + { + TFileName cmpFileName(KOutputFileDir); + cmpFileName.Append(aFileName); + + TFileName refFileName(KReferenceFileDir); + refFileName.Append(aFileName); + + // connect to file service + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile cmpFile; + User::LeaveIfError(cmpFile.Open(fs, cmpFileName, EFileRead) ); + CleanupClosePushL(cmpFile); + + RFile refFile; + User::LeaveIfError(refFile.Open(fs, refFileName, EFileRead) ); + CleanupClosePushL(refFile); + + TInt cmpFileSize = 0; + TInt refFileSize = 0; + + cmpFile.Size(cmpFileSize); + refFile.Size(refFileSize); + + if (cmpFileSize != refFileSize) + { + CleanupStack::PopAndDestroy(3); // refFile, cmpFile, fs + return -1; + } + + CMMFDataBuffer* cmpFileBuf = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(cmpFileBuf); + CMMFDataBuffer* refFileBuf = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(refFileBuf); + + TInt result = 0; + for (;;) + { + User::LeaveIfError(cmpFile.Read(cmpFileBuf->Data() ) ); + if (cmpFileBuf->Data().Length() == 0) // end of file + { + break; + } + + User::LeaveIfError(refFile.Read(refFileBuf->Data() ) ); + if (cmpFileBuf->Data() != refFileBuf->Data() ) + { + result = -1; + break; + } + + cmpFileBuf->Data().Zero(); + refFileBuf->Data().Zero(); + } + + CleanupStack::PopAndDestroy(5); // refFileBuff, cmpFileBuff, refFile, cmpFile, fs + return result; + } + +/** + * This function is called by two TestNewL() tests, it calls ProcessL() once + * and checks the result. + * @param "CMMFCodec* aCodec" + * the codec for test + * @return "TVerdict" + * EPass: at least one byte src processed and one byte of dst generated and no error + * EFail: other wise. + * @leave if out of memory or ProcessL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::ProcessOnceForNewL(CMMFCodec* aCodec) + { + TVerdict testResult = EFail; + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + TInt testNumber = 28; + TPckgBuf config(SbcParametersL(testNumber) ); + aCodec->ConfigureL(KSbcCodecConfigUid, config); + + ReadSourceL(GetTestFileName(testNumber), srcBuffer->Data(), 0); + + if (srcBuffer->Data().Length() > 0) // end of file + { + TCodecProcessResult result = aCodec->ProcessL(*srcBuffer, *dstBuffer); + + if (result.iDstBytesAdded > 0 && result.iSrcBytesProcessed > 0) + { + testResult = EPass; + } + } + else + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::ProcessOnceForNewL no source read") ); + } + + CleanupStack::PopAndDestroy(2); // dstBuffer, srcBuffer + + return testResult; +} + +/** + * This function tests codec instantiation by ECom plugin UID. + * @param "TUid aCodecUID" + * the codec ECom UID + * @return "TVerdict" + * EPass: ProcessOnceForNewL() passes + * EFail: ProcessOnceForNewL() fails + * @leave if CMMFCodec::NewL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestNewL(TUid aCodecUID) + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(aCodecUID) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestNewL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestNewL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + TVerdict result = ProcessOnceForNewL(codec); + CleanupStack::PopAndDestroy(); //codec + return result; + } + +/** + * This function tests codec instantiation by two FourCC codes. + * @param "const TFourCC& aSrcFourCC" + * the FourCC code of source media type + * @param "const TFourCC& aDstFourCC" + * the FourCC code of destination media type + * @return "TVerdict" + * EPass: ProcessOnceForNewL() passes + * EFail: ProcessOnceForNewL() fails + * @leave if CMMFCodec::NewL() or ProcessOnceForNewL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestNewL(const TFourCC& aSrcFourCC, const TFourCC& aDstFourCC) + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(aSrcFourCC, aDstFourCC) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestNewL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestNewL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + TVerdict result = ProcessOnceForNewL(codec); + CleanupStack::PopAndDestroy(); //codec + return result; + } + +/** + * Performance test + * This function tests ProcessL() function, it checks if ProcessL() returns the + * correct result with different buffer size settings + * @return "TVerdict" + * EPass: the results are expected ones. + * EFail: otherwise. + * @leave if out of memory or ProcessL(), ReadSourceL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestProcessL() + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestProcessL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + const TInt testNumber = 28; + + TSBCFrameParameters param = SbcParametersL(testNumber); + + const TUint sbcFrameLength = param.CalcFrameLength(); + const TUint pcmFrameSize = sizeof(TInt16) * param.BlockLength() * param.Channels() * param.Subbands(); + + // create src buffer + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(pcmFrameSize); + CleanupStack::PushL(srcBuffer); + + // dummy buffer, smaller than one frame length + CMMFDataBuffer* dummyBuffer = CMMFDataBuffer::NewL(sbcFrameLength - 1); + CleanupStack::PushL(dummyBuffer); + + // create dst buffer + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(sbcFrameLength); + CleanupStack::PushL(dstBuffer); + + ReadSourceL(GetTestFileName(testNumber), srcBuffer->Data(), 0); + + if (static_cast(srcBuffer->Data().Length() ) != pcmFrameSize) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL read source failed") ); + CleanupStack::PopAndDestroy(3); // dstBuffer, srcBuffer, codec + return EFail; + } + + TVerdict testResult = EPass; + TCodecProcessResult procResult; + + /** test ProcessL() without ConfigureL() called, should leave with KErrAbort */ + + TRAP(err, procResult = codec->ProcessL(*srcBuffer, *dstBuffer) ); + + if (err != KErrAbort || + procResult.iSrcBytesProcessed != 0 || + procResult.iDstBytesAdded != 0 || + procResult.iStatus != TCodecProcessResult::EProcessError) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL failed, ProcessL didn't leave with KErrAbort when ConfigureL() is not called") ); + testResult = EFail; + } + + /** test ProcessL() with small dst buffer size, should leave with KErrArgument */ + + TPckgBuf config(param); + codec->ConfigureL(KSbcCodecConfigUid, config); + + codec->ResetL(); + TRAP(err, procResult = codec->ProcessL(*srcBuffer, *dummyBuffer) ); + + if (err != KErrArgument || + procResult.iSrcBytesProcessed != 0 || + procResult.iDstBytesAdded != 0 || + procResult.iStatus != TCodecProcessResult::EProcessError) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL failed in ProcessL") ); + testResult = EFail; + } + + /** test ProcessL() with correct settings, should return EProcessComplete */ + + codec->ResetL(); + TRAP(err, procResult = codec->ProcessL(*srcBuffer, *dstBuffer) ); + + if (err != KErrNone || + procResult.iSrcBytesProcessed != pcmFrameSize || + procResult.iDstBytesAdded != sbcFrameLength || + procResult.iStatus != TCodecProcessResult::EProcessComplete) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL failed, ProcessL didn't work propertly with correct settings") ); + testResult = EFail; + } + + /** test ProcessL() with not enough dst buffer remained, should return EProcessIncomplete */ + + // now the remaining dst buffer size is one byte less than one frame length + dstBuffer->SetPosition(1); + + codec->ResetL(); + TRAP(err, procResult = codec->ProcessL(*srcBuffer, *dstBuffer) ); + + if (err != KErrNone || + procResult.iSrcBytesProcessed != 0 || + procResult.iDstBytesAdded != 0 || + procResult.iStatus != TCodecProcessResult::EProcessIncomplete) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL failed, ProcessL didn't return EProcessIncomplete when there is not enough dst buffer") ); + testResult = EFail; + } + + /** test ProcessL() with not enough src buffer remained, should return EDstNotFilled */ + + // set this position to an even value as only even number of samples will be cached + const TInt srcPos = 2; + // the remaining src buffer size is less than one frame, it should be cached, + // and return EProcessDstNotFilled + srcBuffer->SetPosition(srcPos); + // now the remaining dst buffer size is one frame length + dstBuffer->SetPosition(0); + + codec->ResetL(); + TRAP(err, procResult = codec->ProcessL(*srcBuffer, *dstBuffer) ); + + if (err != KErrNone || + procResult.iSrcBytesProcessed != pcmFrameSize - srcPos || + procResult.iDstBytesAdded != 0 || + procResult.iStatus != TCodecProcessResult::EDstNotFilled) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessL failed, ProcessL didn't return EDstNotFilled when there is not enough src buffer") ); + testResult = EFail; + } + + CleanupStack::PopAndDestroy(4); // dstBuffer, dummyBuffer, srcBuffer, codec + return testResult; + } + +/** + * This function tests the whole encoding routine with a specific settings (e.g. + * sbc frameparameters, src buffer size, dst buffer size) and compares the result + * file with reference file. + * @param "TInt aTestNumber" + * the test number. + * @param "TInt aSrcBufSize" + * the source buffer size. + * @param "TInt aDstBufSize" + * the destination buffer size. + * @return "TVerdict" + * EPass: encoded file is the same as the reference file. + * EFail: encoded file is NOT the same as the reference file. + * @leave if out of memory or ProcessL(), ReadSourceL(), WriteDstToFileL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestEncodeL(TInt aTestNumber, TInt aSrcBufSize, TInt aDstBufSize) + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestEncodeL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestEncodeL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(aSrcBufSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(aDstBufSize); + CleanupStack::PushL(dstBuffer); + + TPckgBuf config(SbcParametersL(aTestNumber) ); + codec->ConfigureL(KSbcCodecConfigUid, config); + + TInt srcFilePos = 0; + TInt dstFilePos = 0; + + for (;;) + { + ReadSourceL(GetTestFileName(aTestNumber), srcBuffer->Data(), srcFilePos); + + if (srcBuffer->Data().Length() == 0) // end of file + { + break; + } + + TCodecProcessResult result = codec->ProcessL(*srcBuffer, *dstBuffer); + + WriteDstToFileL(GetRefFileName(aTestNumber), dstBuffer->Data(), dstFilePos); + + srcBuffer->Data().Zero(); + dstBuffer->Data().Zero(); + + srcFilePos += result.iSrcBytesProcessed; + dstFilePos += result.iDstBytesAdded; + } + + TVerdict result = EPass; + if (CompareFileL(GetRefFileName(aTestNumber) ) != 0) + { + result = EFail; + } + + CleanupStack::PopAndDestroy(3); // dstBuffer, srcBuffer, codec + return result; + } + +/** + * This function tests codec ResetL() function make sure the cach buffer + * gets cleared when it gets called. It compares the encoded file with the reference file + * @return "TVerdict" + * EPass: encoded file is the same as the reference file. + * EFail: encoded file is NOT the same as the reference file. + * @leave if out of memory or ProcessL(), ReadSourceL(), WriteDstToFileL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestRepositionL() + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestRepositionL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestRepositionL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + const TInt testNumber = 28; + // this size will make sure some samples will be cached, + // also make sure it is an EVEN number + const TInt srcBufSize = 4094; + const TInt dstBufSize = 2048; + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(srcBufSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(dstBufSize); + CleanupStack::PushL(dstBuffer); + + TSBCFrameParameters param = SbcParametersL(testNumber); + + TPckgBuf config(param); + codec->ConfigureL(KSbcCodecConfigUid, config); + + const TUint pcmFrameSize = sizeof(TInt16) * param.BlockLength() * param.Channels() * param.Subbands(); + + TInt srcFilePos = 0; + TInt dstFilePos = 0; + + for (;;) + { + ReadSourceL(GetTestFileName(testNumber), srcBuffer->Data(), srcFilePos); + + if (srcBuffer->Data().Length() == 0) // end of file + { + break; + } + + TCodecProcessResult result = codec->ProcessL(*srcBuffer, *dstBuffer); + + WriteDstToFileL(GetRefFileName(testNumber), dstBuffer->Data(), dstFilePos); + + // clear up any cached samples + codec->ResetL(); + // the iSrcBytesProcessed includes the encoded src size plus the cached src size, + // here set the iSrcBytesProcessed to the encoded src size only as we cleared up + // the cached samples + result.iSrcBytesProcessed -= srcBuffer->Data().Length() % pcmFrameSize; + + srcBuffer->Data().Zero(); + dstBuffer->Data().Zero(); + + // set new src file position, which is the end of encoded src (no cached src) + srcFilePos += result.iSrcBytesProcessed; + // set new dst file position + dstFilePos += result.iDstBytesAdded; + } + + TVerdict result = EPass; + if (CompareFileL(GetRefFileName(testNumber) ) != 0) + { + result = EFail; + } + + CleanupStack::PopAndDestroy(3); // dstBuffer, srcBuffer, codec + return result; + } + +/** + * This test tests changing configuration for the codec. It calls ConfigureL() once to + * encode one sbc bitstream, then changes a different configuration by calling ConfigureL() + * and encode another sbc bitstream. + * @return "TVerdict" + * EPass: if encoded sbc files are the same as the reference files. + * EFail: if not. + * @leave if ReadSourceL(), ProcessL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestChangeConfigL() + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestChangeConfigL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestChangeConfigL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + const TInt testNumber[2] = {1, 28}; + // this size will make sure some samples will be cached, + // also make sure it is an EVEN number + const TInt srcBufSize = 4094; + const TInt dstBufSize = 2048; + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(srcBufSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(dstBufSize); + CleanupStack::PushL(dstBuffer); + + TVerdict result = EPass; + for (TInt test = 0; test < 2; test++) + { + TSBCFrameParameters param = SbcParametersL(testNumber[test]); + + TPckgBuf config(param); + codec->ConfigureL(KSbcCodecConfigUid, config); + codec->ResetL(); + + TInt srcFilePos = 0; + TInt dstFilePos = 0; + + for (;;) + { + ReadSourceL(GetTestFileName(testNumber[test]), srcBuffer->Data(), srcFilePos); + + if (srcBuffer->Data().Length() == 0) // end of file + { + break; + } + + TCodecProcessResult result = codec->ProcessL(*srcBuffer, *dstBuffer); + + WriteDstToFileL(GetRefFileName(testNumber[test]), dstBuffer->Data(), dstFilePos); + + srcBuffer->Data().Zero(); + dstBuffer->Data().Zero(); + + srcFilePos += result.iSrcBytesProcessed; + dstFilePos += result.iDstBytesAdded; + } + + if (CompareFileL(GetRefFileName(testNumber[test]) ) != 0) + { + result = EFail; + } + } + + CleanupStack::PopAndDestroy(3); // dstBuffer, srcBuffer, codec + return result; + } + +/** + * This tests memory scribble for ProcessL(). It creates a buffer size of frame_length + 2, + * the first byte and last byte are used to detect memory scribble, + * the middle frame_length bytes are used for destination buffer. It calls ProcessL() once. + * and checks if the first or last byte value changed to check memory scribble. + * @return "TVerdict" + * EPass: if there is no momery scribble. + * EFail: if there is momery scribble. + * @leave if ReadSourceL(), ProcessL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestMemoryScribbleL() + { + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + if (err != KErrNone) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_SbcCodec::TestMemoryScribbleL Leave occurred in NewL, error code %d"), err); + return EFail; + } + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestMemoryScribbleL NewL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + const TInt testNumber = 28; + + TSBCFrameParameters param = SbcParametersL(testNumber); + + TPckgBuf config(param); + codec->ConfigureL(KSbcCodecConfigUid, config); + + const TUint sbcFrameLength = param.CalcFrameLength(); + const TUint pcmFrameSize = sizeof(TInt16) * param.BlockLength() * param.Channels() * param.Subbands(); + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(pcmFrameSize); + CleanupStack::PushL(srcBuffer); + + // front and end bytes are used to detect memory scribble + CMMFDataBuffer* buffer = CMMFDataBuffer::NewL(sbcFrameLength + 2); + CleanupStack::PushL(buffer); + + TUint8* firstByte = const_cast(buffer->Data().Ptr() ); + TUint8* lastByte = firstByte + sbcFrameLength + 1; + + const TUint8 initValue = 0xaa; // 10101010 + + *firstByte = initValue; + *lastByte = initValue; + + CMMFPtrBuffer* dstBuffer = CMMFPtrBuffer::NewL(TPtr8(firstByte + 1, sbcFrameLength) ); + CleanupStack::PushL(dstBuffer); + + ReadSourceL(GetTestFileName(testNumber), srcBuffer->Data(), 0); + + TVerdict testResult = EPass; + if (static_cast(srcBuffer->Data().Length() ) == pcmFrameSize) + { + TCodecProcessResult result = codec->ProcessL(*srcBuffer, *dstBuffer); + + if (result.iSrcBytesProcessed != pcmFrameSize || + result.iDstBytesAdded != sbcFrameLength || + result.iStatus != TCodecProcessResult::EProcessComplete) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestMemoryScribbleL failed in ProcessL") ); + testResult = EFail; + } + + if (*firstByte != initValue || *lastByte != initValue ) // memory been scribbled + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestMemoryScribbleL memory scribble occured") ); + testResult = EFail; + } + } + else + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestMemoryScribbleL read source failed") ); + testResult = EFail; + } + + CleanupStack::PopAndDestroy(4); // dstBuffer, buffer, srcBuffer, codec + return testResult; + } + +/** + * This tests all the codec APIs (here we are using TestRepositionL() test as it + * uses all the APIs) and checks if there is any memory leak, it panics if so. + * @return "TVerdict" + * EPass: if there is no momery leak. + * EFail: if there is momery leak. + * @leave if TestRepositionL() leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestMemoryLeakL() + { + __MM_HEAP_MARK; + + TestRepositionL(); + + __MM_HEAP_MARKEND; + + return EPass; + } + +/** + * This function tests how NewL deals with a memory allocation failure. This test + * will pass if NewL leaves with the correct error code on every memory allocation. + * + * @return "TVerdict" + * EPass: if the test passes. + * EFail: if the test fails. + */ +TVerdict CTestStep_MMF_SbcCodec::TestNewLOutOfMemoryL() + { + TVerdict testResult = EPass; + TInt failCount = 1; + + for (;;) + { + __MM_HEAP_MARK; + __UHEAP_FAILNEXT(failCount); + + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KSbcCodecPluginUid) ); + + // it should return either KErrNone or KErrNoMemory, + // ideally should only return KErrNone when codec is created. + if (err == KErrNone) + { + TAny *testAlloc = User::Alloc(1); + + delete codec; + if (testAlloc == NULL) + { + break; + } + User::Free(testAlloc); + } + else if (err != KErrNoMemory) + { + delete codec; + testResult = EFail; + break; + } + + failCount++; + + __UHEAP_RESET; + __MM_HEAP_MARKEND; + } // while(1) + + INFO_PRINTF2(_L("NewL out of memory test finished at round %d"), failCount); + + return testResult; + } + +/** + * This function tests how the ProcessL() would deal with a memory allocation failure. + * @return "TVerdict" + * EPass: if the test passes. + * EFail: if the test fails. + * @leave if out of memory or ConfigureL(), ReadSourceL leaves + */ +TVerdict CTestStep_MMF_SbcCodec::TestProcessLOutOfMemoryL() + { + __MM_HEAP_MARK; + + CMMFCodec* codec = CMMFCodec::NewL(KSbcCodecPluginUid); + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessLOutOfMemoryL returned NULL") ); + return EFail; + } + + CleanupStack::PushL(codec); + + const TInt testNumber = 28; + // this size will make sure some samples will be cached, + // also make sure it is an EVEN number + const TInt srcBufSize = 4094; + const TInt dstBufSize = 2048; + + TPckgBuf config(SbcParametersL(testNumber) ); + codec->ConfigureL(KSbcCodecConfigUid, config); + + // create buffers + CMMFDataBuffer* srcBuffer = CMMFDataBuffer::NewL(srcBufSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* dstBuffer = CMMFDataBuffer::NewL(dstBufSize); + CleanupStack::PushL(dstBuffer); + + ReadSourceL(GetTestFileName(testNumber), srcBuffer->Data(), 0); + if (srcBuffer->Data().Length() == 0) // end of file + { + ERR_PRINTF1(_L(">> CTestStep_MMF_SbcCodec::TestProcessLOutOfMemoryL no source read") ); + return EFail; + } + + TVerdict testResult = EPass; + TInt failCount = 1; + + for (;;) + { + __UHEAP_FAILNEXT(failCount); + + TCodecProcessResult dummyResult; // don't care about this result + TRAPD(err, dummyResult = codec->ProcessL(*srcBuffer, *dstBuffer) ); + + // it should return either KErrNone or KErrNoMemory, + // ideally should only return KErrNone when codec is created. + if (err == KErrNone) + { + // attempt to allocate another cell. If this fails, + // we have tested all of the memory allocs carried out by NewL. + TAny *testAlloc = User::Alloc(1); + + if (testAlloc == NULL) + { + break; + } + User::Free(testAlloc); + } + else if (err != KErrNoMemory) + { + testResult = EFail; + break; + } + + failCount++; + + __UHEAP_RESET; + } // while(1) + + INFO_PRINTF2(_L("ProcessL out of memory test finished at round %d"), failCount); + + CleanupStack::PopAndDestroy(3); // dstBuffer, srcBuffer, codec + + __MM_HEAP_MARKEND; + + return testResult; + } + +//------------------------------------------------------------------ +// ** TEST MMF_SBCCODEC STEPS *** +//------------------------------------------------------------------ + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_001::CTest_MMF_SbcCodec_U_001() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-001-HP"); + } + +/** + * Instantiate a codec with plugin UID + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_001::DoTestStepL() + { + TVerdict testResult = EFail; + TRAPD(err, testResult = TestNewL(KSbcCodecPluginUid) ); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_002::CTest_MMF_SbcCodec_U_002() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-002-HP"); + } + +/** + * Instantiate a codec with FourCC Codes + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_002::DoTestStepL() + { + TVerdict testResult = EFail; + TRAPD(err, testResult = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeSBC) ); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_010::CTest_MMF_SbcCodec_U_010() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-010-HP"); + } + +/** + * ProcessL() test + * This test tests the ProcessL() function with different buffer size settings, and + * check the returned results + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_010::DoTestStepL() + { + TVerdict testResult = EFail; + TRAPD(err, testResult = TestProcessL() ); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_011::CTest_MMF_SbcCodec_U_011() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-011-HP"); + } + +/** + * Configuration tests + * This test tests if codec supports 8 different settings (see TSS & TP for A2DP spec) + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_011::DoTestStepL() + { + TVerdict testResult = EPass; + TInt srcBufSize = KDefaultBufferSize; + TInt dstBufSize = KDefaultBufferSize >> 1; + + for (TInt testNumber = 1; testNumber <= 8; testNumber++) + { + TVerdict result = EFail; + + TRAPD(err, result = TestEncodeL(testNumber, srcBufSize, dstBufSize) ); + + if (err) + { + INFO_PRINTF3(_L("Configuration test %d left with status %d"), testNumber, err); + testResult = EFail; + } + if (result == EFail) + { + INFO_PRINTF2(_L("Configuration test %d failed"), testNumber); + testResult = EFail; + } + + // This is simulating different src buffer size by decreasing the + // src buffer size number each time, it covers sample caching and + // no caching various cases to make sure the codec can handle different + // src buffer size correctly + srcBufSize--; + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_012::CTest_MMF_SbcCodec_U_012() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-012-HP"); + } + +/** + * Maximum Bit Rate tests + * This test tests sbc coded handles 8 different maximum bit rate settings (see TSS & TP for A2DP spec) + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_012::DoTestStepL() + { + TVerdict testResult = EPass; + TInt srcBufSize = KDefaultBufferSize; + TInt dstBufSize = KDefaultBufferSize >> 1; + + for (TInt testNumber = 11; testNumber <= 18; testNumber++) + { + TVerdict result = EFail; + TRAPD(err, result = TestEncodeL(testNumber, srcBufSize, dstBufSize) ); + + if (err) + { + INFO_PRINTF3(_L("Max Bit Rate test %d left with status %d"), testNumber, err); + testResult = EFail; + } + if (result == EFail) + { + INFO_PRINTF2(_L("Max Bit Rate test %d failed"), testNumber); + testResult = EFail; + } + + // This is simulating different src buffer size by decreasing the + // src buffer size number each time, it covers sample caching and + // no caching various cases to make sure the codec can handle different + // src buffer size correctly + srcBufSize--; + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_013::CTest_MMF_SbcCodec_U_013() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-013-HP"); + } + +/** + * Special tests + * This test tests sbc codec handles 2 special cases (see TSS & TP for A2DP spec) + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_013::DoTestStepL() + { + TVerdict testResult = EPass; + TInt srcBufSize = KDefaultBufferSize; + TInt dstBufSize = KDefaultBufferSize >> 1; + + for (TInt testNumber = 19; testNumber <= 20; testNumber++) + { + TVerdict result = EFail; + TRAPD(err, result = TestEncodeL(testNumber, srcBufSize, dstBufSize) ); + + if (err) + { + INFO_PRINTF3(_L("Special test %d left with status %d"), testNumber, err); + testResult = EFail; + } + if (result == EFail) + { + INFO_PRINTF2(_L("Special test %d failed"), testNumber); + testResult = EFail; + } + + // This is simulating different src buffer size by decreasing the + // src buffer size number each time, it covers sample caching and + // no caching various cases to make sure the codec can handle different + // src buffer size correctly + srcBufSize--; + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_014::CTest_MMF_SbcCodec_U_014() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-014-HP"); + } + +/** + * Typical tests + * This test tests sbc codec handles 8 typical settings (see TSS & TP for A2DP spec) which + * are required in REQ2716, our sbc encoder has to support these settings. + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_014::DoTestStepL() + { + TVerdict testResult = EPass; + TInt srcBufSize = KDefaultBufferSize; + TInt dstBufSize = KDefaultBufferSize >> 1; + + for (TInt testNumber = 21; testNumber <= 28; testNumber++) + { + TVerdict result = EFail; + TRAPD(err, result = TestEncodeL(testNumber, srcBufSize, dstBufSize) ); + + if (err) + { + INFO_PRINTF3(_L("Typical test %d left with status %d"), testNumber, err); + testResult = EFail; + } + if (result == EFail) + { + INFO_PRINTF2(_L("Typical test %d failed"), testNumber); + testResult = EFail; + } + + // This is simulating different src buffer size by decreasing the + // src buffer size number each time, it covers sample caching and + // no caching various cases to make sure the codec can handle different + // src buffer size correctly + srcBufSize--; + } + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_015::CTest_MMF_SbcCodec_U_015() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-015-HP"); + } + +/** + * Reposition tests + * This test tests ResetL() function and audio sample cach issue + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_015::DoTestStepL() + { + TVerdict testResult = EFail; + TRAPD(err, testResult = TestRepositionL() ); + + if (err) + { + INFO_PRINTF2(_L("Reposition test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("Reposition test passes") ); + } + + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_016::CTest_MMF_SbcCodec_U_016() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-016-HP"); + } + +/** + * Change configuration test + * This test tests reconfigure sbc codec by calling ConfigureL() function + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_016::DoTestStepL() + { + TVerdict testResult = EFail; + TRAPD(err, testResult = TestChangeConfigL() ); + + if (err) + { + INFO_PRINTF2(_L("Change conguration test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("Change conguration test passes") ); + } + + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_021::CTest_MMF_SbcCodec_U_021() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-021-HP"); + } + +/** + * Memory Scribble test + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_021::DoTestStepL() + { + TVerdict testResult = EPass; + + TRAPD(err, testResult = TestMemoryScribbleL() ); + + if (err) + { + INFO_PRINTF2(_L("Memory scribble test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("Memory scribble test passes") ); + } + + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_022::CTest_MMF_SbcCodec_U_022() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-022-HP"); + } + +/** + * Memory Leak test + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_022::DoTestStepL() + { + TVerdict testResult = EPass; + + TRAPD(err, testResult = TestMemoryLeakL() ); + + if (err) + { + INFO_PRINTF2(_L("Memory leak test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("Memory leak test passes") ); + } + + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_023::CTest_MMF_SbcCodec_U_023() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-023-HP"); + } + +/** + * Out of Memory test for NewL() + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_023::DoTestStepL() + { + TVerdict testResult = EPass; + + TRAPD(err, testResult = TestNewLOutOfMemoryL() ); + + if (err) + { + INFO_PRINTF2(_L("NewL out of memory test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("NewL out of memory test passes") ); + } + + return testResult; + } + +/** + * Constructor + */ +CTest_MMF_SbcCodec_U_024::CTest_MMF_SbcCodec_U_024() + { + iTestStepName = _L("MM-MMF-SbcCodec-U-024-HP"); + } + +/** + * Out of Memory test for ProcessL() + * @test Req. under test REQ2716 + */ +TVerdict CTest_MMF_SbcCodec_U_024::DoTestStepL() + { + TVerdict testResult = EPass; + + TRAPD(err, testResult = TestProcessLOutOfMemoryL() ); + + if (err) + { + INFO_PRINTF2(_L("ProcessL out of memory test left with status %d"), err); + testResult = EFail; + } + else + { + INFO_PRINTF1(_L("ProcessL out of memory test passes") ); + } + + return testResult; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,224 @@ +// Copyright (c) 2004-2009 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: +// + +#ifndef __TSU_MMF_SBCCODEC_H__ +#define __TSU_MMF_SBCCODEC_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "SBCFrameParameters.h" + +/** + * @class CTestStep_MMF_SbcCodec TSU_MMF_SbcCodec.h "TSU_MMF_SbcCodec.h" + * @brief Test step class for testing sbc codec. + * It's a base class for all test steps. + */ +class CTestStep_MMF_SbcCodec : public CTestStep + { +public: + CTestStep_MMF_SbcCodec(); + virtual ~CTestStep_MMF_SbcCodec(); + +protected: + TVerdict TestNewL(TUid aCodecUID); + TVerdict TestNewL(const TFourCC& aSrcFourCC, const TFourCC& aDstFourCC); + TVerdict TestProcessL(); + TVerdict TestEncodeL(TInt aTestNumber, TInt aSrcBufSize, TInt aDstBufSize); + TVerdict TestRepositionL(); + TVerdict TestChangeConfigL(); + + TVerdict TestMemoryScribbleL(); + TVerdict TestMemoryLeakL(); + TVerdict TestNewLOutOfMemoryL(); + TVerdict TestProcessLOutOfMemoryL(); + +private: + const TDesC& GetTestFileName(TInt aTestNumber); + const TDesC& GetRefFileName(TInt aTestNumber); + void ReadSourceL(const TDesC& fileName, TDes8& aSrcBuffer, TInt aPosition); + void WriteDstToFileL(const TDesC& fileName, const TDes8& aSrcBuffer, TInt aPosition); + TInt CompareFileL(const TDesC& aFileName); + TVerdict ProcessOnceForNewL(CMMFCodec* aCodec); + }; + + +/** + * @class CTest_MMF_ACOD_U_001 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_001 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_001(); + ~CTest_MMF_SbcCodec_U_001() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_002 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_002 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_002(); + ~CTest_MMF_SbcCodec_U_002() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_010 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_010 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_010(); + ~CTest_MMF_SbcCodec_U_010() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_011 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_011 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_011(); + ~CTest_MMF_SbcCodec_U_011() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_012 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_012 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_012(); + ~CTest_MMF_SbcCodec_U_012() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_013 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_013 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_013(); + ~CTest_MMF_SbcCodec_U_013() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_014 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_014 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_014(); + ~CTest_MMF_SbcCodec_U_014() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_015 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_015 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_015(); + ~CTest_MMF_SbcCodec_U_015() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_016 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_016 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_016(); + ~CTest_MMF_SbcCodec_U_016() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_021 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_021 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_021(); + ~CTest_MMF_SbcCodec_U_021() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_022 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_022 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_022(); + ~CTest_MMF_SbcCodec_U_022() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_023 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_023 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_023(); + ~CTest_MMF_SbcCodec_U_023() {} + virtual TVerdict DoTestStepL(); + }; + +/** + * @class CTest_MMF_ACOD_U_024 + * @test Req. under test REQ2716 + */ +class CTest_MMF_SbcCodec_U_024 : public CTestStep_MMF_SbcCodec + { +public: + CTest_MMF_SbcCodec_U_024(); + ~CTest_MMF_SbcCodec_U_024() {} + virtual TVerdict DoTestStepL(); + }; + + +#endif //__TSU_MMF_SBCCODEC_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodecSuite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodecSuite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,86 @@ + +// Copyright (c) 2004-2009 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: +// This main DLL entry point for the TSU_MMF_SBCCODEC.dll +// +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_SbcCodecSuite.h" +#include "TSU_MMF_SbcCodec.h" + + +/** + * NewTestSuite is exported at ordinal 1 + * this provides the interface to allow schedule test + * to create instances of this test suite + */ +EXPORT_C CTestSuite_MMF_SbcCodec* NewTestSuiteL() + { + CTestSuite_MMF_SbcCodec* self = new(ELeave) CTestSuite_MMF_SbcCodec; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); // result + return self; + } + +/** + * Destructor + */ +CTestSuite_MMF_SbcCodec::~CTestSuite_MMF_SbcCodec() + { + } + +/** + * Get Test Suite version + */ +TPtrC CTestSuite_MMF_SbcCodec::GetVersion() + { + _LIT(KTxtVersion, "1.0"); + return KTxtVersion(); + } + +/** + * This function initialises the test suite + * this creates all the test steps and stores them inside CTestSuite_MMF_SbcCodec + */ +void CTestSuite_MMF_SbcCodec::InitialiseL() + { + // store the name of this test suite + iSuiteName = _L("TSU_MMF_SbcCodec"); + + // NewL() tests + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_001); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_002); + + // ProcessL() tests + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_010); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_011); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_012); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_013); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_014); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_015); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_016); + + // Memory tests + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_021); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_022); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_023); + AddTestStepL(new(ELeave) CTest_MMF_SbcCodec_U_024); + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodecSuite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/TSU_MMF_SbcCodecSuite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,36 @@ +// Copyright (c) 2004-2009 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: +// This contains CTestSuite_MMF_SbcCodec +// +// + +#ifndef __TSU_MMF_SBCCODEC_SUITE_H_ +#define __TSU_MMF_SBCCODEC_SUITE_H_ + +#include + +/** @xxxx + * @class CTestSuite_MMF_SbcCodec TSU_MMF_SbcCodecSuite.h "TSU_MMF_SbcCodecSuite.h" + * @brief Test suite class for testing sbc codec. + */ +class CTestSuite_MMF_SbcCodec : public CTestSuite +{ +public: + virtual ~CTestSuite_MMF_SbcCodec(); + void InitialiseL(); + TPtrC GetVersion(); +}; + +#endif // __TSU_MMF_SBCCODEC_SUITE_H_ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/bwins/TSU_MMF_SbcCodecU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/bwins/TSU_MMF_SbcCodecU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewTestSuiteL@@YAPAVCTestSuite_MMF_SbcCodec@@XZ @ 1 NONAME ; class CTestSuite_MMF_SbcCodec * NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/eabi/TSU_MMF_SbcCodecU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/eabi/TSU_MMF_SbcCodecU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/group/TSU_MMF_SbcCodec.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/group/TSU_MMF_SbcCodec.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,82 @@ +// Copyright (c) 2010 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: +// + +#ifndef TSUMMFSBCCODEC_IBY +#define TSUMMFSBCCODEC_IBY + +#include + +file=ABI_DIR\DEBUG_DIR\tsu_mmf_sbccodec.dll System\Libs\tsu_mmf_sbccodec.dll +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SBCCODEC.script \tsu_mmf_sbccodec.script +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SBCCODEC_ALLOC.script \tsu_mmf_sbccodec_alloc.script + +// test source files +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_01.wav \sbc_test_01.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_02.wav \sbc_test_02.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_03.wav \sbc_test_03.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_04.wav \sbc_test_04.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_05.wav \sbc_test_05.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_06.wav \sbc_test_06.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_07.wav \sbc_test_07.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_08.wav \sbc_test_08.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_09.wav \sbc_test_09.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_10.wav \sbc_test_10.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_11.wav \sbc_test_11.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_12.wav \sbc_test_12.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_13.wav \sbc_test_13.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_14.wav \sbc_test_14.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_15.wav \sbc_test_15.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_16.wav \sbc_test_16.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_17.wav \sbc_test_17.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_18.wav \sbc_test_18.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_19.wav \sbc_test_19.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_20.wav \sbc_test_20.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_21.wav \sbc_test_21.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_22.wav \sbc_test_22.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_23.wav \sbc_test_23.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_24.wav \sbc_test_24.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_25.wav \sbc_test_25.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_26.wav \sbc_test_26.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_27.wav \sbc_test_27.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_28.wav \sbc_test_28.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_01.sbc \sbc_test_01.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_02.sbc \sbc_test_02.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_03.sbc \sbc_test_03.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_04.sbc \sbc_test_04.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_05.sbc \sbc_test_05.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_06.sbc \sbc_test_06.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_07.sbc \sbc_test_07.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_08.sbc \sbc_test_08.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_09.sbc \sbc_test_09.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_10.sbc \sbc_test_10.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_11.sbc \sbc_test_11.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_12.sbc \sbc_test_12.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_13.sbc \sbc_test_13.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_14.sbc \sbc_test_14.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_15.sbc \sbc_test_15.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_16.sbc \sbc_test_16.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_17.sbc \sbc_test_17.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_18.sbc \sbc_test_18.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_19.sbc \sbc_test_19.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_20.sbc \sbc_test_20.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_21.sbc \sbc_test_21.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_22.sbc \sbc_test_22.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_23.sbc \sbc_test_23.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_24.sbc \sbc_test_24.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_25.sbc \sbc_test_25.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_26.sbc \sbc_test_26.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_27.sbc \sbc_test_27.sbc +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_28.sbc \sbc_test_28.sbc +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,94 @@ +// Copyright (c) 2004-2009 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: +// + + +PRJ_TESTMMPFILES + +// mmp files +../MmpFiles/TSU_MMF_SbcCodec.mmp + + +PRJ_TESTEXPORTS + +// script files +../TSU_MMF_SBCCODEC.script c:/mm/tsu_mmf_sbccodec.script +../TSU_MMF_SBCCODEC_ALLOC.script c:/mm/tsu_mmf_sbccodec_alloc.script + +// test source files +../Data/sbc_test_01.wav c:/mm/mmf/testfiles/sbc/sbc_test_01.wav +../Data/sbc_test_02.wav c:/mm/mmf/testfiles/sbc/sbc_test_02.wav +../Data/sbc_test_03.wav c:/mm/mmf/testfiles/sbc/sbc_test_03.wav +../Data/sbc_test_04.wav c:/mm/mmf/testfiles/sbc/sbc_test_04.wav +../Data/sbc_test_05.wav c:/mm/mmf/testfiles/sbc/sbc_test_05.wav +../Data/sbc_test_06.wav c:/mm/mmf/testfiles/sbc/sbc_test_06.wav +../Data/sbc_test_07.wav c:/mm/mmf/testfiles/sbc/sbc_test_07.wav +../Data/sbc_test_08.wav c:/mm/mmf/testfiles/sbc/sbc_test_08.wav +../Data/sbc_test_09.wav c:/mm/mmf/testfiles/sbc/sbc_test_09.wav +../Data/sbc_test_10.wav c:/mm/mmf/testfiles/sbc/sbc_test_10.wav + +../Data/sbc_test_11.wav c:/mm/mmf/testfiles/sbc/sbc_test_11.wav +../Data/sbc_test_12.wav c:/mm/mmf/testfiles/sbc/sbc_test_12.wav +../Data/sbc_test_13.wav c:/mm/mmf/testfiles/sbc/sbc_test_13.wav +../Data/sbc_test_14.wav c:/mm/mmf/testfiles/sbc/sbc_test_14.wav +../Data/sbc_test_15.wav c:/mm/mmf/testfiles/sbc/sbc_test_15.wav +../Data/sbc_test_16.wav c:/mm/mmf/testfiles/sbc/sbc_test_16.wav +../Data/sbc_test_17.wav c:/mm/mmf/testfiles/sbc/sbc_test_17.wav +../Data/sbc_test_18.wav c:/mm/mmf/testfiles/sbc/sbc_test_18.wav +../Data/sbc_test_19.wav c:/mm/mmf/testfiles/sbc/sbc_test_19.wav +../Data/sbc_test_20.wav c:/mm/mmf/testfiles/sbc/sbc_test_20.wav + +../Data/sbc_test_21.wav c:/mm/mmf/testfiles/sbc/sbc_test_21.wav +../Data/sbc_test_22.wav c:/mm/mmf/testfiles/sbc/sbc_test_22.wav +../Data/sbc_test_23.wav c:/mm/mmf/testfiles/sbc/sbc_test_23.wav +../Data/sbc_test_24.wav c:/mm/mmf/testfiles/sbc/sbc_test_24.wav +../Data/sbc_test_25.wav c:/mm/mmf/testfiles/sbc/sbc_test_25.wav +../Data/sbc_test_26.wav c:/mm/mmf/testfiles/sbc/sbc_test_26.wav +../Data/sbc_test_27.wav c:/mm/mmf/testfiles/sbc/sbc_test_27.wav +../Data/sbc_test_28.wav c:/mm/mmf/testfiles/sbc/sbc_test_28.wav + +// test reference files +../Data/sbc_test_01.sbc c:/mm/mmf/ref/sbc/sbc_test_01.sbc +../Data/sbc_test_02.sbc c:/mm/mmf/ref/sbc/sbc_test_02.sbc +../Data/sbc_test_03.sbc c:/mm/mmf/ref/sbc/sbc_test_03.sbc +../Data/sbc_test_04.sbc c:/mm/mmf/ref/sbc/sbc_test_04.sbc +../Data/sbc_test_05.sbc c:/mm/mmf/ref/sbc/sbc_test_05.sbc +../Data/sbc_test_06.sbc c:/mm/mmf/ref/sbc/sbc_test_06.sbc +../Data/sbc_test_07.sbc c:/mm/mmf/ref/sbc/sbc_test_07.sbc +../Data/sbc_test_08.sbc c:/mm/mmf/ref/sbc/sbc_test_08.sbc +../Data/sbc_test_09.sbc c:/mm/mmf/ref/sbc/sbc_test_09.sbc +../Data/sbc_test_10.sbc c:/mm/mmf/ref/sbc/sbc_test_10.sbc + +../Data/sbc_test_11.sbc c:/mm/mmf/ref/sbc/sbc_test_11.sbc +../Data/sbc_test_12.sbc c:/mm/mmf/ref/sbc/sbc_test_12.sbc +../Data/sbc_test_13.sbc c:/mm/mmf/ref/sbc/sbc_test_13.sbc +../Data/sbc_test_14.sbc c:/mm/mmf/ref/sbc/sbc_test_14.sbc +../Data/sbc_test_15.sbc c:/mm/mmf/ref/sbc/sbc_test_15.sbc +../Data/sbc_test_16.sbc c:/mm/mmf/ref/sbc/sbc_test_16.sbc +../Data/sbc_test_17.sbc c:/mm/mmf/ref/sbc/sbc_test_17.sbc +../Data/sbc_test_18.sbc c:/mm/mmf/ref/sbc/sbc_test_18.sbc +../Data/sbc_test_19.sbc c:/mm/mmf/ref/sbc/sbc_test_19.sbc +../Data/sbc_test_20.sbc c:/mm/mmf/ref/sbc/sbc_test_20.sbc + +../Data/sbc_test_21.sbc c:/mm/mmf/ref/sbc/sbc_test_21.sbc +../Data/sbc_test_22.sbc c:/mm/mmf/ref/sbc/sbc_test_22.sbc +../Data/sbc_test_23.sbc c:/mm/mmf/ref/sbc/sbc_test_23.sbc +../Data/sbc_test_24.sbc c:/mm/mmf/ref/sbc/sbc_test_24.sbc +../Data/sbc_test_25.sbc c:/mm/mmf/ref/sbc/sbc_test_25.sbc +../Data/sbc_test_26.sbc c:/mm/mmf/ref/sbc/sbc_test_26.sbc +../Data/sbc_test_27.sbc c:/mm/mmf/ref/sbc/sbc_test_27.sbc +../Data/sbc_test_28.sbc c:/mm/mmf/ref/sbc/sbc_test_28.sbc + + +TSU_MMF_SbcCodec.iby /epoc32/rom/include/TSU_MMF_SbcCodec.iby diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/group/component_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/group/component_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,80 @@ +; Copyright (c) 2010 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: +; +;*Files To Copy... + +"\epoc32\release\$(platform)\udeb\tsu_mmf_sbccodec.dll"-"c:\sys\bin\tsu_mmf_sbccodec.dll" +"\epoc32\release\$(platform)\urel\sbcencoder.dll"-"c:\sys\bin\sbcencoder.dll" +"\epoc32\data\z\resource\plugins\sbcencoder.rsc"-"c:\resource\plugins\sbcencoder.rsc" + +"\epoc32\data\c\mm\TSU_MMF_SBCCODEC.script"-"c:\tsu_mmf_sbccodec.script" +"\epoc32\data\c\mm\TSU_MMF_SBCCODEC_ALLOC.script"-"c:\tsu_mmf_sbccodec_alloc.script" + +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_01.wav"-"e:\sbc_test_01.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_02.wav"-"e:\sbc_test_02.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_03.wav"-"e:\sbc_test_03.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_04.wav"-"e:\sbc_test_04.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_05.wav"-"e:\sbc_test_05.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_06.wav"-"e:\sbc_test_06.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_07.wav"-"e:\sbc_test_07.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_08.wav"-"e:\sbc_test_08.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_09.wav"-"e:\sbc_test_09.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_10.wav"-"e:\sbc_test_10.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_11.wav"-"e:\sbc_test_11.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_12.wav"-"e:\sbc_test_12.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_13.wav"-"e:\sbc_test_13.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_14.wav"-"e:\sbc_test_14.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_15.wav"-"e:\sbc_test_15.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_16.wav"-"e:\sbc_test_16.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_17.wav"-"e:\sbc_test_17.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_18.wav"-"e:\sbc_test_18.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_19.wav"-"e:\sbc_test_19.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_20.wav"-"e:\sbc_test_20.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_21.wav"-"e:\sbc_test_21.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_22.wav"-"e:\sbc_test_22.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_23.wav"-"e:\sbc_test_23.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_24.wav"-"e:\sbc_test_24.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_25.wav"-"e:\sbc_test_25.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_26.wav"-"e:\sbc_test_26.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_27.wav"-"e:\sbc_test_27.wav" +"\epoc32\data\c\mm\mmf\testfiles\sbc\sbc_test_28.wav"-"e:\sbc_test_28.wav" + +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_01.sbc"-"c:\sbc\ref\sbc_test_01.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_02.sbc"-"c:\sbc\ref\sbc_test_02.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_03.sbc"-"c:\sbc\ref\sbc_test_03.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_04.sbc"-"c:\sbc\ref\sbc_test_04.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_05.sbc"-"c:\sbc\ref\sbc_test_05.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_06.sbc"-"c:\sbc\ref\sbc_test_06.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_07.sbc"-"c:\sbc\ref\sbc_test_07.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_08.sbc"-"c:\sbc\ref\sbc_test_08.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_09.sbc"-"c:\sbc\ref\sbc_test_09.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_10.sbc"-"c:\sbc\ref\sbc_test_10.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_11.sbc"-"c:\sbc\ref\sbc_test_11.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_12.sbc"-"c:\sbc\ref\sbc_test_12.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_13.sbc"-"c:\sbc\ref\sbc_test_13.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_14.sbc"-"c:\sbc\ref\sbc_test_14.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_15.sbc"-"c:\sbc\ref\sbc_test_15.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_16.sbc"-"c:\sbc\ref\sbc_test_16.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_17.sbc"-"c:\sbc\ref\sbc_test_17.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_18.sbc"-"c:\sbc\ref\sbc_test_18.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_19.sbc"-"c:\sbc\ref\sbc_test_19.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_20.sbc"-"c:\sbc\ref\sbc_test_20.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_21.sbc"-"c:\sbc\ref\sbc_test_21.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_22.sbc"-"c:\sbc\ref\sbc_test_22.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_23.sbc"-"c:\sbc\ref\sbc_test_23.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_24.sbc"-"c:\sbc\ref\sbc_test_24.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_25.sbc"-"c:\sbc\ref\sbc_test_25.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_26.sbc"-"c:\sbc\ref\sbc_test_26.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_27.sbc"-"c:\sbc\ref\sbc_test_27.sbc" +"\epoc32\data\c\mm\mmf\ref\sbc\sbc_test_28.sbc"-"c:\sbc\ref\sbc_test_28.sbc" diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SbcCodec/mmpfiles/TSU_MMF_SbcCodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SbcCodec/mmpfiles/TSU_MMF_SbcCodec.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2004-2009 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: +// using relative paths for sourcepath and user includes +// +// + +TARGET tsu_mmf_sbccodec.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID 0x1000008d 0x10204977 +VENDORID 0x70000001 + +SOURCEPATH ../ +SOURCE TSU_MMF_SbcCodec.cpp +SOURCE TSU_MMF_SbcCodecSuite.cpp + +USERINCLUDE ../ +USERINCLUDE ../../../src/codec/sbcencoder + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY testframeworkclient.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib + +#ifdef EABI +NOEXPORTLIBRARY +#endif + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/ALawMono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/ALawMono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Imaad4BitMono8Khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Imaad4BitMono8Khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/MuLawMono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/MuLawMono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16BMono8khz400hzTone.au Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16BMono8khz400hzTone.au has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16FromALawMono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16FromALawMono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16FromMuLawMono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16FromMuLawMono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16Mono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16Mono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16Stereo8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Pcm16Stereo8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/PcmU8Mono8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/PcmU8Mono8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/PcmU8Stereo8khz400hzTone.wav Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/PcmU8Stereo8khz400hzTone.wav has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.cod Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.cod has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.inp Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.inp has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.out Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq01.out has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.cod Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.cod has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.inp Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.inp has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.out Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq02.out has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.cod Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.cod has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.inp Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.inp has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.out Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq03.out has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.cod Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.cod has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.inp Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.inp has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.out Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq04.out has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq05.cod Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq05.cod has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq05.out Binary file devsound/devsoundrefplugin/tsrc/SwCodecDevices/Data/Seq05.out has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,11354 @@ +// Copyright (c) 2003-2009 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: +// + +// TSU_MMF_ACOD_BASE.CPP +// +// Copyright (c) 2003 Symbian Ltd. All rights reserved. +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_ACOD.h" +#include "TSU_MMF_devicesuite.h" + +#include +#include +#include + +#ifdef __WINS__ +//wins directories +_LIT(KSourceFilesDir, "c:\\mm\\mmf\\testfiles\\acod\\"); +_LIT(KComparisonFilesDir, "c:\\mm\\mmf\\ref\\acod\\"); +#else +/* +arm4 directories +All source and comparison files need to be copied manually onto the flash card. +This code assumes the flash card is represented by drive E: on the target board. +If this is not the case, the KSourceFilesDir and KComparisonFilesDir strings +need to be changed accordingly. +*/ +_LIT(KSourceFilesDir, "e:\\"); +_LIT(KComparisonFilesDir, "e:\\"); +#endif + +//------------------------------------------------------------------ +// ** TEST MMF_ACOD STEPS *** + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0001::CTest_MMF_ACOD_U_0001() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0001-HP"); + } + +/** @xxxx + * Instantiate a codec by FourCC Codes and preferred supplier + * @test Req. under test REQ172.6.3 + */ +TVerdict CTest_MMF_ACOD_U_0001::DoTestStepL() + { + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewLPreferredSupplierL()); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0002::CTest_MMF_ACOD_U_0002() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0002-HP"); + } + +/** @xxxx + * ALAW To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.1 + */ +TVerdict CTest_MMF_ACOD_U_0002::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodeALAW, KMMFFourCCCodePCM16)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0003::CTest_MMF_ACOD_U_0003() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0003-HP"); + } + +/** @xxxx + * ALAW To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.1 + */ +TVerdict CTest_MMF_ACOD_U_0003::DoTestStepL() + { +/* const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + */ + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0004::CTest_MMF_ACOD_U_0004() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0004-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 100; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0004::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KAlawToPCM16OptimumDst)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0005::CTest_MMF_ACOD_U_0005() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0005-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 25; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0005::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAlawToPCM16OptimumSrc, KSmallBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0006::CTest_MMF_ACOD_U_0006() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0006-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 5000; + iExpectedDstBytesAdded[i] = 10000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0006::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0007::CTest_MMF_ACOD_U_0007() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0007-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0007::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0008::CTest_MMF_ACOD_U_0008() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0008-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0008::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0009::CTest_MMF_ACOD_U_0009() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0009-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0009::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAlawToPCM16OptimumSrc, KAlawToPCM16OptimumDst)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0010::CTest_MMF_ACOD_U_0010() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0010-HP"); +// iHeapSize = 0x20000; + } + +/** @xxxx + * ALAW To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0010::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; + INFO_PRINTF1(_L(">> The ALAW to PCM16 codec doesn't currently store data between calls to ProcessL")); + +// TRAPD(err, testOK = TestRepositionL(codecUid, KAlawToPCM16OptimumSrc, KAlawToPCM16OptimumDst+30)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0011::CTest_MMF_ACOD_U_0011() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0011-HP"); + } + +/** @xxxx + * PCM16 To ALAW Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.3 + */ +TVerdict CTest_MMF_ACOD_U_0011::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeALAW)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0012::CTest_MMF_ACOD_U_0012() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0012-HP"); + } + +/** @xxxx + * PCM16 To ALAW Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.3 + */ +TVerdict CTest_MMF_ACOD_U_0012::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0013::CTest_MMF_ACOD_U_0013() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0013-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 25; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0013::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToAlawOptimumDst)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0014::CTest_MMF_ACOD_U_0014() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0014-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 100; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0014::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAlawOptimumSrc, KSmallBufferSize)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0015::CTest_MMF_ACOD_U_0015() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0015-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 5000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0015::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0016::CTest_MMF_ACOD_U_0016() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0016-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0016::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0017::CTest_MMF_ACOD_U_0017() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0017-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0017::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0018::CTest_MMF_ACOD_U_0018() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0018-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To ALAW Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0018::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAlawOptimumSrc, KPCM16ToAlawOptimumDst)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0019::CTest_MMF_ACOD_U_0019() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0019-HP"); +// iHeapSize = 0x20000; + } + +/** @xxxx + * PCM16 To ALAW Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0019::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to ALAW codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err= KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0020::CTest_MMF_ACOD_U_0020() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0020-HP"); + } + +/** @xxxx + * PCM8 To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.4 + */ +TVerdict CTest_MMF_ACOD_U_0020::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM8, KMMFFourCCCodePCM16)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0021::CTest_MMF_ACOD_U_0021() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0021-HP"); + } + +/** @xxxx + * PCM8 To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.4 + */ +TVerdict CTest_MMF_ACOD_U_0021::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0022::CTest_MMF_ACOD_U_0022() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0022-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 100; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0022::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM8ToPCM16OptimumDst)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0023::CTest_MMF_ACOD_U_0023() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0023-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 25; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0023::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM8ToPCM16OptimumSrc, KSmallBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0024::CTest_MMF_ACOD_U_0024() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0024-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 5000; + iExpectedDstBytesAdded[i] = 10000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0024::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0025::CTest_MMF_ACOD_U_0025() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0025-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0025::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0026::CTest_MMF_ACOD_U_0026() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0026-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0026::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0027::CTest_MMF_ACOD_U_0027() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0027-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0027::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM8ToPCM16OptimumSrc, KPCM8ToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0028::CTest_MMF_ACOD_U_0028() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0028-HP"); +// iHeapSize = 0x20000; + } + +/** @xxxx + * PCM8 To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0028::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM8 to PCM16 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KPCM8ToPCM16OptimumSrc, KPCM8ToPCM16OptimumDst+30)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0029::CTest_MMF_ACOD_U_0029() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0029-HP"); + } + +/** @xxxx + * PCM16 To PCM8 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.5 + */ +TVerdict CTest_MMF_ACOD_U_0029::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodePCM8)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0030::CTest_MMF_ACOD_U_0030() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0030-HP"); + } + +/** @xxxx + * PCM16 To PCM8 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.5 + */ +TVerdict CTest_MMF_ACOD_U_0030::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0031::CTest_MMF_ACOD_U_0031() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0031-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 25; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0031::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToPCM8OptimumDst)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0032::CTest_MMF_ACOD_U_0032() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0032-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 100; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0032::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM8OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0033::CTest_MMF_ACOD_U_0033() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0033-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 5000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0033::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0034::CTest_MMF_ACOD_U_0034() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0034-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0034::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0035::CTest_MMF_ACOD_U_0035() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0035-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0035::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0036::CTest_MMF_ACOD_U_0036() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0036-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM8 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0036::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM8OptimumSrc, KPCM16ToPCM8OptimumDst)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0037::CTest_MMF_ACOD_U_0037() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0037-HP"); + } + +/** @xxxx + * PCM16 To PCM8 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0037::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to PCM8 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0038::CTest_MMF_ACOD_U_0038() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0038-HP"); + } + +/** @xxxx + * PCM16 To PCM16B Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.6 + */ +TVerdict CTest_MMF_ACOD_U_0038::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodePCM16B)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0039::CTest_MMF_ACOD_U_0039() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0039-HP"); + } + +/** @xxxx + * PCM16B To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.6 + */ +TVerdict CTest_MMF_ACOD_U_0039::DoTestStepL() + { + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16B, KMMFFourCCCodePCM16)); + TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0040::CTest_MMF_ACOD_U_0040() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0040-HP"); + } + +/** @xxxx + * PCMU16 To PCMU16B Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.6 + */ +TVerdict CTest_MMF_ACOD_U_0040::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCMU16, KMMFFourCCCodePCMU16B)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0041::CTest_MMF_ACOD_U_0041() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0041-HP"); + } + +/** @xxxx + * PCMU16B To PCMU16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.6 + */ +TVerdict CTest_MMF_ACOD_U_0041::DoTestStepL() + { + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCMU16B, KMMFFourCCCodePCMU16)); +TInt err=KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0042::CTest_MMF_ACOD_U_0042() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0042-HP"); + } + +/** @xxxx + * PCM16 To PCM16B Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.6 + */ +TVerdict CTest_MMF_ACOD_U_0042::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0043::CTest_MMF_ACOD_U_0043() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0043-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0043::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToPCM16BOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0044::CTest_MMF_ACOD_U_0044() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0044-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0044::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM16BOptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0045::CTest_MMF_ACOD_U_0045() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0045-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 10000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0045::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0046::CTest_MMF_ACOD_U_0046() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0046-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0046::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0047::CTest_MMF_ACOD_U_0047() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0047-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0047::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0048::CTest_MMF_ACOD_U_0048() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0048-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCM16B Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0048::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM16BOptimumSrc, KPCM16ToPCM16BOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0049::CTest_MMF_ACOD_U_0049() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0049-HP"); + } + +/** @xxxx + * PCM16 To PCM16B Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0049::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; +// const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to PCM16B codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0050::CTest_MMF_ACOD_U_0050() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0050-HP"); + } + +/** @xxxx + * PCM16 To PCMU16B Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2 + */ +TVerdict CTest_MMF_ACOD_U_0050::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodePCMU16B)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0051::CTest_MMF_ACOD_U_0051() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0051-HP"); + } + +/** @xxxx + * PCM16 To PCMU16B Instantiate codec by UID + * @test Req. under test REQ172.6.1 + */ +TVerdict CTest_MMF_ACOD_U_0051::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0052::CTest_MMF_ACOD_U_0052() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0052-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0052::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToPCMU16BOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0053::CTest_MMF_ACOD_U_0053() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0053-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0053::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16BOptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0054::CTest_MMF_ACOD_U_0054() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0054-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 10000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0054::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0055::CTest_MMF_ACOD_U_0055() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0055-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0055::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0056::CTest_MMF_ACOD_U_0056() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0056-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0056::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0057::CTest_MMF_ACOD_U_0057() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0057-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16B Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0057::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16BOptimumSrc, KPCM16ToPCMU16BOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0058::CTest_MMF_ACOD_U_0058() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0058-HP"); + } + +/** @xxxx + * PCM16 To PCMU16B Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0058::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to PCMU16B codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0059::CTest_MMF_ACOD_U_0059() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0059-HP"); + } + +/** @xxxx + * PCM16 To PCMU16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.7 + */ +TVerdict CTest_MMF_ACOD_U_0059::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodePCMU16)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0060::CTest_MMF_ACOD_U_0060() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0060-HP"); + } + +/** @xxxx + * PCM16 To PCMU16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.7 + */ +TVerdict CTest_MMF_ACOD_U_0060::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0061::CTest_MMF_ACOD_U_0061() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0061-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0061::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToPCMU16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0062::CTest_MMF_ACOD_U_0062() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0062-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0062::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0063::CTest_MMF_ACOD_U_0063() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0063-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 10000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0063::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0064::CTest_MMF_ACOD_U_0064() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0064-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0064::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0065::CTest_MMF_ACOD_U_0065() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0065-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0065::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0066::CTest_MMF_ACOD_U_0066() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0066-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0066::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16OptimumSrc, KPCM16ToPCMU16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0067::CTest_MMF_ACOD_U_0067() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0067-HP"); + } + +/** @xxxx + * PCM16 To PCMU16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0067::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to PCMU16 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0068::CTest_MMF_ACOD_U_0068() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0068-HP"); + } + +/** @xxxx + * PCM16 To PCMU8 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.8 + */ +TVerdict CTest_MMF_ACOD_U_0068::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodePCMU8)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0069::CTest_MMF_ACOD_U_0069() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0069-HP"); + } + +/** @xxxx + * PCM16 To PCMU8 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.8 + */ +TVerdict CTest_MMF_ACOD_U_0069::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0070::CTest_MMF_ACOD_U_0070() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0070-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 25; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0070::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToPCMU8OptimumDst)); + TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0071::CTest_MMF_ACOD_U_0071() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0071-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 100; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0071::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU8OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0072::CTest_MMF_ACOD_U_0072() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0072-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 5000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0072::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0073::CTest_MMF_ACOD_U_0073() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0073-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0073::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0074::CTest_MMF_ACOD_U_0074() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0074-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0074::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0075::CTest_MMF_ACOD_U_0075() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0075-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To PCMU8 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0075::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU8OptimumSrc, KPCM16ToPCMU8OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0076::CTest_MMF_ACOD_U_0076() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0076-HP"); + } + +/** @xxxx + * PCM16 To PCMU8 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0076::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to PCMU8 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//----------------------------------------------------------------- + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0077::CTest_MMF_ACOD_U_0077() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0077-HP"); + } + +/** @xxxx + * PCMU16B To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.9 + */ +TVerdict CTest_MMF_ACOD_U_0077::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCMU16B, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0078::CTest_MMF_ACOD_U_0078() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0078-HP"); + } + +/** @xxxx + * PCMU16B To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.9 + */ +TVerdict CTest_MMF_ACOD_U_0078::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0079::CTest_MMF_ACOD_U_0079() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0079-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0079::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCMU16BToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0080::CTest_MMF_ACOD_U_0080() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0080-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0080::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16BToPCM16OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0081::CTest_MMF_ACOD_U_0081() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0081-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 10000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0081::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0082::CTest_MMF_ACOD_U_0082() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0082-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0082::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0083::CTest_MMF_ACOD_U_0083() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0083-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0083::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0084::CTest_MMF_ACOD_U_0084() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0084-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16B To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0084::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16BToPCM16OptimumSrc, KPCMU16BToPCM16OptimumDst)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0085::CTest_MMF_ACOD_U_0085() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0085-HP"); + } + +/** @xxxx + * PCMU16B To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0085::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCMU16B to PCM16 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0086::CTest_MMF_ACOD_U_0086() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0086-HP"); + } + +/** @xxxx + * PCMU16 To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.25 + */ +TVerdict CTest_MMF_ACOD_U_0086::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCMU16, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0087::CTest_MMF_ACOD_U_0087() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0087-HP"); + } + +/** @xxxx + * PCMU16 To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.25 + */ +TVerdict CTest_MMF_ACOD_U_0087::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0088::CTest_MMF_ACOD_U_0088() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0088-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0088::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCMU16ToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0089::CTest_MMF_ACOD_U_0089() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0089-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0089::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16ToPCM16OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0090::CTest_MMF_ACOD_U_0090() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0090-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 10000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0090::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0091::CTest_MMF_ACOD_U_0091() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0091-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0091::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0092::CTest_MMF_ACOD_U_0092() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0092-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0092::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0093::CTest_MMF_ACOD_U_0093() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0093-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU16 To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0093::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16ToPCM16OptimumSrc, KPCMU16ToPCM16OptimumDst)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0094::CTest_MMF_ACOD_U_0094() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0094-HP"); + } + +/** @xxxx + * PCMU16 To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0094::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCMU16 to PCM16 codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0095::CTest_MMF_ACOD_U_0095() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0095-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.11 + */ +TVerdict CTest_MMF_ACOD_U_0095::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCMU8, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0096::CTest_MMF_ACOD_U_0096() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0096-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.11 + */ +TVerdict CTest_MMF_ACOD_U_0096::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0097::CTest_MMF_ACOD_U_0097() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0097-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 100; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0097::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCMU8ToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0098::CTest_MMF_ACOD_U_0098() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0098-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 25; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0098::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU8ToPCM16OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0099::CTest_MMF_ACOD_U_0099() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0099-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 5000; + iExpectedDstBytesAdded[i] = 10000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0099::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0100::CTest_MMF_ACOD_U_0100() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0100-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0100::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0101::CTest_MMF_ACOD_U_0101() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0101-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0101::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0102::CTest_MMF_ACOD_U_0102() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0102-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0102::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU8ToPCM16OptimumSrc, KPCMU8ToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0103::CTest_MMF_ACOD_U_0103() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0103-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0103::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + INFO_PRINTF1(_L(">> The PCMU8 to PCM16 codec doesn't currently store data between calls to ProcessL")); + +// TRAPD(err, testOK = TestRepositionL(codecUid, KPCMU8ToPCM16OptimumSrc, KPCMU8ToPCM16OptimumDst+30)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0104::CTest_MMF_ACOD_U_0104() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0104-HP"); + } + +/** @xxxx + * MULAW To PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.13 + */ +TVerdict CTest_MMF_ACOD_U_0104::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodeMuLAW, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0105::CTest_MMF_ACOD_U_0105() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0105-HP"); + } + +/** @xxxx + * MULAW To PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.13 + */ +TVerdict CTest_MMF_ACOD_U_0105::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0106::CTest_MMF_ACOD_U_0106() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0106-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 100; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0106::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KMulawToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0107::CTest_MMF_ACOD_U_0107() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0107-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 25; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0107::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMulawToPCM16OptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0108::CTest_MMF_ACOD_U_0108() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0108-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 5000; + iExpectedDstBytesAdded[i] = 10000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0108::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0109::CTest_MMF_ACOD_U_0109() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0109-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0109::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0110::CTest_MMF_ACOD_U_0110() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0110-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0110::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0111::CTest_MMF_ACOD_U_0111() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0111-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x800; + iExpectedDstBytesAdded[i] = 0x1000; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0111::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMulawToPCM16OptimumSrc, KMulawToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0112::CTest_MMF_ACOD_U_0112() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0112-HP"); + } + +/** @xxxx + * MULAW To PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0112::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; + INFO_PRINTF1(_L(">> The MULAW To PCM16 codec doesn't currently store data between calls to ProcessL")); + +// TRAPD(err, testOK = TestRepositionL(codecUid, KMulawToPCM16OptimumSrc, KMulawToPCM16OptimumDst+30)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0113::CTest_MMF_ACOD_U_0113() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0113-HP"); + } + +/** @xxxx + * PCM16 To MULAW Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.15 + */ +TVerdict CTest_MMF_ACOD_U_0113::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeMuLAW)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0114::CTest_MMF_ACOD_U_0114() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0114-HP"); + } + +/** @xxxx + * PCM16 To MULAW Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.15 + */ +TVerdict CTest_MMF_ACOD_U_0114::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0115::CTest_MMF_ACOD_U_0115() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0115-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 25; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0115::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToMulawOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0116::CTest_MMF_ACOD_U_0116() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0116-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 100; + iExpectedDstBytesAdded[i] = 50; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0116::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToMulawOptimumSrc, KSmallBufferSize)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0117::CTest_MMF_ACOD_U_0117() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0117-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 10000; + iExpectedDstBytesAdded[i] = 5000; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0117::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0118::CTest_MMF_ACOD_U_0118() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0118-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0118::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0119::CTest_MMF_ACOD_U_0119() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0119-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + + if((i%2)==0)//even i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + else //odd i + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0119::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0120::CTest_MMF_ACOD_U_0120() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0120-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x1000; + iExpectedDstBytesAdded[i] = 0x800; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 To MULAW Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0120::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToMulawOptimumSrc, KPCM16ToMulawOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0121::CTest_MMF_ACOD_U_0121() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0121-HP"); + } + +/** @xxxx + * PCM16 To MULAW Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0121::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; + + INFO_PRINTF1(_L(">> The PCM16 to MULAW codec doesn't currently store data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, KDefaultBufferSize, KDefaultBufferSize+30)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0122::CTest_MMF_ACOD_U_0122() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0122-HP"); + } + +/** @xxxx + * IMAD to PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.12 + */ +TVerdict CTest_MMF_ACOD_U_0122::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodeIMAD, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0123::CTest_MMF_ACOD_U_0123() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0123-HP"); + } + +/** @xxxx + * IMAD to PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.12 + */ +TVerdict CTest_MMF_ACOD_U_0123::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0124::CTest_MMF_ACOD_U_0124() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0124-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAD to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0124::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KAdpcmToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0125::CTest_MMF_ACOD_U_0125() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0125-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * IMAD to PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0125::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAdpcmToPCM16OptimumSrc, KSmallBufferSize)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0126::CTest_MMF_ACOD_U_0126() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0126-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + if(i<4) + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + else + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAD to PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0126::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0127::CTest_MMF_ACOD_U_0127() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0127-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EProcessIncomplete; + } + +/** @xxxx + * IMAD to PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0127::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0128::CTest_MMF_ACOD_U_0128() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0128-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EProcessIncomplete; + } + +/** @xxxx + * IMAD to PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0128::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0129::CTest_MMF_ACOD_U_0129() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0129-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x400; + iExpectedDstBytesAdded[i] = 0xFC8; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * IMAD to PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0129::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAdpcmToPCM16OptimumSrc, KAdpcmToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0130::CTest_MMF_ACOD_U_0130() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0130-HP"); + } + +/** @xxxx + * IMAD to PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0130::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; + +// TUint src = (KAdpcmToPCM16OptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The IMAD to PCM16 codec stores data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, src, KAdpcmToPCM16OptimumDst)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0131::CTest_MMF_ACOD_U_0131() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0131-HP"); + } + +/** @xxxx + * PCM16 to IMAD Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.14 + */ +TVerdict CTest_MMF_ACOD_U_0131::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeIMAD)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0132::CTest_MMF_ACOD_U_0132() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0132-HP"); + } + +/** @xxxx + * PCM16 to IMAD Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.14 + */ +TVerdict CTest_MMF_ACOD_U_0132::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0133::CTest_MMF_ACOD_U_0133() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0133-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAD to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0133::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToAdpcmOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0134::CTest_MMF_ACOD_U_0134() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0134-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to IMAD Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0134::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAdpcmOptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0135::CTest_MMF_ACOD_U_0135() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0135-HP"); + iHeapSize = 0x20000; + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAD Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0135::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0136::CTest_MMF_ACOD_U_0136() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0136-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAD Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0136::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0137::CTest_MMF_ACOD_U_0137() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0137-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAD Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0137::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0138::CTest_MMF_ACOD_U_0138() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0138-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0xFC8; + iExpectedDstBytesAdded[i] = 0x400; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 to IMAD Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0138::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAdpcmOptimumSrc, KPCM16ToAdpcmOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0139::CTest_MMF_ACOD_U_0139() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0139-HP"); + } + +/** @xxxx + * PCM16 to IMAD Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0139::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + +// TUint src = (KPCM16ToAdpcmOptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The PCM16 to IMAD codec stores data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, src, KPCM16ToAdpcmOptimumDst)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0140::CTest_MMF_ACOD_U_0140() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0140-HP"); + } + +/** @xxxx + * IMAS to PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.17 + */ +TVerdict CTest_MMF_ACOD_U_0140::DoTestStepL() + { + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewL(KMMFFourCCCodeIMAS, KMMFFourCCCodePCM16)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0141::CTest_MMF_ACOD_U_0141() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0141-HP"); + } + +/** @xxxx + * IMAS to PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.17 + */ +TVerdict CTest_MMF_ACOD_U_0141::DoTestStepL() + { +// const TUid codecUid = {0}; //KMmfUidHwDeviceIMAADPCMToPCM16Stereo}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0142::CTest_MMF_ACOD_U_0142() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0142-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAS to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0142::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KStereoAdpcmToPCM16OptimumDst)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0143::CTest_MMF_ACOD_U_0143() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0143-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * IMAS to PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0143::DoTestStepL() + { +// const TUid codecUid = {0};//{0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KStereoAdpcmToPCM16OptimumSrc, KSmallBufferSize)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0144::CTest_MMF_ACOD_U_0144() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0144-HP"); + iHeapSize = 0x20000; + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EProcessIncomplete; + } + +/** @xxxx + * IMAS to PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0144::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0145::CTest_MMF_ACOD_U_0145() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0145-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EProcessIncomplete; + } + +/** @xxxx + * IMAS to PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0145::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0146::CTest_MMF_ACOD_U_0146() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0146-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EProcessIncomplete; + } + +/** @xxxx + * IMAS to PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0146::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); + TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0147::CTest_MMF_ACOD_U_0147() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0147-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x400; + iExpectedDstBytesAdded[i] = 0xF90; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * IMAS to PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0147::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KStereoAdpcmToPCM16OptimumSrc, KStereoAdpcmToPCM16OptimumDst)); + TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0148::CTest_MMF_ACOD_U_0148() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0148-HP"); + } + +/** @xxxx + * IMAS to PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0148::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; + +// TUint src = (KStereoAdpcmToPCM16OptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The IMAS to PCM16 codec stores data between calls to ProcessL")); + //TRAPD(err, testOK = TestRepositionL(codecUid, src, KStereoAdpcmToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0149::CTest_MMF_ACOD_U_0149() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0149-HP"); + } + +/** @xxxx + * PCM16 to IMAS Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.18 + */ +TVerdict CTest_MMF_ACOD_U_0149::DoTestStepL() + { + TBool testOK = EFalse; + //TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeIMAS)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0150::CTest_MMF_ACOD_U_0150() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0150-HP"); + } + +/** @xxxx + * PCM16 to IMAS Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.18 + */ +TVerdict CTest_MMF_ACOD_U_0150::DoTestStepL() + { +// AASSERT( 0 ); // remove this tests ! +// const TUid codecUid = {0}; //KMmfUidHwDevicePCM16ToIMAADPCMStereo}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0151::CTest_MMF_ACOD_U_0151() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0151-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 50; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAS to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0151::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSize, KPCM16ToStereoAdpcmOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0152::CTest_MMF_ACOD_U_0152() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0152-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to IMAS Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0152::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToStereoAdpcmOptimumSrc, KSmallBufferSize)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0153::CTest_MMF_ACOD_U_0153() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0153-HP"); + iHeapSize = 0x20000; + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessIncomplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAS Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0153::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0154::CTest_MMF_ACOD_U_0154() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0154-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAS Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0154::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0155::CTest_MMF_ACOD_U_0155() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0155-HP"); + + iExpectedReturnValue[0].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[1].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[2].iStatus = TCodecProcessResult::EDstNotFilled; + iExpectedReturnValue[3].iStatus = TCodecProcessResult::EProcessComplete; + iExpectedReturnValue[4].iStatus = TCodecProcessResult::EDstNotFilled; + } + +/** @xxxx + * PCM16 to IMAS Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0155::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0156::CTest_MMF_ACOD_U_0156() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0156-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0xF90; + iExpectedDstBytesAdded[i] = 0x400; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 to IMAS Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0156::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToStereoAdpcmOptimumSrc, KPCM16ToStereoAdpcmOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0157::CTest_MMF_ACOD_U_0157() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0157-HP"); + } + +/** @xxxx + * PCM16 to IMAS Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0157::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + +// TUint src = (KPCM16ToStereoAdpcmOptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The PCM16 to IMAS codec stores data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, src, KPCM16ToStereoAdpcmOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0158::CTest_MMF_ACOD_U_0158() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0158-HP"); + } + +/** @xxxx + * GSM610 to PCM16 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.19 + */ +TVerdict CTest_MMF_ACOD_U_0158::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodeGSM610, KMMFFourCCCodePCM16)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0159::CTest_MMF_ACOD_U_0159() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0159-HP"); + } + +/** @xxxx + * GSM610 to PCM16 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.19 + */ +TVerdict CTest_MMF_ACOD_U_0159::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0160::CTest_MMF_ACOD_U_0160() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0160-HP"); + iHeapSize = 0x200000; + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + + } + +/** @xxxx + * GSM610 to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0160::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSizeGSM, KGSM610ToPCM16OptimumDstGSM, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0161::CTest_MMF_ACOD_U_0161() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0161-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0161::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KGSM610ToPCM16OptimumSrcGSM, KSmallBufferSizeGSM, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0162::CTest_MMF_ACOD_U_0162() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0162-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0162::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0163::CTest_MMF_ACOD_U_0163() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0163-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0163::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0164::CTest_MMF_ACOD_U_0164() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0164-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessIncomplete; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0164::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0165::CTest_MMF_ACOD_U_0165() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0165-HP"); + iSingleIteration = ETrue; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0x104; + iExpectedDstBytesAdded[i] = 0xA00; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0165::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KGSM610ToPCM16OptimumSrc, KGSM610ToPCM16OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0166::CTest_MMF_ACOD_U_0166() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0166-HP"); + } + +/** @xxxx + * GSM610 to PCM16 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0166::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + +// TUint src = (KGSM610ToPCM16OptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The GSM610 to PCM16 codec stores data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, src, KGSM610ToPCM16OptimumDst)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0167::CTest_MMF_ACOD_U_0167() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0167-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Instantiate codec by FourCC Codes + * @test Req. under test REQ172.6.2, REQ172.11.20 + */ +TVerdict CTest_MMF_ACOD_U_0167::DoTestStepL() + { + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(KMMFFourCCCodePCM16, KMMFFourCCCodeGSM610)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0168::CTest_MMF_ACOD_U_0168() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0168-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Instantiate codec by UID + * @test Req. under test REQ172.6.1, REQ172.11.20 + */ +TVerdict CTest_MMF_ACOD_U_0168::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestNewL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0169::CTest_MMF_ACOD_U_0169() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0169-HP"); + iHeapSize = 0x20000; + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * GSM610 to PCM16 Pass in small source buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0169::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KSmallBufferSizeGSM, KPCM16ToGSM610OptimumDstGSM, 0, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0170::CTest_MMF_ACOD_U_0170() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0170-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to GSM610 Pass in small dest buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0170::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToGSM610OptimumSrc, KSmallBufferSize, 0, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0171::CTest_MMF_ACOD_U_0171() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0171-HP"); + iHeapSize = 0x20000; + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to GSM610 Pass in large buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0171::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KLargeBufferSize, KLargeBufferSize, 0, EFalse)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0172::CTest_MMF_ACOD_U_0172() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0172-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to GSM610 Pass in default sized buffers + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0172::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KDefaultBufferSize, KDefaultBufferSize, 0, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0173::CTest_MMF_ACOD_U_0173() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0173-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to GSM610 Pass in buffers with different max length and length + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0173::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMaxBufferLength, KDefaultBufferSize, KDefaultBufferSize, EFalse)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0174::CTest_MMF_ACOD_U_0174() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0174-HP"); + iSingleIteration = ETrue; + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0xA00; + iExpectedDstBytesAdded[i] = 0x104; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EProcessComplete; + } + } + +/** @xxxx + * PCM16 to GSM610 Pass in buffers of optimum size + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0174::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToGSM610OptimumSrc, KPCM16ToGSM610OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0175::CTest_MMF_ACOD_U_0175() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0175-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Reposition source pointer during conversion + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0175::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + +// TUint src = (KPCM16ToGSM610OptimumSrc/4) + 10; + + INFO_PRINTF1(_L(">> The PCM16 to GSM610 codec stores data between calls to ProcessL")); +// TRAPD(err, testOK = TestRepositionL(codecUid, src, KPCM16ToGSM610OptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0176::CTest_MMF_ACOD_U_0176() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0176-HP"); + } + +/** @xxxx + * Instantiate codec that doesn't exist + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0176::DoTestStepL() + { +// CMMFCodec* codec = NULL; + //TRAPD(err, codec = CMMFCodec::NewL(KMMFFourCCCodeALAW, KMMFFourCCCodePCMU16B)); + TInt err = KErrNone; + if (err == KErrNone || err == KErrNotSupported) + return EPass; + else + { + ERR_PRINTF2(_L(">> CTest_MMF_ACOD_U_0176::DoTestStepL Leave occurred in NewL, error code %d"), err); + return EFail; + } + } +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0177::CTest_MMF_ACOD_U_0177() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0177-HP"); + } + +/** @xxxx + * Instantiate codec from fourCC codes that don't exist + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0177::DoTestStepL() + { +// const TUint32 KFourCCCodeP1B = 0x42315020; //(' ', 'P', '1', 'B') +// const TUint32 KFourCCCodePS16 = 0x36315350; //('P', 'S', '1', '6') + +// CMMFCodec* codec = NULL; + //TRAPD(err, codec = CMMFCodec::NewL(KFourCCCodeP1B, KFourCCCodePS16)); + + TInt err = KErrNone; + if (err == KErrNone || err == KErrNotSupported) + return EPass; + else + { + ERR_PRINTF2(_L(">> CTest_MMF_ACOD_U_0177::DoTestStepL Leave occurred in NewL, error code %d"), err); + return EFail; + } + } +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0178::CTest_MMF_ACOD_U_0178() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0178-HP"); + } + +/** @xxxx + * Test out of memory in NewL + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0178::DoTestStepL() + { +// CMMFCodec* codec = NULL; + __UHEAP_FAILNEXT(1); + //TRAPD(err, codec = CMMFCodec::NewL(KMMFFourCCCodePCMU8, KMMFFourCCCodePCM16)); +TInt err = KErrNone; + if (err == KErrNoMemory) + return EPass; + else + { + ERR_PRINTF2(_L(">> CTest_MMF_ACOD_U_0178::DoTestStepL Leave occurred in NewL, error code %d"), err); + return EFail; + } + } +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0179::CTest_MMF_ACOD_U_0179() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0179-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * ALAW To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0179::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KAlawToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0180::CTest_MMF_ACOD_U_0180() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0180-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * ALAW To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0180::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAlawToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0181::CTest_MMF_ACOD_U_0181() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0181-HP"); + } + +/** @xxxx + * ALAW To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0181::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0182::CTest_MMF_ACOD_U_0182() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0182-HP"); + } + +/** @xxxx + * ALAW To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0182::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0183::CTest_MMF_ACOD_U_0183() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0183-HP"); + } + +/** @xxxx + * ALAW To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0183::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceAlawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0184::CTest_MMF_ACOD_U_0184() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0184-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to ALAW Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0184::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToAlawOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0185::CTest_MMF_ACOD_U_0185() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0185-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to ALAW Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0185::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAlawOptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0186::CTest_MMF_ACOD_U_0186() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0186-HP"); + } + +/** @xxxx + * PCM16 to ALAW Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0186::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0187::CTest_MMF_ACOD_U_0187() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0187-HP"); + } + +/** @xxxx + * PCM16 to ALAW Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0187::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0188::CTest_MMF_ACOD_U_0188() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0188-HP"); + } + +/** @xxxx + * PCM16 to ALAW Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0188::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToALaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0189::CTest_MMF_ACOD_U_0189() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0189-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM8 To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0189::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM8ToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0190::CTest_MMF_ACOD_U_0190() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0190-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM8 To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0190::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM8ToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0191::CTest_MMF_ACOD_U_0191() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0191-HP"); + } + +/** @xxxx + * PCM8 To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0191::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0192::CTest_MMF_ACOD_U_0192() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0192-HP"); + } + +/** @xxxx + * PCM8 To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0192::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0193::CTest_MMF_ACOD_U_0193() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0193-HP"); + } + +/** @xxxx + * PCM8 To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0193::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0194::CTest_MMF_ACOD_U_0194() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0194-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to PCM8 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0194::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopTInt err = KErrNone;FiveTimesL(codecUid, 0, KPCM16ToPCM8OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0195::CTest_MMF_ACOD_U_0195() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0195-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to PCM8 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0195::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM8OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0196::CTest_MMF_ACOD_U_0196() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0196-HP"); + } + +/** @xxxx + * PCM16 to PCM8 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0196::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0197::CTest_MMF_ACOD_U_0197() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0197-HP"); + } + +/** @xxxx + * PCM16 to PCM8 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0197::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0198::CTest_MMF_ACOD_U_0198() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0198-HP"); + } + +/** @xxxx + * PCM16 to PCM8 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0198::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMS8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err= KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0199::CTest_MMF_ACOD_U_0199() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0199-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * Swap Endian Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0199::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; + //const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToPCM16BOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0200::CTest_MMF_ACOD_U_0200() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0200-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * Swap Endian Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0200::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; + //const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCM16BOptimumSrc, 0)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0201::CTest_MMF_ACOD_U_0201() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0201-HP"); + } + +/** @xxxx + * Swap Endian Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0201::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; + const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0202::CTest_MMF_ACOD_U_0202() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0202-HP"); + } + +/** @xxxx + * Swap Endian Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0202::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; + //const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0203::CTest_MMF_ACOD_U_0203() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0203-HP"); + } + +/** @xxxx + * Swap Endian Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0203::DoTestStepL() + { + //const TUid codecUid = {KMMFUidCodecPCM16SwapEndian}; + //const TUid codecUid = {KMmfUidHwDevicePCM16toPCM16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0204::CTest_MMF_ACOD_U_0204() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0204-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to PCMU16BE Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0204::DoTestStepL() + { + //const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToPCMU16BOptimumDst)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0205::CTest_MMF_ACOD_U_0205() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0205-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to PCMU16BE Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0205::DoTestStepL() + { + //const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16BOptimumSrc, 0)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0206::CTest_MMF_ACOD_U_0206() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0206-HP"); + } + +/** @xxxx + * PCM16 to PCMU16BE Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0206::DoTestStepL() + { + const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0207::CTest_MMF_ACOD_U_0207() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0207-HP"); + } + +/** @xxxx + * PCM16 to PCMU16BE Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0207::DoTestStepL() + { + const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0208::CTest_MMF_ACOD_U_0208() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0208-HP"); + } + +/** @xxxx + * PCM16 to PCMU16BE Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0208::DoTestStepL() + { +// const TUid codecUid = {KMMFUidHwDevicePCM16toPCMU16B}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0209::CTest_MMF_ACOD_U_0209() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0209-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to PCMU16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0209::DoTestStepL() + { + //const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToPCMU16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0210::CTest_MMF_ACOD_U_0210() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0210-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to PCMU16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0210::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0211::CTest_MMF_ACOD_U_0211() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0211-HP"); + } + +/** @xxxx + * PCM16 to PCMU16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0211::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0212::CTest_MMF_ACOD_U_0212() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0212-HP"); + } + +/** @xxxx + * PCM16 to PCMU16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0212::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0213::CTest_MMF_ACOD_U_0213() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0213-HP"); + } + +/** @xxxx + * PCM16 to PCMU16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0213::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0214::CTest_MMF_ACOD_U_0214() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0214-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to PCMU8 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0214::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToPCMU8OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0215::CTest_MMF_ACOD_U_0215() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0215-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to PCMU8 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0215::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToPCMU8OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0216::CTest_MMF_ACOD_U_0216() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0216-HP"); + } + +/** @xxxx + * PCM16 to PCMU8 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0216::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0217::CTest_MMF_ACOD_U_0217() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0217-HP"); + } + +/** @xxxx + * PCM16 to PCMU8 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0217::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0218::CTest_MMF_ACOD_U_0218() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0218-HP"); + } + +/** @xxxx + * PCM16 to PCMU8 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0218::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceS16ToPCMU8}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0219::CTest_MMF_ACOD_U_0219() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0219-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU16BE to PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0219::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCMU16BToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0220::CTest_MMF_ACOD_U_0220() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0220-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCMU16BE to PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0220::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16BToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0221::CTest_MMF_ACOD_U_0221() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0221-HP"); + } + +/** @xxxx + * PCMU16BE to PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0221::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone; + +// if (err==KErrNone && testOK) +// TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0222::CTest_MMF_ACOD_U_0222() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0222-HP"); + } + +/** @xxxx + * PCMU16BE to PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0222::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0223::CTest_MMF_ACOD_U_0223() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0223-HP"); + } + +/** @xxxx + * PCMU16BE to PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0223::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16BEToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0224::CTest_MMF_ACOD_U_0224() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0224-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU16 to PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0224::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCMU16ToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0225::CTest_MMF_ACOD_U_0225() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0225-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCMU16 to PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0225::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU16ToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0226::CTest_MMF_ACOD_U_0226() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0226-HP"); + } + +/** @xxxx + * PCMU16 to PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0226::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +// if (err==KErrNone && testOK) +TInt err = KErrNone ; + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0227::CTest_MMF_ACOD_U_0227() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0227-HP"); + } + +/** @xxxx + * PCMU16 to PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0227::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0228::CTest_MMF_ACOD_U_0228() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0228-HP"); + } + +/** @xxxx + * PCMU16 to PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0228::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceU16ToPCMS16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0229::CTest_MMF_ACOD_U_0229() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0229-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCMU8 To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0229::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCMU8ToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0230::CTest_MMF_ACOD_U_0230() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0230-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCMU8 To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0230::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCMU8ToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0231::CTest_MMF_ACOD_U_0231() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0231-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0231::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0232::CTest_MMF_ACOD_U_0232() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0232-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0232::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0233::CTest_MMF_ACOD_U_0233() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0233-HP"); + } + +/** @xxxx + * PCMU8 To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0233::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCMU8ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone ; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0234::CTest_MMF_ACOD_U_0234() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0234-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * MULAW To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0234::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KMulawToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0235::CTest_MMF_ACOD_U_0235() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0235-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * MULAW To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0235::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KMulawToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0236::CTest_MMF_ACOD_U_0236() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0236-HP"); + } + +/** @xxxx + * MULAW To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0236::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone ; + //if (err==KErrNone && testOK) + // TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0237::CTest_MMF_ACOD_U_0237() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0237-HP"); + } + +/** @xxxx + * MULAW To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0237::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0238::CTest_MMF_ACOD_U_0238() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0238-HP"); + } + +/** @xxxx + * MULAW To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0238::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceMulawToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0239::CTest_MMF_ACOD_U_0239() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0239-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to MULAW Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0239::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToMulawOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0240::CTest_MMF_ACOD_U_0240() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0240-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to MULAW Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0240::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToMulawOptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0241::CTest_MMF_ACOD_U_0241() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0241-HP"); + } + +/** @xxxx + * PCM16 to MULAW Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0241::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0242::CTest_MMF_ACOD_U_0242() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0242-HP"); + } + +/** @xxxx + * PCM16 to MULAW Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0242::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0243::CTest_MMF_ACOD_U_0243() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0243-HP"); + } + +/** @xxxx + * PCM16 to MULAW Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0243::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToMuLaw}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0244::CTest_MMF_ACOD_U_0244() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0244-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAD To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0244::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KAdpcmToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0245::CTest_MMF_ACOD_U_0245() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0245-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * IMAD To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0245::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KAdpcmToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0246::CTest_MMF_ACOD_U_0246() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0246-HP"); + } + +/** @xxxx + * IMAD To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0246::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone ; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0247::CTest_MMF_ACOD_U_0247() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0247-HP"); + } + +/** @xxxx + * IMAD To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0247::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0248::CTest_MMF_ACOD_U_0248() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0248-HP"); + } + +/** @xxxx + * IMAD To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0248::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceIMAADPCMToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0249::CTest_MMF_ACOD_U_0249() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0249-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to IMAD Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0249::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToAdpcmOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0250::CTest_MMF_ACOD_U_0250() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0250-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to IMAD Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0250::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToAdpcmOptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0251::CTest_MMF_ACOD_U_0251() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0251-HP"); + } + +/** @xxxx + * PCM16 to IMAD Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0251::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0252::CTest_MMF_ACOD_U_0252() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0252-HP"); + } + +/** @xxxx + * PCM16 to IMAD Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0252::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0253::CTest_MMF_ACOD_U_0253() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0253-HP"); + } + +/** @xxxx + * PCM16 to IMAD Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0253::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToIMAADPCM}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); +TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0254::CTest_MMF_ACOD_U_0254() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0254-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * IMAS To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0254::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KStereoAdpcmToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0255::CTest_MMF_ACOD_U_0255() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0255-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * IMAS To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0255::DoTestStepL() + { + //const TUid codecUid = {0}; + TBool testOK = EFalse; + //TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KStereoAdpcmToPCM16OptimumSrc, 0)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0256::CTest_MMF_ACOD_U_0256() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0256-HP"); + } + +/** @xxxx + * IMAS To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0256::DoTestStepL() + { + const TUid codecUid = {0}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0257::CTest_MMF_ACOD_U_0257() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0257-HP"); + } + +/** @xxxx + * IMAS To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0257::DoTestStepL() + { + const TUid codecUid = {0}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0258::CTest_MMF_ACOD_U_0258() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0258-HP"); + } + +/** @xxxx + * IMAS To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0258::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0259::CTest_MMF_ACOD_U_0259() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0259-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to IMAS Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0259::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToStereoAdpcmOptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0260::CTest_MMF_ACOD_U_0260() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0260-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to IMAS Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0260::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToStereoAdpcmOptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0261::CTest_MMF_ACOD_U_0261() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0261-HP"); + } + +/** @xxxx + * PCM16 to IMAS Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0261::DoTestStepL() + { + const TUid codecUid = {0}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); +TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0262::CTest_MMF_ACOD_U_0262() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0262-HP"); + } + +/** @xxxx + * PCM16 to IMAS Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0262::DoTestStepL() + { + const TUid codecUid = {0}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0263::CTest_MMF_ACOD_U_0263() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0263-HP"); + } + +/** @xxxx + * PCM16 to IMAS Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0263::DoTestStepL() + { +// const TUid codecUid = {0}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0264::CTest_MMF_ACOD_U_0264() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0264-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * GSM610 To PCM16 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0264::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KGSM610ToPCM16OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0265::CTest_MMF_ACOD_U_0265() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0265-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * GSM610 To PCM16 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0265::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KGSM610ToPCM16OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0266::CTest_MMF_ACOD_U_0266() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0266-HP"); + } + +/** @xxxx + * GSM610 To PCM16 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0266::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0267::CTest_MMF_ACOD_U_0267() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0267-HP"); + } + +/** @xxxx + * GSM610 To PCM16 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0267::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0268::CTest_MMF_ACOD_U_0268() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0268-HP"); + } + +/** @xxxx + * GSM610 To PCM16 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0268::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDeviceGSM610ToPCM16}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0269::CTest_MMF_ACOD_U_0269() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0269-HP"); + + for (TUint i=0; i<5; i++) + { + iExpectedSrcBytesProcessed[i] = 0; + iExpectedDstBytesAdded[i] = 0; + iExpectedReturnValue[i].iStatus = TCodecProcessResult::EDstNotFilled; + } + } + +/** @xxxx + * PCM16 to GSM610 Pass in zero sized source buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0269::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, 0, KPCM16ToGSM610OptimumDst)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0270::CTest_MMF_ACOD_U_0270() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0270-HP"); + + iExpectedLeaveErrorCode = KErrArgument; + } + +/** @xxxx + * PCM16 to GSM610 Pass in zero sized destination buffer + * @test Req. under test REQ172.6.4, REQ172.6.5 + */ +TVerdict CTest_MMF_ACOD_U_0270::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestProcessLLoopFiveTimesL(codecUid, KPCM16ToGSM610OptimumSrc, 0)); +TInt err = KErrNone; + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0271::CTest_MMF_ACOD_U_0271() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0271-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Test out of memory + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0271::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + +// TRAPD(err, testOK = TestNewLOutOfMemoryL(codecUid)); + TInt err = KErrNone; + if (err==KErrNone && testOK) + TRAP(err, testOK = TestProcessLOutOfMemoryL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0272::CTest_MMF_ACOD_U_0272() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0272-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Test for memory leaks + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0272::DoTestStepL() + { + const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; + TRAPD(err, testOK = TestMemoryLeakL(codecUid)); + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + +/** @xxxx + * Constructor + */ +CTest_MMF_ACOD_U_0273::CTest_MMF_ACOD_U_0273() + { + // store the name of this test case + // this is the name that is used by the script file + // Each test step initialises it's own name + iTestStepName = _L("MM-MMF-ACOD-U-0273-HP"); + } + +/** @xxxx + * PCM16 to GSM610 Test for memory scribbles + * @test Req. under test REQ172.11 + */ +TVerdict CTest_MMF_ACOD_U_0273::DoTestStepL() + { +// const TUid codecUid = {KMmfUidHwDevicePCM16ToGSM610}; + TBool testOK = EFalse; +// TRAPD(err, testOK = TestMemoryScribbleL(codecUid)); + TInt err = KErrNone; + + if (err) + { + INFO_PRINTF2(_L("Test left with status %d"), err); + return EFail; + } + else if (!testOK) + { + INFO_PRINTF1(_L("Test failed")); + return EFail; + } + else + return EPass; + } + +//------------------------------------------------------------------ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_ACOD_H__ +#define __TSU_MMF_ACOD_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "TSU_MMF_ACOD_BufferSizes.h" + +/** @xxxx + * @class CTestStep_MMF_SwCodecDevices + * @brief Test class that enables MMF Audio Codec tests. + * It's a base class for all test steps. + */ +class CTestSuite_MMF_SwCodecDevices; +class CTestStep_MMF_SwCodecDevices : public CTestStep + { +public: + CTestStep_MMF_SwCodecDevices(); + virtual ~CTestStep_MMF_SwCodecDevices(); + void SetSuite( CTestSuite_MMF_SwCodecDevices* aPtr ); + CTestSuite_MMF_SwCodecDevices* GetSuite(); +private: + CTestSuite_MMF_SwCodecDevices* iRefSuite; + }; + +#endif// TSU_MMF_ACOD_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD_BASE.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD_BASE.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1556 @@ +// Copyright (c) 2003-2009 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: +// [ separated to separate module for understandability +// 12k loc not a good idea for maintenance ] +// +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_ACOD.h" +#include "TSU_MMF_devicesuite.h" + +#include +#include +#include + +#ifdef __WINS__ +//wins directories +_LIT(KSourceFilesDir, "c:\\mm\\mmf\\testfiles\\acod\\"); +_LIT(KComparisonFilesDir, "c:\\mm\\mmf\\ref\\acod\\"); +#else +/* +arm4 directories +All source and comparison files need to be copied manually onto the flash card. +This code assumes the flash card is represented by drive E: on the target board. +If this is not the case, the KSourceFilesDir and KComparisonFilesDir strings +need to be changed accordingly. +*/ +_LIT(KSourceFilesDir, "e:\\"); +_LIT(KComparisonFilesDir, "e:\\"); +#endif + +//8KHz source files +_LIT(KPCM16SourceFile,"PCM16Source.raw"); +_LIT(KPCM16BSourceFile,"PCM16BSource.raw"); +_LIT(KPCMU16SourceFile,"PCMU16Source.raw"); +_LIT(KPCMU16BSourceFile,"PCMU16BSource.raw"); +_LIT(KStereoPCM16SourceFile,"StereoPCM16Source.raw"); +_LIT(KPCM8SourceFile,"PCM8Source.raw"); +_LIT(KPCMU8SourceFile,"PCMU8Source.raw"); +_LIT(KAlawSourceFile,"AlawSource.raw"); +_LIT(KMulawSourceFile,"MulawSource.raw"); +_LIT(KAdpcmSourceFile,"AdpcmSource.raw"); +_LIT(KStereoAdpcmSourceFile,"StereoAdpcmSource.raw"); +_LIT(KGSM610SourceFile,"GSM610Source.raw"); + +//comparison files +_LIT(KAlawToPCM16ComparisonFile,"AlawToPCM16Comparison.raw"); +_LIT(KPCM16ToAlawComparisonFile,"PCM16ToAlawComparison.raw"); +_LIT(KPCM8ToPCM16ComparisonFile,"PCM8ToPCM16Comparison.raw"); +_LIT(KPCM16ToPCM8ComparisonFile,"PCM16ToPCM8Comparison.raw"); +_LIT(KPCM16ToPCM16BComparisonFile,"PCM16ToPCM16BComparison.raw"); +_LIT(KPCM16BToPCM16ComparisonFile,"PCM16BToPCM16Comparison.raw"); +_LIT(KPCMU16ToPCMU16BComparisonFile,"PCMU16ToPCMU16BComparison.raw"); +_LIT(KPCMU16BToPCMU16ComparisonFile,"PCMU16BToPCMU16Comparison.raw"); +_LIT(KPCM16ToPCMU16BComparisonFile,"PCM16ToPCMU16BComparison.raw"); +_LIT(KPCMU16BToPCM16ComparisonFile,"PCMU16BToPCM16Comparison.raw"); +_LIT(KPCM16ToPCMU16ComparisonFile,"PCM16ToPCMU16Comparison.raw"); +_LIT(KPCMU16ToPCM16ComparisonFile,"PCMU16ToPCM16Comparison.raw"); +_LIT(KPCM16ToPCMU8ComparisonFile,"PCM16ToPCMU8Comparison.raw"); +_LIT(KPCMU8ToPCM16ComparisonFile,"PCMU8ToPCM16Comparison.raw"); +_LIT(KAdpcmToPCM16ComparisonFile,"AdpcmToPCM16Comparison.raw"); +_LIT(KPCM16ToAdpcmComparisonFile,"PCM16ToAdpcmComparison.raw"); +_LIT(KMulawToPCM16ComparisonFile,"MulawToPCM16Comparison.raw"); +_LIT(KPCM16ToMulawComparisonFile,"PCM16ToMulawComparison.raw"); +_LIT(KStereoAdpcmToPCM16ComparisonFile,"StereoAdpcmToPCM16Comparison.raw"); +_LIT(KPCM16ToStereoAdpcmComparisonFile,"PCM16ToStereoAdpcmComparison.raw"); +_LIT(KGSM610ToPCM16ComparisonFile,"GSM610ToPCM16Comparison.raw"); +_LIT(KPCM16ToGSM610ComparisonFile,"PCM16ToGSM610Comparison.raw"); + +_LIT(KPreferredSupplierSourceFile,"AAAASource.raw"); +_LIT(KPreferredSupplierComparisonFile,"AAAABBBBPrefSuppComparison.raw"); +_LIT(KPreferredSupplier,"Preferred Supplier Test Codec 1"); + + +const TUint32 KMMFFourCCCodeAAAA = 0x41414141; //"AAAA" +const TUint32 KMMFFourCCCodeBBBB = 0x42424242; //"BBBB" + +CTestStep_MMF_ACOD::CTestStep_MMF_ACOD() + { + iExpectedLeaveErrorCode = KErrNone; + iSingleIteration = EFalse; + } + +CTestStep_MMF_ACOD::~CTestStep_MMF_ACOD() + { + } + +/** @xxxx + * This function gets the correct comparison filename for the codec specified. + * + * @param "TInt aCodecUID" + * Uid of codec. + * "TDes& aFilename" + * Descriptor to contain the comparison filename string. + */ +void CTestStep_MMF_ACOD::GetComparisonFilenameFromCodecUidL(TInt aCodecUID, TDes& aFilename) + { + + switch(aCodecUID) + { + case KMmfUidHwDeviceAlawToPCM16: //KMmfUidHwDeviceAlawToPCM16 + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KAlawToPCM16ComparisonFile); + break; + case KMmfUidHwDevicePCM16ToALaw: //KMmfUidHwDevicePCM16ToALaw + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToAlawComparisonFile); + break; + case KMmfUidHwDevicePCM8ToPCM16: //KMmfUidHwDevicePCM8ToPCM16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM8ToPCM16ComparisonFile); + break; + case KMmfUidHwDeviceS16ToPCMS8: //KMmfUidHwDeviceS16ToPCMS8: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCM8ComparisonFile); + break; + //case KMMFUidCodecPCM16SwapEndian: + case KMMFUidHwDevicePCM16toPCMU16B: //KMmfUidHwDevicePCM16toPCM16B + case KMMFUidHwDevicePCM16BtoPCM16: //KMMFUidCodecPCM16BtoPCM16 + case KMMFUidHwDevicePCMU16toPCMU16B: //KMMFUidCodecPCMU16toPCMU16B + case KMMFUidHwDevicePCMU16BtoPCMU16: //KMMFUidCodecPCMU16BtoPCMU16 + //This file is used for all swap endian tests other than instantiation. + //There is no need to test ProcessL for every swap endian combination. + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCM16BComparisonFile); + break; + + //xxx GK + //case KMMFUidHwDevicePCM16toPCMU16B ://KMMFUidHwDevicePCM16toPCMU16B: + // aFilename.Copy(KComparisonFilesDir); + // aFilename.Append(KPCM16ToPCMU16BComparisonFile); + // break; + + case KMmfUidHwDeviceU16BEToPCMS16://KMmfUidHwDeviceU16BEToPCMS16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16BToPCM16ComparisonFile); + break; + + case KMmfUidHwDeviceS16ToPCMU16://KMmfUidHwDeviceS16ToPCMU16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCMU16ComparisonFile); + break; + + case KMmfUidHwDeviceU16ToPCMS16://KMmfUidHwDeviceU16ToPCMS16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16ToPCM16ComparisonFile); + break; + + case KMmfUidHwDeviceS16ToPCMU8://KMmfUidHwDeviceS16ToPCMU8: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCMU8ComparisonFile); + break; + + case KMmfUidHwDevicePCMU8ToPCM16: //KMmfUidHwDevicePCMU8ToPCM16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU8ToPCM16ComparisonFile); + break; + + case KMmfUidHwDeviceIMAADPCMToPCM16: //KMmfUidHwDeviceIMAADPCMToPCM16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KAdpcmToPCM16ComparisonFile); + break; + + case KMmfUidHwDevicePCM16ToIMAADPCM: //KMmfUidHwDevicePCM16ToIMAADPCM: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToAdpcmComparisonFile); + break; + + case KMmfUidHwDeviceMulawToPCM16: //KMmfUidHwDeviceMulawToPCM16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KMulawToPCM16ComparisonFile); + break; + + case KMmfUidHwDevicePCM16ToMuLaw: //KMmfUidHwDevicePCM16ToMuLaw: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToMulawComparisonFile); + break; + + case KMmfUidHwDeviceGSM610ToPCM16: //KMmfUidHwDeviceGSM610ToPCM16: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KGSM610ToPCM16ComparisonFile); + break; + + case KMmfUidHwDevicePCM16ToGSM610://KMmfUidHwDevicePCM16ToGSM610: + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToGSM610ComparisonFile); + break; + default: + User::Leave(KErrNotSupported); + break; + } + } + +/** @xxxx + * This function gets the correct comparison filename for the fourCC codes specified. + * + * @param "const TFourCC& aSrcFourCC" + * Source fourCC code. + * "const TFourCC& aDstFourCC" + * Destination fourCC code. + * "TDes& aFilename" + * Descriptor to contain the comparison filename string. + */ +void CTestStep_MMF_ACOD::GetComparisonFilenameFromFourCCL(const TFourCC& aSrcFourCC, const TFourCC& aDstFourCC, TDes& aFilename) + { + if (aSrcFourCC == KMMFFourCCCodePCM16) + { + if (aDstFourCC == KMMFFourCCCodeALAW) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToAlawComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodePCM16B) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCM16BComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodePCM8) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCM8ComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodePCMU16B) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCMU16BComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodePCMU16) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCMU16ComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodePCMU8) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToPCMU8ComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodeIMAD) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToAdpcmComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodeMuLAW) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToMulawComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodeIMAS) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToStereoAdpcmComparisonFile); + } + else if (aDstFourCC == KMMFFourCCCodeGSM610) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16ToGSM610ComparisonFile); + } + } + else if (aDstFourCC == KMMFFourCCCodePCM16) + { + if (aSrcFourCC == KMMFFourCCCodeALAW) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KAlawToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodePCM8) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM8ToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodePCM16B) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCM16BToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodePCMU16B) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16BToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodePCMU16) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16ToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodePCMU8) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU8ToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodeIMAD) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KAdpcmToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodeMuLAW) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KMulawToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodeIMAS) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KStereoAdpcmToPCM16ComparisonFile); + } + if (aSrcFourCC == KMMFFourCCCodeGSM610) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KGSM610ToPCM16ComparisonFile); + } + } + else if ((aSrcFourCC == KMMFFourCCCodePCMU16) && + (aDstFourCC == KMMFFourCCCodePCMU16B)) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16ToPCMU16BComparisonFile); + } + else if ((aSrcFourCC == KMMFFourCCCodePCMU16B) && + (aDstFourCC == KMMFFourCCCodePCMU16)) + { + aFilename.Copy(KComparisonFilesDir); + aFilename.Append(KPCMU16BToPCMU16ComparisonFile); + } + else + User::Leave(KErrNotSupported); + } + +/** @xxxx + * This function gets the correct source filename for the codec specified. + * + * @param "TInt aCodecUID" + * Uid of codec. + * "TDes& aFilename" + * Descriptor to contain the source filename string. + */ +void CTestStep_MMF_ACOD::GetSourceFilenameFromCodecUidL(TInt aCodecUID, TDes& aFilename) + { + switch(aCodecUID) + { + case KMmfUidHwDeviceAlawToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KAlawSourceFile); + break; + case KMmfUidHwDevicePCM16ToALaw: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDevicePCM8ToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM8SourceFile); + break; + case KMmfUidHwDeviceS16ToPCMS8: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + //case KMMFUidCodecPCM16SwapEndian: + case KMmfUidHwDevicePCM16toPCM16B: + case KMMFUidHwDevicePCM16BtoPCM16: + case KMMFUidHwDevicePCMU16toPCMU16B: + case KMMFUidHwDevicePCMU16BtoPCMU16: + //this file is used for all swap endian tests other than instantiation. + //there is no need to test ProcessL for every swap endian combination. + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMMFUidHwDevicePCM16toPCMU16B: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDeviceU16BEToPCMS16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCMU16BSourceFile); + break; + case KMmfUidHwDeviceS16ToPCMU16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDeviceU16ToPCMS16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCMU16SourceFile); + break; + case KMmfUidHwDeviceS16ToPCMU8: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDevicePCMU8ToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCMU8SourceFile); + break; + case KMmfUidHwDeviceIMAADPCMToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KAdpcmSourceFile); + break; + case KMmfUidHwDevicePCM16ToIMAADPCM: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDeviceMulawToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KMulawSourceFile); + break; + case KMmfUidHwDevicePCM16ToMuLaw: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + case KMmfUidHwDeviceGSM610ToPCM16: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KGSM610SourceFile); + break; + case KMmfUidHwDevicePCM16ToGSM610: + aFilename.Copy(KSourceFilesDir); + aFilename.Append(KPCM16SourceFile); + break; + + default: + User::Leave(KErrNotSupported); + break; + } + } + +/** @xxxx + * This function gets the correct source filename for the fourCC codes specified. + * + * @param "const TFourCC& aSrcFourCC" + * Source fourCC code. + * "const TFourCC& aDstFourCC" + * Destination fourCC code. + * "TDes& aFilename" + * Descriptor to contain the source filename string. + */ +void CTestStep_MMF_ACOD::GetSourceFilenameFromFourCCL(const TFourCC& aSrcFourCC, const TFourCC& aDstFourCC, TDes& aFilename) + { + aFilename.Copy(KSourceFilesDir); + if (aSrcFourCC == KMMFFourCCCodePCM16) + { + if (aDstFourCC == KMMFFourCCCodeIMAS) + aFilename.Append(KStereoPCM16SourceFile); + else + aFilename.Append(KPCM16SourceFile); + } + else if (aSrcFourCC == KMMFFourCCCodeALAW) + aFilename.Append(KAlawSourceFile); + else if (aSrcFourCC == KMMFFourCCCodePCM8) + aFilename.Append(KPCM8SourceFile); + else if (aSrcFourCC == KMMFFourCCCodePCM16B) + aFilename.Append(KPCM16BSourceFile); + else if (aSrcFourCC == KMMFFourCCCodePCMU16B) + aFilename.Append(KPCMU16BSourceFile); + else if (aSrcFourCC == KMMFFourCCCodePCMU16) + aFilename.Append(KPCMU16SourceFile); + else if (aSrcFourCC == KMMFFourCCCodePCMU8) + aFilename.Append(KPCMU8SourceFile); + else if (aSrcFourCC == KMMFFourCCCodeIMAD) + aFilename.Append(KAdpcmSourceFile); + else if (aSrcFourCC == KMMFFourCCCodeMuLAW) + aFilename.Append(KMulawSourceFile); + else if (aSrcFourCC == KMMFFourCCCodeIMAS) + aFilename.Append(KStereoAdpcmSourceFile); + else if (aSrcFourCC == KMMFFourCCCodeGSM610) + aFilename.Append(KGSM610SourceFile); + else + User::Leave(KErrNotSupported); + } + +/** @xxxx + * This function checks the data in iOutputDataBuffer against data in a comparison + * file. + * + * @param "const TDesC& aFilename" + * Full path of the comparison file to compare against. + * "TUint aPosition" + * File position from which to read the comparison data. + * @return "TBool" + * ETrue if the output is the same as the comparison data + * EFalse if the output is different to the comparison data +*/ +TBool CTestStep_MMF_ACOD::CheckOutputAgainstComparisonFileL(const TDesC& aFilename, TUint aPosition) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile file; + User::LeaveIfError(file.Open(fs, aFilename, EFileRead|EFileShareAny)); + CleanupClosePushL(file); + + RFileReadStream fileReadStream(file, aPosition); + CleanupClosePushL(fileReadStream); + + //read data from comparison file into descriptor + HBufC8* compBuffer = HBufC8::NewL(iOutputDataBuffer->Length()); + CleanupStack::PushL(compBuffer); + TPtr8 compBufferPtr = compBuffer->Des(); + TRAPD(err, fileReadStream.ReadL(compBufferPtr, iOutputDataBuffer->Length())); + if ((err != KErrNone) && (err != KErrEof)) User::LeaveIfError(err); //EOF not an error ? + + //compare destination buffer with comparison descriptor + TInt result = iOutputDataBuffer->Compare(*compBuffer); + + if (result != 0) + INFO_PRINTF3(_L(">> iOutputDataBuffer size is %d, Comparison buffer size is %d"), iOutputDataBuffer->Length(), compBuffer->Length()); + + CleanupStack::PopAndDestroy(4); //compBuffer, fileReadStream, file, fs + + if (result == 0) + return ETrue; + else + return EFalse; + } + +/** @xxxx + * This function checks the number of source bytes processed against + * iExpectedSrcBytesProcessed. + * + * @param "TUint aCount" + * Index in the iExpectedSrcBytesProcessed array to check the value against. + * @return "TBool" + * ETrue if the source bytes processed is as expected. + * EFalse if the source bytes processed is not as expected. + */ +TBool CTestStep_MMF_ACOD::CheckSrcBytesProcessedL(TUint aCount) + { + if (iCodecProcessResult.iSrcBytesProcessed == iExpectedSrcBytesProcessed[aCount]) + return ETrue; + else if (STATIC_CAST(TUint, iFileDataLeft) < iExpectedSrcBytesProcessed[aCount]) + { + INFO_PRINTF4(_L(">> TCodecProcessResult::iSrcBytesProcessed is %d, Not enough source data available in file. iFileDataLeft for LOOP %d is %d"), iCodecProcessResult.iSrcBytesProcessed, aCount, iFileDataLeft); + if (iCodecProcessResult.iSrcBytesProcessed == STATIC_CAST(TUint, iFileDataLeft)) + return ETrue; + else + return EFalse; + } + else + { + INFO_PRINTF4(_L(">> TCodecProcessResult::iSrcBytesProcessed is %d, iExpectedSrcBytesProcessed for LOOP %d is %d"), iCodecProcessResult.iSrcBytesProcessed, aCount, iExpectedSrcBytesProcessed[aCount]); + return EFalse; + } + } + +/** @xxxx + * This function checks the number of destination bytes added against + * iExpectedDstBytesAdded. + * + * @param "TUint aCount" + * Index of the iExpectedDstBytesAdded array to check the value against. + * @return "TBool" + * ETrue if the dest bytes added is as expected. + * EFalse if the dest bytes added is not as expected. + */ +TBool CTestStep_MMF_ACOD::CheckDstBytesAddedL(TUint aCount) + { + if (iCodecProcessResult.iDstBytesAdded == iExpectedDstBytesAdded[aCount]) + return ETrue; + else if (STATIC_CAST(TUint, iFileDataLeft) < iExpectedSrcBytesProcessed[aCount]) + { + INFO_PRINTF4(_L(">> TCodecProcessResult::iDstBytesAdded is %d, Not enough source data available in file. iFileDataLeft for LOOP %d is %d"), iCodecProcessResult.iDstBytesAdded, aCount, iFileDataLeft); + return ETrue; + } + else + { + INFO_PRINTF4(_L(">> TCodecProcessResult::iDstBytesAdded is %d, iExpectedDstBytesAdded for LOOP %d is %d"), iCodecProcessResult.iDstBytesAdded, aCount, iExpectedDstBytesAdded[aCount]); + return EFalse; + } + } + +/** @xxxx + * This function checks the length of iOutputDataBuffer against iTotalDstBytesAdded. + * + * @return "TBool" + * ETrue if the values are the same. + * EFalse if the values are different. + */ +TBool CTestStep_MMF_ACOD::CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL() + { + if (iOutputDataBuffer->Length() == STATIC_CAST(TInt, iTotalDstBytesAdded)) + return ETrue; + else + { + INFO_PRINTF3(_L(">> Output Data Buffer Length is %d, iTotalDstBytesAdded is %d"), iOutputDataBuffer->Length(), iTotalDstBytesAdded); + return EFalse; + } + } + +/** @xxxx + * Checks the current return value against iExpectedReturnValue. + * + * @param "TUint aCount" + * Index of the iExpectedReturnValue array to check the value against. + * @return "TBool" + * ETrue if the return value is as expected. + * EFalse if the return value is not as expected. + */ +TBool CTestStep_MMF_ACOD::CheckReturnValueL(TUint aCount) + { + if (aCount >= 5) + User::Leave(KErrArgument); + + if (iCodecProcessResult.iStatus == iExpectedReturnValue[aCount].iStatus) + { + return ETrue; + } + else + { + INFO_PRINTF4(_L(">> TCodecProcessResult::iStatus is %d, iExpectedReturnValue for LOOP %d is %d"), iCodecProcessResult.iStatus, aCount, iExpectedReturnValue[aCount].iStatus); + return EFalse; + } + } + +/** @xxxx + * This function fills the source buffer with data from the file specified. + * + * @param "CMMFBuffer* aSrcBuffer" + * Buffer to contain the data read from the source file. + * "const TDesC& aFileName" + * Name of source file to use. + * "TUint aPosition" + * Position in the file from which to read the data. + */ +void CTestStep_MMF_ACOD::FillSourceBufferFromSourceFileL(CMMFBuffer* aSrcBuffer, const TDesC& aFilename, TUint aPosition) + { + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + RFile file; + User::LeaveIfError(file.Open(fs, aFilename, EFileRead|EFileShareAny)); + CleanupClosePushL(file); + + iFileDataLeft = 0; + file.Size(iFileDataLeft); + if (STATIC_CAST(TInt, aPosition) < iFileDataLeft) + iFileDataLeft -= aPosition; + else User::Leave(KErrEof); + + RFileReadStream fileReadStream(file, aPosition); + CleanupClosePushL(fileReadStream); + + TInt srcBufferLength = STATIC_CAST(CMMFDataBuffer*, aSrcBuffer)->Data().MaxLength(); + + //read data from source file into source buffer + if(iFileDataLeft < srcBufferLength) + fileReadStream.ReadL(STATIC_CAST(CMMFDataBuffer*, aSrcBuffer)->Data(), iFileDataLeft); + else + fileReadStream.ReadL(STATIC_CAST(CMMFDataBuffer*, aSrcBuffer)->Data()); + + CleanupStack::PopAndDestroy(3); //filereadstream, file, fs + } + +/** @xxxx + * This function tests the functionality of ProcessL for the codec specified. + * + * @param "TUid aCodecUID" + * Uid of the codec under test. + * "TUint aSrcBufferSize" + * Size of source buffer to test the codec with. + * "TUint aDstBufferSize" + * Size of destination buffer to test the codec with. + * "TUint aSrcBufferLength" + * Length of source buffer to test the codec with if less than the maxLength. + * aSrcBufferLength defaults to zero. It is not used unless a value is + * specified. A value should only be specified in cases where the buffer + * length is less than the maxlength. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +TBool CTestStep_MMF_ACOD::TestProcessL(TUid aCodecUID, TUint aSrcBufferSize, TUint aDstBufferSize, TUint aSrcBufferLength) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(aSrcBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(aDstBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + //if source buffer has different length to max length, crop data + if (aSrcBufferLength > 0) + { + srcBuffer->Data().SetLength(aSrcBufferLength); + } + + //instantiate codec + CMMFCodec* codec = CMMFCodec::NewL(aCodecUID); + CleanupStack::PushL(codec); + + TBool testOK = ETrue; + TRAPD(err, iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer)); + if (err) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessL Leave occurred in ProcessL, error code %d"), err); + testOK = EFalse; + } + else + { + //copy data to iOutputDataBuffer + iOutputDataBuffer = HBufC8::NewL(dstBuffer->Data().Length()); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + outputDataBufferPtr.Append(dstBuffer->Data()); + + iTotalDstBytesAdded = iCodecProcessResult.iDstBytesAdded; + iTotalSrcBytesProcessed = iCodecProcessResult.iSrcBytesProcessed; + + //investigate results + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + GetComparisonFilenameFromCodecUidL(aCodecUID.iUid, ptrFilename); + + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessL CheckOutputAgainstComparisonFileL returned EFalse")); + testOK = EFalse; + } + if (!CheckDstBytesAddedL(0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessL CheckDstBytesAddedL returned EFalse")); + testOK = EFalse; + } + if (!CheckSrcBytesProcessedL(0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessL CheckSrcBytesProcessedL returned EFalse")); + testOK = EFalse; + } + if (!CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL()) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessL CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL returned EFalse")); + testOK = EFalse; + } + if (!CheckReturnValueL(0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessL CheckReturnValue returned EFalse")); + testOK = EFalse; + } + + //clean up memory + CleanupStack::PopAndDestroy(); //filename + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + } + + CleanupStack::PopAndDestroy(4); //codec, srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } + + +/** @xxxx + * This function tests the functionality of ProcessL for the codec specified. + * It mimics the datapath by calling ProcessL five times in a loop, checking the + * return value each time and passing in new buffers accordlingly. + * + * @param "TUid aCodecUID" + * Uid of the codec under test. + * "TUint aSrcBufferSize" + * Size of source buffers to test the codec with. + * "TUint aDstBufferSize" + * Size of destination buffers to test the codec with. + * "TUint aSrcBufferLength" + * Length of source buffer to test the codec with if less than the maxLength. + * aSrcBufferLength defaults to zero and is not used unless a value is + * specified.A value should only be specified if the buffer length is less + * than the maxlength. + * "TBool aCheckExpectedBytesProcessed" + * Boolean value to determine whether to check the srcBytesProcessed and + * dstBytesAdded against their expected values. This defaults to true, + * but allows for the tests to be bypassed for non-linear codecs where the + * expected values are difficult to determine. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +#ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL(TUid aCodecUID, TUint aSrcBufferSize, TUint aDstBufferSize, TUint aSrcBufferLength, TBool aCheckExpectedBytesProcessed) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(aSrcBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(aDstBufferSize); + CleanupStack::PushL(dstBuffer); + + //read first buffer of data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + TRAPD(srcFileError, FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0)); + TBool endOfFile = EFalse; + if (srcFileError == KErrEof) + endOfFile = ETrue; + else if (srcFileError) + User::Leave(srcFileError); + + + //if source buffer has different length to max length, crop data + if (aSrcBufferLength > 0) + { + srcBuffer->Data().SetLength(aSrcBufferLength); + } + + //instantiate codec + CMMFCodec* codec = CMMFCodec::NewL(aCodecUID); + CleanupStack::PushL(codec); + + TBool testOK = ETrue; + TRAPD(err, iOutputDataBuffer = HBufC8::NewL(aDstBufferSize*5)); + User::LeaveIfError(err); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + + + TUint maxIters = 0; + if(iSingleIteration) + { + maxIters = 1; + } + else + { + maxIters = 5; + } + + for (TUint i=0; iProcessL(*srcBuffer, *dstBuffer)); + if (err) + { + if (err == iExpectedLeaveErrorCode) + break; + else + { + ERR_PRINTF3(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d Leave occurred in ProcessL, error code %d"), i, err); + testOK = EFalse; + break; + } + } + else if (iExpectedLeaveErrorCode) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d A leave was expected in ProcessL, but this didn't occur"), i); + testOK = EFalse; + break; + } + + iTotalDstBytesAdded += iCodecProcessResult.iDstBytesAdded; + iTotalSrcBytesProcessed += iCodecProcessResult.iSrcBytesProcessed; + + if (i<4) + { + switch (iCodecProcessResult.iStatus) + { + case TCodecProcessResult::EProcessComplete: + { + outputDataBufferPtr.Append(dstBuffer->Data()); + dstBuffer->SetPosition(0); + if (!CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL()) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL returned EFalse"), i); + testOK = EFalse; + } + srcBuffer->SetPosition(0); + srcBuffer->NextFrame(); + + if (!endOfFile) + { + TRAP(srcFileError, FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, iTotalSrcBytesProcessed)); + if (srcFileError == KErrEof) + endOfFile = ETrue; + else if (srcFileError) + User::Leave(srcFileError); + } + if (aSrcBufferLength > 0) + srcBuffer->Data().SetLength(aSrcBufferLength); + break; + } + case TCodecProcessResult::EProcessIncomplete: + { + outputDataBufferPtr.Append(dstBuffer->Data()); + dstBuffer->SetPosition(0); + if (!CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL()) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL returned EFalse"), i); + testOK = EFalse; + } + srcBuffer->SetPosition(iCodecProcessResult.iSrcBytesProcessed + srcBuffer->Position()); + break; + } + case TCodecProcessResult::EDstNotFilled: + { + dstBuffer->SetPosition(iCodecProcessResult.iDstBytesAdded + dstBuffer->Position()); + + if (!endOfFile) + { + TRAP(srcFileError, FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, iTotalSrcBytesProcessed)); + if (srcFileError == KErrEof) + endOfFile = ETrue; + else if (srcFileError) + User::Leave(srcFileError); + } + if (aSrcBufferLength > 0) + srcBuffer->Data().SetLength(aSrcBufferLength); + break; + } + default: + User::Leave(KErrCorrupt); //should never get here + } + } + else //last time + { + outputDataBufferPtr.Append(dstBuffer->Data()); + if (!CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL()) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckOutputDataBufferSizeAgainstTotalDstBytesAddedL returned EFalse"), i); + testOK = EFalse; + } + } + + if (!CheckReturnValueL(i)) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckReturnValue returned EFalse"), i); + testOK = EFalse; + } + if (aCheckExpectedBytesProcessed) + { + if (!CheckDstBytesAddedL(i)) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckDstBytesAddedL returned EFalse"), i); + testOK = EFalse; + } + if (!CheckSrcBytesProcessedL(i)) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL LOOP %d CheckSrcBytesProcessedL returned EFalse"), i); + testOK = EFalse; + } + } + + if (endOfFile) + break; + } + + if (testOK) + { + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + GetComparisonFilenameFromCodecUidL(aCodecUID.iUid, ptrFilename); + + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestProcessLLoopFiveTimesL CheckOutputAgainstComparisonFileL returned EFalse")); + testOK = EFalse; + } + + CleanupStack::PopAndDestroy(); //filename + } + + //clean up memory + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + CleanupStack::PopAndDestroy(4); //codec, srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } +#endif + +/** @xxxx + * This function tests how the codec handles a reposition. This test is only really + * relevant to codecs that store data between calls to ProcessL. When a reposition + * occurs the stored data should be flushed. + * + * ProcessL is called 3 times: + * After the first call the frame number is increased by one; + * After the second call the output data is checked to ensure that extra data HAS been + * written to the output buffer; The frame number is set to 5 to mimic a reposition. + * After the third call the output data is checked to ensure that extra data HAS NOT + * been written to the output buffer. + * + * Note: It is important to use buffer sizes that will force the codec to store extra + * data and return EProcessComplete or EDstNotFilled each time around the loop. + * + * @param "TUid aCodecUID" + * Uid of the codec under test. + * "TUint aSrcBufferSize" + * Size of source buffer to test the codec with. + * "TUint aDstBufferSize" + * Size of destination buffer to test the codec with. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ + #ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestRepositionL(TUid aCodecUID, TUint aSrcBufferSize, TUint aDstBufferSize) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(aSrcBufferSize); + CleanupStack::PushL(srcBuffer); + + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(aDstBufferSize); + CleanupStack::PushL(dstBuffer); + + //read first buffer of data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + //instantiate codec + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(aCodecUID)); + if (err) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestRepositionL Leave occurred in NewL, error code %d"), err); + return EFalse; + } + else + { + CleanupStack::PushL(codec); + } + + TBool testOK = ETrue; + iOutputDataBuffer = HBufC8::NewL(aDstBufferSize); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + GetComparisonFilenameFromCodecUidL(aCodecUID.iUid, ptrFilename); + + for (TUint i=0; i<3; i++) + { + iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer); + + if ((iCodecProcessResult.iStatus == TCodecProcessResult::EProcessComplete) || + (iCodecProcessResult.iStatus == TCodecProcessResult::EDstNotFilled)) + { + switch(i) + { + case 0: + { + srcBuffer->SetPosition(0); + srcBuffer->SetFrameNumber(5); + dstBuffer->SetPosition(0); + + break; + } + case 1: + { + srcBuffer->SetPosition(0); + srcBuffer->SetFrameNumber(0); + dstBuffer->SetPosition(0); + + outputDataBufferPtr.Copy(dstBuffer->Data()); + if (CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + INFO_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestRepositionL CheckOutputAgainstComparisonFileL returned ETrue for LOOP %d."), i); + INFO_PRINTF1(_L(">> If the codec stores left over data from the previous call to ProcessL, this may indicate that the test is invalid.")); + INFO_PRINTF1(_L(">> Try using different buffer sizes.")); + } + break; + } + case 2: + { + outputDataBufferPtr.Copy(dstBuffer->Data()); + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestRepositionL CheckOutputAgainstComparisonFileL returned EFalse for LOOP %d"), i); + testOK = EFalse; + } + break; + } + default: + break; + } + } + else + { + INFO_PRINTF3(_L(">> CTestStep_MMF_ACOD::TestRepositionL Return code was %d for LOOP %d."), iCodecProcessResult.iStatus, i); + INFO_PRINTF1(_L(">> This indicates that the test is invalid. Try using different buffer sizes.")); + break; + } + } + + //clean up memory + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + CleanupStack::PopAndDestroy(5); //filename, codec, srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } + +#endif + +/** @xxxx + * This function tests codec instantiation by Uid. + * + * @param "TUid aCodecUID" + * Uid of the codec under test. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ + #ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestNewL(TUid aCodecUID) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + TBool testOK = ETrue; + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(aCodecUID)); + if (err) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestNewL Leave occurred in NewL, error code %d"), err); + testOK = EFalse; + } + else + { + CleanupStack::PushL(codec); + + //Check codec is non-null + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewL NewL returned NULL")); + testOK = EFalse; + } + else + { + //Process one buffer of data + iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer); + + //copy data to iOutputDataBuffer + iOutputDataBuffer = HBufC8::NewL(dstBuffer->Data().Length()); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + outputDataBufferPtr.Append(dstBuffer->Data()); + + //investigate results + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + GetComparisonFilenameFromCodecUidL(aCodecUID.iUid, ptrFilename); + + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewL CheckOutputAgainstComparisonFileL returned EFalse")); + testOK = EFalse; + } + CleanupStack::PopAndDestroy(); //filename + } + + CleanupStack::PopAndDestroy(); //codec + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + } + + CleanupStack::PopAndDestroy(3); //srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } +#endif + +/** @xxxx + * This function tests codec instantiation by fourCC codes. + * + * @param "const TFourCC& aSrcFourCC" + * Source fourCC code of the codec under test. + * "const TFourCC& aDstFourCC" + * Destination fourCC code of the codec under test. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +#ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestNewL(const TFourCC& aSrcFourCC, const TFourCC& aDstFourCC) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromFourCCL(aSrcFourCC, aDstFourCC, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + TBool testOK = ETrue; + + //create codec from uid + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(aSrcFourCC, aDstFourCC)); + if (err) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestNewL Leave occurred in NewL, error code %d"), err); + testOK = EFalse; + } + else + { + CleanupStack::PushL(codec); + + //Check codec is non-null + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewL NULL CMMFCodec returned from NewL")); + testOK = EFalse; + } + else + { + //Process one buffer of data + iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer); + + //copy data to iOutputDataBuffer + iOutputDataBuffer = HBufC8::NewL(dstBuffer->Data().Length()); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + outputDataBufferPtr.Append(dstBuffer->Data()); + + //investigate results + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + GetComparisonFilenameFromFourCCL(aSrcFourCC, aDstFourCC, ptrFilename); + + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewL CheckOutputAgainstComparisonFileL returned EFalse")); + testOK = EFalse; + } + CleanupStack::PopAndDestroy(); //filename + } + + CleanupStack::PopAndDestroy(); //codec + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + } + + CleanupStack::PopAndDestroy(3); //srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } +#endif + +/** @xxxx + * This function tests codec instantiation by fourCC codes and preferred supplier. + * Two new codecs have been created for the purpose of this test. They take the same + * fourCC codes (AAAA and BBBB) but have different suppliers. + * + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +#ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestNewLPreferredSupplierL() + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + ptrSrcFilename.Copy(KSourceFilesDir); + ptrSrcFilename.Append(KPreferredSupplierSourceFile); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + TBool testOK = ETrue; + + //create codec from uid and preferredSupplier + CMMFCodec* codec = NULL; + TRAPD(err, codec = CMMFCodec::NewL(KMMFFourCCCodeAAAA, KMMFFourCCCodeBBBB, KPreferredSupplier)); + if (err) + { + ERR_PRINTF2(_L(">> CTestStep_MMF_ACOD::TestNewLPreferredSupplierL Leave occurred in NewL, error code %d"), err); + testOK = EFalse; + } + else + { + CleanupStack::PushL(codec); + + //Check codec is non-null + if (!codec) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewLPreferredSupplierL NULL CMMFCodec returned from NewL")); + testOK = EFalse; + } + else + { + //Process one buffer of data + iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer); + + //copy data to iOutputDataBuffer + iOutputDataBuffer = HBufC8::NewL(dstBuffer->Data().Length()); + TPtr8 outputDataBufferPtr = iOutputDataBuffer->Des(); + outputDataBufferPtr.Append(dstBuffer->Data()); + + //investigate results + HBufC* filename = HBufC::NewLC(KMaxPath); + TPtr ptrFilename = filename->Des(); + ptrFilename.Copy(KComparisonFilesDir); + ptrFilename.Append(KPreferredSupplierComparisonFile); + + if (!CheckOutputAgainstComparisonFileL(ptrFilename, 0)) + { + ERR_PRINTF1(_L(">> CTestStep_MMF_ACOD::TestNewLPreferredSupplierL CheckOutputAgainstComparisonFileL returned EFalse")); + testOK = EFalse; + } + + CleanupStack::PopAndDestroy(filename); + } + + CleanupStack::PopAndDestroy(codec); + delete iOutputDataBuffer; + iOutputDataBuffer = NULL; + } + + CleanupStack::PopAndDestroy(3, srcBuffer); //srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } +#endif + +/** @xxxx + * This functionality isn't implemented yet + */ +#ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestMemoryScribbleL(TUid aCodecUID) + { + aCodecUID = aCodecUID; + + INFO_PRINTF1(_L(">> This test has not been implemented, as it has not yet been determined how to test for memory scribbles.")); + return ETrue; + } +#endif + +/** @xxxx + * This function panics if any memory leaks occur during the calls to NewL or ProcessL. + * + * @param "TUid aCodecUID" + * Uid of codec under test. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +TBool CTestStep_MMF_ACOD::TestMemoryLeakL(TUid aCodecUID) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + __MM_HEAP_MARK; + //instantiate codec + CMMFCodec* codec = CMMFCodec::NewL(aCodecUID); + CleanupStack::PushL(codec); + + iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer); + + CleanupStack::PopAndDestroy(4); //codec, srcFilename, dstBuffer, srcBuffer + + __MM_HEAP_MARKEND; + + return ETrue; + } + +/** @xxxx + * This function tests how NewL deals with a memory allocation failure. + * This test will pass if NewL leaves with the correct error code on every + * memory allocation. + * + * @param "TUid aCodecUID" + * Uid of codec under test. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +#ifdef OLD_CRUD_REMOVE +TBool CTestStep_MMF_ACOD::TestNewLOutOfMemoryL(TUid aCodecUID) + { + aCodecUID = aCodecUID; + CMMFCodec* codec = NULL; + TInt failCount = 1; + TBool testComplete = EFalse; + TBool testOK = ETrue; + + while (!testComplete) + { + TInt err = 0; + __UHEAP_FAILNEXT(failCount); + __MM_HEAP_MARK; + + TRAP(err, codec = CMMFCodec::NewL(aCodecUID)); + + switch (err) + { + case KErrNoMemory : + break; + case KErrNone : + { + //attempt to allocate another cell. If this fails, we have tested all + //of the memory allocs carried out by NewL. + TAny *testAlloc = User::Alloc(1); + if (testAlloc==NULL) + { + testComplete = ETrue; + failCount --; + } + else + User::Free(testAlloc); + + delete codec; + codec = NULL; + break; + } + default: + { + testOK = EFalse; + testComplete = ETrue; + break; + } + } + + __MM_HEAP_MARKEND; + __UHEAP_RESET; + failCount++; + } + + if(!testOK) + return EFalse; + else + return ETrue; + } + +#endif + + +/** @xxxx + * This function tests how ProcessL would deal with a memory allocation failure. + * For most of the codecs ProcessL doesn't allocate any memory, so this test will + * pass when ProcessL succeeds as well as when ProcessL leaves with the correct code. + * + * @param "TUid aCodecUID" + * Uid of codec under test. + * @return "TBool" + * ETrue if the test passes. + * EFalse if the test fails. + */ +TBool CTestStep_MMF_ACOD::TestProcessLOutOfMemoryL(TUid aCodecUID) + { + //create buffers + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(KDefaultBufferSize); + CleanupStack::PushL(dstBuffer); + + //Fill source buffer with data + HBufC* srcFilename = HBufC::NewLC(KMaxPath); + TPtr ptrSrcFilename = srcFilename->Des(); + GetSourceFilenameFromCodecUidL(aCodecUID.iUid, ptrSrcFilename); + FillSourceBufferFromSourceFileL(srcBuffer, ptrSrcFilename, 0); + + //instantiate codec + CMMFCodec* codec = CMMFCodec::NewL(aCodecUID); + CleanupStack::PushL(codec); + TBool testOK = ETrue; + TUint failCount = 1; + TBool testComplete = EFalse; + + while (!testComplete) + { + __UHEAP_FAILNEXT(failCount); + __MM_HEAP_MARK; + TRAPD(err, iCodecProcessResult = codec->ProcessL(*srcBuffer, *dstBuffer)); + + switch (err) + { + case KErrNoMemory : + break; + case KErrNone : + { + //attempt to allocate another cell. If this fails, we have tested all + //of the memory allocs carried out by ProcessL. + TAny *testAlloc = User::Alloc(1); + if (testAlloc==NULL) + { + testComplete = ETrue; + failCount --; + } + else + User::Free(testAlloc); + break; + } + default: + { + testOK = EFalse; + testComplete = ETrue; + break; + } + } + + __MM_HEAP_MARKEND; + __UHEAP_RESET; + failCount++; + } + + CleanupStack::PopAndDestroy(4); //codec, srcFilename, dstBuffer, srcBuffer + + if(!testOK) + return EFalse; + else + return ETrue; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD_BufferSizes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_ACOD_BufferSizes.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2003 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: +* +*/ + +#ifndef __TSU_MMF_ACOD_BufferSizes_H__ +#define __TSU_MMF_ACOD_BufferSizes_H__ + +const TUint KDefaultBufferSize = 0x1000; +const TUint KLargeBufferSize = 10000; +const TUint KSmallBufferSize = 50; +const TUint KSmallBufferSizeGSM = 640; +const TUint KMaxBufferLength = 10000; + +//Optimum source buffer sizes +const TUint KAlawToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToAlawOptimumSrc = 0x1000; +const TUint KPCM8ToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToPCM8OptimumSrc = 0x1000; +const TUint KPCM16ToPCM16BOptimumSrc = 0x1000; +const TUint KPCM16BToPCM16OptimumSrc = 0x1000; +const TUint KPCMU16ToPCMU16BOptimumSrc = 0x1000; +const TUint KPCMU16BToPCMU16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU16BOptimumSrc = 0x1000; +const TUint KPCMU16BToPCM16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU16OptimumSrc = 0x1000; +const TUint KPCMU16ToPCM16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU8OptimumSrc = 0x1000; +const TUint KPCMU8ToPCM16OptimumSrc = 0x800; +const TUint KMulawToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToMulawOptimumSrc = 0x1000; +const TUint KAdpcmToPCM16OptimumSrc = 0x400; +const TUint KPCM16ToAdpcmOptimumSrc = 0xFC8; +const TUint KStereoAdpcmToPCM16OptimumSrc = 0x400; +const TUint KPCM16ToStereoAdpcmOptimumSrc = 0xF90; +const TUint KGSM610ToPCM16OptimumSrc = 0x104; +const TUint KPCM16ToGSM610OptimumSrc = 0xA00; + +const TUint KGSM610ToPCM16OptimumSrcGSM = 0x280; // 640 (Dec) + +//Optimum dest buffer sizes +const TUint KAlawToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToAlawOptimumDst = 0x800; +const TUint KPCM8ToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCM8OptimumDst = 0x800; +const TUint KPCM16ToPCM16BOptimumDst = 0x1000; +const TUint KPCM16BToPCM16OptimumDst = 0x1000; +const TUint KPCMU16ToPCMU16BOptimumDst = 0x1000; +const TUint KPCMU16BToPCMU16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU16BOptimumDst = 0x1000; +const TUint KPCMU16BToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU16OptimumDst = 0x1000; +const TUint KPCMU16ToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU8OptimumDst = 0x800; +const TUint KPCMU8ToPCM16OptimumDst = 0x1000; +const TUint KMulawToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToMulawOptimumDst = 0x800; +const TUint KAdpcmToPCM16OptimumDst = 0xFC8; +const TUint KPCM16ToAdpcmOptimumDst = 0x400; +const TUint KStereoAdpcmToPCM16OptimumDst = 0xF90; +const TUint KPCM16ToStereoAdpcmOptimumDst = 0x400; +const TUint KGSM610ToPCM16OptimumDst = 0xA00; +const TUint KPCM16ToGSM610OptimumDst = 0x104; + + +const TUint KPCM16ToGSM610OptimumDstGSM = 0x280; +const TUint KGSM610ToPCM16OptimumDstGSM = 0x186A0; //100000 0x32C8; // 13000 (Dec) + + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_CodecTests.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_CodecTests.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,556 @@ +// Copyright (c) 2003-2009 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: +// + +// EPOC includes +#include +#include +#include +#include + +// Test system includes +#include "tsu_mmf_CodecTests.h" +#include "TSU_MMF_DeviceSuite.h" + +//[codec includes ] +#include +#include "MmfPcm16toAlawhwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "mmfpcm16ToImaAdpcm.h" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "MMFpcm16ToPcm16HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" + +const TInt KFmtChunkSize = 16; +const TInt KAuMagic = 0x2e736e64; + +//[ Codec Unit tests structure +// The unit tests shall use text files +// for small portions of test data +// which should be stored are stored in a simple format +// containing the relevant parameters for the test +//] +class TCodecUnitTestParams + { +public: + const TText* iTestName; // name of the test + const TText* iInputFilename; // input wav file + const TText* iComparisonFileName; // output wav file + TInt iExpectedResult; // expected result + }; + +// constant table of parameters for tests +const TCodecUnitTestParams KTestParameters[] = +{ + { + _S("MM-MMF-SWCODECDEVICES-U-0010-HP"), + _S("Pcm16Mono8khz400hzTone.wav"), + _S("Pcm16BMono8Khz400hzTone.Au"), + KErrNone + }, + + { + _S("MM-MMF-SWCODECDEVICES-U-0011-HP"), + _S("Pcm16Mono8khz400hzTone.wav"), + _S("Imaad4BitMono8Khz400hzTone.wav"), + KErrNone + }, + + { + _S("MM-MMF-SWCODECDEVICES-U-0012-HP"), + _S("Imaad4BitMono8Khz400hzTone.wav"), + _S("Pcm16Mono8khz400hzTone.wav"), + KErrNone + }, + + { + _S("MM-MMF-SWCODECDEVICES-U-0014-HP"), + _S("Pcm16Mono8khz400hzTone.wav"), + _S("PcmU8Mono8khz400hzTone.wav"), + KErrNone + }, + + { + _S("MM-MMF-SWCODECDEVICES-U-0015-HP"), + _S("PcmU8Mono8khz400hzTone.wav"), + _S("Pcm16Mono8khz400hzTone.wav"), + KErrNone + }, + + { + _S("MM-MMF-SWCODECDEVICES-U-0016-HP"), + _S("Pcm16Stereo8khz400hzTone.wav"), + _S("PcmU8Stereo8khz400hzTone.wav"), + KErrNone + }, +}; + +/** +* +* Print8BitResults +* @param aRefCodedData +* @param aCodedData +* @param aDataLength +* +**/ +template +void CTestStepCodecUnitTest::Print8BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength ) + { + __ASSERT_DEBUG(aRefCodedData,Panic(EBadArgument)); + __ASSERT_DEBUG(aCodedData,Panic(EBadArgument)); + + for( TInt i = 0; i < aDataLength; i++ ) + { + INFO_PRINTF6( _L("delta %u p1 %u p2 %u p1 %x p2 %x"), (*aRefCodedData-*aCodedData),*aRefCodedData, *aCodedData, *aRefCodedData, *aCodedData ); + aRefCodedData++; + aCodedData++; + } + } + +/** +* +* Print16BitResults +* @param aRefCodedData +* @param aCodedData +* @param aDataLength +* +**/ +template +void CTestStepCodecUnitTest::Print16BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength ) + { + //[precondition pointers are aok] + __ASSERT_DEBUG(aRefCodedData,Panic(EBadArgument)); + __ASSERT_DEBUG(aCodedData,Panic(EBadArgument)); + //[precondition data is of even length ] + __ASSERT_DEBUG( (aDataLength % 2 == 0),Panic(EBadArgument)); + + TInt length = aDataLength /2; + TInt16 refCodedValue = 0; + TInt16 codedValue = 0; + for( TInt i = 0; i < length; i++ ) + { + refCodedValue = static_cast( aRefCodedData[0] ); + refCodedValue |= static_cast((aRefCodedData[1] << 8 )); + codedValue = static_cast( aCodedData[0] &KAndMask8bit); + codedValue |= static_cast((aCodedData[1] << 8 )); + INFO_PRINTF6( _L("delta %d p1 %d p2 %d p1 %x p2 %x"), (refCodedValue-codedValue),refCodedValue, codedValue, refCodedValue, codedValue ); + aRefCodedData+=2; + aCodedData+=2; + } + } +/** +* +* CTestStepCodecUnitTest +* +**/ +template +CTestStepCodecUnitTest::CTestStepCodecUnitTest( TUint aTestIndex ) + { + //[precondition valid index ] +// __ASSERT_DEBUG( (aTestIndex >= 0),Panic(EBadArgument)); // EABI warning removal + __ASSERT_DEBUG( (aTestIndex < (sizeof(KTestParameters)/sizeof(TCodecUnitTestParams))),Panic(EBadArgument)); + // store a pointer to the test parameters + iTestParameters = &(KTestParameters[aTestIndex]); + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = iTestParameters->iTestName; + } + +/** +* +* ~CTestStepCodecUnitTest +* +**/ +template +CTestStepCodecUnitTest::~CTestStepCodecUnitTest() + { + } +/** +* +* DoTestStepL +* +**/ +template +TVerdict CTestStepCodecUnitTest::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass; + + // code and decode the input file + TInt numBuffersToProcess = ComputeBuffersToProcess(); + TInt codedBufferSize = numBuffersToProcess*iCodecUnderTest->SinkBufferSize(); + iCodedData = CMMFDescriptorBuffer::NewL( codedBufferSize); + // Compare the results and return test status + TUint8* ptrSrc = CONST_CAST(TUint8*,iSourceData->Data().Ptr()); + TUint8* ptrDest = CONST_CAST(TUint8*,iCodedData->Data().Ptr()); + CMMFDataBuffer* srcBuffer = CMMFDescriptorBuffer::NewL(iCodecUnderTest->SourceBufferSize()); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer* destBuffer = CMMFDescriptorBuffer::NewL(iCodecUnderTest->SinkBufferSize()); + TUint8* pInBuffer = CONST_CAST(TUint8*,srcBuffer->Data().Ptr()); + TUint8* pOutBuffer = CONST_CAST(TUint8*,destBuffer->Data().Ptr()); + CleanupStack::PushL(destBuffer); + + for( TInt i = 0; i < numBuffersToProcess; i++) + { + //[ copy data & increment input pointer] + Mem::Copy( pInBuffer, ptrSrc, iCodecUnderTest->SourceBufferSize() ); + srcBuffer->Data().SetLength( iCodecUnderTest->SourceBufferSize() ); + ptrSrc+= iCodecUnderTest->SourceBufferSize(); + + //[ code the data ] + iCodecUnderTest->ProcessL( *srcBuffer, *destBuffer); + + //[ copy out the data & increment pointer ] + Mem::Copy( ptrDest, pOutBuffer, iCodecUnderTest->SinkBufferSize() ); + iCodedData->Data().SetLength( (i+1)*iCodecUnderTest->SinkBufferSize() ); + destBuffer->Data().SetLength(0); // reset buffer length + ptrDest+=iCodecUnderTest->SinkBufferSize(); + } + + //[ compare the coded data against the reference data] + //[ compare the processed number of bytes in the + // coded buffer to the reference data] + __ASSERT_DEBUG( iRefCodedData->Data().Length() >= iCodedData->Data().Length(),Panic(EBadInvariant)); + + TUint8* ptr1 = CONST_CAST(TUint8*,iRefCodedData->Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*,iCodedData->Data().Ptr()); + + if(!iComparator.CompareL( ptr1,ptr2, iCodedData->Data().Length())!=0) + { + INFO_PRINTF1( _L("Comparison has failed")); + //(this->*iPrintFormats[ C ])( ptr1, ptr2, iCodedData->Data().Length() ); + result = EFail ; + } + + //[ pop buffers ] + CleanupStack::PopAndDestroy(2,srcBuffer); //srcBuffer, destBuffer + delete iCodedData; + iCodedData = NULL; + + __MM_HEAP_MARKEND; + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +template +TVerdict CTestStepCodecUnitTest::DoTestStepPreambleL() + { + //[ assert preconditions on a and b ] + __ASSERT_DEBUG( A >= 0, Panic(EBadInvariant)); //sanity check on data + __ASSERT_DEBUG( B >= 0, Panic(EBadInvariant)); //sanity check on data + __ASSERT_DEBUG( C >= 0, Panic(EBadInvariant)); //sanity check on data + __ASSERT_DEBUG( A < 2, Panic(EBadInvariant)); //sanity check on data + __ASSERT_DEBUG( B < 2, Panic(EBadInvariant)); //sanity check on data + __ASSERT_DEBUG( C < 2, Panic(EBadInvariant)); //sanity check on data + + //[ initialise file reader callbacks ] + iReaders[ 0 ] = &CTestStepCodecUnitTest::ReadWavFileL; + iReaders[ 1 ] = &CTestStepCodecUnitTest::ReadAuFileL; + + //[ initialise print format callbacks ] + iPrintFormats[ 0 ] = &CTestStepCodecUnitTest::Print8BitResults; + iPrintFormats[ 1 ] = &CTestStepCodecUnitTest::Print16BitResults; + + // make codec + iCodecUnderTest = new(ELeave) T; // a cmmfcodec + + // [ Parse files into buffers, input & comparison + // using the configured file readers ] + TBuf<40> testFileName = iTestParameters->iInputFilename; + (this->*iReaders[ A ])(iSourceData, testFileName ); + testFileName = iTestParameters->iComparisonFileName; + (this->*iReaders[ B ])(iRefCodedData,testFileName ); + return EPass; + } +/** +* +* DoTestStepPostambleL +* +**/ +template +TVerdict CTestStepCodecUnitTest::DoTestStepPostambleL(void) + { + //Destroy Codec + delete iCodecUnderTest; + delete iSourceData; + delete iCodedData; + delete iRefCodedData; + return EPass; + } + +/** +* Reads wav file data into the supplied buffer +* ReadFileL +* @param +* @param +* This function reads the data portion of a wav file +* into a data buffer +**/ +template +void CTestStepCodecUnitTest::ReadWavFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile ) + { + // connect to the file server + User::LeaveIfError(iFs.Connect()); + + // [open the file and read its data contents into the buffer ] + // [the assumption will be the data is stored in wav format only] + TFileName fileName = GetSuite()->DefaultPath(); + fileName.Append(aFile); + + RFile file1; + User::LeaveIfError(file1.Open(iFs, fileName, EFileShareAny | EFileStream | EFileRead)); + CleanupClosePushL(file1); + + //[ get the size and position of the data from the wav file ] + TInt pos = KFmtChunkSize; + User::LeaveIfError(file1.Seek( ESeekStart, pos )); + TInt fmtChunkSize = 0; + User::LeaveIfError(ReadInt(file1, fmtChunkSize)); + //[ seek to data chunk size ] + pos = KFmtChunkSize+fmtChunkSize+8; + User::LeaveIfError(file1.Seek(ESeekStart, pos )); + //read data chunk size + TInt dataChunkSize = 0; + User::LeaveIfError(ReadInt(file1, dataChunkSize)); + //create buffer large eneough to deal with data size + TInt fileSize = 0; + User::LeaveIfError(file1.Size(fileSize)); + __ASSERT_DEBUG( fileSize > dataChunkSize, Panic(EBadInvariant)); //sanity check on data + aBuffer = CMMFDescriptorBuffer::NewL(dataChunkSize); + User::LeaveIfError(file1.Read( aBuffer->Data(),dataChunkSize)); + aBuffer->Data().SetLength(dataChunkSize); + file1.Close(); + CleanupStack::PopAndDestroy(1); //file1 + } + +/** +* Reads Au file data into the supplied buffer +* ReadFileL +* @param +* @param +* This function reads the data portion of a wav file +* into a data buffer +**/ +template +void CTestStepCodecUnitTest::ReadAuFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile ) + { + // connect to the file server + User::LeaveIfError(iFs.Connect()); + + // [open the file and read its data contents into the buffer ] + TFileName fileName = GetSuite()->DefaultPath(); + fileName.Append(aFile); + + RFile file1; + User::LeaveIfError(file1.Open(iFs, fileName, EFileShareAny | EFileStream | EFileRead)); + CleanupClosePushL(file1); + + TInt magicNumber = 0; + User::LeaveIfError(ReadIntB(file1, magicNumber)); + if( magicNumber != KAuMagic ) + { + // have not detected the appropriate header + INFO_PRINTF1(_L("Have not detected Au Header ie magic number 0x2e736e64")); + User::Leave( KErrCorrupt ); + } + + //[ header size ] + TInt headerSize = 0; + User::LeaveIfError(ReadIntB(file1, headerSize)); + + TInt fileSize = 0; + User::LeaveIfError(file1.Size(fileSize)); + + //[ filesize - headersize = datasize ] + TInt dataSize = fileSize - headerSize; + + // [ assert that the datasize >= 0 ] + __ASSERT_DEBUG( dataSize >= 0, Panic(EBadInvariant)); //sanity check on data + + //[Seek to the correct position and read data into Buffer] + User::LeaveIfError(file1.Seek(ESeekStart, headerSize )); + __ASSERT_DEBUG( fileSize > dataSize, Panic(EBadInvariant)); //sanity check on data + + //[ read the data into a Buffer ] + aBuffer = CMMFDescriptorBuffer::NewL(dataSize); + User::LeaveIfError(file1.Read( aBuffer->Data(),dataSize)); + aBuffer->Data().SetLength(dataSize); + file1.Close(); + CleanupStack::PopAndDestroy(1); //file1 + } + +/** +* Reads file into buffer +* ReadFileL +* @param aFile the file from which to read the data +* @param aValue the returned value +* This function reads a 32bit value in a rather inefficient way +**/ +template +TInt CTestStepCodecUnitTest::ReadInt( RFile& aFile, TInt& aValue ) + { + TUint8 data[4]; + TPtr8 theDes( data, 4 ); + User::LeaveIfError(aFile.Read( theDes, 4)); + // now assemble the data from the buffer + aValue = data[0]; + aValue |= data[1] << 8; + aValue |= data[2] << 16; + aValue |= data[3] << 24; + + return KErrNone; + } + + +/** +* Reads file into buffer +* ReadFileL +* @param aFile the file from which to read the data +* @param aValue the returned value +* This function reads a 32bit value in BigEndian forma +and coverts it to Little Endian in a rather inefficient way +**/ +template +TInt CTestStepCodecUnitTest::ReadIntB( RFile& aFile, TInt& aValue ) + { + TUint8 data[4]; + TPtr8 theDes( data, 4 ); + User::LeaveIfError(aFile.Read( theDes, 4)); + // now assemble the data from the buffer + aValue = data[3]; + aValue |= data[2] << 8; + aValue |= data[1] << 16; + aValue |= data[0] << 24; + + return KErrNone; + } + +/** +* +* ComputeBuffersToProcess +* @precondition InputBuffer has been setup +* @precondition Codec has been instantiated +* +**/ +template +TInt CTestStepCodecUnitTest::ComputeBuffersToProcess() + { + TInt numWholeBuffers = (iSourceData->Data().MaxLength()/iCodecUnderTest->SourceBufferSize() ); + return numWholeBuffers; + } + + +/** +* +* This is used for template instantiation. +* +**/ + +template class CTestStepCodecUnitTest; +template class CTestStepCodecUnitTest; +template class CTestStepCodecUnitTest,0,0,1>; +template class CTestStepCodecUnitTest; +template class CTestStepCodecUnitTest,0,0,1>; + + +/** +* +* Compare +* @param aData +* @param aData2 +* @param aNoSamples +* @return TBool +* +**/ +TBool TComparator::CompareL( TUint8* aData, TUint8* aData2, TInt aLength ) + { + TBool result = ETrue; + if( !aData ) + User::Leave(KErrArgument); + if( !aData2 ) + User::Leave(KErrArgument); + + if( Mem::Compare( aData,aLength, aData2, aLength )!=0) + { + result = EFalse; + } + + return result; + } + +/** +* +* Compare +* @param aData +* @param aData2 +* @param aNoSamples +* @result TBool +* +**/ +template +TBool TDbComparator::CompareL( TUint8* aData, TUint8* aData2, TInt aLength ) + { + TBool result = ETrue; + if( !aData ) + User::Leave(KErrArgument); + if( !aData2 ) + User::Leave(KErrArgument); + + //[ lets compute the signal to noise ratio ] + TReal sumSigSquared = 0.0; + TReal sumErrorSquared = 0.0; + TUint8* pData = aData; + TUint8* pData2 = aData2; + TInt numSamples = aLength/2; + // compute the sum of sig and error squared + for( TInt count = 0; count < numSamples; count++ ) + { + TInt16 sample1 = static_cast( pData[0] &KAndMask8bit); + sample1 |= static_cast((pData[1] << 8 )); + TInt16 sample2 = static_cast( pData2[0] &KAndMask8bit); + sample2 |= static_cast((pData2[1] << 8 )); + pData +=1; + pData2+=2; + sumSigSquared += sample1*sample1; + sumErrorSquared += (sample1-sample2)*(sample1-sample2); + } + + TReal sn = 0.0; + const TReal tolerance = 0.001; + //[precondition error is >= tolerance ] + if( sumErrorSquared < tolerance ) + User::Leave( KErrArgument ); + //[claculate ratio safely ] + Math::Log( sn, (sumSigSquared/sumErrorSquared)); + sn*= 10; + TReal threshold = T; // integer used as real with 100ths db accuracy + threshold /= 100.0; + if( sn < threshold ) + result = EFalse; + + return result; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_DeviceSuite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_DeviceSuite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,183 @@ +// Copyright (c) 2002-2009 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: +// TSU_MMF_SwCodecDevicesSuite.cpp +// This main DLL entry point for the TSU_MMF_SWCODECDEVICES.dll +// +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_DeviceSuite.h" +#include "TSU_MMF_SWCODECDEVICES.h" +#include "tsu_mmf_CodecTests.h" +#include "TSU_MMF_SignConversionCodecs.h" +#include "TSU_MMF_Loop.h" +#include "TSU_MMF_Oom.h" +//[ actual codec includes ] +#include "MmfPcm16toAlawhwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "GSM610.H" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "mmfpcm16ToImaAdpcm.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcmS16topcmU16Codec.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmU16BeToPcmS16HwDevice.h" +#include "mmfpcmU16TopcmS16HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" + + +/** + * NewTestSuite is exported at ordinal 1 + * this provides the interface to allow schedule test + * to create instances of this test suite + */ +EXPORT_C CTestSuite_MMF_SwCodecDevices* NewTestSuiteL() + { + CTestSuite_MMF_SwCodecDevices* result = new (ELeave) CTestSuite_MMF_SwCodecDevices; + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(1, result); // result + return result; + } + +//destructor +CTestSuite_MMF_SwCodecDevices::~CTestSuite_MMF_SwCodecDevices() + { + } + +//Get Test Suite version +_LIT(KTxtVersion,"0.1"); +TPtrC CTestSuite_MMF_SwCodecDevices::GetVersion( void ) + { + return KTxtVersion(); + } + +/** + * + * Add a test step into the suite + * @param "CTestStep_MMF_SwCodecDevices* aPtrTestStep" + * Test step pointer + */ +void CTestSuite_MMF_SwCodecDevices::AddTestStepL( CTestStep_MMF_SwCodecDevices* aPtrTestStep ) + { + // test steps contain a pointer back to the suite which owns them + aPtrTestStep->SetSuite(this); + // add the step using tyhe base class method + CTestSuite::AddTestStepL(aPtrTestStep); + } + +/** + * Constructor for test suite + * this creates all the test steps and + * stores them inside CTestSuite_MMF_SWCODECDEVICES + */ +void CTestSuite_MMF_SwCodecDevices::InitialiseL( void ) + { + // store the name of this test suite + InitSystemPath(); + iSuiteName = _L("TSU_MMF_SWCODECDEVICES"); + + AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0001() ); + AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0002() ); + AddTestStepL( new(ELeave) CTest_MMF_SwCodecDevices_U_0003() ); + AddTestStepL( new(ELeave) CTestALawCodec_U_0004()); + AddTestStepL( new(ELeave) CTestMuLawCodec_U_0006()); + + AddTestStepL( new(ELeave) CTestStepCodecUnitTest(0)); + AddTestStepL( new(ELeave) CTestStepCodecUnitTest(1) ); + AddTestStepL( new(ELeave) CTestStepCodecUnitTest,0,0,1>(2)); + AddTestStepL( new(ELeave) CTestStepCodecUnitTest(3)); + AddTestStepL( new(ELeave) CTestStepCodecUnitTest,0,0,1>(4)); + AddTestStepL( new(ELeave) CTestStepCodecUnitTest(5)); + + AddTestStepL( new(ELeave) CTestStepSignConversionTest()); + AddTestStepL( new(ELeave) CTestStepSignConversionTest()); + AddTestStepL( new(ELeave) CTestStepSignConversionTest()); + AddTestStepL( new(ELeave) CTestStepSignConversionTest()); + AddTestStepL( new(ELeave) CTestStepSignConversionTest()); + + AddTestStepL( new(ELeave) CTestIMaadCodec()); + + AddTestStepL( new(ELeave) CTestStepOomTest(0)); + AddTestStepL( new(ELeave) CTestStepOomTest(1)); + AddTestStepL( new(ELeave) CTestStepGsm610ToPcm16OomTest(2)); + AddTestStepL( new(ELeave) CTestStepOomTest(3)); + AddTestStepL( new(ELeave) CTestStepOomTest(4)); + AddTestStepL( new(ELeave) CTestStepOomTest(5)); + AddTestStepL( new(ELeave) CTestStepOomTest(6)); + AddTestStepL( new(ELeave) CTestStepOomTest(7)); + AddTestStepL( new(ELeave) CTestStepOomTest(8)); + AddTestStepL( new(ELeave) CTestStepOomTest(9)); + AddTestStepL( new(ELeave) CTestStepOomTest(10)); + AddTestStepL( new(ELeave) CTestStepOomTest(11)); + AddTestStepL( new(ELeave) CTestStepOomTest(12)); + AddTestStepL( new(ELeave) CTestStepOomTest(13)); + AddTestStepL( new(ELeave) CTestStepOomTest(14)); + AddTestStepL( new(ELeave) CTestStepPcm16ToGsm610OomTest(15)); + + AddTestStepL( new(ELeave) CTestStepLoopTest(0)); + AddTestStepL( new(ELeave) CTestStepLoopTest(1)); + AddTestStepL( new(ELeave) CTestStepLoopTest(2)); + AddTestStepL( new(ELeave) CTestStepLoopTest(3)); + AddTestStepL( new(ELeave) CTestStepLoopTest(4)); + AddTestStepL( new(ELeave) CTestStepLoopTest(5)); + AddTestStepL( new(ELeave) CTestStepLoopTest(6)); + AddTestStepL( new(ELeave) CTestStepLoopTest(7)); + AddTestStepL( new(ELeave) CTestStepLoopTest(8)); + AddTestStepL( new(ELeave) CTestStepLoopTest(9)); + AddTestStepL( new(ELeave) CTestStepLoopTest(10)); + AddTestStepL( new(ELeave) CTestStepLoopTest(11)); + AddTestStepL( new(ELeave) CTestStepLoopTest(12)); + AddTestStepL( new(ELeave) CTestStepLoopTest(13)); + AddTestStepL( new(ELeave) CTestStepLoopTest(14)); + AddTestStepL( new(ELeave) CTestStepLoopTest(15)); + + } + +/** +* +* InitSystemPath +* This sets up the default path +* +*/ +void CTestSuite_MMF_SwCodecDevices::InitSystemPath() + { + _LIT(KAudioStremOutSourcePathOnC,"c:\\mm\\mmf\\testfiles\\SwCodecDevices\\"); + + RFs fs; + TUint att; + TInt ret = fs.Connect(); + __ASSERT_ALWAYS(ret == KErrNone,User::Panic(_L("Sys path not setup"),ret)); + + if (fs.Att(KAudioStremOutSourcePathOnC, att) == KErrNone) + iDefaultPath = KAudioStremOutSourcePathOnC; + else + User::Panic(_L("Test files not found"),KErrNotFound); + + fs.Close(); + } + +const TDesC& CTestSuite_MMF_SwCodecDevices::DefaultPath() const + { + return iDefaultPath; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_DeviceSuite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_DeviceSuite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,71 @@ +// Copyright (c) 2003-2009 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: +// This contains CTestSuite_MMF_SwCodecDevices +// +// + +#ifndef __TSU_MMF_SWCODECDEVICES_SUITE_H_ +#define __TSU_MMF_SWCODECDEVICES_SUITE_H_ + +#include + +/* + TMmfAudioControllerPanics is an enumeration with the following entries: + EBadArgument indicates a bad argument + EBadState indicates a state viaolation + EBadInvariant indicates an invariant violation + EBadReset indicates failed reset + EPostConditionViolation indicates a post condition violation +*/ +enum TMmfCodecTestPanics + { + EBadArgument, + EBadState, + EBadInvariant, + EBadReset, + EPostConditionViolation + }; + +/** +* Panic +* This method generates a panic +* @param "TInt" +* @xxxx +*/ +inline void Panic(TInt aPanicCode) + { + _LIT(KMMFTestSwHwDevicesPanicCategory, "MMFTestSwHwDevices"); + User::Panic(KMMFTestSwHwDevicesPanicCategory, aPanicCode); + } + +class CTestStep_MMF_SwCodecDevices; + +class CTestSuite_MMF_SwCodecDevices : public CTestSuite + { +public: + + void InitialiseL( void ); + virtual ~CTestSuite_MMF_SwCodecDevices(); + void AddTestStepL( CTestStep_MMF_SwCodecDevices *ptrTestStep ); + TPtrC GetVersion( void ); + void InitSystemPath(); + const TDesC& DefaultPath() const; + +private: + TFileName iDefaultPath; + }; + + +#endif /* TSU_MMF_SWCODECDEVICES_SUITE_H_ */ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Loop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Loop.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,246 @@ +// Copyright (c) 2003-2009 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: +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_DeviceSuite.h" +#include "TSU_MMF_Loop.h" + +//[ actual codec includes ] +#include "MmfPcm16toAlawhwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "GSM610.H" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "mmfpcm16ToImaAdpcm.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcmS16topcmU16Codec.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmU16BeToPcmS16HwDevice.h" +#include "mmfpcmU16TopcmS16HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" + +//[ Codec Unit tests structure +// The unit tests shall use text files +// for small portions of test data +// which should be stored are stored in a simple format +// containing the relevant parameters for the test +//] +class TLoopTestParams + { +public: + const TText* iTestName; // name of the test + }; + +// constant table of parameters for tests +const TLoopTestParams KLoopParameters[] = + { + {_S("MM-MMF-SWCODECDEVICES-U-0061-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0062-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0063-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0064-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0065-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0066-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0067-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0068-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0069-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0070-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0071-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0072-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0073-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0074-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0075-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0076-HP")} + }; + +/** +* +* CTestStepLoopTest +* +*/ +template +CTestStepLoopTest::CTestStepLoopTest( TUint aTestIndex ) + { + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = (&KLoopParameters[aTestIndex])->iTestName; + } + +/** +* +* ~CTestStepLoopTest +* +*/ +template +CTestStepLoopTest::~CTestStepLoopTest() + { + } + +/** +* +* DoTestStepL +* This method tests codec src & destination buffer size violations +* and position violations. +* +**/ +template +TVerdict CTestStepLoopTest::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass; + + //[ Buffer size violation on the src ] + const TInt KSrcDataBufferSize = iCodecUnderTest->SourceBufferSize(); + const TInt KSinkDataBufferSize = iCodecUnderTest->SinkBufferSize(); + + //[ create the data buffers and do not worry about filling them since + // this is simply a precondition test ] + TInt srcDataBufferSize = KSrcDataBufferSize*2; + TInt sinkDataBufferSize = KSinkDataBufferSize; + if( CodecPreconditionTestL( srcDataBufferSize, sinkDataBufferSize ) == KErrNone ) + { + //[ info print here ] + INFO_PRINTF1(_L("Src Data Buffer precondition violation")); + result = EFail; + } + + //[ Buffer size violation on the Destination ] + srcDataBufferSize = KSrcDataBufferSize; + sinkDataBufferSize = KSinkDataBufferSize/4; + if( CodecPreconditionTestL( srcDataBufferSize, sinkDataBufferSize ) == KErrNone ) + { + INFO_PRINTF1(_L("Sink Data Buffer precondition violation")); + result = EFail; + } + + //[ Position violation on the src ] + srcDataBufferSize = KSrcDataBufferSize; + sinkDataBufferSize = KSinkDataBufferSize; + if( CodecPreconditionTestL( srcDataBufferSize, sinkDataBufferSize, srcDataBufferSize/2, 0 ) == KErrNone ) + { + INFO_PRINTF1(_L("Src Data Buffer position precondition violation")); + result = EFail; + } + + //[ Position violation on the Destination ] + srcDataBufferSize = KSrcDataBufferSize; + sinkDataBufferSize = KSinkDataBufferSize; + if( CodecPreconditionTestL( srcDataBufferSize, sinkDataBufferSize,0, sinkDataBufferSize/2 ) == KErrNone ) + { + INFO_PRINTF1(_L("Sink Data Buffer position precondition violation")); + result = EFail; + } + + delete iSourceData; + delete iCodedData ; + iSourceData = NULL; + iCodedData = NULL; + + __MM_HEAP_MARKEND; + return result; + } + +/** +* +* CodecPreconditionTest +* @precondition 0<= aSrcPosition < aSrcDataBufferSize +* @precondition 0<= aSinkPosition < aSinkDataBufferSize +* @return TInt error code +**/ +template +TInt CTestStepLoopTest::CodecPreconditionTestL( TInt aSrcDataBufferSize, TInt aSinkDataBufferSize, TInt aSrcPosition, TInt aSinkPosition ) + { + TInt result = KErrNone; + //[ assert preconditions ] + ASSERT( (0 <= aSrcPosition ) && ( aSrcPosition < aSrcDataBufferSize )); + ASSERT( (0 <= aSinkPosition ) && ( aSinkPosition < aSinkDataBufferSize )); + + delete iSourceData; + delete iCodedData ; + iSourceData = NULL; + iCodedData = NULL; + iSourceData = CMMFDescriptorBuffer::NewL(aSrcDataBufferSize * sizeof(TUint8)); + iCodedData = CMMFDescriptorBuffer::NewL(aSinkDataBufferSize * sizeof(TUint8)); + //set the lengths of the buffers + iSourceData->Data().SetLength(aSrcDataBufferSize); + iCodedData->Data().SetLength(aSinkDataBufferSize); + + //set the positions on the buffers + iSourceData->SetPosition(aSrcPosition); + iCodedData->SetPosition(aSinkPosition); + + TRAP(result,iCodecUnderTest->ProcessL(*iSourceData, *iCodedData)); + + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +template +TVerdict CTestStepLoopTest::DoTestStepPreambleL(void) + { + iCodecUnderTest = new (ELeave) Codec; + return EPass; + } + +/** +* +* DoTestStepPostambleL +* +*/ +template +TVerdict CTestStepLoopTest::DoTestStepPostambleL(void) + { + delete iCodecUnderTest; + iCodecUnderTest = NULL; + delete iSourceData; + iSourceData = NULL; + delete iCodedData; + iCodedData = NULL; + return EPass; + } + +/** +* +* This is used for template instantiation. +* +**/ + +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; +template class CTestStepLoopTest; + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Loop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Loop.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,52 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_LOOP_H_ +#define __TSU_MMF_LOOP_H_ + +#include +#include "TSU_MMF_ACOD.h" +#include +#include + +/** +* +* class CTestStepLoopTest +* This class is responsible for testing the +* preconditions on the ProcessL method of the codecs. +* +*/ +template +class CTestStepLoopTest : public CTestStep_MMF_SwCodecDevices + { +public: + CTestStepLoopTest( TUint aTestIndex ); + virtual ~CTestStepLoopTest(); + virtual enum TVerdict DoTestStepL(); + virtual TVerdict DoTestStepPreambleL(void); + virtual TVerdict DoTestStepPostambleL(void); +private: + TInt CodecPreconditionTestL( TInt aSrcDataBufferSize, + TInt aSinkDataBufferSize, + TInt aSrcPosition = 0, + TInt aSinkPosition = 0 ); +private: + CMMFSwCodec* iCodecUnderTest; // sw codec under test + CMMFDataBuffer* iSourceData; // reference source data buffer + CMMFDataBuffer* iCodedData; // coded data buffer + }; + +#endif /* TSU_MMF_Loop_H_ */ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Oom.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Oom.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,290 @@ +// Copyright (c) 2003-2009 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: +// + +// EPOC includes +#include +#include + +// Test system includes +#include "TSU_MMF_DeviceSuite.h" +#include "TSU_MMF_Oom.h" + +//[ actual codec includes ] +#include "MmfPcm16toAlawhwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "mmfpcm16ToImaAdpcm.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcmS16topcmU16Codec.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmU16BeToPcmS16HwDevice.h" +#include "mmfpcmU16TopcmS16HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" + +//[ Codec Unit tests structure +// The unit tests shall use text files +// for small portions of test data +// which should be stored are stored in a simple format +// containing the relevant parameters for the test +//] +class TOomTestParams + { +public: + const TText* iTestName; // name of the test + }; + +// constant table of parameters for tests +const TOomTestParams KOomParameters[] = + { + {_S("MM-MMF-SWCODECDEVICES-U-0041-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0042-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0043-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0044-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0045-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0046-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0047-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0048-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0049-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0050-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0051-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0052-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0053-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0054-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0055-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0056-HP")} + }; + +/** +* +* CTestStepOomTest +* +*/ +template +CTestStepOomTest::CTestStepOomTest( TUint aTestIndex ) + { + // store the name of this test case + // this is the name that is used by the script file +// __ASSERT_DEBUG( (aTestIndex >= 0) && ( aTestIndex < sizeof(KOomParameters)/sizeof(TOomTestParams)),Panic(EBadInvariant)); + __ASSERT_DEBUG( ( aTestIndex < sizeof(KOomParameters)/sizeof(TOomTestParams)),Panic(EBadInvariant)); // EABI warning removal + iTestStepName = (&KOomParameters[aTestIndex])->iTestName; + } + +/** +* +* ~CTestStepOomTest +* +*/ +template +CTestStepOomTest::~CTestStepOomTest() + { + } + +/** +* +* DoTestStepL +* +**/ +template +TVerdict CTestStepOomTest::DoTestStepL() + { + TVerdict result = EPass; + + TBool testOK = ETrue; + TUint failCount = 1; + TBool testComplete = EFalse; + + while (!testComplete) + { + __UHEAP_FAILNEXT(failCount); + __MM_HEAP_MARK; + TRAPD(err, Oom()); + switch (err) + { + case KErrNoMemory : + break; + case KErrNone : + { + //attempt to allocate another cell. If this fails, we have tested all + //of the memory allocs carried out by ProcessL. + TAny *testAlloc = User::Alloc(1); + if (testAlloc==NULL) + { + testComplete = ETrue; + failCount --; + } + else + User::Free(testAlloc); + break; + } + default: + { + testOK = EFalse; + testComplete = ETrue; + break; + } + } + + __MM_HEAP_MARKEND; + __UHEAP_RESET; + failCount++; + } + + if(!testOK) + { + result = EFail; + } + + return result; + } + +/** +* +* Oom performs the oom test on the codec in question +* @param srcBuffer +* @param dstBuffer +* @return TInt error status +* +**/ +template +TInt CTestStepOomTest::Oom() + { + //instantiate codec via a factory function which allows + //two phase construction if needed as in the case of gsm610 + // by derivation. + Codec* theCodec = GetCodecL(); + CleanupStack::PushL(theCodec); + + //create buffers + TInt srcBufferSize = theCodec->SourceBufferSize(); + TInt sinkBufferSize = theCodec->SinkBufferSize(); + CMMFDataBuffer *srcBuffer = CMMFDataBuffer::NewL(srcBufferSize); + srcBuffer->Data().SetLength( srcBufferSize); + CleanupStack::PushL(srcBuffer); + CMMFDataBuffer *dstBuffer = CMMFDataBuffer::NewL(sinkBufferSize); + dstBuffer->Data().SetLength( sinkBufferSize ); + CleanupStack::PushL(dstBuffer); + + //[perform the coding operation] + theCodec->ProcessL(*srcBuffer, *dstBuffer); + + CleanupStack::PopAndDestroy(3,theCodec); //theCodec,dstBuffer, srcBuffer + return KErrNone; + } + +/** +* +* GetCodec() +* @return fully contrsucted codec pointer +* note the client of this function is responsible for deallocation +* +**/ +template +Codec* CTestStepOomTest::GetCodecL() + { + return new(ELeave) Codec(); + } + + +/** +* +* DoTestStepPreambleL +* +**/ +template +TVerdict CTestStepOomTest::DoTestStepPreambleL(void) + { + return EPass; + } + +/** +* +* DoTestStepPostambleL +* +*/ +template +TVerdict CTestStepOomTest::DoTestStepPostambleL(void) + { + return EPass; + } + +/** +* +* GetCodecL() +* @return CMMFGsm610ToPcm16Codec* +* +**/ +CMMFGsm610ToPcm16Codec* CTestStepGsm610ToPcm16OomTest::GetCodecL() + { + CMMFGsm610ToPcm16Codec* theCodec = new (ELeave) CMMFGsm610ToPcm16Codec; + CleanupStack::PushL(theCodec); + theCodec->ConstructL(); + CleanupStack::Pop(1); // theCodec + return theCodec; + } +/** +* +* GetCodecL +* @return CMMFGsm610ToPcm16Codec* +* +**/ +CMMFGsm610ToPcm16Codec* CTestStepPcm16ToGsm610OomTest::GetCodecL() + { + CMMFGsm610ToPcm16Codec* theCodec = new (ELeave) CMMFGsm610ToPcm16Codec(); + CleanupStack::PushL(theCodec); + theCodec->ConstructL(); + CleanupStack::Pop(1); // theCodec + return theCodec; + } + +/** +* +* This is used for template instantiation. +* +* Normally templated classes are defined in header files.. +* Here we use them in *.cpp which requires an explicit instantiation. +* We know that any other reference to CTestStepOomTest within +* this dll will instantiate the template and we do not want the compiler +* to remind us about that. +* +**/ + +#ifdef __VC32__ +#pragma warning( disable : 4660 ) +#endif + +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; +template class CTestStepOomTest; + +#ifdef __VC32__ +#pragma warning( default : 4660 ) +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Oom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_Oom.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,67 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_OOM_H_ +#define __TSU_MMF_OOM_H_ + +#include +#include "TSU_MMF_ACOD.h" +#include +#include +#include "GSM610.H" + +/** +* +* class CTestStepOomTest +* This class is responsible for testing the out of memory +* condition on all the codecs. +* +*/ +template +class CTestStepOomTest : public CTestStep_MMF_SwCodecDevices + { +public: + CTestStepOomTest( TUint aTestIndex ); + virtual ~CTestStepOomTest(); + virtual enum TVerdict DoTestStepL(); + virtual TVerdict DoTestStepPreambleL(void); + virtual TVerdict DoTestStepPostambleL(void); +protected: + virtual Codec* GetCodecL(); +private: + TInt Oom(); + }; + +class CTestStepGsm610ToPcm16OomTest: public CTestStepOomTest + { +public: + CTestStepGsm610ToPcm16OomTest( TUint aTestIndex) + : CTestStepOomTest(aTestIndex){}; +private: + virtual CMMFGsm610ToPcm16Codec* GetCodecL(); +}; + +class CTestStepPcm16ToGsm610OomTest: public CTestStepOomTest + { +public: + CTestStepPcm16ToGsm610OomTest( TUint aTestIndex) + : CTestStepOomTest(aTestIndex){}; +private: + virtual CMMFGsm610ToPcm16Codec* GetCodecL(); +}; + + +#endif /* TSU_MMF_OOM_H_ */ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,2148 @@ +// Copyright (c) 2003-2010 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: +// + +// EPOC includes +#include +#include +#include +#include + +// Test system includes +#include "TSU_MMF_SWCODECDEVICES.h" +#include "TSU_MMF_SwCodecDevices_BufferSizes.h" +#include "TSU_MMF_DeviceSuite.h" +#include +#include +#include +#include +#include "mmfpcm16ToImaAdpcm.h" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "GSM610.H" +#include "gsm610_types.h" + +//The marco is assumed to be identical to the original one defined in sf\os\mmaudio\mmlibs\mmfw\codecs\Inc\Gsm610CodecCommon\gsm610fr.h +#define PACKSIZE 65 // Size of one bit packed block (2 frames) + +/** +* +* CTestStep_MMF_SwCodecDevices +* +**/ +CTestStep_MMF_SwCodecDevices::CTestStep_MMF_SwCodecDevices() + { + iHeapSize = 300000; + } + +/** +* +* ~CTestStep_MMF_SwCodecDevices +* +*/ +CTestStep_MMF_SwCodecDevices::~CTestStep_MMF_SwCodecDevices() + { + } + +/** +* +* SetSuite +* @param aPtr ref to the test suite +* +**/ +void CTestStep_MMF_SwCodecDevices::SetSuite( CTestSuite_MMF_SwCodecDevices* aPtr ) + { + iRefSuite = aPtr; + } +/** +* +* GetSuite +* @return CTestSuite_MMF_SwCodecDevices* +* +**/ +CTestSuite_MMF_SwCodecDevices* CTestStep_MMF_SwCodecDevices::GetSuite() + { + return iRefSuite; + } +/** +* +* CTest_MMF_Gsm610 +* +*/ +CTest_MMF_Gsm610::CTest_MMF_Gsm610() + { + + } + +/** +* +* CTest_MMF_SwCodecDevices_U_0001 +* +*/ +CTest_MMF_SwCodecDevices_U_0001::CTest_MMF_SwCodecDevices_U_0001() + { + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0001-HP"); + } + +/** +* +* CTest_MMF_SwCodecDevices_U_0001 +* +**/ +CTest_MMF_SwCodecDevices_U_0001::~CTest_MMF_SwCodecDevices_U_0001() + { + + } +/** +* +* +* ~CTest_MMF_Gsm610 +* +*/ +CTest_MMF_Gsm610::~CTest_MMF_Gsm610() + { + // nothing to do .. + } + +/** +* +* +* DoTestStepL +* +*/ +TVerdict CTest_MMF_SwCodecDevices_U_0001::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass ; + + CMmfGsm610ToPcm16HwDevice* pDecoder = CMmfGsm610ToPcm16HwDevice::NewL(); + CleanupStack::PushL(pDecoder); + + // do the same for the inverse operation + CMmfPcm16ToGsm610HwDevice* pEncoder = CMmfPcm16ToGsm610HwDevice::NewL(); + CleanupStack::PushL(pEncoder); + CMMFSwCodec& theEncode = pEncoder->Codec(); + + //[ create buffers of the appropriate size ] + const TInt srcBufferSize = theEncode.SourceBufferSize(); + const TInt sinkBufferSize = theEncode.SinkBufferSize(); + const TInt codedBufferSize = 76*4* KNumFramesInABuffer; // number of coded buffers * size of coded buffer 63*2 + iNumCodedFrames = KNumFramesInABuffer; //XXX claculate these constants soon + + iScratchData = CMMFDescriptorBuffer::NewL( codedBufferSize); + + //[ pcm data buffers ] + iRefSrcData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + iDecodedData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + + //[ coded data buffers ] + iRefCodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + iRefDecodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + iCodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + + //[ for now process only the first few buffers + // and encode the data] + INFO_PRINTF1(_L("Encoding Frame...")); + TInt srcFileSize = 0; + iSrcFile.Size( srcFileSize); + TInt buffLen =iRefSrcData->Data().MaxLength(); + TInt numBuffers = srcFileSize/buffLen; + if( numBuffers > 4 ) // [ not all buffers are processed without error + // and this is the intention probably of the test sequences] + numBuffers = 4; + TInt badBufferCount = 0; + TInt goodBufferCount = 0; + + for( TInt bufferCount = 0; bufferCount < numBuffers; bufferCount++ ) + { + //[precondition pointers are ok] + ReadDataBufferL(iSrcFile, *iRefSrcData ); + + ParseCodedDataL(iRefCodedData); + + CMMFSwCodec::TCodecProcessResult encodeRes = theEncode.ProcessL( *iRefSrcData, *iCodedData ); + if( encodeRes != CMMFSwCodec::TCodecProcessResult::EProcessComplete ) + { + INFO_PRINTF1( _L("Error Failed to complete coding") ); + return EFail; + } + + //[ compare results ] + if( !CompareEncodeResults( iCodedData, iRefCodedData ) ) + { + result = EFail; + badBufferCount++; + } + else + { + goodBufferCount++; + } + + } + + //[ log number of good buffers & number of bad buffers ] + INFO_PRINTF4(_L("Good Buffers %d, Bad Buffers %d, Total Buffers %d"), + goodBufferCount, badBufferCount, badBufferCount+goodBufferCount ); + + //[pop data from the cleanup stack ] + CleanupStack::PopAndDestroy(2, pDecoder); //pDecoder, theCodec + + delete iRefSrcData; // reference source data + iRefSrcData = NULL; + delete iRefCodedData; //reference coded data + iRefCodedData = NULL; + delete iRefDecodedData; // reference decoded data + iRefDecodedData = NULL; + delete iCodedData; // buffer of coded data + iCodedData = NULL; + delete iDecodedData; // buffer of actual decoded data + iDecodedData = NULL; + delete iScratchData; // scratch data buffer + iScratchData = NULL; + + __MM_HEAP_MARKEND; + + return result; + } + +/** +* +* ParseCodedDataL +* +*/ +void CTest_MMF_Gsm610::ParseCodedDataL( CMMFDataBuffer* aBuffer ) + { + codes frame0; + codes frame1; + + //[ read all the coded data into the scratch buffer from reference file ] + ReadDataBufferL( iCodedFile, *iScratchData ); + TUint8* dest = const_cast(aBuffer->Data().Ptr()); + TUint8* src = const_cast(iScratchData->Data().Ptr()); + + //[ for all the coded frames parse these frames to proper coded form ] + for( TInt count = 0; count < iNumCodedFrames; count++ ) + { + // parse data to frame + ParseFrameL( frame0, src ); + ParseFrameL( frame1, src ); + //[ finally pack the two frames into the coded data buffer ] + PackFrame0( &frame0, reinterpret_cast(dest) ); + PackFrame1( &frame1, reinterpret_cast(dest) ); + dest+= KGsmFrameSize; + } + + aBuffer->Data().SetLength(KGsmFrameSize*iNumCodedFrames); + } +/** +* +* ParseFrame +* @param aFrame this stores the gsm frame in an unpacked structure +* @param aBuffer this contains the reference file data as 76 words +* +*/ +void CTest_MMF_Gsm610::ParseFrameL( struct codes& aFrame, TUint8* &aSrc ) + { + for(TInt i = 0; i < 8; i++ ) + { + aFrame.LARc[i] = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.LARc[i] |= static_cast(*aSrc++ << 8 ); + } + + for( TInt j = 0; j < 4; j++ ) + { + aFrame.sfc[j].Nc = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.sfc[j].Nc |= static_cast(*aSrc++ << 8 ); + aFrame.sfc[j].bc = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.sfc[j].bc |= static_cast(*aSrc++ << 8 ); + aFrame.sfc[j].Mc = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.sfc[j].Mc |= static_cast(*aSrc++ << 8 ); + aFrame.sfc[j].xmaxc = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.sfc[j].xmaxc |= static_cast(*aSrc++ << 8 ); + + for( TInt k = 0; k < 13; k++ ) + { + aFrame.sfc[j].xMc[k] = static_cast (*aSrc++ &KAndMask8bit ); + aFrame.sfc[j].xMc[k] |= static_cast(*aSrc++ << 8 ); + } + + } + + } + +/** +* +* DoTestStepPreambleL +* +*/ +enum TVerdict CTest_MMF_SwCodecDevices_U_0001::DoTestStepPreambleL(void) + { + TVerdict result = EPass; + //[ connect to the file server ] + User::LeaveIfError( iFs.Connect()); + + //[ read the ref source data ] + if(!GetStringFromConfig(_L("SectionOne"), _L("SourceData01"), iSourceDataFile) || + !GetStringFromConfig(_L("SectionOne"), _L("CodedData01"), iCodedDataFile) || + !GetStringFromConfig(_L("SectionOne"), _L("DecodedData01"), iDecodedDataFile) ) + { + return EInconclusive; + } + + //[ open the data files] + OpenFileL(iSrcFile,iSourceDataFile ); + OpenFileL(iCodedFile,iCodedDataFile ); + OpenFileL(iDecodeFile,iDecodedDataFile); + return result; + } + +/** +* +* CompareCodedResults +* @param aEncodedFrame +* @param aRefFrame +* @result TBool +* +*/ +TBool CTest_MMF_Gsm610::CompareEncodeResults( CMMFDataBuffer* aEncoded, CMMFDataBuffer* aRefFrame ) + { + TBool result = ETrue; + + //[precondition no encoded frames == refframes ] + __ASSERT_DEBUG(aEncoded,Panic(EBadArgument)); + __ASSERT_DEBUG(aRefFrame,Panic(EBadArgument)); + + TInt upperLimit = aEncoded->Data().Length()/KGsmFrameSize; + + const CMMFDataBuffer* encoded = STATIC_CAST(const CMMFDataBuffer*, aEncoded); + const CMMFDataBuffer* reference = STATIC_CAST(CMMFDataBuffer*, aRefFrame); + + TUint8* pFrames = CONST_CAST(TUint8*,encoded->Data().Ptr()); + TUint8* pRefFrames = CONST_CAST(TUint8*,reference->Data().Ptr()); + + TInt badFrameCount = 0; + TInt goodFrameCount = 0; + + //[ for all frames ] + for( TInt index = 0; index < upperLimit; index++ ) + { + //[ compare src and ref frame] + if( !CompareGsm610Frames( pFrames, pRefFrames )) + { + result = EFalse; + badFrameCount++; + INFO_PRINTF2(_L("Bad Frame Number: %d"), index ); + } + else{ + goodFrameCount++; + } + + //[ increment frame pointers by size of gsmencoded frame + pFrames += KGsmFrameSize; + pRefFrames += KGsmFrameSize; + } + + //[ log number of good frames & number of bad frames ] + INFO_PRINTF4(_L("Good Frames %d, Bad Frames %d, Total Frames %d"), + goodFrameCount, badFrameCount, badFrameCount+goodFrameCount ); + + return result ; + } + +/** +* +* CompareGsm610Frames +* This function compares two encoded gsm610 frames +* @result TBool Frames are the same or different +* +**/ +TBool CTest_MMF_Gsm610::CompareGsm610Frames( TUint8* aGsmFrame,TUint8* aRefGsmFrame ) + { + TBool result = ETrue; + ASSERT( aGsmFrame ); + __ASSERT_DEBUG(aGsmFrame,Panic(EBadArgument)); + __ASSERT_DEBUG(aRefGsmFrame,Panic(EBadArgument)); + + codes codeBuf0; + codes codeBuf1; + codes refCodeBuf0; + codes refCodeBuf1; + + UnpackFrame0(&codeBuf0, aGsmFrame ); + UnpackFrame1(&codeBuf1, aGsmFrame ); + UnpackFrame0(&refCodeBuf0, aRefGsmFrame ); + UnpackFrame1(&refCodeBuf1, aRefGsmFrame ); + + if( !Compare( codeBuf0, refCodeBuf0 ) || + !Compare( codeBuf1, refCodeBuf1) ) + + { + //LogGsmFrames( codeBuf0, refCodeBuf0 ); // add for debug reasons + //LogGsmFrames( codeBuf1, refCodeBuf1 ); // add for debugging reasons + result = EFalse; + } + + return result ; + } + +/** +* +* LogGsmFrames +* @param aGsmFrame +* @param aRefGsmFrame +* +**/ +void CTest_MMF_Gsm610::LogGsmFrames( codes& aGsmFrame, codes& aRefGsmFrame ) + { + //[ print the quantized lar coefficients ] + INFO_PRINTF1(_L("Coded Frame:")); + LogGsmFrame( aGsmFrame ); + INFO_PRINTF1(_L("Reference Frame:")); + LogGsmFrame( aRefGsmFrame ); + } + +/** +* +* LogGsmFrame +* prints a GsmFrame to the test log +* @param aFrame +* +**/ +void CTest_MMF_Gsm610::LogGsmFrame ( codes& aFrame ) + { + INFO_PRINTF2(_L("LARc[0] = %d"), aFrame.LARc[0]); + INFO_PRINTF2(_L("LARc[1] = %d"), aFrame.LARc[1]); + INFO_PRINTF2(_L("LARc[2] = %d"), aFrame.LARc[2]); + INFO_PRINTF2(_L("LARc[3] = %d"), aFrame.LARc[3]); + INFO_PRINTF2(_L("LARc[4] = %d"), aFrame.LARc[4]); + INFO_PRINTF2(_L("LARc[5] = %d"), aFrame.LARc[5]); + INFO_PRINTF2(_L("LARc[6] = %d"), aFrame.LARc[6]); + INFO_PRINTF2(_L("LARc[7] = %d"), aFrame.LARc[7]); + + //[ for each sub frame print its data ] + for( TInt i = 0; i < 4; i++ ) + { + INFO_PRINTF2(_L("Nc = %d"), aFrame.sfc[i].Nc); + INFO_PRINTF2(_L("bc = %d"), aFrame.sfc[i].bc); + INFO_PRINTF2(_L("Mc= %d"), aFrame.sfc[i].Mc); + INFO_PRINTF2(_L("xmaxc = %d"), aFrame.sfc[i].xmaxc); + INFO_PRINTF2(_L("xMc[0] = %d"), aFrame.sfc[i].xMc[0]); + INFO_PRINTF2(_L("xMc[1] = %d"), aFrame.sfc[i].xMc[1]); + INFO_PRINTF2(_L("xMc[2] = %d"), aFrame.sfc[i].xMc[2]); + INFO_PRINTF2(_L("xMc[3] = %d"), aFrame.sfc[i].xMc[3]); + INFO_PRINTF2(_L("xMc[4] = %d"), aFrame.sfc[i].xMc[4]); + INFO_PRINTF2(_L("xMc[5] = %d"), aFrame.sfc[i].xMc[5]); + INFO_PRINTF2(_L("xMc[6] = %d"), aFrame.sfc[i].xMc[6]); + INFO_PRINTF2(_L("xMc[7] = %d"), aFrame.sfc[i].xMc[7]); + INFO_PRINTF2(_L("xMc[8] = %d"), aFrame.sfc[i].xMc[8]); + INFO_PRINTF2(_L("xMc[9] = %d"), aFrame.sfc[i].xMc[9]); + INFO_PRINTF2(_L("xMc[10] = %d"), aFrame.sfc[i].xMc[10]); + INFO_PRINTF2(_L("xMc[11] = %d"), aFrame.sfc[i].xMc[11]); + INFO_PRINTF2(_L("xMc[12] = %d"), aFrame.sfc[i].xMc[12]); + } + } + +/** +* +* Compare +* +**/ +TBool CTest_MMF_Gsm610::Compare( codes& aFrame1, codes& aFrame2 ) + { + TBool result = ETrue; + + if( (aFrame1.LARc[0] != aFrame2.LARc[0] ) || + (aFrame1.LARc[1] != aFrame2.LARc[1] ) || + (aFrame1.LARc[2] != aFrame2.LARc[2] ) || + (aFrame1.LARc[3] != aFrame2.LARc[3] ) || + (aFrame1.LARc[4] != aFrame2.LARc[4] ) || + (aFrame1.LARc[5] != aFrame2.LARc[5] ) || + (aFrame1.LARc[6] != aFrame2.LARc[6] ) || + (aFrame1.LARc[7] != aFrame2.LARc[7] ) ) + { + result = EFalse; + } + + for( TInt i = 0; i < 4; i++ ) + { + if( + (aFrame1.sfc[i].Nc != aFrame2.sfc[i].Nc) || + (aFrame1.sfc[i].bc != aFrame2.sfc[i].bc) || + (aFrame1.sfc[i].Mc != aFrame2.sfc[i].Mc) || + (aFrame1.sfc[i].xmaxc != aFrame2.sfc[i].xmaxc) || + (aFrame1.sfc[i].xMc[0] != aFrame2.sfc[i].xMc[0]) || + (aFrame1.sfc[i].xMc[1] != aFrame2.sfc[i].xMc[1]) || + (aFrame1.sfc[i].xMc[2] != aFrame2.sfc[i].xMc[2]) || + (aFrame1.sfc[i].xMc[3] != aFrame2.sfc[i].xMc[3]) || + (aFrame1.sfc[i].xMc[4] != aFrame2.sfc[i].xMc[4]) || + (aFrame1.sfc[i].xMc[5] != aFrame2.sfc[i].xMc[5]) || + (aFrame1.sfc[i].xMc[6] != aFrame2.sfc[i].xMc[6]) || + (aFrame1.sfc[i].xMc[7] != aFrame2.sfc[i].xMc[7]) || + (aFrame1.sfc[i].xMc[8] != aFrame2.sfc[i].xMc[8]) || + (aFrame1.sfc[i].xMc[9] != aFrame2.sfc[i].xMc[9]) || + (aFrame1.sfc[i].xMc[10] != aFrame2.sfc[i].xMc[10]) || + (aFrame1.sfc[i].xMc[11] != aFrame2.sfc[i].xMc[11]) || + (aFrame1.sfc[i].xMc[12] != aFrame2.sfc[i].xMc[12])) + { + result = EFail; + } + } + + return result; + } + +/** +* +* CompareCodedResults +* +*/ +TBool CTest_MMF_Gsm610::CompareDecodeResults(CMMFDataBuffer* aEncoded, CMMFDataBuffer* aRefFrame ) + { + TBool result = ETrue; + + //[ precondition the buffers are of the same length ] + __ASSERT_DEBUG(aEncoded,Panic(EBadArgument)); + __ASSERT_DEBUG(aRefFrame,Panic(EBadArgument)); + __ASSERT_DEBUG(aEncoded->Data().MaxLength() == aRefFrame->Data().MaxLength(),Panic(EBadArgument)); + + TUint8 *pResults = CONST_CAST(TUint8*,aEncoded->Data().Ptr()); + TUint8 *pRefData = CONST_CAST(TUint8*,aRefFrame->Data().Ptr()); + TInt numResults = aEncoded->Data().MaxLength(); + + if (Mem::Compare( pResults,numResults,pRefData,numResults)!=0) + { + result = EFalse; + } + + return result ; + } +/** +* +* ReadDataL +* Reads entire data file into buffer +* +**/ +void CTest_MMF_Gsm610::ReadDataL( CMMFDataBuffer*& aBuffer, const TDesC& aFile1 ) + { + TFileName fileName = GetSuite()->DefaultPath(); + fileName.Append(aFile1); + + RFile file1; + User::LeaveIfError(file1.Open(iFs, fileName, EFileShareAny | EFileStream | EFileRead)); + CleanupClosePushL(file1); + TInt fileSize = 0; + User::LeaveIfError(file1.Size(fileSize)); + aBuffer = CMMFDescriptorBuffer::NewL(fileSize); + User::LeaveIfError(file1.Read( aBuffer->Data(),fileSize)); + CleanupStack::PopAndDestroy(1); //file1 + } + +/** +* +* OpenFileL +* @param aFile +* @param aFileName +* +**/ +void CTest_MMF_Gsm610::OpenFileL( RFile& aFile, const TDesC& aFileName ) + { + User::LeaveIfError(aFile.Open(iFs, aFileName, EFileShareAny | EFileStream | EFileRead)); + } + +/** +* +* CloseFileL +* @param aFile +* +**/ +void CTest_MMF_Gsm610::CloseFileL( RFile& aFile ) + { + aFile.Close(); + } + +/** +* +* ReadDataBuffer +* @param aFile +* assumes file reads sufficient data +* +**/ +void CTest_MMF_Gsm610::ReadDataBufferL( const RFile& aFile, CMMFDataBuffer& aBuffer ) + { + //[ The read will set the length of the descriptor to the number of bytes read] + User::LeaveIfError(aFile.Read( aBuffer.Data(),aBuffer.Data().MaxLength() )); + INFO_PRINTF2(_L("Bytes read = %d"), aBuffer.Data().Length() ); + } + +/** +* +* FillPcmBuffer +* @param aSrcBuffer +* Fill a buffer with a sine wave +* +**/ +void CTest_MMF_Gsm610::FillPcmBuffer( CMMFDataBuffer& aSrcBuffer ) + { + //fill the Src Buffer + TUint8* pDst = CONST_CAST(TUint8*,aSrcBuffer.Data().Ptr()); + TInt length = aSrcBuffer.Data().MaxLength(); + + //[encode the data] + TInt16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + for(TInt i=0; i( 1000 * val ); + *pDst++ = static_cast( srcValue & KAndMask8bit); + *pDst++ = static_cast((srcValue >> 8) & KAndMask8bit ); + //INFO_PRINTF2(_L("Sine = %d"), srcValue ); //uncomment for debugging purposes + } + + aSrcBuffer.Data().SetLength(length); + + } + +/** +* +* DoTestStepPostambleL +* @result TVerdict +* +*/ +TVerdict CTest_MMF_SwCodecDevices_U_0001::DoTestStepPostambleL(void) + { + // close files + CloseFileL( iSrcFile ); + CloseFileL( iCodedFile ); + CloseFileL( iDecodeFile ); + //[ clean up the buffers etc ] + delete iRefSrcData; // reference source data + delete iRefCodedData; //reference coded data + delete iRefDecodedData; // reference decoded data + delete iCodedData; // buffer of coded data + delete iDecodedData; // buffer of actual decoded data + delete iScratchData; // scratch data buffer + return EPass; + } + +/** +* +* UnpackFrame0 +* @param aCodeBuf +* @param pbuf +* +**/ +void CTest_MMF_Gsm610::UnpackFrame0(codes* aCodeBuf, TUint8* pbuf) + { + TInt16* LAR = aCodeBuf->LARc; + + // unpack the LAR[0..7] from the first 4.5 bytes + LAR[0] = (TInt16)((pbuf[0] & 0x3F)); + LAR[1] = (TInt16)(((pbuf[0] & 0xC0) >> 6) | ((pbuf[1] & 0x0F) << 2)); + LAR[2] = (TInt16)(((pbuf[1] & 0xF0) >> 4) | ((pbuf[2] & 0x01) << 4)); + LAR[3] = (TInt16)(((pbuf[2] & 0x3E) >> 1)); + LAR[4] = (TInt16)(((pbuf[2] & 0xC0) >> 6) | ((pbuf[3] & 0x03) << 2)); + LAR[5] = (TInt16)(((pbuf[3] & 0x3C) >> 2)); + LAR[6] = (TInt16)(((pbuf[3] & 0xC0) >> 6) | ((pbuf[4] & 0x01) << 2)); + LAR[7] = (TInt16)(((pbuf[4] & 0x0E) >> 1)); + + // unpack Nc, bc, Mc, xmaxc, and xMc for each of the 4 sub-frames + for(TInt i = 0; i < 4; i++) + { + struct sfcodes& c = aCodeBuf->sfc[i]; +#define sfb(x) (pbuf[4+i*7+x]) + c.Nc = (TInt16)(((sfb(0) & 0xF0) >> 4) | ((sfb(1) & 0x07) << 4)); + c.bc = (TInt16)(((sfb(1) & 0x18) >> 3)); + c.Mc = (TInt16)(((sfb(1) & 0x60) >> 5)); + c.xmaxc = (TInt16)(((sfb(1) & 0x80) >> 7) | ((sfb(2) & 0x1F) << 1)); + c.xMc[0] = (TInt16)(((sfb(2) & 0xE0) >> 5)); + c.xMc[1] = (TInt16)((sfb(3) & 0x07)); + c.xMc[2] = (TInt16)(((sfb(3) & 0x3C) >> 3)); + c.xMc[3] = (TInt16)(((sfb(3) & 0xC0) >> 6) | ((sfb(4) & 0x01) << 2)); + c.xMc[4] = (TInt16)(((sfb(4) & 0x0E) >> 1)); + c.xMc[5] = (TInt16)(((sfb(4) & 0x70) >> 4)); + c.xMc[6] = (TInt16)(((sfb(4) & 0x80) >> 7) | ((sfb(5) & 0x03) << 1)); + c.xMc[7] = (TInt16)(((sfb(5) & 0x1C) >> 2)); + c.xMc[8] = (TInt16)(((sfb(5) & 0xE0) >> 5)); + c.xMc[9] = (TInt16)((sfb(6) & 0x07)); + c.xMc[10] = (TInt16)(((sfb(6) & 0x38) >> 3)); + c.xMc[11] = (TInt16)(((sfb(6) & 0xC0) >> 6) | ((sfb(7) & 0x01) << 2)); + c.xMc[12] = (TInt16)(((sfb(7) & 0x0E) >> 1)); +#undef sfb + } + } + +/** +* +* UnpackFrame1 +* @param aCodeBuf +* @param pbuf +* +**/ +void CTest_MMF_Gsm610::UnpackFrame1(struct codes* aCodeBuf, TUint8* pbuf) +{ + TInt16* LAR = aCodeBuf->LARc; + + // unpack the LAR[0..7] from the first 4.5 bytes + LAR[0] = (TInt16)(((pbuf[32] & 0xF0) >> 4) | ((pbuf[33] & 0x03) << 4)); + LAR[1] = (TInt16)(((pbuf[33] & 0xFC) >> 2)); + LAR[2] = (TInt16)(((pbuf[34] & 0x1F))); + LAR[3] = (TInt16)(((pbuf[34] & 0xE0) >> 5) | ((pbuf[35] & 0x03) << 3)); + LAR[4] = (TInt16)(((pbuf[35] & 0x3C) >> 2)); + LAR[5] = (TInt16)(((pbuf[35] & 0xC0) >> 6) | ((pbuf[36] & 0x03) << 2)); + LAR[6] = (TInt16)(((pbuf[36] & 0x1C) >> 2)); + LAR[7] = (TInt16)(((pbuf[36] & 0xE0) >> 5)); + + // unpack Nc, bc, Mc, xmaxc, and xMc for each of the 4 sub-frames + for(TInt i = 0; i < 4; i++) + { + struct sfcodes& c = aCodeBuf->sfc[i]; +#define sfb(x) (pbuf[37+i*7+x]) + c.Nc = (TInt16)(sfb(0) & 0x7F); + c.bc = (TInt16)(((sfb(0) & 0x80) >> 7) | ((sfb(1) & 0x01) << 1)); + c.Mc = (TInt16)(((sfb(1) & 0x06) >> 1)); + c.xmaxc = (TInt16)(((sfb(1) & 0xF8) >> 3) | ((sfb(2) & 0x01) << 5)); + c.xMc[0] = (TInt16)(((sfb(2) & 0x0E) >> 1)); + c.xMc[1] = (TInt16)(((sfb(2) & 0x70) >> 4)); + c.xMc[2] = (TInt16)(((sfb(2) & 0x80) >> 7) | ((sfb(3) & 0x03) << 1)); + c.xMc[3] = (TInt16)(((sfb(3) & 0x1C) >> 2)); + c.xMc[4] = (TInt16)(((sfb(3) & 0xE0) >> 5)); + c.xMc[5] = (TInt16)(((sfb(4) & 0x07))); + c.xMc[6] = (TInt16)(((sfb(4) & 0x38) >> 3)); + c.xMc[7] = (TInt16)(((sfb(4) & 0xC0) >> 6) | ((sfb(5) & 0x01) << 2)); + c.xMc[8] = (TInt16)(((sfb(5) & 0x0E) >> 1)); + c.xMc[9] = (TInt16)(((sfb(5) & 0x70) >> 4)); + c.xMc[10] = (TInt16)(((sfb(5) & 0x80) >> 7) | ((sfb(6) & 0x03) << 1)); + c.xMc[11] = (TInt16)(((sfb(6) & 0x1C) >> 2)); + c.xMc[12] = (TInt16)(((sfb(6) & 0xE0) >> 5)); + +#undef sfb + } + } + +/** +* +* PackFrame0 +* Pack the codewords of the even frame into pack buffer. +* Packing as in MS gsm610 encoder. +* @param aCodeBuf Code words for one speech frame. +* @param pbuf the output buffer +* +**/ +void CTest_MMF_Gsm610::PackFrame0(struct codes* aCodeBuf, TInt8* pbuf) + { + TInt16* LAR = aCodeBuf->LARc; + + // pack the LARc[0..7] into the first 4.5 bytes + *pbuf++ = (TUint8)(((LAR[0] ) & 0x3F) | ((LAR[1] << 6) & 0xC0)); + *pbuf++ = (TUint8)(((LAR[1] >> 2) & 0x0F) | ((LAR[2] << 4) & 0xF0)); + *pbuf++ = (TUint8)(((LAR[2] >> 4) & 0x01) | ((LAR[3] << 1) & 0x3E) | ((LAR[4] << 6) & 0xC0)); + *pbuf++ = (TUint8)(((LAR[4] >> 2) & 0x03) | ((LAR[5] << 2) & 0x3C) | ((LAR[6] << 6) & 0xC0)); + *pbuf = (TUint8)(((LAR[6] >> 2) & 0x01) | ((LAR[7] << 1) & 0x0E)); + + // pack Nc, bc, Mc, xmaxc, and xMc for each of the 4 sub-frames + for(TInt i = 0; i < 4; i++) + { + struct sfcodes& c = aCodeBuf->sfc[i]; + *pbuf++ |= ((c.Nc << 4) & 0xF0); + *pbuf++ = (TUint8)(((c.Nc >> 4) & 0x07) | ((c.bc << 3) & 0x18) | ((c.Mc << 5) & 0x60) | ((c.xmaxc << 7) & 0x80)); + *pbuf++ = (TUint8)(((c.xmaxc >> 1) & 0x1F) | ((c.xMc[0] << 5) & 0xE0)); + *pbuf++ = (TUint8)((c.xMc[1] & 0x07) | ((c.xMc[2] << 3) & 0x38) | ((c.xMc[3] << 6) & 0xC0)); + *pbuf++ = (TUint8)(((c.xMc[3] >> 2) & 0x01) | ((c.xMc[4] << 1) & 0x0E) | ((c.xMc[5] << 4) & 0x70) | ((c.xMc[6] << 7) & 0x80)); + *pbuf++ = (TUint8)(((c.xMc[6] >> 1) & 0x03) | ((c.xMc[7] << 2) & 0x1C) | ((c.xMc[8] << 5) & 0xE0)); + *pbuf++ = (TUint8)((c.xMc[9] & 0x07) | ((c.xMc[10] << 3) & 0x38) | ((c.xMc[11] << 6) & 0xC0)); + *pbuf = (TUint8)(((c.xMc[11] >> 2) & 0x01) | ((c.xMc[12] << 1) & 0x0E)); + } + } + +/** +* +* PackFrame1 +* Pack the codewords of the even frame into pack buffer. +* Packing as in MS gsm610 encoder. +* @param aCodeBuf Code words for one speech frame. +* @param pbuf the output buffer +* +**/ +void CTest_MMF_Gsm610::PackFrame1(struct codes* aCodeBuf, TInt8* pbuf) + { + TInt16* LAR = aCodeBuf->LARc; + + pbuf += (PACKSIZE / 2); + + // pack the LARc[0..7] into the first 4.5 bytes, starting with the msb of the first byte + *pbuf++ = (TUint8) (pbuf[0] | ((LAR[0] << 4) & 0xF0)); + *pbuf++ = (TUint8)(((LAR[0] >> 4) & 0x03) | ((LAR[1] << 2) & 0xFC)); + *pbuf++ = (TUint8)(((LAR[2] ) & 0x1F) | ((LAR[3] << 5) & 0xE0)); + *pbuf++ = (TUint8)(((LAR[3] >> 3) & 0x03) | ((LAR[4] << 2) & 0x3C) | ((LAR[5] << 6) & 0xC0)); + *pbuf++ = (TUint8)(((LAR[5] >> 2) & 0x03) | ((LAR[6] << 2) & 0x1C) | ((LAR[7] << 5) & 0xE0)); + + // pack Nc, bc, Mc, xmaxc, and xMc for each of the 4 sub-frames + for(TInt i = 0; i < 4; i++) + { + struct sfcodes& c = aCodeBuf->sfc[i]; + *pbuf++ = (TUint8)((c.Nc & 0x7F) | ((c.bc << 7) & 0x80)); + *pbuf++ = (TUint8)(((c.bc >> 1) & 0x01) | ((c.Mc << 1) & 0x06) | ((c.xmaxc << 3) & 0xF8)); + *pbuf++ = (TUint8)(((c.xmaxc >> 5) & 0x01) | ((c.xMc[0] << 1) & 0x0E) | ((c.xMc[1] << 4) & 0x70) | ((c.xMc[2] << 7) & 0x80)); + *pbuf++ = (TUint8)(((c.xMc[2] >> 1) & 0x03) | ((c.xMc[3] << 2) & 0x1C) | ((c.xMc[4] << 5) & 0xE0)); + *pbuf++ = (TUint8)(((c.xMc[5]) & 0x07) | ((c.xMc[6] << 3) & 0x38) | ((c.xMc[7] << 6) & 0xC0)); + *pbuf++ = (TUint8)(((c.xMc[7] >> 2) & 0x01) | ((c.xMc[8] << 1) & 0x0E) | ((c.xMc[9] << 4) & 0x70) | ((c.xMc[10] << 7) & 0x80)); + *pbuf++ = (TUint8)(((c.xMc[10] >> 1) & 0x03) | ((c.xMc[11] << 2) & 0x1C) | ((c.xMc[12] << 5) & 0xE0)); + } + } + +/** +* +* CTest_MMF_SwCodecDevices_U_0001 +* +*/ +CTest_MMF_SwCodecDevices_U_0002::CTest_MMF_SwCodecDevices_U_0002() + { + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0002-HP"); + } +/** +* +* CTest_MMF_SwCodecDevices_U_0001 +* +**/ +CTest_MMF_SwCodecDevices_U_0002::~CTest_MMF_SwCodecDevices_U_0002() + { + + } + +/** +* +* +* DoTestStepL +* +**/ +TVerdict CTest_MMF_SwCodecDevices_U_0002::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass ; + + CMmfGsm610ToPcm16HwDevice* pDecoder = CMmfGsm610ToPcm16HwDevice::NewL(); + CleanupStack::PushL(pDecoder); + //[ note this reference should be a ptr ] + CMMFSwCodec& theCodec = pDecoder->Codec(); + + //[ create buffers of the appropriate size ] + const TInt srcBufferSize = theCodec.SourceBufferSize(); + const TInt sinkBufferSize = theCodec.SinkBufferSize(); + const TInt codedBufferSize = 76*4* KNumFramesInABuffer; // number of coded buffers * size of coded buffer 63*2 + iNumCodedFrames = KNumFramesInABuffer; //XXX claculate these constants soon + + iScratchData = CMMFDescriptorBuffer::NewL( codedBufferSize); + + iRefCodedData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + iCodedData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + iRefDecodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + iDecodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize); + + //[ for now process only the first buffer ] + //[encode the data] + INFO_PRINTF1(_L("Decoding Frames...")); + TInt codedFileSize = 0; + iCodedFile.Size( codedFileSize); + + TInt numBuffers = codedFileSize/srcBufferSize; + if(numBuffers > 4 ) + numBuffers = 4; + TInt badBufferCount = 0; + TInt goodBufferCount = 0; + for( TInt bufferCount = 0; bufferCount < numBuffers; bufferCount++ ) + { + ReadDataBufferL(iDecodeFile, *iRefDecodedData ); + ParseCodedDataL(iCodedData); + + CMMFSwCodec::TCodecProcessResult decodeRes = theCodec.ProcessL( *iCodedData, *iDecodedData ); + if( decodeRes != CMMFSwCodec::TCodecProcessResult::EProcessComplete ) + { + INFO_PRINTF1( _L("Error Failed to complete decoding") ); + return EFail; + } + + //[ compare results ] + if(!CompareDecodeResults( iDecodedData, iRefDecodedData )) + { + result = EFail; + badBufferCount++; + } + else + { + goodBufferCount++; + } + + } + + //[ log number of good frames & number of bad frames ] + INFO_PRINTF4(_L("Good Frames %d, Bad Frames %d, Total Frames %d"), + goodBufferCount, badBufferCount, badBufferCount+goodBufferCount ); + + //[pop data from the cleanup stack ] + CleanupStack::PopAndDestroy(pDecoder); + + delete iRefCodedData; + iRefCodedData = NULL; + delete iRefDecodedData; + iRefDecodedData = NULL; + delete iDecodedData; + iDecodedData = NULL; + delete iCodedData ; + iCodedData = NULL; + delete iScratchData; + iScratchData = NULL; + + __MM_HEAP_MARKEND; + return result; + } + +/** +* +* DoTestStepPreambleL +* +*/ +enum TVerdict CTest_MMF_SwCodecDevices_U_0002::DoTestStepPreambleL(void) + { + TVerdict result = EPass; + //[ connect to the file server ] + User::LeaveIfError( iFs.Connect()); + + //[ read the ref source data ] + if(!GetStringFromConfig(_L("SectionOne"), _L("SourceData01"), iSourceDataFile) || + !GetStringFromConfig(_L("SectionOne"), _L("CodedData01"), iCodedDataFile) || + !GetStringFromConfig(_L("SectionOne"), _L("DecodedData01"), iDecodedDataFile) ) + { + return EInconclusive; + } + + //[ open the data files] + OpenFileL(iSrcFile,iSourceDataFile ); + OpenFileL(iCodedFile,iCodedDataFile ); + OpenFileL(iDecodeFile,iDecodedDataFile); + + iScratchData = CMMFDescriptorBuffer::NewL(KCodedBufferSize); + + return result; + } + +/** +* +* DoTestStepPostambleL +* @result TVerdict +* +*/ +TVerdict CTest_MMF_SwCodecDevices_U_0002::DoTestStepPostambleL(void) + { + // close files + CloseFileL( iCodedFile ); + CloseFileL( iDecodeFile ); + //[ clean up the buffers etc ] + delete iRefSrcData; // reference source data + delete iRefCodedData; //reference coded data + delete iRefDecodedData; // refernce decoded data + delete iCodedData; // buffer of coded data + delete iDecodedData; // buffer of actual decoded data + delete iScratchData; // scratch data buffer + return EPass; + } + +/** +* +* CTest_MMF_SwCodecDevices_U_0003 +* +**/ +CTest_MMF_SwCodecDevices_U_0003::CTest_MMF_SwCodecDevices_U_0003() + { + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0003-HP"); + } +/** +* +* ~CTest_MMF_SwCodecDevices_U_0003 +* +**/ +CTest_MMF_SwCodecDevices_U_0003::~CTest_MMF_SwCodecDevices_U_0003() + { + + } + +/** +* +* DoTestStepL +* +**/ +TVerdict CTest_MMF_SwCodecDevices_U_0003::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass ; + + CMmfGsm610ToPcm16HwDevice* pDecoder = CMmfGsm610ToPcm16HwDevice::NewL(); + CleanupStack::PushL(pDecoder); + //[ note this reference should be a ptr ] + CMMFSwCodec& theCodec = pDecoder->Codec(); + + // do the same for the inverse operation + CMmfPcm16ToGsm610HwDevice* pEncoder = CMmfPcm16ToGsm610HwDevice::NewL(); + CleanupStack::PushL(pEncoder); + CMMFSwCodec& theEncode = pEncoder->Codec(); + + //[ create buffers of the appropriate size ] + const TInt srcBufferSize = theEncode.SourceBufferSize(); + const TInt sinkBufferSize = theEncode.SinkBufferSize(); + + iRefSrcData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + iRefCodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + iRefDecodedData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + iCodedData = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + iDecodedData = CMMFDescriptorBuffer::NewL( srcBufferSize ); + + //[ now get a sine wave of 800hz, code and decode and + // compare the results ] + FillPcmBuffer( *iRefSrcData ); + + // encode + CMMFSwCodec::TCodecProcessResult encodeRes = theEncode.ProcessL( *iRefSrcData, *iCodedData ); + if( encodeRes != CMMFSwCodec::TCodecProcessResult::EProcessComplete ) + { + INFO_PRINTF1( _L("Error Failed to complete coding") ); + return EFail; + } + + //decode + CMMFSwCodec::TCodecProcessResult decodeRes = theCodec.ProcessL( *iCodedData, *iDecodedData ); + if( decodeRes != CMMFSwCodec::TCodecProcessResult::EProcessComplete ) + { + INFO_PRINTF1( _L("Error Failed to complete decoding") ); + return EFail; + } + + //[ because the codec overwrites its input regenerate it ] + FillPcmBuffer( *iRefSrcData ); + + //[ NOW COMPARE THE RESULTS DISTORTION < 18 DB ] + + TUint8 *pResults = (TUint8*)(iDecodedData->Data().Ptr()); + TUint8 *pRefData = (TUint8*)(iRefSrcData->Data().Ptr()); + TInt numResults = iDecodedData->Data().MaxLength(); + TReal sum1 = 0.0; + TReal sum2 = 0.0; + TReal ratio = 0.0; + TInt16 temp1 = 0; + TInt16 temp2 = 0; + numResults /= 2; // compensate for bytes to short conversion + //[print the results to allow analysis] + for( TInt index = 0; index < numResults; index++ ) + { + temp1 = static_cast((*pResults++) &KAndMask8bit); + temp1 |= static_cast((*pResults++ << 8)); + sum1 += temp1*temp1; + temp2 = static_cast((*pRefData++) &KAndMask8bit); + temp2 |= static_cast((*pRefData++ << 8)); + sum2 += (temp2-temp1)*(temp2-temp1); + //INFO_PRINTF3( _L("S %d D %d"),temp2, temp1 ); // add for debugging purposes + } + + //[calculate the ratio ] + ratio = sum1; + ratio /=sum2; + TReal sn = 0.0; + // calculate as 18db + Math::Log( sn, ratio ); + sn *= 10; + + INFO_PRINTF2( _L("Signal to Noise Ratio @800Hz %f db"), sn ); +#ifdef EABI + if( sn < 18 ) //[ @800hz a sn of less than 18db is deemed a failure + // not that sn is a great measure of a voice coder's quality] + result = EFail ; +#else + if( sn < 14 ) //DEF086144 - Codec source buffer size is reduced + result = EFail ; +#endif + //[pop data from the cleanup stack ] + CleanupStack::PopAndDestroy(2, pDecoder); //pDecoder, theCodec, + delete iRefSrcData; + iRefSrcData = NULL; + delete iRefCodedData; + iRefCodedData = NULL; + delete iRefDecodedData; + iRefDecodedData = NULL; + delete iCodedData; + iCodedData = NULL; + delete iDecodedData; + iDecodedData = NULL; + + __MM_HEAP_MARKEND; + + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +TVerdict CTest_MMF_SwCodecDevices_U_0003::DoTestStepPreambleL(void) + { + return EPass; + } + +/** +* +* DoTestStepPostambleL +* +**/ +TVerdict CTest_MMF_SwCodecDevices_U_0003::DoTestStepPostambleL(void) + { + return EPass; + } + +/** +* +* FillSrcBufferL +* @param aSrcData pointer to the src data which stores 16bit samples +* @param aNoSamples number of 16bit samples to store +* @param aOffset offset used to generate the samples (linear range) +**/ +void TLawUtility::FillSrcBufferL( TUint8* aSrcData, TInt aNoSamples, TInt16 aOffset ) + { + //[precondition aSrcData != NULL ] + if( !aSrcData ) + User::Leave( KErrArgument ); + const TInt16 KUpperLimit = static_cast(aOffset + aNoSamples); + TUint8* pDest = aSrcData ; + for( TInt16 i = aOffset; i< KUpperLimit; i++ ) + { + *pDest++ = static_cast( i & 0xff); + *pDest++ = static_cast( (i >>8) &0xff ); + } + } + +/** +* +* CompareCodedData +* @param aCodedData the data coded using symbian codec +* @param aRefCodedData the data coded using independent implementation +* @param aNoSamples the number of coded samples +* +**/ +TInt TLawUtility::CompareCodedDataL(TUint8* aCodedData,TUint8* aRefCodedData, TInt aNoSamples ) + { + TInt result = KErrNone; + //[precondition aCodedData != NULL ] + if( !aCodedData ) + User::Leave( KErrArgument); + //[preciondition aRefCodedData != NULL ] + if( !aRefCodedData ) + User::Leave( KErrArgument ); + + //[ use mem compare to compare the data Buffers ] + if( Mem::Compare(aCodedData, aNoSamples, aRefCodedData, aNoSamples )!=0) + { + //[ data is not the same ] + for( TInt count = 0; count < aNoSamples; count++ ) + { + //RDebug::Print(_L("c1 %u c2 %u"), *aCodedData++, *aRefCodedData++); Statement commented under DEF105143 + *aCodedData++; + *aRefCodedData++; + } + result = KErrCorrupt; + } + + return result; + } + +/** +* +* AssembleValL +* @param aDecodedData +* @return decoded value +* +**/ +TInt16 TLawUtility::AssembleValL(TUint8* aDecodedData) + { + TInt16 val; + if(!aDecodedData ) + User::Leave( KErrArgument); + + //assemble the value + val = static_cast( aDecodedData[0] &KAndMask8bit); + val |= static_cast((aDecodedData[1] << 8 )); + + return val; + } + +/** +* +* SNRatio +* +**/ +TReal TLawUtility::SNRatioL(TUint8* aDecodedData, TUint8* aSrcData, TInt aNoSamples ) + { + const TReal KThreshold = 0.0001; + TReal ratio = 0.0; + //[precondition aDecodedData != NULL ] + if( !aDecodedData ) + User::Leave( KErrArgument ); + //[ precondition aSrcData != NULL ] + if( !aSrcData ) + User::Leave( KErrArgument ); + + TReal sumSig = 0.0; // numerator + TReal sumNoise = 0.0; // denominator + TInt difference = 0; + TInt16 dataValue = 0; + TInt decodeVal = 0; + for( TInt count = 0; count < aNoSamples; count++ ) + { + decodeVal = AssembleValL(aDecodedData); + dataValue = AssembleValL(aSrcData); + difference = decodeVal - dataValue; + sumSig += (decodeVal*decodeVal); // sum of the squares of the signal + sumNoise += (difference * difference ); // sum of the square of the difference + aDecodedData+=2; + aSrcData+=2; + } + + //[ guard against division by zero ] + if( !( sumNoise >= KThreshold )) + User::Leave( KErrUnderflow ); + + //[ calculate the sn ratio ] + //[ 10log10( sumSig/SumNoise ] + Math::Log( ratio, (sumSig/sumNoise) ); + ratio *= 10; // ratio = 10*log( x**2/(error**2)) in db + return ratio; + } + +/** +* +* CompareSNRatiosL +* @param aCodecSN codec under test SN ratio in db +* @param aCodecSN2 refernce codec SN ratio in db +* @param aThreshold difference allowed in db +* @result within tolerance +* +**/ +TBool TLawUtility::CompareSNRatiosL( TReal aCodecSN, TReal aCodecSN2, TReal aTolerance ) + { + TBool result = ETrue; + TReal difference = (aCodecSN - aCodecSN2); + //[ it would be nice to replace this with a abs function ?] + if( difference < 0.0 ) + { + if( aTolerance > difference ) + { + result = EFalse; + } + } + else + { + if( aTolerance < difference ) + { + result = EFalse; + } + } + + return result; + } + +/** +* +* ComputeSNL compute the Signal to Noise Ratio +* +**/ +TReal TLawUtility::ComputeSNL( TReal aSumSigSquared, TReal aSumErrorSquared ) + { + TReal sn = 0.0; + const TReal tolerance = 0.001; + //[precondition error is >= tolerance ] + if( aSumErrorSquared < tolerance ) + User::Leave( KErrArgument ); + //[claculate ratio safely ] + Math::Log( sn, (aSumSigSquared/aSumErrorSquared)); + sn*= 10; + return sn; + } + +/** +* +* SumSquaredL +* +**/ +TReal TLawUtility::SumSquaredL( TUint8* aData, TInt aNoSamples ) + { + //[precondition arg is ok ] + if( !aData ) + { + User::Leave(KErrArgument); + } + + TUint8* pData = aData; + TInt16 sample ; + TReal sumSigSquared = 0.0; + for( TInt count = 0; count < aNoSamples; count++ ) + { + sample = static_cast( pData[0] &KAndMask8bit); + sample |= static_cast((pData[1] << 8 )); + sumSigSquared += (sample*sample); + pData+=2; + } + + return sumSigSquared; + } + +/** +* +* SumErrorSquaredL +* @param aData +* @param aData2 +* @param aNoSamples +* @result TReal +* +**/ +TReal TLawUtility::SumErrorSquaredL( TUint8* aData, TUint8* aData2, TInt aNoSamples ) + { + //[precondition aData is not NULL] + if( !aData ) + { + User::Leave(KErrArgument); + } + + //[precondition aData2 is not NULL ] + if( !aData2 ) + { + User::Leave(KErrArgument); + } + + TUint8* pData = aData; + TUint8* pData2 = aData2; + TInt16 sample ; + TInt16 sample2; + TReal sumErrorSquared = 0.0; + TInt error; + for( TInt count = 0; count < aNoSamples; count++ ) + { + error = 0; + sample = static_cast( pData[0] &KAndMask8bit); + sample |= static_cast((pData[1] << 8 )); + sample2 = static_cast( pData2[0] &KAndMask8bit); + sample2 |= static_cast((pData2[1] << 8 )); + error = sample -sample2; // compute the error + sumErrorSquared += (error*error); // add error squared to the sum + pData +=2; + pData2 +=2; + } + + return sumErrorSquared; + } + +/** +* +* CTestMuLawCodec_U_0006 +* +**/ +CTestMuLawCodec_U_0006::CTestMuLawCodec_U_0006() + { + //[ set test name] + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0006-HP"); + } + +/** +* +* LinearToMuLawSample +* @param aSample a 16 bit pcm sample +* @result Mu Law encoded sample +* +**/ +TUint8 CTestMuLawCodec_U_0006::LinearToMuLawSample( TInt16 aSample) + { + const int KBias = 0x84; + const int KClip = 32635; + TInt sign = (aSample >> 8) & 0x80; + if(sign) + aSample = static_cast(-aSample); + if(aSample > KClip) + aSample = KClip; + aSample = static_cast(aSample + KBias); + TInt exponent = static_cast( MuLawCompressTable[(aSample>>7) & 0xFF]); + TInt mantissa = (aSample >> (exponent+3)) & 0x0F; + TInt compressedByte = ~(sign | (exponent << 4) | mantissa); + return static_cast( compressedByte ); + } + +/** +* +* ConvertPcmMuLaw +* +**/ +void CTestMuLawCodec_U_0006::ConvertPcmMuLawL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ) + { + //[ precondition aSrcData ] + if( !aSrcData ) + User::Leave( KErrArgument ); + //[precondition aCodedData ] + if( !aCodedData ) + User::Leave( KErrArgument ); + + TUint8* pCoded = aCodedData; + TUint8* pData = aSrcData ; + TInt16 pcmSample; + for( TInt count = 0; count < aNumSamples; count++ ) + { + //[ code the data ] + pcmSample = static_cast(pData[0]); + pcmSample |= static_cast((pData[1] << 8 )); + *pCoded++ = LinearToMuLawSample(pcmSample); + pData+=2; + } + } + +/** +* +* ConvertMuLawPcm +* +**/ +void CTestMuLawCodec_U_0006::ConvertMuLawPcmL(TUint8* aCoded, TUint8* aDecoded, TInt aNumSamples ) + { + //[ precondition aCoded ] + if( !aCoded ) + User::Leave( KErrArgument ); + //[precondition aDecoded ] + if( !aDecoded ) + User::Leave( KErrArgument ); + + TInt16 pcmSample; + TUint8* pCoded = aCoded; + TUint8* pDecoded = aDecoded; + //[ lets convert the data ] + for(TInt count = 0; count < aNumSamples; count++ ) + { + pcmSample = MuLawDecompressTable[*pCoded++]; + *pDecoded++ = static_cast( pcmSample & 0xFF); + *pDecoded++ = static_cast((pcmSample >> 8 ) & 0xFF); + } + } + +/** +* +* DoTestStepL +* +**/ +TVerdict CTestMuLawCodec_U_0006::DoTestStepL() + { + TVerdict result = EPass; + const TInt KSrcBufferSize = 400; // small buffer size + const TInt KHalfSrcBufferSize = 200; // small buffer size + const TInt KCodedBufferSize = 200; // small buffer size + const TInt KLowerLimit = -800; //lower limit of test range + const TInt KUpperLimit = 800; // upper limit of test range +1 + + //[ allocate memory buffers] + TUint8* pSymbianSrcData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pSymbianSrcData); + TUint8* pIndependentSrcData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pIndependentSrcData); + TUint8* pSymbianCodedData = new(ELeave)TUint8[KCodedBufferSize]; + CleanupStack::PushL(pSymbianCodedData); + TUint8* pIndependentCodedData = new(ELeave)TUint8[KCodedBufferSize]; + CleanupStack::PushL(pIndependentCodedData); + TUint8* pSymbianDecodedData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pSymbianDecodedData); + TUint8* pIndependentDecodedData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pIndependentDecodedData); + + TMMFAudioMuLawToS16PcmCodec decoder; + TMMFAudioSPcm16ToMuLawCodec encoder; + + TLawUtility helper; + TReal symbianCodecSN = 0.0; + TReal independentCodecSN = 0.0; + + TReal sumRefSig = 0.0; // sum of sig squared + TReal sumRefError = 0.0; // sum of error sig squared + TReal sumSymbianSig = 0.0; // sum of sig squared + TReal sumSymbianError = 0.0; // sum of error sig squared + + //[ interate over a suitable range and process each buffer] + for( TInt index = KLowerLimit; index < KUpperLimit; index+= KHalfSrcBufferSize ) + { + TInt16 offset = static_cast( index); + //[ fill the src buffers ] + helper.FillSrcBufferL( pSymbianSrcData, KHalfSrcBufferSize, offset ); + helper.FillSrcBufferL( pIndependentSrcData, KHalfSrcBufferSize, offset ); + + //[encode the src data ] + encoder.Convert( pSymbianSrcData, pSymbianCodedData, KHalfSrcBufferSize ); + ConvertPcmMuLawL(pIndependentSrcData,pIndependentCodedData,KHalfSrcBufferSize ); + + //[ decode the data ] + decoder.Convert( pSymbianCodedData, pSymbianDecodedData, KHalfSrcBufferSize ); + ConvertMuLawPcmL( pIndependentCodedData,pIndependentDecodedData,KHalfSrcBufferSize); + + //[ check both codecs code the data similarly] + TInt errorCode =helper.CompareCodedDataL(pIndependentCodedData, pSymbianCodedData, KHalfSrcBufferSize ); + if( errorCode != KErrNone ) + { + INFO_PRINTF1(_L("Forward Transformation for Mu-Law codec is not conformant to ref codec")); + User::LeaveIfError(errorCode); + } + //[ upate running total sums to be used for signal to noise + // ratio calculations ] + sumRefSig += helper.SumSquaredL(pIndependentSrcData, KHalfSrcBufferSize); + sumRefError += helper.SumErrorSquaredL(pIndependentSrcData,pIndependentDecodedData,KHalfSrcBufferSize); + sumSymbianSig += helper.SumSquaredL(pSymbianSrcData,KHalfSrcBufferSize); + sumSymbianError += helper.SumErrorSquaredL(pSymbianSrcData,pSymbianDecodedData,KHalfSrcBufferSize); + } + + const TReal KTolerance = 1; // allow for a 1 db tolerance + symbianCodecSN = helper.ComputeSNL(sumSymbianSig,sumSymbianError); + independentCodecSN = helper.ComputeSNL(sumRefSig, sumRefError); + // Gamma = (dynamic range of codec /signal std deviation ) + INFO_PRINTF1(_L("We would expect S/N ration to be greater than 35db for an MuLaw codec with Gamma = 10")); + INFO_PRINTF2(_L("Signal/Noise Ratio Symbian Codec %f"), symbianCodecSN ); + INFO_PRINTF2(_L("Signal/Noise Ratio Reference Codec %f"), independentCodecSN ); + + //[ compare the s/n ratio's of the two codec implementations] + if( !helper.CompareSNRatiosL( symbianCodecSN, independentCodecSN, KTolerance )) + { + //[ fail the test because the s/n ratios were divergent ] + result = EFail; + } + CleanupStack::PopAndDestroy(6,pSymbianSrcData); //pSymbianSrcData,pIndependentSrcData, + //pSymbianCodedData,pIndependentCodedData + //pSymbianDecodedData,pIndependentDecodedData + + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +TVerdict CTestMuLawCodec_U_0006::DoTestStepPreambleL(void) + { + TVerdict result = EPass; + return result; //nothing doing + } + +/** +* +* DoTestStepPostambleL +* +**/ +TVerdict CTestMuLawCodec_U_0006::DoTestStepPostambleL(void) + { + TVerdict result = EPass; + return result; //nothing doing + } + +/** +* +* Mu-Law Compression Table +* +**/ +const TInt8 CTestMuLawCodec_U_0006::MuLawCompressTable[PcmToMuLawCompressionTableSize] = +{ +0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, +4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 +}; + +/** +* +* Mu-Law Decompression Table +* +**/ +const TInt16 CTestMuLawCodec_U_0006::MuLawDecompressTable[MuLawToPcmCompressionTableSize]= +{ +-32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, +-23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, +-15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412, +-11900,-11388,-10876,-10364, -9852, -9340, -8828, -8316, +-7932, -7676, -7420, -7164, -6908, -6652, -6396, -6140, +-5884, -5628, -5372, -5116, -4860, -4604, -4348, -4092, +-3900, -3772, -3644, -3516, -3388, -3260, -3132, -3004, +-2876, -2748, -2620, -2492, -2364, -2236, -2108, -1980, +-1884, -1820, -1756, -1692, -1628, -1564, -1500, -1436, +-1372, -1308, -1244, -1180, -1116, -1052, -988, -924, +-876, -844, -812, -780, -748, -716, -684, -652, +-620, -588, -556, -524, -492, -460, -428, -396, +-372, -356, -340, -324, -308, -292, -276, -260, +-244, -228, -212, -196, -180, -164, -148, -132, +-120, -112, -104, -96, -88, -80, -72, -64, +-56, -48, -40, -32, -24, -16, -8, 0, +32124, 31100, 30076, 29052, 28028, 27004, 25980, 24956, +23932, 22908, 21884, 20860, 19836, 18812, 17788, 16764, +15996, 15484, 14972, 14460, 13948, 13436, 12924, 12412, +11900, 11388, 10876, 10364, 9852, 9340, 8828, 8316, +7932, 7676, 7420, 7164, 6908, 6652, 6396, 6140, +5884, 5628, 5372, 5116, 4860, 4604, 4348, 4092, +3900, 3772, 3644, 3516, 3388, 3260, 3132, 3004, +2876, 2748, 2620, 2492, 2364, 2236, 2108, 1980, +1884, 1820, 1756, 1692, 1628, 1564, 1500, 1436, +1372, 1308, 1244, 1180, 1116, 1052, 988, 924, +876, 844, 812, 780, 748, 716, 684, 652, +620, 588, 556, 524, 492, 460, 428, 396, +372, 356, 340, 324, 308, 292, 276, 260, +244, 228, 212, 196, 180, 164, 148, 132, +120, 112, 104, 96, 88, 80, 72, 64, +56, 48, 40, 32, 24, 16, 8, 0 +}; + +/** +* +* CTestALawCodec_U_0004 +* +**/ +CTestALawCodec_U_0004::CTestALawCodec_U_0004() + { + //[ set test name ] + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0004-HP"); + } + +/** +* +* ConvertPcmALaw converts Pcm 16 to 8bit ALaw +* @param aSrcData The src data +* @param aCoded The coded result +* @param aNumSamples The number of samples to be processed +* @precondition aSrcData is not NULL +* @precondition aCodedData is not NULL +* @precondition there is sufficient room in the destination +* to contain the coded samples +* +**/ +void CTestALawCodec_U_0004::ConvertPcmALawL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ) + { + //[ precondition aSrcData ] + if( !aSrcData ) + User::Leave( KErrArgument ); + //[precondition aCodedData ] + if( !aCodedData ) + User::Leave( KErrArgument ); + + TUint8* pCoded = aCodedData; + TUint8* pData = aSrcData ; + TInt16 pcmSample; + for( TInt count = 0; count < aNumSamples; count++ ) + { + //[ code the data ] + pcmSample = static_cast(pData[0]); + pcmSample |= static_cast((pData[1] << 8 )); + *pCoded++ = LinearToALawSample(pcmSample); + pData+=2; + } + } + +/** +* +* ConvertALawPcm converts from 8bit ALaw to Pcm16 +* @param aCoded The coded data +* @param aDecoded The decoded result +* @param aNumSamples The number of samples to be processed +* @precondition aCoded is not NULL +* @precondition aDecoded is not NULL +* @precondition there is sufficient room in the destination +* to contain the coded samples +* +**/ +void CTestALawCodec_U_0004::ConvertALawPcmL(TUint8* aCoded, TUint8* aDecoded, TInt aNumSamples ) + { + //[ precondition aSrcData ] + if( !aCoded ) + User::Leave( KErrArgument ); + //[precondition aCodedData ] + if( !aDecoded ) + User::Leave( KErrArgument ); + + TInt16 pcmSample; + TUint8* pCoded = aCoded; + TUint8* pDecoded = aDecoded; + //[ lets convert the data ] + for(TInt count = 0; count < aNumSamples; count++ ) + { + pcmSample = ALawDecompressTable[*pCoded++]; + *pDecoded++ = static_cast(pcmSample & 0xFF); + *pDecoded++ = static_cast((pcmSample >> 8 ) & 0xFF); + } + } + +/** +* +* LinearToALawSample converts a Pcm16 sample to ALaw +* @param aSample the PCM 16 sample to be converted +* @result coded result +* +**/ +TUint8 CTestALawCodec_U_0004::LinearToALawSample(TInt16 aSample) + { + const TInt KClip = 32635; + TInt sign; + TInt exponent; + TInt mantissa; + TUint8 compressedByte; + sign = ((~aSample) >> 8) & 0x80; + if(!sign) + aSample = static_cast(-aSample); + if(aSample > KClip) + aSample = KClip; + if(aSample >= 256) + { + exponent = static_cast( ALawCompressTable[(aSample >> 8) & 0x7F]); + mantissa = (aSample >> (exponent + 3) ) & 0x0F; + compressedByte = static_cast ((exponent << 4) | mantissa); + } + else + { + compressedByte = static_cast (aSample >> 4); + } + compressedByte ^= (sign ^ 0x55); + return compressedByte; + } + +/** +* +* DoTestStepL +* +**/ +TVerdict CTestALawCodec_U_0004::DoTestStepL() + { + TVerdict result = EPass; + const TInt KSrcBufferSize = 400; // small buffer size + const TInt KHalfSrcBufferSize = 200; // small buffer size + const TInt KCodedBufferSize = 200; // small buffer size + const TInt KLowerLimit = -400; //lower limit of test range + const TInt KUpperLimit = 400; // upper limit of test range +1 + + //[ allocate memory buffers] + TUint8* pSymbianSrcData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pSymbianSrcData); + TUint8* pIndependentSrcData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pIndependentSrcData); + TUint8* pSymbianCodedData = new(ELeave)TUint8[KCodedBufferSize]; + CleanupStack::PushL(pSymbianCodedData); + TUint8* pIndependentCodedData = new(ELeave)TUint8[KCodedBufferSize]; + CleanupStack::PushL(pIndependentCodedData); + TUint8* pSymbianDecodedData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pSymbianDecodedData); + TUint8* pIndependentDecodedData = new(ELeave)TUint8[KSrcBufferSize]; + CleanupStack::PushL(pIndependentDecodedData); + + TMMFAudioSPcm16ToAlawCodec encoder; + TMMFAudioALawToS16PcmCodec decoder; + + TLawUtility helper; + TReal symbianCodecSN = 0.0; + TReal independentCodecSN = 0.0; + + TReal sumRefSig = 0.0; // sum of sig squared + TReal sumRefError = 0.0; // sum of error sig squared + TReal sumSymbianSig = 0.0; // sum of sig squared + TReal sumSymbianError = 0.0; // sum of error sig squared + + //[ interate over a suitable range and process each buffer] + for( TInt index = KLowerLimit; index < KUpperLimit; index+= KHalfSrcBufferSize ) + { + TInt16 offset = static_cast( index); + //[ fill the src buffers ] + helper.FillSrcBufferL( pSymbianSrcData, KHalfSrcBufferSize, offset ); + helper.FillSrcBufferL( pIndependentSrcData, KHalfSrcBufferSize, offset ); + + //[encode the src data ] + encoder.Convert( pSymbianSrcData, pSymbianCodedData, KHalfSrcBufferSize ); + ConvertPcmALawL(pIndependentSrcData,pIndependentCodedData,KHalfSrcBufferSize ); + + //[ decode the data ] + decoder.Convert( pSymbianCodedData, pSymbianDecodedData, KHalfSrcBufferSize ); + ConvertALawPcmL( pIndependentCodedData,pIndependentDecodedData,KHalfSrcBufferSize); + + //[ check both codecs code the data similarly] + TInt errorCode = helper.CompareCodedDataL(pIndependentCodedData, pSymbianCodedData, KHalfSrcBufferSize ); + if( errorCode != KErrNone ) + { + INFO_PRINTF1(_L("Forward Transformation for ALaw codec is not conformant to ref codec")); + User::LeaveIfError(errorCode); + } + + //[ upate running total sums to be used for signal to noise + // ratio calculations ] + sumRefSig += helper.SumSquaredL(pIndependentSrcData, KHalfSrcBufferSize); + sumRefError += helper.SumErrorSquaredL(pIndependentSrcData,pIndependentDecodedData,KHalfSrcBufferSize); + sumSymbianSig += helper.SumSquaredL(pSymbianSrcData,KHalfSrcBufferSize); + sumSymbianError += helper.SumErrorSquaredL(pSymbianSrcData,pSymbianDecodedData,KHalfSrcBufferSize); + } + const TReal KTolerance = 1; // allow for a 1 db tolerance + symbianCodecSN = helper.ComputeSNL(sumSymbianSig,sumSymbianError); + independentCodecSN = helper.ComputeSNL(sumRefSig, sumRefError); + // Gamma = (dynamic range of codec /signal std deviation ) + INFO_PRINTF1(_L("We would expect S/N ration to be greater than 30db for an ALaw codec with Gamma = 10")); + INFO_PRINTF2(_L("Signal/Noise Ratio Symbian Codec %f"), symbianCodecSN ); + INFO_PRINTF2(_L("Signal/Noise Ratio Reference Codec %f"), independentCodecSN ); + + //[ compare the s/n ratio's of the two codec implementations] + if( !helper.CompareSNRatiosL( symbianCodecSN, independentCodecSN, KTolerance )) + { + //[ fail the test because the s/n ratios were divergent ] + result = EFail; + } + + CleanupStack::PopAndDestroy(6,pSymbianSrcData); //pSymbianSrcData,pIndependentSrcData, + //pSymbianCodedData,pIndependentCodedData + //pSymbianDecodedData,pIndependentDecodedData + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +TVerdict CTestALawCodec_U_0004::DoTestStepPreambleL(void) + { + TVerdict result = EPass; + return result; //nothing doing + } +/** +* +* DoTestStepPostambleL +* +**/ +TVerdict CTestALawCodec_U_0004::DoTestStepPostambleL(void) + { + TVerdict result = EPass; + return result; //nothing doing + } +/** +* +* ALaw Compression Table +* +**/ +const TInt8 CTestALawCodec_U_0004::ALawCompressTable[PcmToALawCompressionTableSize] = +{ +1,1,2,2,3,3,3,3, +4,4,4,4,4,4,4,4, +5,5,5,5,5,5,5,5, +5,5,5,5,5,5,5,5, +6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6, +6,6,6,6,6,6,6,6, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7, +7,7,7,7,7,7,7,7 +}; + +/** +* +* ALaw Decompression Table +* +**/ +const TInt16 CTestALawCodec_U_0004::ALawDecompressTable[ALawToPcmCompressionTableSize] = +{ +-5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, +-7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, +-2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, +-3776, -3648, -4032, -3904, -3264, -3136, -3520, -3392, +-22016,-20992,-24064,-23040,-17920,-16896,-19968,-18944, +-30208,-29184,-32256,-31232,-26112,-25088,-28160,-27136, +-11008,-10496,-12032,-11520,-8960, -8448, -9984, -9472, +-15104,-14592,-16128,-15616,-13056,-12544,-14080,-13568, +-344, -328, -376, -360, -280, -264, -312, -296, +-472, -456, -504, -488, -408, -392, -440, -424, +-88, -72, -120, -104, -24, -8, -56, -40, +-216, -200, -248, -232, -152, -136, -184, -168, +-1376, -1312, -1504, -1440, -1120, -1056, -1248, -1184, +-1888, -1824, -2016, -1952, -1632, -1568, -1760, -1696, +-688, -656, -752, -720, -560, -528, -624, -592, +-944, -912, -1008, -976, -816, -784, -880, -848, +5504, 5248, 6016, 5760, 4480, 4224, 4992, 4736, +7552, 7296, 8064, 7808, 6528, 6272, 7040, 6784, +2752, 2624, 3008, 2880, 2240, 2112, 2496, 2368, +3776, 3648, 4032, 3904, 3264, 3136, 3520, 3392, +22016, 20992, 24064, 23040, 17920, 16896, 19968, 18944, +30208, 29184, 32256, 31232, 26112, 25088, 28160, 27136, +11008, 10496, 12032, 11520, 8960, 8448, 9984, 9472, +15104, 14592, 16128, 15616, 13056, 12544, 14080, 13568, +344, 328, 376, 360, 280, 264, 312, 296, +472, 456, 504, 488, 408, 392, 440, 424, +88, 72, 120, 104, 24, 8, 56, 40, +216, 200, 248, 232, 152, 136, 184, 168, +1376, 1312, 1504, 1440, 1120, 1056, 1248, 1184, +1888, 1824, 2016, 1952, 1632, 1568, 1760, 1696, +688, 656, 752, 720, 560, 528, 624, 592, +944, 912, 1008, 976, 816, 784, 880, 848 +}; + +/** +* +* CTestIMaadCodec +* +**/ +CTestIMaadCodec::CTestIMaadCodec() + { + //[ set test name ] + iTestStepName = _L("MM-MMF-SWCODECDEVICES-U-0022-HP"); + } + +/** +* +* DoTestStepL +* +**/ +TVerdict CTestIMaadCodec::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass; + TInt srcBufferSize; + TInt sinkBufferSize; + const TReal KExpectedSNRatioDb = 30.0; //30 db for now + + //[ Create coder and decoder codecs ] + CMMFPcm16ToImaAdpcmHwDevice* pHwDevice = CMMFPcm16ToImaAdpcmHwDevice::NewL(); + CleanupStack::PushL( pHwDevice ); + + CMMFSwCodec& theCodec = pHwDevice->Codec(); + + CMMFImaAdpcmToPcm16CodecHwDevice* pHwDecoder = CMMFImaAdpcmToPcm16CodecHwDevice::NewL(); + CleanupStack::PushL( pHwDecoder ); + + CMMFSwCodec& theDecoder = pHwDecoder->Codec(); + + //[ Create data buffers with position != 0] + srcBufferSize = 100; // arbitrary non zero size + sinkBufferSize = 100; + CMMFDescriptorBuffer* pSrcBuffer = CMMFDescriptorBuffer::NewL( srcBufferSize ); + CleanupStack::PushL( pSrcBuffer ); + + CMMFDescriptorBuffer* pSinkBuffer = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + CleanupStack::PushL( pSinkBuffer ); + + //[ trap & check error code ] + TInt errCode; + pSrcBuffer->Data().SetLength(srcBufferSize); + pSinkBuffer->Data().SetLength(sinkBufferSize); + pSrcBuffer->SetPosition(1); + TRAP( errCode, theCodec.ProcessL(*pSrcBuffer, *pSinkBuffer)); + if( errCode != KErrArgument ) + { + result = EFail; + return result; + } + + //[set position of sink buffer to nonzero value] + pSrcBuffer->SetPosition(0); + pSinkBuffer->SetPosition(1); + TRAP( errCode, theCodec.ProcessL(*pSrcBuffer, *pSinkBuffer)); + if( errCode != KErrArgument ) + { + result = EFail; + return result; + } + + //[set position of sink and src to nonzero value ] + pSrcBuffer->SetPosition(1); + pSinkBuffer->SetPosition(1); + TRAP( errCode, theCodec.ProcessL(*pSrcBuffer, *pSinkBuffer)); + if( errCode != KErrArgument ) + { + result = EFail; + return result; + } + + //[ reset the position of both buffers to zero ] + pSrcBuffer->SetPosition(0); + pSinkBuffer->SetPosition(0); + //[ set the src/sink buffer sizes to src and sink + // buffer sizes and fill src with data ] + CleanupStack::PopAndDestroy(2, pSrcBuffer); // pSrcBuffer, pSinkBuffer + + //[Create Source & Sink and fill source data in ] + srcBufferSize = theCodec.SourceBufferSize(); + pSrcBuffer = CMMFDescriptorBuffer::NewL( srcBufferSize ); + CleanupStack::PushL( pSrcBuffer ); + + CMMFDescriptorBuffer* pDecodedBuffer = CMMFDescriptorBuffer::NewL( srcBufferSize ); + CleanupStack::PushL( pDecodedBuffer ); + + sinkBufferSize = theCodec.SinkBufferSize(); + pSinkBuffer = CMMFDescriptorBuffer::NewL( sinkBufferSize ); + CleanupStack::PushL( pSinkBuffer ); + + pSrcBuffer->Data().SetLength(srcBufferSize); + pDecodedBuffer->Data().SetLength(srcBufferSize); + pSinkBuffer->Data().SetLength(sinkBufferSize); + + //[ fill src buffer with ramp] + FillSrcBufferL( *pSrcBuffer ); + // encode and decode the data + theCodec.ProcessL(*pSrcBuffer, *pSinkBuffer); + theDecoder.ProcessL( *pSinkBuffer, *pDecodedBuffer ); + + if(!CompareResults( KExpectedSNRatioDb, pSrcBuffer, pDecodedBuffer)) + { + //Test has failed because sn ratio was not good enough + result = EFail; + } + + //[ clean up ] + CleanupStack::PopAndDestroy( 5, pHwDevice ); // pHwDevice, pHwDecoder, pSrcBuffer, pDecodedBuffer, pSinkBuffer + + __MM_HEAP_MARKEND; + return result; + } + +/** +* +* DoTestStepPreambleL +* +**/ +TVerdict CTestIMaadCodec::DoTestStepPreambleL(void) + { + return EPass; + } + +/** +* +* DoTestStepPostambleL +* +**/ +TVerdict CTestIMaadCodec::DoTestStepPostambleL(void) + { + return EPass; + } + + +/** +* +* FillSrcBuffer +* @param aBuffer +* This function fills the buffer with a ramp of linear pcm16 data +* +**/ +void CTestIMaadCodec::FillSrcBufferL( CMMFDescriptorBuffer& aBuffer ) + { + TInt slope = 2; + TInt dataLength = aBuffer.Data().Length(); + TUint8* pData = const_cast(aBuffer.Data().Ptr()); + TInt noPc16Samples = dataLength/2; + ASSERT( noPc16Samples*slope < 32768 ); + for( TInt16 count = 0; count < noPc16Samples ; count++ ) + { + TInt16 pcmSample = static_cast( count * slope); + *pData++ = static_cast( pcmSample & 0xFF ); + *pData++ = static_cast( ( pcmSample >> 8 )); + } + } + +/** +* +* CompareResults +* @param aExpectedSNRatioDb +* @param aSrcBuffer +* @param aSinkBuffer +* @result TBool +* This function returns True if the computed Signal to Noise Ratio +* is Greater than or equal to the expected signal to noise ratio. +* The function will also return EFalse if any of the preconditions +* are violated. +* @precondition aSrcBuffer, aSinkBuffer are not NULL +* @precondition aSrcBuffer data lenegth == aSinkBuffer data length +* @precondition the data buffers contain pcm16 data +* +**/ +TBool CTestIMaadCodec::CompareResults( TReal aExpectedSNRatioDb, + CMMFDescriptorBuffer* aSrcBuffer, + CMMFDescriptorBuffer* aSinkBuffer) + { + TBool result = EFalse; + + //[ precondition pointers are not NULL ] + if( !aSrcBuffer || !aSinkBuffer ) + return result; + + //[ precondition buffer lengths are equal ] + TInt length = aSrcBuffer->Data().Length(); + if( length != aSinkBuffer->Data().Length() ) + return result; + + // buffers must be of even length + if( !(length % sizeof(TInt16) == 0 )) + return result; + + TInt pcmLength = length/2; + TReal sumSignalSquared = 0.0; + TReal sumNoiseSquared = 0.0; + TUint8* pSrcData = const_cast(aSrcBuffer->Data().Ptr()); + TUint8* pDecodeData = const_cast(aSinkBuffer->Data().Ptr()); + TInt16 sampleOriginal; + TInt16 sampleDecode; + for( TInt count = 0; count < pcmLength; count++ ) + { + sampleOriginal = static_cast( pSrcData[0] &KAndMask8bit); + sampleOriginal |= static_cast((pSrcData[1] << 8 )); + sampleDecode = static_cast( pDecodeData[0] &KAndMask8bit); + sampleDecode |= static_cast((pDecodeData[1] << 8 )); + pSrcData+=2; + pDecodeData+= 2; + sumSignalSquared += sampleOriginal * sampleOriginal; + TInt noise = sampleOriginal - sampleDecode ; + sumNoiseSquared += noise * noise; + } + + //[ if the noise is low the signals are equivalent and + // overflow can be avoided ] + if( sumNoiseSquared < 0.001 ) + { + result = ETrue; + return result; + } + TReal computedSNRatioDb; + Math::Log( computedSNRatioDb, sumSignalSquared/sumNoiseSquared ); + computedSNRatioDb *= 10; + + //[ compare claculated s/n ratio against expected ] + if( computedSNRatioDb >= aExpectedSNRatioDb ) + result = ETrue; + + return result; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,213 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCODECDEVICES_H__ +#define __TSU_MMF_SWCODECDEVICES_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "TSU_MMF_ACOD.h" + +const TInt PcmToMuLawCompressionTableSize = 256; +const TInt MuLawToPcmCompressionTableSize = 256; +const TInt PcmToALawCompressionTableSize = 128; +const TInt ALawToPcmCompressionTableSize = 256; + +class CTestSuite ; +class CTestSuite_MMF_SwCodecDevices; + +/** + * @class CTest_MMF_ACOD_U_0001 + * @test Req. under test REQ172.6.3 + */ +class CTest_MMF_Gsm610 : public CTestStep_MMF_SwCodecDevices + { +public: + CTest_MMF_Gsm610(); + ~CTest_MMF_Gsm610(); +protected: + void ReadDataL(CMMFDataBuffer*& aBuffer, const TDesC& aFile1); + void PrintGsm610Frame(TUint8* aGsm610Frame); + void PrintPcmDataFrame(TUint8* aPcm16Frame); + TBool CompareEncodeResults( CMMFDataBuffer* aEncoded, CMMFDataBuffer* aRefFrame ); + TBool CompareDecodeResults(CMMFDataBuffer* aEncoded, CMMFDataBuffer* aRefFrame ); + TBool CompareGsm610Frames( TUint8* aGsmFrame,TUint8* aRefGsmFrame ); + void UnpackFrame1(struct codes* aCodeBuf, TUint8* pbuf); + void UnpackFrame0(struct codes* aCodeBuf, TUint8* pbuf); + void PackFrame0(struct codes* aCodeBuf, TInt8* pbuf); + void PackFrame1(struct codes* aCodeBuf, TInt8* pbuf); + + TBool Compare( codes& aFrame1, codes& aFrame2 ); + void LogGsmFrames( codes& aGsmFrame, codes& aRefGsmFrame ); + void LogGsmFrame ( codes& aFrame ); + void FillPcmBuffer( CMMFDataBuffer& aSrcBuffer ); + void OpenFileL( RFile& aFile, const TDesC& aFileName ); + void ReadDataBufferL( const RFile& aFile, CMMFDataBuffer& aBuffer ); + void CloseFileL( RFile& aFile ); + void ParseFrameL( struct codes& aFrame, TUint8* &aBuffer ); + void ParseCodedDataL( CMMFDataBuffer* aBuffer ); +protected: + //[ files for conformance testing of the codec + // which are defined in the ETSI standard ] + TPtrC iSourceDataFile; // source data file name + TPtrC iCodedDataFile; // coded data file name + TPtrC iDecodedDataFile; // decoded data file name + RFile iSrcFile; // src file + RFile iCodedFile; // coded file + RFile iDecodeFile; // decoded file + CMMFDataBuffer* iRefSrcData; // reference source data + CMMFDataBuffer* iRefCodedData; // refernce decoded data + CMMFDataBuffer* iRefDecodedData; // refernce decoded data + CMMFDataBuffer* iCodedData; // buffer of coded data + CMMFDataBuffer* iDecodedData; // buffer of actual decoded data + CMMFDataBuffer* iScratchData; // buffer of actual decoded data + RFs iFs; // file server + RFile iFile; + TInt iNumCodedFrames; // number of coded frames in src buffer + } ; + +/* +* +* CTest_MMF_SwCodecDevices_U_0001 +* +**/ +class CTest_MMF_SwCodecDevices_U_0001: public CTest_MMF_Gsm610 +{ + +public: + CTest_MMF_SwCodecDevices_U_0001(); + ~CTest_MMF_SwCodecDevices_U_0001(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); +}; + + +/** +* +* CTest_MMF_SwCodecDevices_U_0002 +* +**/ +class CTest_MMF_SwCodecDevices_U_0002: public CTest_MMF_Gsm610 +{ +public: + CTest_MMF_SwCodecDevices_U_0002(); + ~CTest_MMF_SwCodecDevices_U_0002(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); +}; + +/** +* +* CTest_MMF_SwCodecDevices_U_0003 +* +**/ +class CTest_MMF_SwCodecDevices_U_0003: public CTest_MMF_Gsm610 +{ +public: + CTest_MMF_SwCodecDevices_U_0003(); + ~CTest_MMF_SwCodecDevices_U_0003(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); + +}; + +//[ some utility functions to aid mu and alaw codec tests] +class TLawUtility + { + public: + void FillSrcBufferL( TUint8* aSrcData, TInt aNoSamples, TInt16 aOffset ); + TBool CompareCodedDataL(TUint8* aCodedData,TUint8* aRefCodedData, TInt aNoSamples ); + TReal SNRatioL(TUint8* aDecodedData, TUint8* aSrcData, TInt aNoSamples ); + TBool CompareSNRatiosL( TReal aCodecSN, TReal aCodecSN2, TReal aTolerance ); + TInt16 AssembleValL(TUint8* aDecodedData); + TReal ComputeSNL( TReal aSumSigSquared, TReal aSumErrorSquared ); + TReal SumSquaredL( TUint8* aData, TInt aNoSamples ); + TReal SumErrorSquaredL( TUint8* aData, TUint8* aData2, TInt aNoSamples ); + }; + +//[ This Test compares the Symbian implmentation +// against another reference implementation +// of the mu law conversion codec due to problems encountered with +// gold wave coding which was different ] +class CTestMuLawCodec_U_0006: public CTestStep_MMF_SwCodecDevices +{ +public: + CTestMuLawCodec_U_0006(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); +private: + void ConvertPcmMuLawL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ); + void ConvertMuLawPcmL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ); + TUint8 LinearToMuLawSample(TInt16 aSample ); +private: + const static TInt8 MuLawCompressTable[PcmToMuLawCompressionTableSize]; + const static TInt16 MuLawDecompressTable[MuLawToPcmCompressionTableSize]; +}; + +//[ This Test compares the Symbian implmentation +// against another reference implementation +// of the mu law conversion codec due to problems encountered with +// gold wave coding which was different ] +class CTestALawCodec_U_0004: public CTestStep_MMF_SwCodecDevices +{ +public: + CTestALawCodec_U_0004(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); +private: + void ConvertPcmALawL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ); + void ConvertALawPcmL(TUint8* aSrcData, TUint8* aCodedData, TInt aNumSamples ); + TUint8 LinearToALawSample(TInt16 aSample); +private: + const static TInt8 ALawCompressTable[PcmToALawCompressionTableSize]; + const static TInt16 ALawDecompressTable[ALawToPcmCompressionTableSize]; +}; + +// This test tests the pcm16 to imaad codec +class CTestIMaadCodec: public CTestStep_MMF_SwCodecDevices +{ +public: + CTestIMaadCodec(); + virtual TVerdict DoTestStepL(); + virtual enum TVerdict DoTestStepPreambleL(void); + virtual enum TVerdict DoTestStepPostambleL(void); +private: + // fill src buffer with linear ramp + // for coding purposes + void FillSrcBufferL( CMMFDescriptorBuffer& aBuffer ); + TBool CompareResults( TReal aExpectedSNRatioDb, + CMMFDescriptorBuffer* aSrcBuffer, + CMMFDescriptorBuffer* aSinkBuffer); +}; + + +//------------------------------------------------------------------ + +#endif// TSU_MMF_SWCODECDEVICES_H__ + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.ini Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,11 @@ +[SectionOne] +sectionNum= 1 +CodedData01 = c:\mm\mmf\testfiles\SwCodecDevices\Seq01.cod +SourceData01 = c:\mm\mmf\testfiles\SwCodecDevices\Seq01.inp +DecodedData01 = c:\mm\mmf\testfiles\SwCodecDevices\Seq01.out + + + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,187 @@ +// +// Copyright (c) 2003 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: +// + +LOAD_SUITE TSU_MMF_SWCODECDEVICES.dll +#PAUSE_AT_END + +# Just wait .. +delay 1000 + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0001-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0001-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0002-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0002-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0003-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0003-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0004-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0004-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0006-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0006-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0010-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0010-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0011-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0011-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0012-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0012-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0014-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0014-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0015-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0015-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0016-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0016-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0017-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0017-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0018-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0018-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0019-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0019-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0020-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0020-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0021-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0021-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0022-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0022-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0061-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0061-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0062-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0062-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0063-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0063-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0064-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0064-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0065-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0065-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0066-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0066-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0067-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0067-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0068-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0068-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0069-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0069-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0070-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0070-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0071-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0071-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0072-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0072-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0073-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0073-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0074-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0074-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0075-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0075-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0075-HP + +RUN_TEST_STEP 30000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0075-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES_Alloc.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SWCODECDEVICES_Alloc.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,110 @@ +// Copyright (c) 2003-2009 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: +// Creation Date 01/10/2003 +// MMF 'sw codec devices alloc testing script' +// +// + +PRINT Run all the MMF 'sw codec devices' OOM unit tests +PRINT +//PAUSE_AT_END + +// +MULTITHREAD +# Copyright (c) 2003 Symbian Ltd. All rights reserved. + +LOAD_SUITE TSU_MMF_SWCODECDEVICES.dll +#PAUSE_AT_END + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0041-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0041-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0042-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0042-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0043-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0043-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0044-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0044-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0045-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0045-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0046-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0046-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0047-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0047-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0048-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0048-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0049-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0049-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0050-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0050-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0051-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0051-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0052-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0052-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0053-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0053-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0054-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0054-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0055-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0055-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCODECDEVICES-U-0056-HP + +RUN_TEST_STEP 60000, TSU_MMF_SWCODECDEVICES, MM-MMF-SWCODECDEVICES-U-0056-HP, C:\MM\TSU_MMF_SWCODECDEVICES.ini +TEST_COMPLETE + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SignConversionCodecs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SignConversionCodecs.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,984 @@ +// Copyright (c) 2003-2009 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: +// TSU_MMF_CodecTests.cpp +// +// + +// EPOC includes +#include +#include +#include +#include + +// Test system includes +#include "TSU_MMF_DeviceSuite.h" +#include "TSU_MMF_SignConversionCodecs.h" + +//[ codec includes ] +#include +#include "MmfPcm16toAlawhwDevice.h" +#include "MmfALawToPcm16HwDevice.h" +#include "mmfpcm16toMulawhwdevice.h" +#include "MmfMuLawToPcm16hwDevice.h" +#include "mmfpcmS8ToPcmS16HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" +#include "mmfpcm16topcmU16BEHwDevice.h" +#include "mmfpcm16SwapEndianhwdevice.h" +#include "mmfpcm16ToImaAdpcm.h" +#include "MmfImaAdpcmtopcm16hwdevice.h" +#include "MMFpcm16ToPcm16HwDevice.h" +#include "MMFpcm16ToPcmU8HwDevice.h" +#include "MMFpcmU8ToPcm16HwDevice.h" +#include "mmfpcmS16PcmS8HwDevice.h" + + +//[ Codec Unit tests structure +// The unit tests shall use text files +// for small portions of test data +// which should be stored are stored in a simple format +// containing the relevant parameters for the test +//] +class TSignConversionTestParams + { +public: + const TText* iTestName; // name of the test + }; + +// constant table of parameters for tests +const TSignConversionTestParams KSignConversionParameters[] = + { + {_S("MM-MMF-SWCODECDEVICES-U-0017-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0018-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0019-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0020-HP")}, + {_S("MM-MMF-SWCODECDEVICES-U-0021-HP")} + }; + +/** +* +* PrintComparisonDataL +* @param aCodedData the coded data buffer +* @param aRefCodedData the reference coded data buffer +* +*/ +void CMMFDataGenerator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print(_L("Coded Data is longer than refernce data")); Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + RDebug::Print( _L("difference: %d, coded: %d, RefCoded: %d"), (*ptr1-*ptr2), *ptr1++, *ptr2++ ); + } + } + +/** +* +* AssembleValue +* @param aData src data buffer +* @param aValue resultant value +* @param aBigEndian whether the value is in BigEndian format +* @precondition aData is not null and has length >= 2 +* +*/ +void CMMFDataGenerator::AssembleValue( TUint8* aData, TInt16& aValue, TBool aBigEndian ) + { + __ASSERT_DEBUG( aData, Panic(EBadArgument)); + if( aBigEndian ) + { + aValue = static_cast( aData[1] &KAndMask8bit ); + aValue |= static_cast((aData[0] << 8 )); + } + else + { + aValue = static_cast( aData[0] &KAndMask8bit); + aValue |= static_cast((aData[1] << 8 )); + } + } + +/** +* +* AssembleValue +* @param aData src data buffer +* @param aValue resultant value +* @param aBigEndian whether the value is in BigEndian format +* @precondition aData is not null and has length >= 2 +* +*/ +void CMMFDataGenerator::AssembleValue( TUint8* aData, TUint16& aValue, TBool aBigEndian ) + { + __ASSERT_DEBUG( aData, Panic(EBadArgument)); + if( aBigEndian ) + { + aValue = aData[1] ; //[ big endian format] + aValue |= (aData[0] << 8 ); + } + else + { + aValue = aData[0] ; + aValue |= (aData[1] << 8 ); + } + } +/** +* +* CMMFPcmU16toPcmU16BGenerator +* +**/ +CMMFPcmU16toPcmU16BGenerator::CMMFPcmU16toPcmU16BGenerator() + { + } + +/** +* +* ~CMMFPcmU16toPcmU16BGenerator +* +**/ +CMMFPcmU16toPcmU16BGenerator::~CMMFPcmU16toPcmU16BGenerator() + { + } + +/** +* +* GenerateSourceDataL +* +**/ +void CMMFPcmU16toPcmU16BGenerator::GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TUint16 KScale2 = 32000; + + //[ create a buffer large enough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TUint16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( (KScale2 * val ) + KScale2+0.5); + *pDst++ = static_cast( srcValue &KAndMask8bit); + *pDst++ = static_cast( (srcValue >>8) &KAndMask8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* GenerateComparisonDataL +* +**/ +void CMMFPcmU16toPcmU16BGenerator::GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TUint16 KScale2 = 32000; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TUint16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( (KScale2 * val)+KScale2 +0.5); + //[endian swap here ] + *pDst++ = static_cast( (srcValue >>8) &KAndMask8bit); + *pDst++ = static_cast( srcValue &KAndMask8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* PrintComparisonDataL +* Prints out coded results for comparison with the +* Reference values and is used when the results differ +* +**/ +void CMMFPcmU16toPcmU16BGenerator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print( _L("Coded Data is longer than refernce data"));Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + //[ now print the results for comparison ] + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + length /= 2; // [for 16bit words length is half] + //[ assert invariant length is even ] + __ASSERT_DEBUG( (length % 2 == 0 ), Panic(EBadInvariant)); + + TUint16 codedValue = 0; + TUint16 refCodedValue = 0; + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + //[ assemble 16bit values from buffer values ] + AssembleValue( ptr1, codedValue, ETrue ); + AssembleValue( ptr2, refCodedValue, ETrue ); + RDebug::Print( _L("difference: %u, coded: %u, RefCoded: %u"), (refCodedValue-codedValue), codedValue, refCodedValue ); + if( i % 100 == 0 ) //deal with debug printf deficiencies + { + User::After(100 ); + } + ptr1+=2; + ptr2+=2; + } + } + +/** +* +* CMMFPcmU16BtoPcmU16Generator +* +**/ +CMMFPcmU16BtoPcmU16Generator::CMMFPcmU16BtoPcmU16Generator() + { + } + +/** +* +* ~CMMFPcmU16BtoPcmU16Generator +* +**/ +CMMFPcmU16BtoPcmU16Generator::~CMMFPcmU16BtoPcmU16Generator() + { + } + +/** +* +* GenerateSourceDataL +* +**/ +void CMMFPcmU16BtoPcmU16Generator::GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TUint8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TInt8 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( (KScale2 * val) ); + //[endian swap here ] + *pDst++ = static_cast( (srcValue >>8) &KAndMask8bit); + *pDst++ = static_cast( srcValue &KAndMask8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* GenerateComparisonDataL +* +**/ +void CMMFPcmU16BtoPcmU16Generator::GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TUint8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TUint16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( KScale2 * val ); + *pDst++ = static_cast( srcValue &KAndMask8bit); + *pDst++ = static_cast( (srcValue >>8) &KAndMask8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* PrintComparisonDataL +* Prints out coded results for comparison with the +* Reference values and is used when the results differ +* +**/ +void CMMFPcmU16BtoPcmU16Generator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print( _L("Coded Data is longer than refernce data"));Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + //[ now print the results for comparison ] + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + length /= 2; //[ for 16bit words ] + TUint16 codedValue = 0; + TUint16 refCodedValue = 0; + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + // assemble 16bit values + AssembleValue( ptr1, codedValue, EFalse); + AssembleValue( ptr2, refCodedValue, EFalse ); + RDebug::Print( _L("difference: %u, coded: %u, RefCoded: %u"), (refCodedValue-codedValue), codedValue, refCodedValue ); + if( i % 100 == 0 ) //deal with debug printf deficiencies + { + User::After( 100 ); + } + ptr1+=2; + ptr2+=2; + } + } + +/** +* +* CMMFPcm8ToPcm16Generator +* +**/ +CMMFPcm8ToPcm16Generator::CMMFPcm8ToPcm16Generator() + { + } + +/** +* +* CMMFPcm8ToPcm16Generator +* +**/ +CMMFPcm8ToPcm16Generator::~CMMFPcm8ToPcm16Generator() + { + } + +/** +* +* GenerateSourceDataL +* +**/ +void CMMFPcm8ToPcm16Generator::GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TInt8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TInt8 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TInt8); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( (KScale2 * val) ); + *pDst++ = srcValue; + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* GenerateSourceDataL +* +**/ +void CMMFPcm8ToPcm16Generator::GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TInt8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TInt16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + TInt8 temp = static_cast((KScale2 * val)); + srcValue = static_cast( temp << 8); + *pDst++ = static_cast( srcValue&KAndMask8bit); + *pDst++ = static_cast((srcValue>>8)&KAndMask8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* PrintComparisonDataL +* Prints out coded results for comparison with the +* Reference values and is used when the results differ +* +**/ +void CMMFPcm8ToPcm16Generator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print( _L("Coded Data is longer than refernce data"));Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + //[ now print the results for comparison ] + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + length /= 2; //[ for 16bit words ] + TInt16 codedValue = 0; + TInt16 refCodedValue = 0; + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + // assemble 16bit values + AssembleValue( ptr1, codedValue, EFalse ); + AssembleValue( ptr2, refCodedValue, EFalse ); + RDebug::Print( _L("difference: %d, coded: %d, RefCoded: %d"), (refCodedValue-codedValue), codedValue, refCodedValue ); + if( i % 100 == 0 ) //deal with debug printf deficiencies + { + User::After(100 ); + } + ptr1+=2; + ptr2+=2; + } + } + +/** +* +* CMMFPcmU8ToPcm16Generator +* +**/ +CMMFPcmU8ToPcm16Generator::CMMFPcmU8ToPcm16Generator() + { + } + +/** +* +* ~CMMFPcmU8ToPcm16Generator +* +**/ +CMMFPcmU8ToPcm16Generator::~CMMFPcmU8ToPcm16Generator() + { + } + +/** +* +* GenerateSourceDataL +* @param aBuffer +* @param aSize in bytes +* +**/ +void CMMFPcmU8ToPcm16Generator::GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TUint8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TUint8 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TUint8); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = KPi*i/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + + srcValue = static_cast((KScale2 * val+KScale2+0.5)); + *pDst++ = srcValue; + //RDebug::Print( _L("U8 = %u"), srcValue ); Statement commented under DEf105143 + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* GenerateComparisonDataL +* @param aBuffer +* @param aSize +* +**/ +void CMMFPcmU8ToPcm16Generator::GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TInt8 KScale2 = 127; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] +// RDebug::Print( _L("Generation"));Commented under DEF105143 + TUint8 theValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TUint8 rrr = 0; + TInt length = aSize/sizeof(TInt16); + for(TInt i=0; i< length; i++) + { + //[ assign data and place in buffer] + theta = KPi*i/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + theValue = static_cast(KScale2 *val + KScale2 + 0.5); + //[ apply the same transformation as the codec ] + rrr = static_cast( theValue^KMaskSign8bit ); + //RDebug::Print( _L("U8 = %u"), theValue ); Statement commented under DEf105143 + *pDst++ = rrr; + *pDst++ = rrr; + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* PrintComparisonDataL +* Prints out coded results for comparison with the +* Reference values and is used when the results differ +* +**/ +void CMMFPcmU8ToPcm16Generator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print( _L("Coded Data is longer than reference data"));Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + //[ now print the results for comparison ] + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + length /= 2; //[ for 16bit words ] + TInt16 codedValue = 0; + TInt16 refCodedValue = 0; + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + // assemble 16bit values + AssembleValue( ptr1, codedValue, EFalse ); + AssembleValue( ptr2, refCodedValue, EFalse ); + RDebug::Print( _L("delta %d c %d, rf %d"), (refCodedValue-codedValue), codedValue, refCodedValue ); + if( i % 100 == 0 ) //deal with debug printf deficiencies + { + User::After(100 ); + } + ptr1+=2; + ptr2+=2; + } + + } + +/** +* +* CMMFPcm16ToPcmU8Generator +* +**/ +CMMFPcm16ToPcmU8Generator::CMMFPcm16ToPcmU8Generator() + { + //Nothing doing + } + +/** +* +* CMMFPcm16ToPcmU8Generator +* +**/ +CMMFPcm16ToPcmU8Generator::~CMMFPcm16ToPcmU8Generator() + { + //Nothing doing + } + +/** +* +* GenerateSourceDataL +* @param aBuffer +* @param aSize in bytes +* This function generates a 400hz sine wav +* under the assumption the sampling frequency is 8khz +* +*/ +void CMMFPcm16ToPcmU8Generator::GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TInt KScale = 320; + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TInt16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TInt16); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( KScale * val ); + *pDst++ = static_cast( srcValue & KAndMask8bit); + *pDst++ = static_cast((srcValue >> 8) & KAndMask8bit ); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* GenerateComparisonDataL +* @param aBuffer +* @param aSize in bytes +* This function generates a 400hz sine wav +* under the assumption the sampling frequency is 8khz +*/ +//[ use partial sopecialization to provide copncrete implmentation] +void CMMFPcm16ToPcmU8Generator::GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ) + { + const TInt KScale2 = 320; //low value chosen to emphasize the distortion of this codec! + + //[ create a buffer large eneough to fill with the data ] + aBuffer = CMMFDescriptorBuffer::NewL(aSize); + + TUint8* pDst = CONST_CAST(TUint8*,aBuffer->Data().Ptr()); + + //[ lets fill it with a 400hz signal at approx -3db ] + //[encode the data] + TInt16 srcValue = 0; + TReal val = 0.0; + TReal theta = 0.0; + TInt noSamples = aSize/sizeof(TUint8); + for(TInt i=0; i< noSamples; i++) + { + //[ assign data and place in buffer] + theta = (KPi*i)/10; // fundamental of 400hz sampled @8khz has 20 db or + // better reproduction through gsm codec + User::LeaveIfError(Math::Sin(val,theta)); + srcValue = static_cast( KScale2 * val ); + *pDst++ = static_cast( (srcValue >> 8) - KMaskSign8bit); + } + + aBuffer->Data().SetLength(aSize); + } + +/** +* +* PrintComparisonDataL +* Prints out coded results for comparison with the +* Reference values and is used when the results differ +* +**/ +void CMMFPcm16ToPcmU8Generator::PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ) + { + //[precondition reference coded data is equal in size or longer than coded data ] + if( aRefCodedData.Data().Length() < aCodedData.Data().Length() ) + { + //[coded data is longer than reference data] + // RDebug::Print( _L("Coded Data is longer than refernce data"));Commented under DEF105143 + User::Leave( KErrCorrupt ); + } + + //[ now print the results for comparison ] + TUint8* ptr1 = CONST_CAST(TUint8*, aCodedData.Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aRefCodedData.Data().Ptr()); + TInt length = aCodedData.Data().Length(); + //[ now print the results for comparison ] + for( TInt i = 0; i < length; i++ ) + { + RDebug::Print( _L("difference: %u, coded: %u, RefCoded: %u"), (*ptr1-*ptr2), *ptr1, *ptr2 ); + if( i % 100 == 0 ) //deal with debug printf deficiencies + { + User::After(100 ); + } + ptr1++; + ptr2++; + } + } + +/** +* +* CompareData +* @param aData1 first data buffer for comparison +* @param aData2 second data buffer for comparison +* result TBool data is the same +* @precondition aData1 has the same amount of data as aData2 +* +*/ +template +TBool CTestStepSignConversionTest::CompareData( CMMFDataBuffer* aData1, CMMFDataBuffer* aData2) + { + TBool result = ETrue; + + //[ precondition aData1 != NULL ] + if( !aData1 ) + { + User::Leave( KErrArgument ); + } + + //[ precondition aData2 != NULL ] + if( !aData2 ) + { + User::Leave( KErrArgument ); + } + + //[precondition aData1 length == aData2 length ] + if( aData1->Data().Length() != aData2->Data().Length() ) + { + User::Leave( KErrArgument ); + } + + //[Now Compare the data] + TUint8* ptr1 = CONST_CAST(TUint8*, aData1->Data().Ptr()); + TUint8* ptr2 = CONST_CAST(TUint8*, aData2->Data().Ptr()); + TInt dataLength = aData2->Data().Length(); + if( Mem::Compare( ptr1, dataLength, ptr2, dataLength )!=0) + { + TUint8* p1 = ptr1; + TUint8* p2 = ptr2; + TInt16 s1 = 0; + TInt16 s2 = 0; + INFO_PRINTF1(_L("------------------------------")); + for( TInt i = 0; i < dataLength/2; i++ ) + { + s1 = static_cast( p1[0] &KAndMask8bit); + s1 |= static_cast((p1[1] << 8 )); + s2 = static_cast( p2[0] &KAndMask8bit); + s2 |= static_cast((p2[1] << 8 )); + INFO_PRINTF3(_L("%d %d"), s1, s2); + p1+=2; + p2+=2; + } + INFO_PRINTF1(_L("------------------------------")); + // RDebug::Print( _L("Comparison has failed")); Commented under DEF105143 + iGenerator->PrintComparisonDataL( *aData1, *aData2 ); + result = EFalse ; + } + return result; + } + +/** +* +* DoTestStepL +* @result TVerdict +* +*/ +template +TVerdict CTestStepSignConversionTest::DoTestStepL() + { + __MM_HEAP_MARK; + TVerdict result = EPass; + + //[pre condition iSourceData ] + if( !iSourceData ) + { + INFO_PRINTF1(_L("Source Data Failure")); + User::Leave( KErrCorrupt); + } + //[precondition iCodedData ] + if( !iCodedData ) + { + INFO_PRINTF1(_L("Coded Data Failure")); + User::Leave( KErrCorrupt); + } + //[precondition iRefData ] + if( !iRefCodedData ) + { + INFO_PRINTF1(_L("RefCodedData Argument Failure")); + User::Leave( KErrCorrupt); + } + + //[ lets code the data and compare it to the reference data ] + iCodecUnderTest->ProcessL(*iSourceData, *iCodedData); + if(!CompareData(iCodedData, iRefCodedData)) + { + INFO_PRINTF1(_L("Coded Results do not match reference coded results")); + + result = EFail; + } + + __MM_HEAP_MARKEND; + return result; + } + +/** +* +* DoTestStepPostambleL +* @result TVerdict +* +*/ +template +TVerdict CTestStepSignConversionTest::DoTestStepPostambleL() + { + TVerdict result = EPass; + //[delete the buffers & Codec] + delete iCodecUnderTest; + delete iGenerator; + delete iSourceData; + delete iCodedData; + delete iRefCodedData; + return result; + } + +/** +* +* DoTestStepPreambleL +* @result TVerdict +* +*/ +template +TVerdict CTestStepSignConversionTest::DoTestStepPreambleL() + { + TVerdict result = EPass; + + iCodecUnderTest = new(ELeave) T; // a cmmfcodec ; + iGenerator = new(ELeave) Generator; // src generator + + //[ensure the number of samples is >= srcbuffers] + const TInt KNumBuffers = 2; + const TInt dataSrcSize = KNumBuffers * iCodecUnderTest->SourceBufferSize(); + + //[generate src data] + iGenerator->GenerateSourceDataL( iSourceData, dataSrcSize); + + const TInt dataSinkSize = KNumBuffers * iCodecUnderTest->SinkBufferSize(); + + //[generate comparison data] + iGenerator->GenerateComparisonDataL( iRefCodedData, dataSinkSize); + + //[reserve space for coded data ] + iCodedData = CMMFDescriptorBuffer::NewL(dataSinkSize); + + return result; + } + +/** +* +* CTestStepCodecUnitTest +* +*/ +template +CTestStepSignConversionTest::CTestStepSignConversionTest() + { + // store the name of this test case + // this is the name that is used by the script file + iTestStepName = (&KSignConversionParameters[index])->iTestName; + } + +/** +* +* CTestStepCodecUnitTest +* +*/ +template +CTestStepSignConversionTest::~CTestStepSignConversionTest() + { + } + +/** +* +* This is used for template instantiation. +* +**/ + +template class CTestStepSignConversionTest; +template class CTestStepSignConversionTest; +template class CTestStepSignConversionTest; +template class CTestStepSignConversionTest; +template class CTestStepSignConversionTest; + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SignConversionCodecs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SignConversionCodecs.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,161 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SIGNCONVERSIONS_H__ +#define __TSU_MMF_SIGNCONVERSIONS_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "TSU_MMF_ACOD.h" + + +class CTestSuite ; +class CTestSuite_MMF_SwCodecDevices; + +/** +* +* class CMMFDataGenerator +* Provides interface for test generator +* +*/ +class CMMFDataGenerator : public CBase + + { +public: + CMMFDataGenerator(){}; + ~CMMFDataGenerator(){}; + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize )=0; + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize )=0; + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + virtual void AssembleValue( TUint8* data, TInt16& aValue, TBool bigEndian = EFalse ); + virtual void AssembleValue( TUint8* data, TUint16& aValue, TBool bigEndian = EFalse ); +private: + CTestSuite_MMF_SwCodecDevices* iRefSuite; //added to allow logging to file + }; + +/** +* +* class CMMFPcm16toPcmU8Generator +* Template class to generate pcm16 data and converted pcmu8 data +* +**/ +class CMMFPcm16ToPcmU8Generator: public CMMFDataGenerator + { +public: + CMMFPcm16ToPcmU8Generator(); + ~CMMFPcm16ToPcmU8Generator(); + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + }; + +/** +* +* class CMMFPcmU16toPcmU16BGenerator +* Template class to generate pcm16 data and converted pcmu8 data +* +**/ +class CMMFPcmU16toPcmU16BGenerator: public CMMFDataGenerator + { +public: + CMMFPcmU16toPcmU16BGenerator(); + ~CMMFPcmU16toPcmU16BGenerator(); + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + }; + +/** +* +* class CMMFPcmU16BtoPcm16BGenerator +* Template class to generate pcm16 data and converted pcmu8 data +* +**/ +class CMMFPcmU16BtoPcmU16Generator: public CMMFDataGenerator + { +public: + CMMFPcmU16BtoPcmU16Generator(); + ~CMMFPcmU16BtoPcmU16Generator(); + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + }; + +/** +* +* class CMMFPcm8ToPcm16Generator +* Template class to generate pcm8 data and convert to pcm16 data +* +**/ +class CMMFPcm8ToPcm16Generator: public CMMFDataGenerator + { +public: + CMMFPcm8ToPcm16Generator(); + ~CMMFPcm8ToPcm16Generator(); + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + }; + +/** +* +* class CMMFPcmU8ToPcm16Generator +* +**/ +class CMMFPcmU8ToPcm16Generator : public CMMFDataGenerator + { +public: + CMMFPcmU8ToPcm16Generator(); + ~CMMFPcmU8ToPcm16Generator(); + virtual void GenerateSourceDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void GenerateComparisonDataL( CMMFDataBuffer* &aBuffer, TInt aSize ); + virtual void PrintComparisonDataL( CMMFDataBuffer& aCodedData, CMMFDataBuffer& aRefCodedData ); + }; + +/** +* Class CTestStepSignConversionTest +* This class tests type conversions using +* a codec T, test data generator Generator +* and having test case name name +**/ +template +class CTestStepSignConversionTest : public CTestStep_MMF_SwCodecDevices + { +public: + CTestStepSignConversionTest(); + virtual ~CTestStepSignConversionTest(); + virtual enum TVerdict DoTestStepL(); + virtual TVerdict DoTestStepPreambleL(void); + virtual TVerdict DoTestStepPostambleL(void); +private: + TBool CompareData( CMMFDataBuffer* aData1, CMMFDataBuffer* aData2 ); +private: + T* iCodecUnderTest; // The Codec Under Test + Generator* iGenerator; + CMMFDataBuffer* iSourceData; // reference source data + CMMFDataBuffer* iCodedData; // coded data + CMMFDataBuffer* iRefCodedData; // reference coded data + CTestSuite_MMF_SwCodecDevices* iRefSuite; + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SwCodecDevices_BufferSizes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/TSU_MMF_SwCodecDevices_BufferSizes.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2003 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: +* +*/ + +#ifndef __TSU_MMF_ACOD_BufferSizes_H__ +#define __TSU_MMF_ACOD_BufferSizes_H__ + +const TUint KDefaultBufferSize = 0x1000; +const TUint KLargeBufferSize = 10000; +const TUint KSmallBufferSize = 50; +const TUint KSmallBufferSizeGSM = 640; +const TUint KMaxBufferLength = 10000; + +//Optimum source buffer sizes +const TUint KAlawToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToAlawOptimumSrc = 0x1000; +const TUint KPCM8ToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToPCM8OptimumSrc = 0x1000; +const TUint KPCM16ToPCM16BOptimumSrc = 0x1000; +const TUint KPCM16BToPCM16OptimumSrc = 0x1000; +const TUint KPCMU16ToPCMU16BOptimumSrc = 0x1000; +const TUint KPCMU16BToPCMU16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU16BOptimumSrc = 0x1000; +const TUint KPCMU16BToPCM16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU16OptimumSrc = 0x1000; +const TUint KPCMU16ToPCM16OptimumSrc = 0x1000; +const TUint KPCM16ToPCMU8OptimumSrc = 0x1000; +const TUint KPCMU8ToPCM16OptimumSrc = 0x800; +const TUint KMulawToPCM16OptimumSrc = 0x800; +const TUint KPCM16ToMulawOptimumSrc = 0x1000; +const TUint KAdpcmToPCM16OptimumSrc = 0x400; +const TUint KPCM16ToAdpcmOptimumSrc = 0xFC8; +const TUint KStereoAdpcmToPCM16OptimumSrc = 0x400; +const TUint KPCM16ToStereoAdpcmOptimumSrc = 0xF90; +const TUint KGSM610ToPCM16OptimumSrc = 0x104; +const TUint KPCM16ToGSM610OptimumSrc = 0xA00; + +const TUint KGSM610ToPCM16OptimumSrcGSM = 0x280; // 640 (Dec) + +//Optimum dest buffer sizes +const TUint KAlawToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToAlawOptimumDst = 0x800; +const TUint KPCM8ToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCM8OptimumDst = 0x800; +const TUint KPCM16ToPCM16BOptimumDst = 0x1000; +const TUint KPCM16BToPCM16OptimumDst = 0x1000; +const TUint KPCMU16ToPCMU16BOptimumDst = 0x1000; +const TUint KPCMU16BToPCMU16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU16BOptimumDst = 0x1000; +const TUint KPCMU16BToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU16OptimumDst = 0x1000; +const TUint KPCMU16ToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToPCMU8OptimumDst = 0x800; +const TUint KPCMU8ToPCM16OptimumDst = 0x1000; +const TUint KMulawToPCM16OptimumDst = 0x1000; +const TUint KPCM16ToMulawOptimumDst = 0x800; +const TUint KAdpcmToPCM16OptimumDst = 0xFC8; +const TUint KPCM16ToAdpcmOptimumDst = 0x400; +const TUint KStereoAdpcmToPCM16OptimumDst = 0xF90; +const TUint KPCM16ToStereoAdpcmOptimumDst = 0x400; +const TUint KGSM610ToPCM16OptimumDst = 0xA00; +const TUint KPCM16ToGSM610OptimumDst = 0x104; + + +const TUint KPCM16ToGSM610OptimumDstGSM = 0x280; +const TUint KGSM610ToPCM16OptimumDstGSM = 0x186A0; //100000 0x32C8; // 13000 (Dec) + + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/bwins/TSU_MMF_SWCODECDEVICESU.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/bwins/TSU_MMF_SWCODECDEVICESU.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS +; NEW: + ?NewTestSuiteL@@YAPAVCTestSuite_MMF_SwCodecDevices@@XZ @ 1 NONAME ; class CTestSuite_MMF_SwCodecDevices * __cdecl NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/eabi/TSU_MMF_SWCODECDEVICESU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/eabi/TSU_MMF_SWCODECDEVICESU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,191 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + _ZTI11TComparator @ 2 NONAME ; ## + _ZTI13TDbComparatorILin300EE @ 3 NONAME ; ## + _ZTI15CTestIMaadCodec @ 4 NONAME ; ## + _ZTI16CTestStepOomTestI20CMMFAlawToPcm16CodecE @ 5 NONAME ; ## + _ZTI16CTestStepOomTestI20CMMFPcm16ToALawCodecE @ 6 NONAME ; ## + _ZTI16CTestStepOomTestI20CMMFPcm8ToPcm16CodecE @ 7 NONAME ; ## + _ZTI16CTestStepOomTestI21CMMFMulawToPcm16CodecE @ 8 NONAME ; ## + _ZTI16CTestStepOomTestI21CMMFPcm16ToMuLawCodecE @ 9 NONAME ; ## + _ZTI16CTestStepOomTestI21CMMFPcm16ToPcmU8CodecE @ 10 NONAME ; ## + _ZTI16CTestStepOomTestI22CMMFGsm610ToPcm16CodecE @ 11 NONAME ; ## + _ZTI16CTestStepOomTestI22CMMFPcmS16ToPcmS8CodecE @ 12 NONAME ; ## + _ZTI16CTestStepOomTestI24CMMFImaAdpcmToPcm16CodecE @ 13 NONAME ; ## + _ZTI16CTestStepOomTestI24CMMFPcm16SwapEndianCodecE @ 14 NONAME ; ## + _ZTI16CTestStepOomTestI24CMMFPcm16ToImaAdpcmCodecE @ 15 NONAME ; ## + _ZTI16CTestStepOomTestI24CMMFPcm16ToPcmU16BECodecE @ 16 NONAME ; ## + _ZTI16CTestStepOomTestI25CMMFPcmU16BeToPcmS16CodecE @ 17 NONAME ; ## + _ZTI16CTestStepOomTestI27CMMFPcm16ToPcmU16CodecCodecE @ 18 NONAME ; ## + _ZTI16CTest_MMF_Gsm610 @ 19 NONAME ; ## + _ZTI17CMMFDataGenerator @ 20 NONAME ; ## + _ZTI17CTestStepLoopTestI20CMMFAlawToPcm16CodecE @ 21 NONAME ; ## + _ZTI17CTestStepLoopTestI20CMMFPcm16ToALawCodecE @ 22 NONAME ; ## + _ZTI17CTestStepLoopTestI20CMMFPcm8ToPcm16CodecE @ 23 NONAME ; ## + _ZTI17CTestStepLoopTestI21CMMFMulawToPcm16CodecE @ 24 NONAME ; ## + _ZTI17CTestStepLoopTestI21CMMFPcm16ToMuLawCodecE @ 25 NONAME ; ## + _ZTI17CTestStepLoopTestI21CMMFPcm16ToPcmU8CodecE @ 26 NONAME ; ## + _ZTI17CTestStepLoopTestI22CMMFGsm610ToPcm16CodecE @ 27 NONAME ; ## + _ZTI17CTestStepLoopTestI22CMMFPcm16ToGsm610CodecE @ 28 NONAME ; ## + _ZTI17CTestStepLoopTestI22CMMFPcmS16ToPcmS8CodecE @ 29 NONAME ; ## + _ZTI17CTestStepLoopTestI24CMMFImaAdpcmToPcm16CodecE @ 30 NONAME ; ## + _ZTI17CTestStepLoopTestI24CMMFPcm16SwapEndianCodecE @ 31 NONAME ; ## + _ZTI17CTestStepLoopTestI24CMMFPcm16ToImaAdpcmCodecE @ 32 NONAME ; ## + _ZTI17CTestStepLoopTestI24CMMFPcm16ToPcmU16BECodecE @ 33 NONAME ; ## + _ZTI17CTestStepLoopTestI25CMMFPcmU16BeToPcmS16CodecE @ 34 NONAME ; ## + _ZTI17CTestStepLoopTestI27CMMFPcm16ToPcmU16CodecCodecE @ 35 NONAME ; ## + _ZTI20CMMFAlawToPcm16Codec @ 36 NONAME ; ## + _ZTI20CMMFPcm16ToALawCodec @ 37 NONAME ; ## + _ZTI20CMMFPcm8ToPcm16Codec @ 38 NONAME ; ## + _ZTI21CMMFMulawToPcm16Codec @ 39 NONAME ; ## + _ZTI21CMMFPcm16ToMuLawCodec @ 40 NONAME ; ## + _ZTI21CMMFPcm16ToPcm16Codec @ 41 NONAME ; ## + _ZTI21CMMFPcm16ToPcmU8Codec @ 42 NONAME ; ## + _ZTI21CMMFPcmU8ToPcm16Codec @ 43 NONAME ; ## + _ZTI21CTestALawCodec_U_0004 @ 44 NONAME ; ## + _ZTI22CMMFGsm610ToPcm16Codec @ 45 NONAME ; ## + _ZTI22CMMFPcm16ToGsm610Codec @ 46 NONAME ; ## + _ZTI22CMMFPcmS16ToPcmS8Codec @ 47 NONAME ; ## + _ZTI22CMMFPcmU16ToPcm16Codec @ 48 NONAME ; ## + _ZTI22CTestMuLawCodec_U_0006 @ 49 NONAME ; ## + _ZTI22CTestStepCodecUnitTestI21CMMFPcm16ToPcmU8Codec11TComparatorLi0ELi0ELi0EE @ 50 NONAME ; ## + _ZTI22CTestStepCodecUnitTestI21CMMFPcmU8ToPcm16Codec13TDbComparatorILin300EELi0ELi0ELi1EE @ 51 NONAME ; ## + _ZTI22CTestStepCodecUnitTestI24CMMFImaAdpcmToPcm16Codec13TDbComparatorILin300EELi0ELi0ELi1EE @ 52 NONAME ; ## + _ZTI22CTestStepCodecUnitTestI24CMMFPcm16SwapEndianCodec11TComparatorLi0ELi1ELi1EE @ 53 NONAME ; ## + _ZTI22CTestStepCodecUnitTestI24CMMFPcm16ToImaAdpcmCodec11TComparatorLi0ELi0ELi0EE @ 54 NONAME ; ## + _ZTI23CMMFPcm16ToAlawHwDevice @ 55 NONAME ; ## + _ZTI23CMMFPcm8ToPcm16HwDevice @ 56 NONAME ; ## + _ZTI24CMMFImaAdpcmToPcm16Codec @ 57 NONAME ; ## + _ZTI24CMMFPcm16SwapEndianCodec @ 58 NONAME ; ## + _ZTI24CMMFPcm16ToImaAdpcmCodec @ 59 NONAME ; ## + _ZTI24CMMFPcm16ToMulawHwDevice @ 60 NONAME ; ## + _ZTI24CMMFPcm16ToPcm16HwDevice @ 61 NONAME ; ## + _ZTI24CMMFPcm16ToPcmU16BECodec @ 62 NONAME ; ## + _ZTI24CMMFPcm16ToPcmU8HwDevice @ 63 NONAME ; ## + _ZTI24CMMFPcm8ToPcm16Generator @ 64 NONAME ; ## + _ZTI24CMMFPcmU8ToPcm16HwDevice @ 65 NONAME ; ## + _ZTI25CMMFPcm16ToPcmU16HwDevice @ 66 NONAME ; ## + _ZTI25CMMFPcm16ToPcmU8Generator @ 67 NONAME ; ## + _ZTI25CMMFPcmS16ToPcmS8HwDevice @ 68 NONAME ; ## + _ZTI25CMMFPcmU16BeToPcmS16Codec @ 69 NONAME ; ## + _ZTI25CMMFPcmU16ToPcm16HwDevice @ 70 NONAME ; ## + _ZTI25CMMFPcmU8ToPcm16Generator @ 71 NONAME ; ## + _ZTI25CMmfGsm610ToPcm16HwDevice @ 72 NONAME ; ## + _ZTI25CMmfPcm16ToGsm610HwDevice @ 73 NONAME ; ## + _ZTI27CMMFPcm16SwapEndianHwDevice @ 74 NONAME ; ## + _ZTI27CMMFPcm16ToImaAdpcmHwDevice @ 75 NONAME ; ## + _ZTI27CMMFPcm16ToPcmU16BEHwDevice @ 76 NONAME ; ## + _ZTI27CMMFPcm16ToPcmU16CodecCodec @ 77 NONAME ; ## + _ZTI27CTestStepSignConversionTestI20CMMFPcm8ToPcm16Codec24CMMFPcm8ToPcm16GeneratorLi1EE @ 78 NONAME ; ## + _ZTI27CTestStepSignConversionTestI21CMMFPcm16ToPcmU8Codec25CMMFPcm16ToPcmU8GeneratorLi0EE @ 79 NONAME ; ## + _ZTI27CTestStepSignConversionTestI21CMMFPcmU8ToPcm16Codec25CMMFPcmU8ToPcm16GeneratorLi4EE @ 80 NONAME ; ## + _ZTI27CTestStepSignConversionTestI24CMMFPcm16SwapEndianCodec28CMMFPcmU16BtoPcmU16GeneratorLi3EE @ 81 NONAME ; ## + _ZTI27CTestStepSignConversionTestI24CMMFPcm16SwapEndianCodec28CMMFPcmU16toPcmU16BGeneratorLi2EE @ 82 NONAME ; ## + _ZTI28CMMFAlawToPcm16CodecHwDevice @ 83 NONAME ; ## + _ZTI28CMMFPcmU16BeToPcmS16HwDevice @ 84 NONAME ; ## + _ZTI28CMMFPcmU16BtoPcmU16Generator @ 85 NONAME ; ## + _ZTI28CMMFPcmU16toPcmU16BGenerator @ 86 NONAME ; ## + _ZTI28CTestStep_MMF_SwCodecDevices @ 87 NONAME ; ## + _ZTI29CMMFMulawToPcm16CodecHwDevice @ 88 NONAME ; ## + _ZTI29CTestStepGsm610ToPcm16OomTest @ 89 NONAME ; ## + _ZTI29CTestStepPcm16ToGsm610OomTest @ 90 NONAME ; ## + _ZTI29CTestSuite_MMF_SwCodecDevices @ 91 NONAME ; ## + _ZTI31CTest_MMF_SwCodecDevices_U_0001 @ 92 NONAME ; ## + _ZTI31CTest_MMF_SwCodecDevices_U_0002 @ 93 NONAME ; ## + _ZTI31CTest_MMF_SwCodecDevices_U_0003 @ 94 NONAME ; ## + _ZTI32CMMFImaAdpcmToPcm16CodecHwDevice @ 95 NONAME ; ## + _ZTV11TComparator @ 96 NONAME ; ## + _ZTV13TDbComparatorILin300EE @ 97 NONAME ; ## + _ZTV15CTestIMaadCodec @ 98 NONAME ; ## + _ZTV16CTestStepOomTestI20CMMFAlawToPcm16CodecE @ 99 NONAME ; ## + _ZTV16CTestStepOomTestI20CMMFPcm16ToALawCodecE @ 100 NONAME ; ## + _ZTV16CTestStepOomTestI20CMMFPcm8ToPcm16CodecE @ 101 NONAME ; ## + _ZTV16CTestStepOomTestI21CMMFMulawToPcm16CodecE @ 102 NONAME ; ## + _ZTV16CTestStepOomTestI21CMMFPcm16ToMuLawCodecE @ 103 NONAME ; ## + _ZTV16CTestStepOomTestI21CMMFPcm16ToPcmU8CodecE @ 104 NONAME ; ## + _ZTV16CTestStepOomTestI22CMMFGsm610ToPcm16CodecE @ 105 NONAME ; ## + _ZTV16CTestStepOomTestI22CMMFPcmS16ToPcmS8CodecE @ 106 NONAME ; ## + _ZTV16CTestStepOomTestI24CMMFImaAdpcmToPcm16CodecE @ 107 NONAME ; ## + _ZTV16CTestStepOomTestI24CMMFPcm16SwapEndianCodecE @ 108 NONAME ; ## + _ZTV16CTestStepOomTestI24CMMFPcm16ToImaAdpcmCodecE @ 109 NONAME ; ## + _ZTV16CTestStepOomTestI24CMMFPcm16ToPcmU16BECodecE @ 110 NONAME ; ## + _ZTV16CTestStepOomTestI25CMMFPcmU16BeToPcmS16CodecE @ 111 NONAME ; ## + _ZTV16CTestStepOomTestI27CMMFPcm16ToPcmU16CodecCodecE @ 112 NONAME ; ## + _ZTV16CTest_MMF_Gsm610 @ 113 NONAME ; ## + _ZTV17CMMFDataGenerator @ 114 NONAME ; ## + _ZTV17CTestStepLoopTestI20CMMFAlawToPcm16CodecE @ 115 NONAME ; ## + _ZTV17CTestStepLoopTestI20CMMFPcm16ToALawCodecE @ 116 NONAME ; ## + _ZTV17CTestStepLoopTestI20CMMFPcm8ToPcm16CodecE @ 117 NONAME ; ## + _ZTV17CTestStepLoopTestI21CMMFMulawToPcm16CodecE @ 118 NONAME ; ## + _ZTV17CTestStepLoopTestI21CMMFPcm16ToMuLawCodecE @ 119 NONAME ; ## + _ZTV17CTestStepLoopTestI21CMMFPcm16ToPcmU8CodecE @ 120 NONAME ; ## + _ZTV17CTestStepLoopTestI22CMMFGsm610ToPcm16CodecE @ 121 NONAME ; ## + _ZTV17CTestStepLoopTestI22CMMFPcm16ToGsm610CodecE @ 122 NONAME ; ## + _ZTV17CTestStepLoopTestI22CMMFPcmS16ToPcmS8CodecE @ 123 NONAME ; ## + _ZTV17CTestStepLoopTestI24CMMFImaAdpcmToPcm16CodecE @ 124 NONAME ; ## + _ZTV17CTestStepLoopTestI24CMMFPcm16SwapEndianCodecE @ 125 NONAME ; ## + _ZTV17CTestStepLoopTestI24CMMFPcm16ToImaAdpcmCodecE @ 126 NONAME ; ## + _ZTV17CTestStepLoopTestI24CMMFPcm16ToPcmU16BECodecE @ 127 NONAME ; ## + _ZTV17CTestStepLoopTestI25CMMFPcmU16BeToPcmS16CodecE @ 128 NONAME ; ## + _ZTV17CTestStepLoopTestI27CMMFPcm16ToPcmU16CodecCodecE @ 129 NONAME ; ## + _ZTV20CMMFAlawToPcm16Codec @ 130 NONAME ; ## + _ZTV20CMMFPcm16ToALawCodec @ 131 NONAME ; ## + _ZTV20CMMFPcm8ToPcm16Codec @ 132 NONAME ; ## + _ZTV21CMMFMulawToPcm16Codec @ 133 NONAME ; ## + _ZTV21CMMFPcm16ToMuLawCodec @ 134 NONAME ; ## + _ZTV21CMMFPcm16ToPcm16Codec @ 135 NONAME ; ## + _ZTV21CMMFPcm16ToPcmU8Codec @ 136 NONAME ; ## + _ZTV21CMMFPcmU8ToPcm16Codec @ 137 NONAME ; ## + _ZTV21CTestALawCodec_U_0004 @ 138 NONAME ; ## + _ZTV22CMMFGsm610ToPcm16Codec @ 139 NONAME ; ## + _ZTV22CMMFPcm16ToGsm610Codec @ 140 NONAME ; ## + _ZTV22CMMFPcmS16ToPcmS8Codec @ 141 NONAME ; ## + _ZTV22CMMFPcmU16ToPcm16Codec @ 142 NONAME ; ## + _ZTV22CTestMuLawCodec_U_0006 @ 143 NONAME ; ## + _ZTV22CTestStepCodecUnitTestI21CMMFPcm16ToPcmU8Codec11TComparatorLi0ELi0ELi0EE @ 144 NONAME ; ## + _ZTV22CTestStepCodecUnitTestI21CMMFPcmU8ToPcm16Codec13TDbComparatorILin300EELi0ELi0ELi1EE @ 145 NONAME ; ## + _ZTV22CTestStepCodecUnitTestI24CMMFImaAdpcmToPcm16Codec13TDbComparatorILin300EELi0ELi0ELi1EE @ 146 NONAME ; ## + _ZTV22CTestStepCodecUnitTestI24CMMFPcm16SwapEndianCodec11TComparatorLi0ELi1ELi1EE @ 147 NONAME ; ## + _ZTV22CTestStepCodecUnitTestI24CMMFPcm16ToImaAdpcmCodec11TComparatorLi0ELi0ELi0EE @ 148 NONAME ; ## + _ZTV23CMMFPcm16ToAlawHwDevice @ 149 NONAME ; ## + _ZTV23CMMFPcm8ToPcm16HwDevice @ 150 NONAME ; ## + _ZTV24CMMFImaAdpcmToPcm16Codec @ 151 NONAME ; ## + _ZTV24CMMFPcm16SwapEndianCodec @ 152 NONAME ; ## + _ZTV24CMMFPcm16ToImaAdpcmCodec @ 153 NONAME ; ## + _ZTV24CMMFPcm16ToMulawHwDevice @ 154 NONAME ; ## + _ZTV24CMMFPcm16ToPcm16HwDevice @ 155 NONAME ; ## + _ZTV24CMMFPcm16ToPcmU16BECodec @ 156 NONAME ; ## + _ZTV24CMMFPcm16ToPcmU8HwDevice @ 157 NONAME ; ## + _ZTV24CMMFPcm8ToPcm16Generator @ 158 NONAME ; ## + _ZTV24CMMFPcmU8ToPcm16HwDevice @ 159 NONAME ; ## + _ZTV25CMMFPcm16ToPcmU16HwDevice @ 160 NONAME ; ## + _ZTV25CMMFPcm16ToPcmU8Generator @ 161 NONAME ; ## + _ZTV25CMMFPcmS16ToPcmS8HwDevice @ 162 NONAME ; ## + _ZTV25CMMFPcmU16BeToPcmS16Codec @ 163 NONAME ; ## + _ZTV25CMMFPcmU16ToPcm16HwDevice @ 164 NONAME ; ## + _ZTV25CMMFPcmU8ToPcm16Generator @ 165 NONAME ; ## + _ZTV25CMmfGsm610ToPcm16HwDevice @ 166 NONAME ; ## + _ZTV25CMmfPcm16ToGsm610HwDevice @ 167 NONAME ; ## + _ZTV27CMMFPcm16SwapEndianHwDevice @ 168 NONAME ; ## + _ZTV27CMMFPcm16ToImaAdpcmHwDevice @ 169 NONAME ; ## + _ZTV27CMMFPcm16ToPcmU16BEHwDevice @ 170 NONAME ; ## + _ZTV27CMMFPcm16ToPcmU16CodecCodec @ 171 NONAME ; ## + _ZTV27CTestStepSignConversionTestI20CMMFPcm8ToPcm16Codec24CMMFPcm8ToPcm16GeneratorLi1EE @ 172 NONAME ; ## + _ZTV27CTestStepSignConversionTestI21CMMFPcm16ToPcmU8Codec25CMMFPcm16ToPcmU8GeneratorLi0EE @ 173 NONAME ; ## + _ZTV27CTestStepSignConversionTestI21CMMFPcmU8ToPcm16Codec25CMMFPcmU8ToPcm16GeneratorLi4EE @ 174 NONAME ; ## + _ZTV27CTestStepSignConversionTestI24CMMFPcm16SwapEndianCodec28CMMFPcmU16BtoPcmU16GeneratorLi3EE @ 175 NONAME ; ## + _ZTV27CTestStepSignConversionTestI24CMMFPcm16SwapEndianCodec28CMMFPcmU16toPcmU16BGeneratorLi2EE @ 176 NONAME ; ## + _ZTV28CMMFAlawToPcm16CodecHwDevice @ 177 NONAME ; ## + _ZTV28CMMFPcmU16BeToPcmS16HwDevice @ 178 NONAME ; ## + _ZTV28CMMFPcmU16BtoPcmU16Generator @ 179 NONAME ; ## + _ZTV28CMMFPcmU16toPcmU16BGenerator @ 180 NONAME ; ## + _ZTV28CTestStep_MMF_SwCodecDevices @ 181 NONAME ; ## + _ZTV29CMMFMulawToPcm16CodecHwDevice @ 182 NONAME ; ## + _ZTV29CTestStepGsm610ToPcm16OomTest @ 183 NONAME ; ## + _ZTV29CTestStepPcm16ToGsm610OomTest @ 184 NONAME ; ## + _ZTV29CTestSuite_MMF_SwCodecDevices @ 185 NONAME ; ## + _ZTV31CTest_MMF_SwCodecDevices_U_0001 @ 186 NONAME ; ## + _ZTV31CTest_MMF_SwCodecDevices_U_0002 @ 187 NONAME ; ## + _ZTV31CTest_MMF_SwCodecDevices_U_0003 @ 188 NONAME ; ## + _ZTV32CMMFImaAdpcmToPcm16CodecHwDevice @ 189 NONAME ; ## + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2004-2009 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: +// + +PRJ_TESTMMPFILES +../MmpFiles/TSU_MMF_SwCodecDevices.mmp + +PRJ_TESTEXPORTS + +../TSU_MMF_SWCODECDEVICES.script c:/mm/tsu_mmf_swcodecdevices.script +../TSU_MMF_SWCODECDEVICES_Alloc.script c:/mm/tsu_mmf_swcodecdevices_alloc.script +../TSU_MMF_SWCODECDEVICES.ini c:/mm/tsu_mmf_swcodecdevices.ini + + +// +// SWCodecDevices data files +// These files are part of an appendix of the ETSI gsm610 standard +// inp is an put file, cod the coded output and out the decoded result +// +../Data/Seq01.inp c:/mm/mmf/testfiles/swcodecdevices/seq01.inp +../Data/Seq01.cod c:/mm/mmf/testfiles/swcodecdevices/seq01.cod +../Data/Seq01.out c:/mm/mmf/testfiles/swcodecdevices/seq01.out +//SwCodecDevices sound files +../Data/ALawMono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/alawmono8khz400hztone.wav +../Data/Imaad4BitMono8Khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/imaad4bitmono8khz400hztone.wav +../Data/MuLawMono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/mulawmono8khz400hztone.wav +../Data/Pcm16BMono8khz400hzTone.au c:/mm/mmf/testfiles/swcodecdevices/pcm16bmono8khz400hztone.au +../Data/Pcm16FromALawMono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcm16fromalawmono8khz400hztone.wav +../Data/Pcm16FromMuLawMono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcm16frommulawmono8khz400hztone.wav +../Data/Pcm16Mono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcm16mono8khz400hztone.wav +../Data/Pcm16Stereo8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcm16stereo8khz400hztone.wav +../Data/PcmU8Mono8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcmu8mono8khz400hztone.wav +../Data/PcmU8Stereo8khz400hzTone.wav c:/mm/mmf/testfiles/swcodecdevices/pcmu8stereo8khz400hztone.wav + + +tsu_mmf_swcodecdevices.iby /epoc32/rom/include/tsu_mmf_swcodecdevices.iby diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/component_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/component_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +; Copyright (c) 2010 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: +; +;*Files To Copy... +"\epoc32\release\armv5\urel\tsu_mmf_swcodecdevices.dll"-"c:\sys\bin\tsu_mmf_swcodecdevices.dll" +"\epoc32\release\armv5\urel\gsm610hwdev.dll"-"c:\sys\bin\gsm610hwdev.dll" +"\epoc32\release\armv5\urel\mmfaudiohwdevices.dll"-"c:\sys\bin\mmfaudiohwdevices.dll" +"\epoc32\release\armv5\urel\gsm610codeccommon.dll"-"c:\sys\bin\gsm610codeccommon.dll" +"\epoc32\release\armv5\urel\mmfcodeccommon.dll"-"c:\sys\bin\mmfcodeccommon.dll" +"\epoc32\release\armv5\urel\mdasoundadapter.dll"-"c:\sys\bin\mdasoundadapter.dll" +"\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\TSU_MMF_SWCODECDEVICES.script"-"c:\tsu_mmf_swcodecdevices.script" +"\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\TSU_MMF_SWCODECDEVICES_Alloc.script"-"c:\tsu_mmf_swcodecdevices_alloc.script" +"\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\TSU_MMF_SWCODECDEVICES.ini"-"c:\mm\tsu_mmf_swcodecdevices.ini" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Seq01.inp"-"c:\mm\mmf\testfiles\swcodecdevices\seq01.inp" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Seq01.cod"-"c:\mm\mmf\testfiles\swcodecdevices\seq01.cod" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Seq01.out"-"c:\mm\mmf\testfiles\swcodecdevices\seq01.out" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\ALawMono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\alawmono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Imaad4BitMono8Khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\imaad4bitmono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\MuLawMono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\mulawmono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Pcm16BMono8khz400hzTone.au"-"c:\mm\mmf\testfiles\swcodecdevices\pcm16bmono8khz400hztone.au" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Pcm16FromALawMono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcm16fromalawmono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Pcm16FromMuLawMono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcm16frommulawmono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Pcm16Mono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcm16mono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\Pcm16Stereo8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcm16stereo8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\PcmU8Mono8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcmu8mono8khz400hztone.wav" + "\sf\os\mm\mmlibs\mmfw\tsrc\mmfunittest\SwCodecDevices\Data\PcmU8Stereo8khz400hzTone.wav"-"c:\mm\mmf\testfiles\swcodecdevices\pcmu8stereo8khz400hztone.wav" diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/tsu_mmf_swcodecdevices.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/group/tsu_mmf_swcodecdevices.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2010 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: +// + +#ifndef __TSU_MMF_SWCODECDEVICES_IBY__ +#define __TSU_MMF_SWCODECDEVICES_IBY__ + +#include + +file=ABI_DIR\DEBUG_DIR\TSU_MMF_SWCODECDEVICES.DLL System\Libs\TSU_MMF_SWCODECDEVICES.DLL +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SWCODECDEVICES.script \TSU_MMF_SWCODECDEVICES.script +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SWCODECDEVICES_ALLOC.script \TSU_MMF_SWCODECDEVICES_ALLOC.script +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SWCODECDEVICES.bat \TSU_MMF_SWCODECDEVICES.bat +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SWCODECDEVICES.ini \TSU_MMF_SWCODECDEVICES.ini +REM data=MULTI_LINGUIFY(rsc ZSYSTEM\LIBS\PLUGINS\101Fd9f0 System\Libs\Plugins\101Fd9f0) +REM data=MULTI_LINGUIFY(rsc ZSYSTEM\LIBS\PLUGINS\101fd9ef System\Libs\Plugins\101Fd9ef) + +REM Test files for swcodectests tests +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Seq01.inp \system\mm\mmf\testfiles\SwCodecDevices\Seq01.inp +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Seq01.cod \system\mm\mmf\testfiles\SwCodecDevices\Seq01.cod +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Seq01.out \system\mm\mmf\testfiles\SwCodecDevices\Seq01.out + +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\ALawMono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\ALawMono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Imaad4BitMono8Khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\Imaad4BitMono8Khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\MuLawMono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\MuLawMono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Pcm16BMono8khz400hzTone.au \system\mm\mmf\testfiles\SwCodecDevices\Pcm16BMono8khz400hzTone.au +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Pcm16FromALawMono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\Pcm16FromALawMono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Pcm16FromMuLawMono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\Pcm16FromMuLawMono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Pcm16Mono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\Pcm16Mono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\Pcm16Stereo8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\Pcm16Stereo8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\PcmU8Mono8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\PcmU8Mono8khz400hzTone.wav +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\Swcodecdevices\PcmU8Stereo8khz400hzTone.wav \system\mm\mmf\testfiles\SwCodecDevices\PcmU8Stereo8khz400hzTone.wav + +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/gsm610_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/gsm610_types.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,47 @@ +// Copyright (c) 2002-2010 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: +// + +//This file is assumed to be identical to the original file: sf\os\mmaudio\mmlibs\mmfw\codecs\Inc\Gsm610CodecCommon\types.h + +#ifndef GSM610_TYPES_H +#define GSM610_TYPES_H + +#include + +typedef TInt16 int2; /* 16 bit */ +typedef TInt32 int4; /* 32 bit */ + +/* Struct for LTP parameters */ + +/* Struct for storing encoded speech parameters of one subframe */ + +struct sfcodes + { + int2 Nc; /* LTP lag */ + int2 bc; /* LTP gain */ + int2 Mc; /* grid */ + int2 xmaxc; /* block max */ + int2 xMc[13]; /* quantized pulses */ + }; + +/* Struct for storing encoded speech parameters of one frame */ + +struct codes + { + int2 LARc[8]; /* quantized LARs */ + struct sfcodes sfc[4]; /* subframe specific codes */ + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/mmpfiles/TSU_MMF_SwCodecDevices.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/mmpfiles/TSU_MMF_SwCodecDevices.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,80 @@ +// Copyright (c) 2010 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: +// using relative paths for sourcepath and user includes +// +// + +TARGET tsu_mmf_swcodecdevices.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID 0x1000008d 0x101FD9F1 +VENDORID 0x70000001 + +SOURCEPATH ../ +SOURCE TSU_MMF_SWCODECDEVICES.cpp +SOURCE TSU_MMF_DeviceSuite.cpp +SOURCE TSU_MMF_CodecTests.cpp +SOURCE TSU_MMF_SignConversionCodecs.cpp +SOURCE TSU_MMF_Oom.cpp +SOURCE TSU_MMF_Loop.cpp +SOURCEPATH ../../../../../devsound/devsoundrefplugin/src/plugin/Audio/gsm610 +SOURCE GSM610.CPP + +SOURCEPATH ../../../../../devsound/devsoundrefplugin/src/plugin/Audio +SOURCE MMFpcm16ToPcm16HwDevice.cpp +SOURCE MMFpcm16ToPcmU8HwDevice.cpp +SOURCE MMFpcmU8ToPcm16HwDevice.cpp +SOURCE Mmfalawtopcm16hwdevice.cpp +SOURCE MmfMuLawToPcm16hwDevice.cpp +SOURCE Mmfimaadpcmtopcm16hwdevice.cpp +SOURCE mmfpcm16toAlawhwdevice.cpp +SOURCE mmfpcm16toMulawhwdevice.cpp +SOURCE mmfpcm16SwapEndianhwdevice.cpp +SOURCE mmfpcmS16topcmU16Codec.cpp +SOURCE mmfpcm16topcmU16BEHwDevice.cpp +SOURCE mmfpcmS16PcmS8HwDevice.cpp +SOURCE mmfpcmS8ToPcmS16HwDevice.cpp +SOURCE mmfpcmU16BeToPcmS16HwDevice.cpp +SOURCE mmfpcmU16TopcmS16HwDevice.cpp +SOURCE mmfpcm16ToImaAdpcm.cpp + +USERINCLUDE ../ +USERINCLUDE ../../../src/plugin/Audio/gsm610 +USERINCLUDE ../../../src/plugin/Audio +USERINCLUDE ../../../../../mmdevicefw/mdf/src/audio/mdasoundadapter + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY testframeworkclient.lib +LIBRARY mmfswcodecwrapper.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY efsrv.lib +LIBRARY mmfcodeccommon.lib +LIBRARY gsm610codeccommon.lib +LIBRARY ecom.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +LIBRARY mdasoundadapter.lib +#endif + +#ifdef EABI +DEFFILE TSU_MMF_SWCODECDEVICES.DEF +#endif + +#ifdef WINSCW +DEFFILE TSU_MMF_SWCODECDEVICES.def +#endif + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/SwCodecDevices/tsu_mmf_CodecTests.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/SwCodecDevices/tsu_mmf_CodecTests.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,87 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_CODECTESTS_H__ +#define __TSU_MMF_CODECTESTS_H__ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "TSU_MMF_ACOD.h" + +const TInt KMaxMethods = 2; + +class CTestSuite ; +class CTestSuite_MMF_SwCodecDevices; + +//[ comparator class used to compare results in a unit test ] +class TComparator +{ +public: + virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength ); +}; + +//[Comparator class used when the results differ] +template +class TDbComparator : public TComparator +{ +public: + virtual TBool CompareL( TUint8* aData, TUint8* aData2, TInt aLength ); +}; + + +class TCodecUnitTestParams; +template +class CTestStepCodecUnitTest : public CTestStep_MMF_SwCodecDevices + { +public: + CTestStepCodecUnitTest( TUint aTestIndex ); + virtual ~CTestStepCodecUnitTest(); + virtual enum TVerdict DoTestStepL(); + virtual TVerdict DoTestStepPreambleL(void); + virtual TVerdict DoTestStepPostambleL(void); +public: + // set up typedef for pointer to dispatch function + typedef void (CTestStepCodecUnitTest::*pCallBack)(CMMFDataBuffer* &aBuffer, const TDesC& aFile ); + typedef void (CTestStepCodecUnitTest::*pPrintFormatCallBack)(TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength); + + virtual void ReadWavFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile ); + virtual void ReadAuFileL( CMMFDataBuffer* &aBuffer, const TDesC& aFile ); + TInt ReadIntB( RFile& aFile, TInt& aValue ); + TInt ComputeBuffersToProcess(); + TInt ReadInt( RFile& aFile, TInt& aValue ); +protected: + virtual void Print8BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength ); + virtual void Print16BitResults( TUint8* aRefCodedData, TUint8* aCodedData, TInt aDataLength ); +protected: + const TCodecUnitTestParams *iTestParameters; + Comparator iComparator; + T* iCodecUnderTest; // The Codec Under Test + CMMFDataBuffer* iSourceData; // reference source data + CMMFDataBuffer* iCodedData; // coded data + CMMFDataBuffer* iRefCodedData; // reference coded data + RFs iFs; // file server + pCallBack iReaders[KMaxMethods]; //[Configurable file readers] + pPrintFormatCallBack iPrintFormats[KMaxMethods]; //[ configurable print formats ] + }; + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,308 @@ +// Copyright (c) 2008-2009 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 "a3fcistubextn.h" +#include +#include +#include "a3fcistubextn.hrh" + +#include +#include +#include +#include +#include + +// +#include "a3fbackdooraccess.h" +#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS +#include +#endif + + +// __________________________________________________________________________ +// Client-side extension + +MDevSoundCIClientExtension* CA3fClientCiStubExtn::NewL() + { + CA3fClientCiStubExtn* self = new (ELeave) CA3fClientCiStubExtn; + return self; + } + +CA3fClientCiStubExtn::~CA3fClientCiStubExtn() + { + delete iDummyBuffer; + REComSession::DestroyedImplementation(iKey); + } + +TInt CA3fClientCiStubExtn::Setup(MCustomCommand& aCustomCommand) + { + iCommand = &aCustomCommand; + iDummyBuffer=KNullDesC().Alloc(); // dummy buffer simulates some allocs + if (!iDummyBuffer) + { + return KErrNoMemory; + } + return KErrNone; + } + +TInt CA3fClientCiStubExtn::CustomInterfaceExtension(TUid aUid, TAny*& aInterface) + { + if (aUid==KUidTestSetVolIf) + { + MTestSetVolIf* interface = this; + aInterface = interface; + return KErrNone; + } + return KErrNotSupported; + } + +void CA3fClientCiStubExtn::Release() + { + delete this; + } + +void CA3fClientCiStubExtn::PassDestructorKey(TUid aDestructorKey) + { + iKey = aDestructorKey; + } + +TInt CA3fClientCiStubExtn::SetVol(TInt aVol) + { + // the key here is the destination package, which represets SetVol. Apart from value + // the rest of the parameters can be ignored + TPckgBuf volumePkg (aVol); + TMMFMessageDestinationPckg setVolDest (TMMFMessageDestination(KUidTestSetVolIf, 0)); + TInt result = iCommand->CustomCommandSync(setVolDest, ETestSetVolIfSetVolCommand, volumePkg, KNullDesC8); + return result; + } + +TInt CA3fClientCiStubExtn::Vol(TInt aMaxVol) + { + // again the key is is the destination package + TPckgBuf maxVolPkg (aMaxVol); + TMMFMessageDestinationPckg setVolDest (TMMFMessageDestination(KUidTestSetVolIf, 0)); + TInt result = iCommand->CustomCommandSync(setVolDest, ETestSetVolIfVolCommand, maxVolPkg, KNullDesC8); + return result; + } + +// __________________________________________________________________________ +// Server-side extension + +MDevSoundCIServerExtension* CA3fServerCiStubExtn::NewL() + { + CA3fServerCiStubExtn* self = new (ELeave) CA3fServerCiStubExtn; + return self; + } + +CA3fServerCiStubExtn::~CA3fServerCiStubExtn() + { + delete iDummyBuffer; + delete iSetVol; + REComSession::DestroyedImplementation(iKey); + } + +TInt CA3fServerCiStubExtn::Setup(MCustomInterface& aCustomInterface) + { + iInterface = &aCustomInterface; + iDummyBuffer=KNullDesC().Alloc(); // dummy buffer simulates some allocs + if (!iDummyBuffer) + { + return KErrNoMemory; + } + return KErrNone; + } + +TInt CA3fServerCiStubExtn::HandleMessageL(const RMmfIpcMessage& aMessage) + { + TMMFMessageDestinationPckg destinationPckg; + MmfMessageUtil::ReadL(aMessage, 0, destinationPckg); + if (destinationPckg().InterfaceId()==KUidTestSetVolIf) + { + CSetVol* volHandler = CSetVol::NewL(*iInterface); + CleanupStack::PushL(volHandler); + TInt result = volHandler->HandleMessageL(aMessage); + CleanupStack::Pop(volHandler); + return result; + } + + return KErrNotSupported; + } + +void CA3fServerCiStubExtn::Release() + { + delete this; + } + +void CA3fServerCiStubExtn::PassDestructorKey(TUid aDestructorKey) + { + iKey = aDestructorKey; + } + +// CSetVol + +CSetVol* CSetVol::NewL(MCustomInterface& aCustomInterface) + { + CSetVol* self = new (ELeave) CSetVol(aCustomInterface); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CSetVol::CSetVol(MCustomInterface& aCustomInterface): + iInterface(&aCustomInterface) + { + // do nothing + } + +void CSetVol::ConstructL() + { + iWait = new (ELeave) CActiveSchedulerWait(); + } + +CSetVol::~CSetVol() + { + delete iWait; + } + +TInt CSetVol::HandleMessageL(const RMmfIpcMessage& aMessage) + { + switch (aMessage.Function()) + { + case ETestSetVolIfSetVolCommand: + { + TPckgBuf volPckg; + MmfMessageUtil::ReadL(aMessage, 1, volPckg); + UpdateA3fPointers(); // grab pointers to context, stream etc + SetVolumeL(volPckg()); + + User::LeaveIfError(iContext->RegisterAudioContextObserver(*this)); + + TInt error = iContext->Commit(); + if (!error) + { + iError = KErrNone; + iWait->Start(); + error = iError; + } + (void) iContext->UnregisterAudioContextObserver(*this); + + aMessage.Complete(error); + return KErrNone; // KErrNone says we've handled the message + } + case ETestSetVolIfVolCommand: + { + TPckgBuf maxVolPckg; + MmfMessageUtil::ReadL(aMessage, 1, maxVolPckg); + UpdateA3fPointers(); // grab pointers to context, stream etc + TInt result = VolumeL(maxVolPckg()); + aMessage.Complete(result); + return KErrNone; // KErrNone says we've handled the message + } + default: + return KErrArgument; + } + } + +void CSetVol::UpdateA3fPointers() + { + MA3FBackdoorAccessIf* backdoor = + static_cast(iInterface->CustomInterface(KA3FBackdoorAccessIfUid)); + if (backdoor) + { + iContext = backdoor->AudioContext(); + iStream = backdoor->AudioStream(); + iGain = backdoor->ProcessingUnit(KUidAudioGainControl); + } + else + { + iContext = NULL; + iStream = NULL; + iGain = NULL; + } + } + +void CSetVol::SetVolumeL(TInt aVolume) + { + RArray channelGains; + CleanupClosePushL(channelGains); + TAudioChannelGain left; + TAudioChannelGain right; + left.iLocation = TAudioChannelGain::ELeft; + right.iLocation = TAudioChannelGain::ERight; + left.iGain = right.iGain = aVolume; + User::LeaveIfError(channelGains.Append(left)); // assumed element 0 in rest of code + User::LeaveIfError(channelGains.Append(right)); // assumed element 1 in rest of code + + MAudioGainControl* gainControl = static_cast(iGain->Interface(KUidAudioGainControl)); + User::LeaveIfError(gainControl->SetGain(channelGains)); + CleanupStack::PopAndDestroy(&channelGains); + } + +TInt CSetVol::VolumeL(TInt aMaxVolume) + { + RArray channelGains; + CleanupClosePushL(channelGains); + TInt maxGain; + + MAudioGainControl* gainControl = static_cast(iGain->Interface(KUidAudioGainControl)); + User::LeaveIfError(gainControl->GetGain(channelGains)); + User::LeaveIfError(gainControl->GetMaxGain(maxGain)); + + TInt basicVolume = (channelGains[0].iGain + channelGains[1].iGain) / 2; + TInt result = basicVolume * aMaxVolume / maxGain; // scale to 0 to maxVolume + + CleanupStack::PopAndDestroy(&channelGains); + return result; + } + +void CSetVol::ContextEvent(TUid aEvent, TInt aError) + { + if (aEvent==KUidA3FContextUpdateComplete || aEvent==KUidA3FContextAbort) + { + // we are going to assume the SetGain() works and use the end of + // the ContextEvent. Really should observe the gain itself + if (aError) + { + iError = aError; + } + iWait->AsyncStop(); + } + } + +// +// ImplementationTable +// + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidA3fClientCiStubExtn, CA3fClientCiStubExtn::NewL), + IMPLEMENTATION_PROXY_ENTRY(KUidA3fServerCiStubExtn, CA3fServerCiStubExtn::NewL), + }; + + +// +// ImplementationGroupProxy +// +// + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,131 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef A3FCISTUBEXTN_H +#define A3FCISTUBEXTN_H + +#include +#include + +#include +#include + +#include + +class CSetVol; + +enum TSetVolCommands + { + ETestSetVolIfSetVolCommand, + ETestSetVolIfVolCommand, + }; + +/** +* +* CA3fClientCiStubExtn +* +* stub version of MDevSoundCIClientExtension +* Always fails to open CIs, but simulates presence of object +*/ + +class CA3fClientCiStubExtn : public CBase, + public MDevSoundCIClientExtension, + public MTestSetVolIf + + { +public: + static MDevSoundCIClientExtension* NewL(); + ~CA3fClientCiStubExtn(); + +protected: + // from MDevSoundCIClientExtension + TInt Setup(MCustomCommand& aCustomCommand); + TInt CustomInterfaceExtension(TUid aUid, TAny*& aInterface); + void Release(); + void PassDestructorKey(TUid aDestructorKey); + + // from MTestSetVolIf + TInt SetVol(TInt aVolume); + TInt Vol(TInt aMaxVolume); + +protected: + TUid iKey; + MCustomCommand* iCommand; // not owned + HBufC* iDummyBuffer; + }; + + +/** +* +* CA3fServerCiStubExtn +* +* stub version of MDevSoundCIServerExtension +* Always fails to open CIs, but simulates presence of object +*/ + +class CA3fServerCiStubExtn : public CBase, + public MDevSoundCIServerExtension + + { +public: + static MDevSoundCIServerExtension* NewL(); + ~CA3fServerCiStubExtn(); + +protected: + // from MDevSoundCIServerExtension + TInt Setup(MCustomInterface& aInterface); + TInt HandleMessageL(const RMmfIpcMessage& aMessage); + void Release(); + void PassDestructorKey(TUid aDestructorKey); + +protected: + TUid iKey; + MCustomInterface* iInterface; // not owned + HBufC* iDummyBuffer; + CSetVol* iSetVol; + }; + +// CAVEAT - for testing only +class CSetVol : public CBase, + public MAudioContextObserver + { +public: + static CSetVol* NewL(MCustomInterface& aCustomInterface); + ~CSetVol(); + + TInt HandleMessageL(const RMmfIpcMessage& aMessage); + + // from MAudioContextObserver + void ContextEvent(TUid aEvent, TInt aError); + +private: + CSetVol(MCustomInterface& aCustomInterface); + void ConstructL(); + + void UpdateA3fPointers(); + void SetVolumeL(TInt aVol); + TInt VolumeL(TInt aMaxVolume); + + MCustomInterface* iInterface; // not owned + MAudioContext* iContext; + MAudioStream* iStream; + MAudioProcessingUnit* iGain; + + CActiveSchedulerWait* iWait; + TInt iError; + }; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ + +// Copyright (c) 2008-2009 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: +// + +#ifndef A3FCISTUBEXTN_HRH +#define A3FCISTUBEXTN_HRH + +#define KUidA3fCiStubExtnDll 0x10285d33 +#define KUidA3fClientCiStubExtn 0x10285d34 +#define KUidA3fServerCiStubExtn 0x10285d35 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/a3fcistubextn/a3fcistubextn.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +// Copyright (c) 2008-2009 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 "ecom/registryinfo.rh" +#include +#include "a3fcistubextn.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidA3fCiStubExtnDll ; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidDevSoundCIClientExtension ; // client ci extn + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidA3fClientCiStubExtn; + version_no = 1; + display_name = "a3fclientcistubextn"; + default_data = "*" ; + opaque_data = ""; + } + }; + }, + INTERFACE_INFO + { + interface_uid = KUidDevSoundCIServerExtension ; // client ci extn + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidA3fServerCiStubExtn; + version_no = 1; + display_name = "a3fservercistubextn"; + default_data = "10283409" ; // the hex value of the interface_uid - currently required + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/Data/TSU_MMF_SWCDWRAPpcm16_16s.raw Binary file devsound/devsoundrefplugin/tsrc/swcdwrap/Data/TSU_MMF_SWCDWRAPpcm16_16s.raw has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/Data/TSU_MMF_SWCDWRAPpcm16_8m.raw Binary file devsound/devsoundrefplugin/tsrc/swcdwrap/Data/TSU_MMF_SWCDWRAPpcm16_8m.raw has changed diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,226 @@ +// +// Copyright (c) 2003-2007 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: +// + +LOAD_SUITE TSU_MMF_SWCDWRAP.dll + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0001-HP + +RUN_TEST_STEP -1 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0001-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0002-HP + +RUN_TEST_STEP -1 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0002-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0003-HP + +RUN_TEST_STEP -1 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0003-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0004-HP + +RUN_TEST_STEP -1 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0004-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0010-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0010-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0011-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0011-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0012-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0012-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0013-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0013-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0014-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0014-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0015-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0015-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0016-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0016-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0017-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0017-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0018-HP + +RUN_TEST_STEP 150000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0018-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0019-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0019-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0020-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0020-HP +TEST_COMPLETE + +#this test fails on EKA1 lubbock due to a defect DEF037387 +#the defect has been fixed on EKA2 +#this test return EInconclusive on EKA1 lubbock +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0021-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0021-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0040-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0040-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0041-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0041-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0042-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0042-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0043-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0043-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0044-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0044-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0045-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0045-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0046-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0046-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0047-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0047-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0049-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0049-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0050-LP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0050-LP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0100-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0100-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0101-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0101-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0102-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0102-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0103-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0103-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0104-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0104-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0105-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0105-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0106-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0106-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0140-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0140-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0141-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0141-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0142-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0142-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0143-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0143-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0144-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0144-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0200-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0200-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0240-HP + +RUN_TEST_STEP 10000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0240-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0300-HP + +RUN_TEST_STEP -1 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0300-HP +TEST_COMPLETE + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_AsyncTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_AsyncTimer.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,170 @@ +// Copyright (c) 2003-2009 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: +// + +// EPOC includes +#include +#include "TSU_MMF_SWCDWRAP_AsyncTimer.h" + +CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL() + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* self = new(ELeave)CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add(this); + iStopActiveSchedulerOnCall = ETrue; + } + +CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall() : CTimer(EPriorityHigh) + { + } + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CallPauseAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval) + { + iCallActionCancelled = EFalse; + iHwDevice = &aHwDevice; + iCallPause = ETrue; + iPauseError = KErrNone; + After(aTimeInterval); + } + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CallStopAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval) + { + iCallActionCancelled = EFalse; + iHwDevice = &aHwDevice; + iCallStop = ETrue; + iStopError = KErrNone; + After(aTimeInterval); + } + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CallStopPauseAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval) + { + iCallActionCancelled = EFalse; + iHwDevice = &aHwDevice; + iCallStopPause = ETrue; + iPauseError = KErrNone; + iStopError = KErrNone; + After(aTimeInterval); + } + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CallStopAndDeleteCodecAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval) + { + iCallActionCancelled = EFalse; + iHwDevice = &aHwDevice; + iCallStopAndDeleteCodec = ETrue; + iStopError = KErrNone; + After(aTimeInterval); + } + + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::RunL() + { + if (!iCallActionCancelled) + { + if (iCallStopPause) + { + iStopError = iHwDevice->Stop(); + if (iStopError != KErrNone) + { + User::Leave(iStopError); + } + + iPauseError = iHwDevice->Pause(); + if (iPauseError != KErrNone) + { + User::Leave(iPauseError); + } + + iCallStopPause = EFalse; + } + else if (iCallPause) + { + iPauseError = iHwDevice->Pause(); + if (iPauseError != KErrNone) + { + User::Leave(iPauseError); + } + + iCallPause = EFalse; + } + else if (iCallStop) + { + iStopError = iHwDevice->Stop(); + if (iStopError != KErrNone) + { + User::Leave(iStopError); + } + iCallStop = EFalse; + } + else if ( iCallStopAndDeleteCodec) + { + iStopAndDeleteCodecError = iHwDevice->StopAndDeleteCodec(); + if (iStopAndDeleteCodecError != KErrNone) + { + User::Leave(iStopAndDeleteCodecError); + } + iCallStopAndDeleteCodec = EFalse; + } + } + + if (iStopActiveSchedulerOnCall) + { + CActiveScheduler::Stop(); + } + } + + +TInt CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::PauseError() + { + return iPauseError; + } + + +TInt CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::StopError() + { + return iStopError; + } + + +TInt CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::StopAndDeleteCodecError() + { + return iStopAndDeleteCodecError; + } + + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::CancelCallAction() + { + iCallActionCancelled = ETrue; + } + + +void CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::StopActiveSchedulerOnCall(TBool aStopActiveSchedulerOnCall) + { + iStopActiveSchedulerOnCall = aStopActiveSchedulerOnCall; + } + + + + + + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_AsyncTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_AsyncTimer.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_ASYNCTIMER_H__ +#define __TSU_MMF_SWCDWRAP_ASYNCTIMER_H__ + +#include + +/** + * Class used by the test harness to make asynchronous + * calls Pause() and Stop() on a hw device plugin + * from the test harness + */ +class CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall : public CTimer + { +public: + static CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* NewL(); + void CallPauseAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval); + void CallStopAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval); + void CallStopAndDeleteCodecAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval); + void CallStopPauseAfter(CMMFHwDevice& aHwDevice, TTimeIntervalMicroSeconds32 aTimeInterval); + TInt PauseError(); + TInt StopError(); + TInt StopAndDeleteCodecError(); + void CancelCallAction(); + void StopActiveSchedulerOnCall(TBool aStopActiveSchedulerOnStop = ETrue); +private: + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall(); + void ConstructL(); + virtual void RunL(); +private: + CMMFHwDevice* iHwDevice; + TBool iCallPause; + TBool iCallStopPause; + TInt iPauseError; + TInt iStopError; + TBool iCallStop; + TBool iCallStopAndDeleteCodec; + TInt iStopAndDeleteCodecError; + TBool iCallActionCancelled; + TBool iStopActiveSchedulerOnCall; + }; + +#endif /* __TSU_MMF_SWCDWRAP_ASYNCTIMER_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_ConvertHwDevObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_ConvertHwDevObserver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,171 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_ConvertHwDevObserver.h" + +CTestConvertMMFHwDeviceObserver::CTestConvertMMFHwDeviceObserver(CMMFHwDevice* aHwDevice) : CTestMMFHwDeviceObserver(aHwDevice) + { + } + +CTestConvertMMFHwDeviceObserver::~CTestConvertMMFHwDeviceObserver() + { + iSourceFile.Close(); + iSinkFile.Close(); + delete iFileReader; + delete iFileWriter; + } + + +TInt CTestConvertMMFHwDeviceObserver::SetConvertFiles(const TDesC& aSourceFileName, const TDesC& aSinkFileName, TUint aNumberOfBuffers) + { + TInt error = KErrNone; + + if (!iFileServerSession.Handle()) + {//open a handle to the file server + error = iFileServerSession.Connect(); + } + + if (!error) + {//have a file server session so source file open file + error = iSourceFile.Open(iFileServerSession, aSourceFileName, EFileRead); + } + + if (!error) + { + //make sure destination file is deleted before we start + error = iFileServerSession.Delete(aSinkFileName); + if (error == KErrNotFound) + error = KErrNone; //KErrNotFound is not an error, means file doesn't exist + if (!error) + { + error = iSinkFile.Create(iFileServerSession, aSinkFileName, EFileWrite); + } + } + + if (!error) + { + if (!iFileReader) + TRAP(error,iFileReader = new(ELeave) CTestFileReader(iSourceFile, this)); + } + + if (!error) + { + if (!iFileWriter) + TRAP(error,iFileWriter = new(ELeave) CTestFileWriter(iSinkFile, this)); + } + + if (!error) + { + iNumberOfBuffers = aNumberOfBuffers; + } + + return error; + } + + +TInt CTestConvertMMFHwDeviceObserver::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + //called on playing when buffer needs to be filled with data to play + TInt error = KErrNone; + iCurrentBufferNumber++; //first buffer is buffer #1 + iCurrentHwDeviceDataBuffer = &(static_cast(aHwDataBuffer)); + + error = FillThisHwBufferFromFile(*iCurrentHwDeviceDataBuffer); + + if (!iError) + iError = error; //log error in observer error + return error; + } + + +TInt CTestConvertMMFHwDeviceObserver::FillThisHwBufferFromFile(CMMFDataBuffer& aHwDataBuffer) + { + return iFileReader->Read(aHwDataBuffer); + } + + +void CTestConvertMMFHwDeviceObserver::FileReadComplete(TInt aError) + { + if (aError == KErrNone) + { + if (iCurrentBufferNumber >= iNumberOfBuffers) + iCurrentHwDeviceDataBuffer->SetLastBuffer(ETrue); + TInt error = iHwDevice->ThisHwBufferFilled(*iCurrentHwDeviceDataBuffer); + if (!iError) + iError = error; //log error in observer error + } + else + { + iError = aError; + } + } + +void CTestConvertMMFHwDeviceObserver::FileWriteComplete(TInt aError) + { + if (aError == KErrNone) + { + TInt error = KErrNone; + if (iCurrentBufferNumber >= iNumberOfBuffers) + { + error = iHwDevice->Stop(); + StopActiveScheduler(); + } + else + {//tell hw device we've emptied it and get another buffer + error = iHwDevice->ThisHwBufferEmptied(*iCurrentHwDeviceDataBuffer); + } + if (!iError) + iError = error; //log error in observer error + } + else + { + iError = aError; + } + } + + +TInt CTestConvertMMFHwDeviceObserver::EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + //called on recording when buffer needs to be written to file + TInt error = KErrNone; + iCurrentHwDeviceDataBuffer = &(static_cast(aHwDataBuffer)); + + if (iCurrentBufferNumber <= iNumberOfBuffers) + { + error = iFileWriter->Write(*iCurrentHwDeviceDataBuffer); + } + + if (!iError) + iError = error; //log error in observer error + return error; + } + + +void CTestConvertMMFHwDeviceObserver::Stopped() + { + } + + +RFile& CTestConvertMMFHwDeviceObserver::ReadFile() + { + return iSourceFile; + } + +RFile& CTestConvertMMFHwDeviceObserver::WriteFile() + { + return iSinkFile; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_ConvertHwDevObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_ConvertHwDevObserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_CONVERTHWDEVOBSERVER_H__ +#define __TSU_MMF_SWCDWRAP_CONVERTHWDEVOBSERVER_H__ + +#include "TSU_MMF_SWCDWRAP_HwDevObserver.h" + +class CTestConvertMMFHwDeviceObserver : public CTestMMFHwDeviceObserver + { +public: + CTestConvertMMFHwDeviceObserver(CMMFHwDevice* aHwDevice); + ~CTestConvertMMFHwDeviceObserver(); + + //MMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual void Stopped(); + + TInt SetConvertFiles(const TDesC& aSourceFileName, const TDesC& aSinkFileName, TUint aNumberOfBuffers); + + //callback from CTestFileReader + virtual void FileReadComplete(TInt aError); + + //callback from CTestFileWriter + virtual void FileWriteComplete(TInt aError); + + //gets Read File handle + RFile& ReadFile(); + + //gets Write File Handle + RFile& WriteFile(); + +private: + TInt FillThisHwBufferFromFile(CMMFDataBuffer& aHwDataBuffer); +private: + CTestFileReader* iFileReader; + CTestFileWriter* iFileWriter; + RFile iSourceFile; + RFile iSinkFile; + }; + +#endif /* __TSU_MMF_SWCDWRAP_CONVERTHWDEVOBSERVER_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_HwDevObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_HwDevObserver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,150 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_HwDevObserver.h" +#include + +void Panic() + { + _LIT(KMMF_SWCDWRAP_UnitTestPanic, "TSU_MMF_SWCDWRAP"); + User::Panic(KMMF_SWCDWRAP_UnitTestPanic, 0); + } + +CTestMMFHwDeviceObserver::CTestMMFHwDeviceObserver(CMMFHwDevice* aHwDevice) : iError(KErrNone) + { + iHwDevice = aHwDevice; + } + +CTestMMFHwDeviceObserver::~CTestMMFHwDeviceObserver() + { + iFileServerSession.Close(); + } + + +TInt CTestMMFHwDeviceObserver::FillThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/) + { +#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER //Adapter loads the drivers + Panic(); //should never get called +#endif + return KErrNone; + } + + +TInt CTestMMFHwDeviceObserver::EmptyThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/) + { + Panic(); //should never get called + return KErrNone; + } + + +TInt CTestMMFHwDeviceObserver::MsgFromHwDevice(TUid aMessageType, const TDesC8& /*aMsg*/) + { + if (aMessageType.iUid != KMmfHwDeviceObserverUpdateBytesPlayed) + { + Panic(); //should never get called + } + return KErrNone; + } + + +void CTestMMFHwDeviceObserver::Stopped() + { + Panic(); //should never get called + } + + +void CTestMMFHwDeviceObserver::Error(TInt aError) + { + if (!iError) + iError = aError; //log error in observer error + } + + +void CTestMMFHwDeviceObserver::StopActiveScheduler() + { + CActiveScheduler* activeScheduler; + activeScheduler = CActiveScheduler::Current(); + activeScheduler->Stop(); + } + + +void CTestMMFHwDeviceObserver::FileReadComplete(TInt /*aError*/) + { + Panic(); //should never get called + } + + +void CTestMMFHwDeviceObserver::FileWriteComplete(TInt /*aError*/) + { + Panic(); //should never get called + } + + +TInt CTestMMFHwDeviceObserver::ErrorStatus() + { + return iError; + } + + +TUint CTestMMFHwDeviceObserver::NumberOfBuffersObserved() + { + return iCurrentBufferNumber; + } + + +TInt CTestMMFHwDeviceObserver::CTestFileReader::Read(CMMFDataBuffer& aBuffer) + { + iDataBuffer = &aBuffer; + iFile.Read(iPosition, iDataBuffer->Data(), iStatus); + if (!IsActive()) + { + SetActive(); + } + return KErrNone; + } + +void CTestMMFHwDeviceObserver::CTestFileReader::RunL() + { + iPosition+=iDataBuffer->BufferSize(); + iParent->FileReadComplete(iStatus.Int()); + } + +void CTestMMFHwDeviceObserver::CTestFileReader::DoCancel() + { + } + + +TInt CTestMMFHwDeviceObserver::CTestFileWriter::Write(CMMFDataBuffer& aBuffer) + { + iDataBuffer = &aBuffer; + iFile.Write(iPosition, iDataBuffer->Data(), iStatus); + SetActive(); + return KErrNone; + } + + +void CTestMMFHwDeviceObserver::CTestFileWriter::RunL() + { + iPosition+=iDataBuffer->BufferSize(); + iParent->FileWriteComplete(iStatus.Int()); + } + +void CTestMMFHwDeviceObserver::CTestFileWriter::DoCancel() + { + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_HwDevObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_HwDevObserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,97 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_HWDEVOBSERVER_H__ +#define __TSU_MMF_SWCDWRAP_HWDEVOBSERVER_H__ + +#include + +class CTestMMFHwDeviceObserver : public CBase, public MMMFHwDeviceObserver + { +public: + CTestMMFHwDeviceObserver(CMMFHwDevice* aHwDevice); + ~CTestMMFHwDeviceObserver(); + + //MMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg); + virtual void Stopped(); + virtual void Error(TInt aError=KErrNone); + + //callback from CTestFileReader + virtual void FileReadComplete(TInt aError); + + //callback from CTestFileWriter + virtual void FileWriteComplete(TInt aError); + + TInt ErrorStatus(); + + TUint NumberOfBuffersObserved(); +protected: + void StopActiveScheduler(); +protected: + class CTestFileReadWriter : public CActive + { + public: + CTestFileReadWriter(RFile& aFile, CTestMMFHwDeviceObserver* aParent) + : CActive(EPriorityStandard), + iFile(aFile), + iParent(aParent){CActiveScheduler::Add(this);}; + ~CTestFileReadWriter() {Cancel();}; + + //CActive + virtual void RunL() {}; + virtual void DoCancel() {}; + + protected: + RFile iFile; + CTestMMFHwDeviceObserver* iParent; + CMMFDataBuffer* iDataBuffer; + TUint iPosition; + }; + class CTestFileReader : public CTestFileReadWriter + { + public: + CTestFileReader(RFile& aSourceFile, CTestMMFHwDeviceObserver* aParent) + : CTestFileReadWriter(aSourceFile, aParent) {}; + TInt Read(CMMFDataBuffer& aBuffer); + + //CActive + virtual void RunL(); + virtual void DoCancel(); + }; + + class CTestFileWriter : public CTestFileReadWriter + { + public: + CTestFileWriter(RFile& aSinkFile, CTestMMFHwDeviceObserver* aParent) + : CTestFileReadWriter(aSinkFile, aParent) {}; + TInt Write(CMMFDataBuffer& aBuffer); + + //CActive + virtual void RunL(); + virtual void DoCancel(); + }; +protected: + TInt iError; + CMMFHwDevice* iHwDevice; + CMMFDataBuffer* iCurrentHwDeviceDataBuffer; + TUint iNumberOfBuffers; + TUint iCurrentBufferNumber; + RFs iFileServerSession; + }; + +#endif /* __TSU_MMF_SWCDWRAP_HWDEVOBSERVER_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_PlayHwDevObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_PlayHwDevObserver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,220 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_PlayHwDevObserver.h" + +CTestPlayMMFHwDeviceObserver::CTestPlayMMFHwDeviceObserver(CMMFHwDevice* aHwDevice) : CTestMMFHwDeviceObserver(aHwDevice) + { + iStopActiveSchedulerOnStop = ETrue; + iCallPauseAndResumeAfterSendingLastBuffer = EFalse; + } + +CTestPlayMMFHwDeviceObserver::~CTestPlayMMFHwDeviceObserver() + { + iSourceFile.Close(); + delete iDataBuffer; + delete iFileReader; + } + + +TInt CTestPlayMMFHwDeviceObserver::FillBufferFromFileSync(const TDesC& aFileName, TUint aBufferSize) + { + TInt error = KErrNone; + iStopped = EFalse; + + if (!iFileServerSession.Handle()) + {//open a handle to the file server + error = iFileServerSession.Connect(); + } + + if (!error) + {//have a file server session so open file + error = iSourceFile.Open(iFileServerSession, aFileName, EFileRead); + } + + if (!error) + {//create buffer to store source data + if (iDataBuffer) + { + delete iDataBuffer; + iDataBuffer = NULL; + } + TRAP(error, iDataBuffer = HBufC8::NewL(aBufferSize)); + } + + if (!error) + {//read file into the source buffer + TPtr8 dataBufferDes(const_cast(iDataBuffer->Ptr()), aBufferSize); + iSourceFile.Read(dataBufferDes); + iAsyncMode = EFalse; + } + + return error; + } + + +TInt CTestPlayMMFHwDeviceObserver::ReadBufferDirectFromFileAsync(const TDesC& aFileName, TUint aNumberOfBuffers) + { + TInt error = KErrNone; + iStopped = EFalse; + + if (!iFileServerSession.Handle()) + {//open a handle to the file server + error = iFileServerSession.Connect(); + } + + if (!error) + {//have a file server session so open file + error = iSourceFile.Open(iFileServerSession, aFileName, EFileRead); + } + + if (!error) + { + if (!iFileReader) + TRAP(error,iFileReader = new(ELeave) CTestFileReader(iSourceFile, this)); + } + + if (!error) + { + iNumberOfBuffers = aNumberOfBuffers; + iAsyncMode = ETrue; + } + + return error; + } + + +TInt CTestPlayMMFHwDeviceObserver::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + //called on playing when buffer needs to be filled with data to play + TInt error = KErrNone; + iCurrentBufferNumber++; //first buffer is buffer #1 + iCurrentHwDeviceDataBuffer = &(static_cast(aHwDataBuffer)); + + if (iAsyncMode) + error = FillThisHwBufferFromFile(*iCurrentHwDeviceDataBuffer); + else + error = FillThisHwBufferFromDes(*iCurrentHwDeviceDataBuffer); + if (!iError) + iError = error; //log error in observer error + return error; + } + + +TInt CTestPlayMMFHwDeviceObserver::FillThisHwBufferFromDes(CMMFDataBuffer& aHwDataBuffer) + { + CMMFDataBuffer* dataBuffer = static_cast(&aHwDataBuffer); + + TUint bufferSize = 0; + if (dataBuffer->RequestSize()) + bufferSize = dataBuffer->RequestSize(); + else bufferSize = dataBuffer->Data().MaxLength(); + + TUint sourceDataLength = static_cast(iDataBuffer->Des().MaxLength()); + + if (iBufferPosition < sourceDataLength) + { + if ((sourceDataLength - iBufferPosition) <= bufferSize) + {//reached end of data + bufferSize = (sourceDataLength - iBufferPosition); + dataBuffer->SetLastBuffer(ETrue); + } + dataBuffer->Data().Copy((iDataBuffer->Ptr()+iBufferPosition), bufferSize); + iBufferPosition+=bufferSize; + } + else + {//have exceeded length of data + dataBuffer->SetLastBuffer(ETrue); + } + + return iHwDevice->ThisHwBufferFilled(*dataBuffer); + } + + +TInt CTestPlayMMFHwDeviceObserver::FillThisHwBufferFromFile(CMMFDataBuffer& aHwDataBuffer) + { + return iFileReader->Read(aHwDataBuffer); + } + + +void CTestPlayMMFHwDeviceObserver::FileReadComplete(TInt aError) + { + if (aError == KErrNone) + { + if (iCurrentBufferNumber >= iNumberOfBuffers) + { + iCurrentHwDeviceDataBuffer->SetLastBuffer(ETrue); + } + if (iCurrentHwDeviceDataBuffer->BufferSize() + < static_cast(iCurrentHwDeviceDataBuffer->Data().MaxLength())) + {//EOF + iCurrentHwDeviceDataBuffer->SetLastBuffer(ETrue); + } + TInt error = iHwDevice->ThisHwBufferFilled(*iCurrentHwDeviceDataBuffer); + if (iCallPauseAndResumeAfterSendingLastBuffer&&iCurrentHwDeviceDataBuffer->LastBuffer()) + { + TInt err = iHwDevice->Pause(); + iCallPauseAndResumeAfterSendingLastBuffer = EFalse;//only call pause once + if (!err)//resume + err = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (!error)//note could potentialy have 2 errors here err & error + error = err; //if so swallow the second error err and keep first + } + if (!iError) + iError = error; //log error in observer error + } + else + { + iError = aError; + } + } + + +void CTestPlayMMFHwDeviceObserver::Stopped() + { + if (iStopActiveSchedulerOnStop) + { + StopActiveScheduler(); + } + iStopped = ETrue; + } + + +RFile& CTestPlayMMFHwDeviceObserver::ReadFile() + { + return iSourceFile; + } + +void CTestPlayMMFHwDeviceObserver::CancelFileRead() + { + iFileReader->Cancel(); + } + +TBool CTestPlayMMFHwDeviceObserver::IsStopped() + { + return iStopped; + } + +void CTestPlayMMFHwDeviceObserver::StopActiveSchedulerOnStop(TBool aStopActiveSchedulerOnStop) + { + iStopActiveSchedulerOnStop = aStopActiveSchedulerOnStop; + } + +void CTestPlayMMFHwDeviceObserver::CallPauseAndResumeAfterSendingLastBuffer() + { + iCallPauseAndResumeAfterSendingLastBuffer = ETrue; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_PlayHwDevObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_PlayHwDevObserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_PLAYHWDEVOBSERVER_H__ +#define __TSU_MMF_SWCDWRAP_PLAYHWDEVOBSERVER_H__ + +#include "TSU_MMF_SWCDWRAP_HwDevObserver.h" + +class CTestPlayMMFHwDeviceObserver : public CTestMMFHwDeviceObserver + { +public: + CTestPlayMMFHwDeviceObserver(CMMFHwDevice* aHwDevice); + ~CTestPlayMMFHwDeviceObserver(); + + //MMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual void Stopped(); + + TInt FillBufferFromFileSync(const TDesC& aFileName, TUint aBufferSize); + TInt ReadBufferDirectFromFileAsync(const TDesC& aFileName, TUint aNumberOfBuffers); + + //callback from CTestFileReader + virtual void FileReadComplete(TInt aError); + + //gets Read File handle + RFile& ReadFile(); + + void CancelFileRead(); + + TBool IsStopped(); + + void StopActiveSchedulerOnStop(TBool aStopActiveSchedulerOnStop = ETrue); + void CallPauseAndResumeAfterSendingLastBuffer(); +private: + TInt FillThisHwBufferFromDes(CMMFDataBuffer& aHwDataBuffer); + TInt FillThisHwBufferFromFile(CMMFDataBuffer& aHwDataBuffer); +private: + CTestFileReader* iFileReader; + TUint iBufferPosition; + RFile iSourceFile; + HBufC8* iDataBuffer; + TBool iAsyncMode; + TBool iStopped; + TBool iStopActiveSchedulerOnStop; + TBool iCallPauseAndResumeAfterSendingLastBuffer; + }; + +#endif /* __TSU_MMF_SWCDWRAP_PLAYHWDEVOBSERVER_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_RecordHwDevObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_RecordHwDevObserver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,121 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_RecordHwDevObserver.h" + +CTestRecordMMFHwDeviceObserver::CTestRecordMMFHwDeviceObserver(CMMFHwDevice* aHwDevice) : CTestMMFHwDeviceObserver(aHwDevice) + { + } + +CTestRecordMMFHwDeviceObserver::~CTestRecordMMFHwDeviceObserver() + { + iSinkFile.Close(); + delete iFileWriter; + } + + +TInt CTestRecordMMFHwDeviceObserver::WriteBufferDirectToFileAsync(const TDesC& aFileName, TUint aNumberOfBuffers) + { + TInt error = KErrNone; + + if (!iFileServerSession.Handle()) + {//open a handle to the file server + error = iFileServerSession.Connect(); + } + + if (!error) + { + //make sure file to be recorded is deleted before we start + error = iFileServerSession.Delete(aFileName); + if (error == KErrNotFound) + error = KErrNone; //KErrNotFound is not an error, means file doesn't exist + + if (!error) + { + error = iSinkFile.Create(iFileServerSession, aFileName, EFileWrite); + if (!error) + { + if (!iFileWriter) + TRAP(error,iFileWriter = new(ELeave) CTestFileWriter(iSinkFile, this)); + } + if (!error) + { + iNumberOfBuffers = aNumberOfBuffers; + } + } + } + return error; + } + + +void CTestRecordMMFHwDeviceObserver::FileWriteComplete(TInt aError) + { + if (aError == KErrNone) + { + TInt error = KErrNone; + if (iCurrentBufferNumber >= iNumberOfBuffers) + { + error = iHwDevice->Stop(); + StopActiveScheduler(); + } + else if (iCurrentHwDeviceDataBuffer->LastBuffer() || iCurrentHwDeviceDataBuffer->BufferSize()==0) + { + error = iHwDevice->Stop(); + StopActiveScheduler(); + } + else + {//tell hw device we've emptied it and get another buffer + error = iHwDevice->ThisHwBufferEmptied(*iCurrentHwDeviceDataBuffer); + } + if (!iError) + iError = error; //log error in observer error + } + else + { + iError = aError; + } + } + + +TInt CTestRecordMMFHwDeviceObserver::EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + //called on recording when buffer needs to be written to file + TInt error = KErrNone; + iCurrentBufferNumber++; + iCurrentHwDeviceDataBuffer = &(static_cast(aHwDataBuffer)); + + if (iCurrentBufferNumber <= iNumberOfBuffers) + { + error = iFileWriter->Write(*iCurrentHwDeviceDataBuffer); + } + if (!iError) + iError = error; //log error in observer error + return error; + } + + +void CTestRecordMMFHwDeviceObserver::Stopped() + { + } + + +RFile& CTestRecordMMFHwDeviceObserver::WriteFile() + { + return iSinkFile; + } + + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_RecordHwDevObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_RecordHwDevObserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_RECORDHWDEVOBSERVER_H__ +#define __TSU_MMF_SWCDWRAP_RECORDHWDEVOBSERVER_H__ + +#include "TSU_MMF_SWCDWRAP_HwDevObserver.h" + +class CTestRecordMMFHwDeviceObserver : public CTestMMFHwDeviceObserver + { +public: + CTestRecordMMFHwDeviceObserver(CMMFHwDevice* aHwDevice); + ~CTestRecordMMFHwDeviceObserver(); + + //MMFHwDeviceObserver + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual void Stopped(); + + TInt WriteBufferDirectToFileAsync(const TDesC& aFileName, TUint aNumberOfBuffers); + + //callback from CTestFileWriter + virtual void FileWriteComplete(TInt aError); + + //gets Write File Handle + RFile& WriteFile(); + +private: + CTestFileWriter* iFileWriter; + RFile iSinkFile; + }; + +#endif /* __TSU_MMF_SWCDWRAP_RECORDHWDEVOBSERVER_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Step.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,365 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_Step.h" +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" +#include "TSU_MMF_SWCDWRAP_HwDevObserver.h" + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +#include "TSU_MMF_SWCDWRAP_PlayHwDevObserver.h" +#endif + + +/** + * Pre-amble for sw codec test step + * Sets __MM_HEAP_MARK for memory leak detection + */ +TVerdict CTestStep_MMF_SWCDWRAP::DoTestStepPreambleL() + { + __MM_HEAP_MARK; + return EPass; + } + +/** + * Post-amble for sw codec test step + * Sets __MM_HEAP_MARKEND for memory leak detection + */ +TVerdict CTestStep_MMF_SWCDWRAP::DoTestStepPostambleL() + { + __MM_HEAP_MARKEND; + return EPass; + } + + + +CTestStep_MMF_SWCDWRAP_U_0001::CTestStep_MMF_SWCDWRAP_U_0001() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0001-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0001::DoTestStepL( void ) +/** + * Use case: N/A + * Instantiate a test CMMFSwCodeWrapper CMMFHwDevice + * via uid. + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + CMMFHwDevice* hwDevice = NULL; + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + TRAPD(err, hwDevice = CMMFHwDevice::NewL(hwDeviceUid)); + + //check hw device has been created + if (err != KErrNone) + { + INFO_PRINTF2(_L("could not create hw device plugin error %d" ), err ); + verdict = EFail; + } + + if (!hwDevice) + { + verdict = EFail; + } + else + { + delete hwDevice; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0002::CTestStep_MMF_SWCDWRAP_U_0002() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0002-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0002::DoTestStepL( void ) +/** + * Use case: N/A + * Instantiate an invalid CMMFHwDevice + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + CMMFHwDevice* hwDevice = NULL; + TUid hwDeviceUid; + hwDeviceUid.iUid = 0xFFFFFFFF;//invalid uid + + TRAPD(err, hwDevice = CMMFHwDevice::NewL(hwDeviceUid)); + + //check hw device has not been created + if (err != KErrNotFound) + { + INFO_PRINTF2(_L("unexpected result %d" ), err ); + verdict = EFail; + } + + if (hwDevice) + { + verdict = EFail; + delete hwDevice; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0003::CTestStep_MMF_SWCDWRAP_U_0003() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0003-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0003::DoTestStepL( void ) +/** + * Use case: N/A + * Initialize sw codec wrapper HwDevice checking that the + * device drivers are loaded + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + CMMFHwDevice* hwDevice = NULL; + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER //Adapter loads the drivers + CActiveScheduler* activeScheduler; + activeScheduler = CActiveScheduler::Current(); + if (!activeScheduler) + { + activeScheduler = new(ELeave)CActiveScheduler; + } + CActiveScheduler::Install(activeScheduler); +#endif + + TRAPD(err, hwDevice = CMMFHwDevice::NewL(hwDeviceUid)); + + THwDeviceInitParams hwDeviceInitParams; + + CTestMMFHwDeviceObserver* hwDeviceObserver = new(ELeave)CTestMMFHwDeviceObserver(hwDevice); + + hwDeviceInitParams.iHwDeviceObserver = hwDeviceObserver; + + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + CTestPlayMMFHwDeviceObserver* hwPlayDeviceObserver = new(ELeave)CTestPlayMMFHwDeviceObserver(hwDevice); + hwDeviceInitParams.iHwDeviceObserver = hwPlayDeviceObserver; +#endif + + if (!err) + { + //check device drivers are not loaded prior to initialization + User::FreePhysicalDevice(KPddFileName); + User::FreeLogicalDevice(KLddFileName); + err = hwDevice->Init(hwDeviceInitParams); + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + if (!err) + { + TUid playCustomInterfaceUid; + playCustomInterfaceUid.iUid = KMmfPlaySettingsCustomInterface; + MPlayCustomInterface* playCustomInterface = + static_cast(hwDevice->CustomInterface(playCustomInterfaceUid)); + playCustomInterface->SetVolume(50000); + + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = 8000; + taskConfig.iStereoMode = ETaskMono; + + if (hwDevice->SetConfig(taskConfig) != KErrNone) + { + return EFail; + } + + TInt KTestBufferSize = 0x2000; + _LIT(filename,"\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + err = hwPlayDeviceObserver->FillBufferFromFileSync(filename, KTestBufferSize/2); + + err = hwDevice->Start(EDevDecode, EDevOutFlow); + + activeScheduler->Start(); + TInt error = hwPlayDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), err ); + verdict = EFail; + } + } +#endif + if (!err) + { + TInt ret = User::LoadPhysicalDevice(KPddFileName); + if (ret!=KErrAlreadyExists) + verdict = EFail; + ret = User::LoadLogicalDevice(KLddFileName); + if (ret!=KErrAlreadyExists) + verdict = EFail; + } + else + { + verdict = EFail; + } + } + + User::FreePhysicalDevice(KPddFileName); + User::FreeLogicalDevice(KLddFileName); + delete hwDevice; + delete hwDeviceObserver; +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + delete activeScheduler; + delete hwPlayDeviceObserver; +#endif + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0004::CTestStep_MMF_SWCDWRAP_U_0004() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0004-HP"); + } + +TVerdict CTestStep_MMF_SWCDWRAP_U_0004::DoTestStepL( void ) +/** + * Use case: N/A + * Initialize sw codec wrapper HwDevice using an invalid hwdevice observer + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + CMMFHwDevice* hwDevice = NULL; + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + TRAPD(err, hwDevice = CMMFHwDevice::NewL(hwDeviceUid)); + if (err) + { + return EInconclusive; + } + + THwDeviceInitParams hwDeviceInitParams; + + hwDeviceInitParams.iHwDeviceObserver = NULL; + + if (!err) + { + err = hwDevice->Init(hwDeviceInitParams); + if (err != KErrArgument) + { + verdict = EFail; + } + } + delete hwDevice; + return verdict; + } + + + +CTestStep_MMF_SWCDWRAP_U_0300::CTestStep_MMF_SWCDWRAP_U_0300() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0300-HP"); + } + +/** + * Verify CMMFHwDevice OOM + * Use case: N/A + * @test Req. under test REQ1931.2 + */ +TVerdict CTestStep_MMF_SWCDWRAP_U_0300::DoTestStepL( void ) + { + TVerdict verdict = EPass; + + CMMFHwDevice* hwDevice = NULL; + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + TInt KMaxFailRate = 100000; + TBool complete = EFalse; + TBool nullAlloc = EFalse; + TInt failCount; + + for (failCount=1; !complete && failCount= KMaxFailRate-1) + { + INFO_PRINTF2(_L("fail count too high %d" ), failCount ); + verdict = EFail; + } + + if (!nullAlloc) + { + INFO_PRINTF1(_L("never alloced after no OOM ")); + } + + + __UHEAP_RESET; + + delete hwDevice; + + return verdict ; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Step.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Step.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,94 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_STEP_H__ +#define __TSU_MMF_SWCDWRAP_STEP_H__ + +#include +#include +#include + +#ifndef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + _LIT(KPddFileName,"ESDRV.PDD"); + _LIT(KLddFileName,"ESOUND.LDD"); +#else + _LIT(KPddFileName,"SOUNDSC.PDD"); + _LIT(KLddFileName,"ESOUNDSC.LDD"); +#endif + +class CTestSuite; +class CTestSuite_MMF_SWCDWRAP; + +/** + * + * CTestStep_MMF_SWCDWRAP, which is the base class for all + * the MMF SWCDWRAP suite test steps. + * + * @lib "TSU_MMF_SWCDWRAP.lib" + * + */ +class CTestStep_MMF_SWCDWRAP : public CTestStep + { +public: + static void CleanUp(TAny *aPtr) ; +protected: + virtual TVerdict DoTestStepPreambleL(); + virtual TVerdict DoTestStepPostambleL(); + }; + + +class CTestStep_MMF_SWCDWRAP_U_0001 : public CTestStep_MMF_SWCDWRAP + { +public: + CTestStep_MMF_SWCDWRAP_U_0001() ; + ~CTestStep_MMF_SWCDWRAP_U_0001(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0002 : public CTestStep_MMF_SWCDWRAP + { +public: + CTestStep_MMF_SWCDWRAP_U_0002() ; + ~CTestStep_MMF_SWCDWRAP_U_0002(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0003 : public CTestStep_MMF_SWCDWRAP + { +public: + CTestStep_MMF_SWCDWRAP_U_0003() ; + ~CTestStep_MMF_SWCDWRAP_U_0003(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0004 : public CTestStep_MMF_SWCDWRAP + { +public: + CTestStep_MMF_SWCDWRAP_U_0004() ; + ~CTestStep_MMF_SWCDWRAP_U_0004(){} ; + virtual TVerdict DoTestStepL(); + } ; + + +class CTestStep_MMF_SWCDWRAP_U_0300 : public CTestStep_MMF_SWCDWRAP + { +public: + CTestStep_MMF_SWCDWRAP_U_0300() ; + ~CTestStep_MMF_SWCDWRAP_U_0300(){} ; + virtual TVerdict DoTestStepL(); + } ; + + +#endif /* __TSU_MMF_SWCDWRAP_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartConvert.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartConvert.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,289 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_StepStartConvert.h" +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" +#include "TSU_MMF_SWCDWRAP_ConvertHwDevObserver.h" +#include "TSU_MMF_SWCDWRAP_TestDevice.h" + +/** + * sets up test step hw device and observer + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestConvert::InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid) + { + TVerdict verdict = EPass; + + verdict = CTestStep_MMF_SWCDWRAP::DoTestStepPreambleL(); + + if (verdict == EPass) + { + + TRAPD(err, iHwDevice = CMMFHwDevice::NewL(aHwDeviceUid)); + + //check hw device has been created + if (err != KErrNone) + { + INFO_PRINTF2(_L("could not create hw device plugin error %d" ), err ); + verdict = EInconclusive; + } + } + + if (verdict == EPass) + { + iActiveScheduler = CActiveScheduler::Current(); + if (!iActiveScheduler) iActiveScheduler = new(ELeave)CActiveScheduler; + CActiveScheduler::Install(iActiveScheduler); + + iHwDeviceObserver = new(ELeave)CTestConvertMMFHwDeviceObserver(iHwDevice); + + THwDeviceInitParams devInfo; + devInfo.iHwDeviceObserver = iHwDeviceObserver; + TInt error = iHwDevice->Init(devInfo); + + if (error != KErrNone) + { + verdict = EInconclusive; + } + } + + return verdict; + } + +/** + * Pre-amble for sw codec test step using 'null' codec hw device + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestConvert::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + +/** + * Pre-amble for sw codec test step using 2:1 buffer ratio codec + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTest2To1Convert::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTest2To1Device; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + +/** + * Post-amble for sw codec test step + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestConvert::DoTestStepPostambleL() + { + delete iHwDevice; + delete iHwDeviceObserver; + delete iActiveScheduler; + + return CTestStep_MMF_SWCDWRAP::DoTestStepPostambleL(); + } + + + +CTestStep_MMF_SWCDWRAP_U_0200::CTestStep_MMF_SWCDWRAP_U_0200() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0200-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0200::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to convert one buffer + * buffer size = codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt convertedFileSize = 0; + + TFileName sourceFilename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TFileName sinkFilename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_converted.raw"); + + TInt error = iHwDeviceObserver->SetConvertFiles(sourceFilename, sinkFilename, 1);//convert 1 buffer + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevNullFunc, EDevInAndOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during convert %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(convertedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with converted file error %d"), error); + verdict = EFail; + } + if (convertedFileSize != KTestBufferSize) + { + INFO_PRINTF1(_L("converted file was not the expected size")); + verdict = EFail; + } + //do a file comparison between source and sink files + TBool compareResult = EFalse; + TRAP(error, compareResult = CompareL(iHwDeviceObserver->ReadFile(), iHwDeviceObserver->WriteFile(),KTestBufferSize)); + if (error) + { + INFO_PRINTF2(_L("problem comparing files error %d"), error); + if (verdict == EPass) + verdict = EInconclusive;//inconclusive because convert probably still ok + } + else if (compareResult == EFalse) + { + INFO_PRINTF1(_L("converted file not identical to source file")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening conversion files error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + +TBool CTestStep_MMF_SWCDWRAP_U_0200::CompareL(RFile& aFile1, RFile& aFile2, TUint aCompareLength) + { + TBool compareResult = ETrue; //ETrue if both files are identical + HBufC8* file1Buffer = HBufC8::NewLC(4); + HBufC8* file2Buffer = HBufC8::NewLC(4); + + //can't use HBufC8 directly with file server as + //HBufC8 is derived from TDesC8 but file server expects TDes8 + TPtr8 file1Ptr(file1Buffer->Des()); + TPtr8 file2Ptr(file2Buffer->Des()); + + //cannot compare file all in one go as we might run + //out of heap - so compare in 4 byte chunks + for (TUint pos=0;pos(pos), file1Ptr, 4); + aFile2.Read(static_cast(pos), file2Ptr, 4); + if (file1Buffer->Compare(*file2Buffer) != 0) + { + compareResult = EFalse; //file mismatch + } + } + CleanupStack::PopAndDestroy( 2 ); //file1Buffer & file2Buffer + return compareResult; + } + + +CTestStep_MMF_SWCDWRAP_U_0240::CTestStep_MMF_SWCDWRAP_U_0240() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0240-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0240::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to convert one buffer + * buffer size = codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt convertedFileSize = 0; + + TFileName sourceFilename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TFileName sinkFilename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_converted2To1.raw"); + + TInt error = iHwDeviceObserver->SetConvertFiles(sourceFilename, sinkFilename, 1);//convert 1 buffer + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevNullFunc, EDevInAndOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during convert %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(convertedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with converted file error %d"), error); + verdict = EFail; + } + if (convertedFileSize != KTest2To1SinkBufferSize) + { + INFO_PRINTF1(_L("converted file was not the expected size")); + verdict = EFail; + } + //not possible to do a file comparison between source and converted file + //as the conversion goes through a codec. + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening conversion files error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartConvert.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartConvert.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_STEPSTARTCONVERT_H__ +#define __TSU_MMF_SWCDWRAP_STEPSTARTCONVERT_H__ + +#include "TSU_MMF_SWCDWRAP_Step.h" + +class CTestSuite; +class CTestSuite_MMF_SWCDWRAP; +class CTestConvertMMFHwDeviceObserver; + +/** + * + * CTestStep_MMF_SWCDWRAP_StartTestConvert, which is the base class for all + * the MMF BASECL suite test steps that test the Start() + * method when used for convertion. + * + * @lib "TSU_MMF_SWCDWRAP.lib" + * + * @xxxx + * + */ +class CTestStep_MMF_SWCDWRAP_StartTestConvert : public CTestStep_MMF_SWCDWRAP + { +protected: + virtual TVerdict DoTestStepPreambleL(); + virtual TVerdict DoTestStepPostambleL(); + TVerdict InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid); +protected: + CActiveScheduler* iActiveScheduler; + CMMFHwDevice* iHwDevice; + CTestConvertMMFHwDeviceObserver* iHwDeviceObserver; + }; + + +/** + * + * CTestStep_MMF_SWCDWRAP_StartTest2To1Convert, which is the base class for all + * the MMF SWCDWRAP suite test steps that test the Start() + * method when used for convertion when using the 2 to 1 buffer ratio codec. + * + * @lib "TSU_MMF_SWCDWRAP.lib" + * + */ +class CTestStep_MMF_SWCDWRAP_StartTest2To1Convert : public CTestStep_MMF_SWCDWRAP_StartTestConvert + { +protected: + virtual TVerdict DoTestStepPreambleL(); + }; + + +class CTestStep_MMF_SWCDWRAP_U_0200 : public CTestStep_MMF_SWCDWRAP_StartTestConvert + { +public: + CTestStep_MMF_SWCDWRAP_U_0200() ; + ~CTestStep_MMF_SWCDWRAP_U_0200(){} ; + virtual TVerdict DoTestStepL(); +private: + TBool CompareL( RFile& aFile1, RFile& aFile2, TUint aCompareLength ); + } ; + + +class CTestStep_MMF_SWCDWRAP_U_0240 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Convert + { +public: + CTestStep_MMF_SWCDWRAP_U_0240() ; + ~CTestStep_MMF_SWCDWRAP_U_0240(){} ; + virtual TVerdict DoTestStepL(); + } ; + +#endif /* __TSU_MMF_SWCDWRAP_STEPSTARTCONVERT_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartDecode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartDecode.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,2101 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_StepStartDecode.h" +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" +#include "TSU_MMF_SWCDWRAP_PlayHwDevObserver.h" +#include "TSU_MMF_SWCDWRAP_AsyncTimer.h" +#include "TSU_MMF_SWCDWRAP_TestDevice.h" + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +/** + * sets up test step hw device and observer + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestDecode::InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid) + { + TVerdict verdict = EPass; + + verdict = CTestStep_MMF_SWCDWRAP::DoTestStepPreambleL(); + + if (verdict == EPass) + { + + TRAPD(err, iHwDevice = CMMFHwDevice::NewL(aHwDeviceUid)); + + //check hw device has been created + if (err != KErrNone) + { + INFO_PRINTF2(_L("could not create hw device plugin error %d" ), err ); + verdict = EInconclusive;//cannot run test proper if no HwDevice plugin available + //therefore if no hw dev plugin not possible to test the API under test + } + } + + if (verdict == EPass) + { + iActiveScheduler = CActiveScheduler::Current(); + if (!iActiveScheduler) iActiveScheduler = new(ELeave)CActiveScheduler; + CActiveScheduler::Install(iActiveScheduler); + + iHwDeviceObserver = new(ELeave)CTestPlayMMFHwDeviceObserver(iHwDevice); + + THwDeviceInitParams devInfo; + devInfo.iHwDeviceObserver = iHwDeviceObserver; + TInt error = iHwDevice->Init(devInfo); + + if (error == KErrNone) + { + TUid playCustomInterfaceUid; + playCustomInterfaceUid.iUid = KMmfPlaySettingsCustomInterface; + iPlayCustomInterface = + (MPlayCustomInterface*)iHwDevice->CustomInterface(playCustomInterfaceUid); + iPlayCustomInterface->SetVolume(50000); + + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = 8000; + taskConfig.iStereoMode = ETaskMono; + + if (iHwDevice->SetConfig(taskConfig) != KErrNone) + { + return EFail; + } + } + else + { + verdict = EInconclusive; + } + } + + return verdict; + } + + +/** + * Pre-amble for sw codec test step using 'null' codec hw device + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestDecode::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + + +/** + * Pre-amble for sw codec test step using 2:1 buffer ratio codec + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTest2To1Decode::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTest2To1Device; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + +/** + * Post-amble for sw codec test step + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestDecode::DoTestStepPostambleL() + { + delete iHwDevice; + delete iHwDeviceObserver; + delete iActiveScheduler; + + return CTestStep_MMF_SWCDWRAP::DoTestStepPostambleL(); + } + + + +CTestStep_MMF_SWCDWRAP_U_0010::CTestStep_MMF_SWCDWRAP_U_0010() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0010-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0010::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play one not completed buffer synchronously + * buffer size < codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, KTestBufferSize/2); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0011::CTestStep_MMF_SWCDWRAP_U_0011() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0011-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0011::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play exactly one complete buffer synchronously + * buffer size < codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, KTestBufferSize);//exactly 1 buffer + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0012::CTestStep_MMF_SWCDWRAP_U_0012() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0012-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0012::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play five complete and 1 not completed buffers synchronously + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, 5*KTestBufferSize + KTestBufferSize/2); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 6) + {//expected 6 buffers 5 complete + 1 not completed buffer + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0013::CTestStep_MMF_SWCDWRAP_U_0013() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0013-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0013::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play 1 buffer from a file using async read operation + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,1); //1 buffer + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0014::CTestStep_MMF_SWCDWRAP_U_0014() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0014-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0014::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play 5 buffers from a file using async read operation + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,5); //5 buffers + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 5) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0015::CTestStep_MMF_SWCDWRAP_U_0015() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0015-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0015::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play a file to completion + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + //calculate the expected duration of the file + //for some reason the calculation needs to broken up into these steps + //otherwise the compiler gets it wrong !! + TInt sourceFileSize = 0; + iHwDeviceObserver->ReadFile().Size(sourceFileSize); + TUint expectedNumberOfBuffers = sourceFileSize/KTestBufferSize; + TInt64 expectedDurationInt64 = sourceFileSize; + expectedDurationInt64 *= 1000000; //uS + expectedDurationInt64 /= (8000*2*1);//(samplerate*2BytesPerSample*mono) + TTimeIntervalMicroSeconds expectedDuration(expectedDurationInt64); + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + TTime startTime(0); + TTime endTime(0); + startTime.HomeTime(); + iActiveScheduler->Start(); + endTime.HomeTime(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + + //check file played for the expected time - allow margin of error +/- 0.55S + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); +#ifdef __WINS__ + if ( (duration.Int64() < (expectedDuration.Int64()-850000)) || + (duration.Int64() > (expectedDuration.Int64()+550000)) ) +#else + if ( (duration.Int64() < (expectedDuration.Int64()-550000)) || + (duration.Int64() > (expectedDuration.Int64()+550000)) ) +#endif // __WINS__ + { + INFO_PRINTF1(_L("file didn't play for the expected duration")); + INFO_PRINTF2(_L("duration observed : %ld"), duration.Int64()); + INFO_PRINTF2(_L("duration expected : %ld"), expectedDuration.Int64()); + verdict = EFail; + } + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfBuffers) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0016::CTestStep_MMF_SWCDWRAP_U_0016() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0016-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0016::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file, play for 4 seconds + * and then call Stop() + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error,asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (!error) + { + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000));//4S + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** STOPPED *****")); + } + else + { + return EInconclusive; + } + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during on Stop %d" ), error ); + verdict = EFail; + } + //check device drivers are not already opened + RMdaDevSound device; + error = device.Open(); + device.Close(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("sound driver was not closed %d" ), error ); + verdict = EFail; + } + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTestBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + { + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0017::CTestStep_MMF_SWCDWRAP_U_0017() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0017-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0017::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file and then play for 4 seconds + * and then call Pause() - tests basic pause functionality + * after Pause() resume playing again + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error,asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL()); + if (!error) + { + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PAUSED *****")); + } + else + { + return EInconclusive; + } + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTestBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + //check the number of bytes played by the device corresponds + //to the time that the pause was at ie 4Seconds + //The pause will have occurred on buffer number expectedNumberOfCompleteBuffersPlayed+2; + //allow an extra margin of +2 buffers. + TUint minAllowedBytesPlayed = KTestBufferSize*expectedNumberOfCompleteBuffersPlayed; + TUint maxAllowedBytesPlayed = KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed+2); + TUint bytesPlayed = iPlayCustomInterface->BytesPlayed(); + if ((bytesPlayed < minAllowedBytesPlayed)||(bytesPlayed > maxAllowedBytesPlayed)) + {//then the number of bytes played was outside the expected value + INFO_PRINTF2(_L("Num of bytes played not as expected at least %d" ), minAllowedBytesPlayed); + INFO_PRINTF2(_L("actual number of bytes played %d"),bytesPlayed); + verdict = EFail; + //note even if this test fails we shall carry on as this + //failure may not be fatal + } + User::After(TTimeIntervalMicroSeconds32(1000000));//1S pause + INFO_PRINTF1(_L("***** RESUME PLAYING *****")); + error = iHwDevice->Start(EDevDecode, EDevOutFlow);//resume play + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback resumed from pause%d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed+1) + {//not sure how many buffers played to EOF but should be more than at pause + INFO_PRINTF1(_L("insufficient number of buffers following resumed playing")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem resuming playback after pause error %d" ), error ); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0018::CTestStep_MMF_SWCDWRAP_U_0018() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0018-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0018::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file and + * and then call Pause() repeating every 1S till EOF + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + //get the size of the source file in bytes + TInt sourceFileSize = 0; + iHwDeviceObserver->ReadFile().Size(sourceFileSize); + + if (error == KErrNone) + { + TUint calculatedBytesPlayed = 0; + TUint expectedNumberOfCompleteBuffersPlayed = 0; + TUint minAllowedBytesPlayed = 0; + TUint maxAllowedBytesPlayed = 0; + TUint bytesPlayed = 0; + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error,asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + //only have timer stopping active scheduler prevents confusion + iHwDeviceObserver->StopActiveSchedulerOnStop(EFalse); + //Keep Pausing every second and resume playing till hw device observer + //has been informed the CMMFHwDevice plugin has stopped or until + //an error occurs + while ( !(error||iHwDeviceObserver->IsStopped()) ) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(1000000)); + TTime startTime(0); + TTime endTime(0); + startTime.HomeTime();//need to time the 1S as it might not be exactly 1S! + iActiveScheduler->Start(); + bytesPlayed = iPlayCustomInterface->BytesPlayed(); + endTime.HomeTime(); + INFO_PRINTF1(_L("***** PAUSED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //1S might not be exactly 1S due to active object + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); + TInt64 durationInt = duration.Int64(); + //(sampleRate * pcm16_2BytesperSample) + TInt64 calculatedBytesPlayedSincePause = 8000*2; + //adjust samples played for error in 1S timer + calculatedBytesPlayedSincePause *= durationInt; + calculatedBytesPlayedSincePause /= 1000000; + calculatedBytesPlayed += I64LOW(calculatedBytesPlayedSincePause); + + if (calculatedBytesPlayed > (bytesPlayed*2)) + {// provides a sanity check if the calculated + //number of bytes is more than double the file size + //then something has gone wrong ie EOF has not been + //successfully detected + error = KErrAbort; + INFO_PRINTF1(_L("Aborting should have EOFed by now")); + } + + expectedNumberOfCompleteBuffersPlayed = calculatedBytesPlayed/KTestBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed) + { + INFO_PRINTF1(_L("insufficient number of buffers")); + + //Return EFail when it is target test + //Return EKnownFailure when it is emulator test +#if defined(__WINS__) || defined(__WINSCW__) + + //CHANGE VERDICT TO EKnownFailure! + //A known failure due to paused the bytes played does not + //reflect the actual number of bytes played. + //MMF code doesn't use pause on the hwDevice to pause. + //These tests are windows sound driver and hardware dependent as well + INFO_PRINTF1(_L("This is a known failure due to a sound driver problem")); + verdict = EKnownFailure; //return EKnownFailure when it is emulator test +#else + verdict = EFail; //return EFail when it is target test +#endif + } + + //check the number of bytes played by the device corresponds + //to the time that the pause was at + //allow a margin of error of 4% +/- 1 buffer + //not the actual margin depends on the sound driver + //windows NT will fail this badly. + //other drivers seem to fail too cause is that the BytesPlayed + //doesn't reflect the actual bytes palyed on pause as the driver + //adds then entire buffer to bytes played including the bytes it + //hasn't played ! + minAllowedBytesPlayed = calculatedBytesPlayed-KTestBufferSize; + minAllowedBytesPlayed *= 96; + minAllowedBytesPlayed /= 100; + maxAllowedBytesPlayed = calculatedBytesPlayed+KTestBufferSize; + maxAllowedBytesPlayed *= 104; + maxAllowedBytesPlayed /= 100; + + INFO_PRINTF2(_L("sounddriver says %d" ), bytesPlayed); + INFO_PRINTF2(_L("calculated bytes played %d" ), calculatedBytesPlayed); + + if ((bytesPlayed < minAllowedBytesPlayed)||(bytesPlayed > maxAllowedBytesPlayed)) + {//then the number of bytes played was outside the expected value + INFO_PRINTF2(_L("Num of bytes played not as expected at least %d" ), minAllowedBytesPlayed); + INFO_PRINTF2(_L("actual number of bytes played %d"),bytesPlayed); + + //Return EKnownFailure when it is target test + //Return EFail when it is emulator test +#if defined(__WINS__) || defined(__WINSCW__) + verdict = EFail; //return EFail when it is emulator test + //note even if this test fails we shall carry on as this + //failure may not be fatal + +#else + //CHANGE VERDICT TO EKnownFailure! + //A known failure due to paused the bytes played does not + //reflect the actual number of bytes played. + //MMF code doesn't use pause on the hwDevice to pause. + //These tests are windows sound driver and hardware dependent as well + INFO_PRINTF1(_L("This is a known failure due to a sound driver problem")); + verdict = EKnownFailure; //return EKnownFailure when it is target test +#endif + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + }//while (!error) && (!iHwDeviceObserver->IsStopped()) + if (error) + { + INFO_PRINTF2(_L("error occured %d" ), error ); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0019::CTestStep_MMF_SWCDWRAP_U_0019() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0019-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0019::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file and then play for 4 seconds + * and then call Stop() and then call Start() again. + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** STOPPED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during on Stop %d" ), error ); + verdict = EFail; + } + //check device drivers are not already opened + RMdaDevSound device; + error = device.Open(); + device.Close(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("sound driver was not closed %d" ), error ); + verdict = EFail; + } + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTestBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + User::After(TTimeIntervalMicroSeconds32(100000));//.1S pause + INFO_PRINTF1(_L("***** PLAYING RESTARTED *****")); + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback resumed from pause%d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed+1) + {//not sure how many buffers played to EOF but should be more than at pause + INFO_PRINTF1(_L("insufficient number of buffers following resumed playing")); + verdict = EFail; + } + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0020::CTestStep_MMF_SWCDWRAP_U_0020() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0020-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0020::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play a file to completion + * Using custom play interface to set to stereo and different sample rate + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + iPlayCustomInterface->SetVolume(20000); + + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = 16000; + taskConfig.iStereoMode = ETaskInterleaved; + + if (iHwDevice->SetConfig(taskConfig) != KErrNone) + { + return EFail; + } + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_16s.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + //calculate the expected duration of the file + //for some reason the calculation needs to broken up into these steps + //otherwise the compiler gets it wrong !! + TInt sourceFileSize = 0; + iHwDeviceObserver->ReadFile().Size(sourceFileSize); + TInt64 expectedDurationInt64 = sourceFileSize; + expectedDurationInt64 *= 1000000; //uS + expectedDurationInt64 /= (16000*2*2);//(samplerate*2BytesPerSample*stereo) + TTimeIntervalMicroSeconds expectedDuration(expectedDurationInt64); + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + TTime startTime(0); + TTime endTime(0); + startTime.HomeTime(); + iActiveScheduler->Start(); + endTime.HomeTime(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + //check file played for the expected time - allow margin of error +/- 0.5S + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); + if ( (duration.Int64() < (expectedDuration.Int64()-500000)) || + (duration.Int64() > (expectedDuration.Int64()+500000)) ) + { + INFO_PRINTF1(_L("file didn't play for the expected duration")); + verdict = EFail; + } + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= 5) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + +CTestStep_MMF_SWCDWRAP_U_0021::CTestStep_MMF_SWCDWRAP_U_0021() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0021-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0021::DoTestStepL( void ) +/** + * Use case: N/A + * Call Pause() after sending last buffer + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + iHwDeviceObserver->CallPauseAndResumeAfterSendingLastBuffer(); + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= 5) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0040::CTestStep_MMF_SWCDWRAP_U_0040() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0040-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0040::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play one not completed buffer synchronously using 2:1 codec + * buffer size < codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, KTest2To1SourceBufferSize/2); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0041::CTestStep_MMF_SWCDWRAP_U_0041() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0041-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0041::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play exactly one complete buffer synchronously using 2:1 codec + * buffer size < codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, KTest2To1SourceBufferSize);//exactly 1 buffer + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0042::CTestStep_MMF_SWCDWRAP_U_0042() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0042-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0042::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play five complete and 1 not completed buffers synchronously using 2:1 codec + * buffer size < codec buffer size + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + TInt error = iHwDeviceObserver->FillBufferFromFileSync(filename, 5*KTest2To1SourceBufferSize + KTest2To1SourceBufferSize/2); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 6) + {//expected 6 buffers 5 complete + 1 not completed buffer + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem creating source buffer from file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0043::CTestStep_MMF_SWCDWRAP_U_0043() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0043-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0043::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play 1 buffer from a file using async read operation using 2:1 codec + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,1); //1 buffer + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0044::CTestStep_MMF_SWCDWRAP_U_0044() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0044-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0044::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play 5 buffers from a file using async read operation using 2:1 codec + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,5); //5 buffers + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 5) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0045::CTestStep_MMF_SWCDWRAP_U_0045() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0045-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0045::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play a file to completion using 2:1 codec + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + //calculate the expected duration of the file + //for some reason the calculation needs to broken up into these steps + //otherwise the compiler gets it wrong !! + TInt sourceFileSize = 0; + iHwDeviceObserver->ReadFile().Size(sourceFileSize); + TInt64 expectedDurationInt64 = sourceFileSize; + expectedDurationInt64 *= 1000000; //uS + expectedDurationInt64 /= (8000*2*1*2);//(samplerate*2BytesPerSample*mono*2:1 codec) + TTimeIntervalMicroSeconds expectedDuration(expectedDurationInt64); + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING SPEED 2:1 *****")); + if (error == KErrNone) + { + TTime startTime(0); + TTime endTime(0); + startTime.HomeTime(); + iActiveScheduler->Start(); + endTime.HomeTime(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + //check file played for the expected time - allow margin of error +/- 0.5S + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); + if ( (duration.Int64() < (expectedDuration.Int64()-500000)) || + (duration.Int64() > (expectedDuration.Int64()+500000)) ) + { + INFO_PRINTF1(_L("file didn't play for the expected duration")); + verdict = EFail; + } + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= 5) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + +CTestStep_MMF_SWCDWRAP_U_0046::CTestStep_MMF_SWCDWRAP_U_0046() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0046-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0046::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file, play for 2 seconds using 2:1 codec + * and then call Stop() + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** STOPPED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during on Stop %d" ), error ); + verdict = EFail; + } + //check device drivers are not already opened + RMdaDevSound device; + error = device.Open(); + device.Close(); + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTest2To1SinkBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0047::CTestStep_MMF_SWCDWRAP_U_0047() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0047-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0047::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file, play for 2 seconds using 2:1 codec + * and then call Pause() - tests basic pause functionality + * after Pause() resume playing again + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PAUSED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTest2To1SinkBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + //check the number of bytes played by the device corresponds + //to the time that the pause was at ie 4Seconds + //The pause will have occurred on buffer number expectedNumberOfCompleteBuffersPlayed+2; + TUint minAllowedBytesPlayed = KTest2To1SinkBufferSize*expectedNumberOfCompleteBuffersPlayed; + TUint maxAllowedBytesPlayed = KTest2To1SinkBufferSize*(expectedNumberOfCompleteBuffersPlayed+2); + TUint bytesPlayed = iPlayCustomInterface->BytesPlayed(); + if ((bytesPlayed < minAllowedBytesPlayed)||(bytesPlayed > maxAllowedBytesPlayed)) + {//then the number of bytes played was outside the expected value + INFO_PRINTF2(_L("Num of bytes played not as expected at least %d" ), minAllowedBytesPlayed); + INFO_PRINTF2(_L("actual number of bytes played %d"),bytesPlayed); + verdict = EFail; + //note even if this test fails we shall carry on as this + //failure may not be fatal + } + User::After(TTimeIntervalMicroSeconds32(1000000));//1S pause + INFO_PRINTF1(_L("***** RESUME PLAYING *****")); + error = iHwDevice->Start(EDevDecode, EDevOutFlow);//resume play + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback resumed from pause%d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed+1) + {//not sure how many buffers played to EOF but should be more than at pause + INFO_PRINTF1(_L("insufficient number of buffers following resumed playing")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem resuming playback after pause error %d" ), error ); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + + +CTestStep_MMF_SWCDWRAP_U_0048::CTestStep_MMF_SWCDWRAP_U_0048() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0048-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0048::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file using 2:1 codec + * and then call Pause() repeatidly every second till EOF + * @test Req. under test REQ1931.2 + */ + { +//this test has been seen to cause the EKA2 lubbock sounddriver +//to occasionaly die, however putting debug info in to get the +//call sequence to the sound driver results in the test running to completion + TVerdict verdict = EPass; +#ifndef __WINS__ + verdict = EKnownFailure; +#else + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + //get the size of the source file in bytes + TInt sourceFileSize = 0; + iHwDeviceObserver->ReadFile().Size(sourceFileSize); + + if (error == KErrNone) + { + TUint calculatedBytesPlayed = 0; + TUint expectedNumberOfCompleteBuffersPlayed = 0; + TUint minAllowedBytesPlayed = 0; + TUint maxAllowedBytesPlayed = 0; + TUint bytesPlayed = 0; + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error,asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + //only have timer stopping active scheduler prevents confusion + iHwDeviceObserver->StopActiveSchedulerOnStop(EFalse); + //Keep Pausing every second and resume playing till hw device observer + //has been informed the CMMFHwDevice plugin has stopped or until + //an error occurs + while ( !(error||iHwDeviceObserver->IsStopped()) ) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(1000000)); + TTime startTime(0); + TTime endTime(0); + startTime.HomeTime(); + iActiveScheduler->Start(); + bytesPlayed = iPlayCustomInterface->BytesPlayed(); + endTime.HomeTime(); + INFO_PRINTF1(_L("***** PAUSED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //(sampleRate * pcm16_2BytesperSample) + TTimeIntervalMicroSeconds duration = endTime.MicroSecondsFrom(startTime); + TInt64 durationInt = duration.Int64(); + TInt64 calculatedBytesPlayedSincePause = 8000*2; + calculatedBytesPlayedSincePause *= durationInt; + calculatedBytesPlayedSincePause /= 1000000; + calculatedBytesPlayed += I64LOW(calculatedBytesPlayedSincePause); + + if (calculatedBytesPlayed > (bytesPlayed*2)) + {// provides a sanity check if the calculated + //number of bytes is more than double the expected value + //(would expect at EOF calcultedBytesPlayed to be half sourceFileSize + //with 2:1 codec + //then something has gone wrong ie EOF has not been + //successfully detected + error = KErrAbort; + INFO_PRINTF1(_L("Aborting should have EOFed by now")); + } + + expectedNumberOfCompleteBuffersPlayed = calculatedBytesPlayed/KTest2To1SinkBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed) + { + INFO_PRINTF1(_L("insufficient number of buffers")); + + //Return EFail when it is target test + //Return EKnownFailure when it is emulator test +#if defined(__WINS__) || defined(__WINSCW__) + + //CHANGE VERDICT TO EKnownFailure! + //A known failure due to paused the bytes played does not + //reflect the actual number of bytes played. + //MMF code doesn't use pause on the hwDevice to pause. + //These tests are windows sound driver and hardware dependent as well + INFO_PRINTF1(_L("This is a known failure due to a sound driver problem")); + verdict = EKnownFailure; //return EKnownFailure when it is emulator test +#else + verdict = EFail; //return EFail when it is target test +#endif + } + + //check the number of bytes played by the device corresponds + //to the time that the pause was at + //allow a margin of error of 4% +/- 1 buffer + //not the actual margin depends on the sound driver + //windows NT will fail this. + //also timer RunL is AO and may be blocked ie timing may not be exact. + minAllowedBytesPlayed = calculatedBytesPlayed-KTestBufferSize; + minAllowedBytesPlayed *= 96; + minAllowedBytesPlayed /= 100; + maxAllowedBytesPlayed = calculatedBytesPlayed+KTestBufferSize; + maxAllowedBytesPlayed *= 104; + maxAllowedBytesPlayed /= 100; + + INFO_PRINTF2(_L("sounddriver says %d" ), bytesPlayed); + INFO_PRINTF2(_L("calculated bytes played %d" ), calculatedBytesPlayed); + + if ((bytesPlayed < minAllowedBytesPlayed)||(bytesPlayed > maxAllowedBytesPlayed)) + {//then the number of bytes played was outside the expected value + INFO_PRINTF2(_L("Num of bytes played not as expected at least %d" ), minAllowedBytesPlayed); + INFO_PRINTF2(_L("actual number of bytes played %d"),bytesPlayed); + + //Return EKnownFailure when it is target test + //Return EFail when it is emulator test +#if defined(__WINS__) || defined(__WINSCW__) + verdict = EFail; //return EFail when it is emulator test + //note even if this test fails we shall carry on as this + //failure may not be fatal + +#else + //CHANGE VERDICT TO EKnownFailure! + //A known failure due to paused the bytes played does not + //reflect the actual number of bytes played. + //MMF code doesn't use pause on the hwDevice to pause. + //These tests are windows sound driver and hardware dependent as well + INFO_PRINTF1(_L("This is a known failure due to a sound driver problem")); + verdict = EKnownFailure; //return EKnownFailure when it is target test +#endif + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + }//while (!error) && (!iHwDeviceObserver->IsStopped()) + if (error) + { + INFO_PRINTF2(_L("error occured %d" ), error ); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } +#endif //__WINS__ + return verdict ; + + } + + +CTestStep_MMF_SWCDWRAP_U_0049::CTestStep_MMF_SWCDWRAP_U_0049() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0049-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0049::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file, play for 2 seconds using 2:1 codec + * and then call Stop() and then call Start() again. + * @test Req. under test REQ1931.2 + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** STOPPED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during on Stop %d" ), error ); + verdict = EFail; + } + //check device drivers are not already opened + RMdaDevSound device; + error = device.Open(); + device.Close(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("sound driver was not closed %d" ), error ); + verdict = EFail; + } + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTest2To1SinkBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + User::After(TTimeIntervalMicroSeconds32(100000));//.1S pause + INFO_PRINTF1(_L("***** PLAYING RESTARTED *****")); + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback resumed from pause%d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed+1) + {//not sure how many buffers played to EOF but should be more than at pause + INFO_PRINTF1(_L("insufficient number of buffers following resumed playing")); + verdict = EFail; + } + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0050::CTestStep_MMF_SWCDWRAP_U_0050() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0050-LP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0050::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to play from a file, play for 2 seconds using 2:1 codec + * and then call StopAndDeleteCodec() and then call Start() again. + */ + { + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAPpcm16_8m.raw"); + + TInt error = iHwDeviceObserver->ReadBufferDirectFromFileAsync(filename,0xFFFF); //EOF + + if (error == KErrNone) + { + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + INFO_PRINTF1(_L("***** PLAYING *****")); + if (error == KErrNone) + { + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAndDeleteCodecAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000)); + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** STOPPED *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopAndDeleteCodecError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during on StopAndDeleteCodec %d" ), error ); + verdict = EFail; + } + //check device drivers are not already opened + RMdaDevSound device; + #ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + //Try querying version before opening the device. Added to improve the code coverage + TVersion version = device.VersionRequired(); + + error = device.Open(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("sound driver was not opened %d" ), error ); + verdict = EFail; + } + version = device.VersionRequired(); + + TBool isMdaDevSound = device.IsMdaSound(); + if(!isMdaDevSound) + { + INFO_PRINTF1(_L("IsMdaDevSound() returned EFalse: Unexpected")); + verdict = EFail; + } + //Try queryinig play volume after opening the device + TInt volume = device.PlayVolume(); + //Try querying gain + volume = device.RecordLevel(); + device.Close(); + #else + error = device.Open(); + device.Close(); + #endif //SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + if (error != KErrNone) + { + INFO_PRINTF2(_L("sound driver was not closed %d" ), error ); + verdict = EFail; + } + + //(4seconds * sampleRate * pcm16_2BytesperSample) + TUint samplesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = samplesPlayed/KTest2To1SinkBufferSize; + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed) + {//not sure how many buffers played to EOF but should be at least 5 + INFO_PRINTF1(_L("insufficient number of buffers")); + verdict = EFail; + } + User::After(TTimeIntervalMicroSeconds32(100000));//.1S pause + INFO_PRINTF1(_L("***** PLAYING RESTARTED *****")); + error = iHwDevice->Start(EDevDecode, EDevOutFlow); + if (error == KErrNone) + { + iActiveScheduler->Start(); + INFO_PRINTF1(_L("***** PLAYING COMPLETE EOF *****")); + error = iHwDeviceObserver->ErrorStatus(); + if ((error != KErrNone)&&(error != KErrUnderflow)) + { + INFO_PRINTF2(_L("error during audio playback resumed from pause%d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() <= expectedNumberOfCompleteBuffersPlayed+1) + {//not sure how many buffers played to EOF but should be more than at pause + INFO_PRINTF1(_L("insufficient number of buffers following resumed playing")); + verdict = EFail; + } + // now delete the codec + INFO_PRINTF1(_L("***** DELETING CODEC *****" )); + error = iHwDevice->DeleteCodec(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error deleting codec, error = %d" ), error ); + verdict = EFail; + } + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening source file error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartDecode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartDecode.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,241 @@ +// Copyright (c) 2003-2009 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: +// TSU_MMF_SWCDWRAP_Step.h +// +// + +#ifndef __TSU_MMF_SWCDWRAP_STEPSTARTDECODE_H__ +#define __TSU_MMF_SWCDWRAP_STEPSTARTDECODE_H__ + +#include "TSU_MMF_SWCDWRAP_Step.h" + +class CTestSuite; +class CTestSuite_MMF_SWCDWRAP; +class CTestPlayMMFHwDeviceObserver; + +/** + * + * CTestStep_MMF_SWCDWRAP, which is the base class for all + * the MMF SWCDWRAP suite test steps that test the Start() + * method when used for decode (play). + * + * @lib "TSU_MMF_SWCDWRAP.lib" + * + */ +class CTestStep_MMF_SWCDWRAP_StartTestDecode : public CTestStep_MMF_SWCDWRAP + { +protected: + virtual TVerdict DoTestStepPreambleL(); + virtual TVerdict DoTestStepPostambleL(); + TVerdict InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid); +protected: + CActiveScheduler* iActiveScheduler; + CMMFHwDevice* iHwDevice; + CTestPlayMMFHwDeviceObserver* iHwDeviceObserver; + MPlayCustomInterface* iPlayCustomInterface; + }; + +class CTestStep_MMF_SWCDWRAP_StartTest2To1Decode : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +protected: + virtual TVerdict DoTestStepPreambleL(); + }; + + +class CTestStep_MMF_SWCDWRAP_U_0010 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0010() ; + ~CTestStep_MMF_SWCDWRAP_U_0010(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0011 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0011() ; + ~CTestStep_MMF_SWCDWRAP_U_0011(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0012 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0012() ; + ~CTestStep_MMF_SWCDWRAP_U_0012(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0013 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0013() ; + ~CTestStep_MMF_SWCDWRAP_U_0013(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0014 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0014() ; + ~CTestStep_MMF_SWCDWRAP_U_0014(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0015 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0015() ; + ~CTestStep_MMF_SWCDWRAP_U_0015(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0016 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0016() ; + ~CTestStep_MMF_SWCDWRAP_U_0016(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0017 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0017() ; + ~CTestStep_MMF_SWCDWRAP_U_0017(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0018 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0018() ; + ~CTestStep_MMF_SWCDWRAP_U_0018(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0019 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0019() ; + ~CTestStep_MMF_SWCDWRAP_U_0019(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0020 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0020() ; + ~CTestStep_MMF_SWCDWRAP_U_0020(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0021 : public CTestStep_MMF_SWCDWRAP_StartTestDecode + { +public: + CTestStep_MMF_SWCDWRAP_U_0021() ; + ~CTestStep_MMF_SWCDWRAP_U_0021(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0040 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0040() ; + ~CTestStep_MMF_SWCDWRAP_U_0040(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0041 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0041() ; + ~CTestStep_MMF_SWCDWRAP_U_0041(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0042 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0042() ; + ~CTestStep_MMF_SWCDWRAP_U_0042(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0043 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0043() ; + ~CTestStep_MMF_SWCDWRAP_U_0043(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0044 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0044() ; + ~CTestStep_MMF_SWCDWRAP_U_0044(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0045 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0045() ; + ~CTestStep_MMF_SWCDWRAP_U_0045(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0046 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0046() ; + ~CTestStep_MMF_SWCDWRAP_U_0046(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0047 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0047() ; + ~CTestStep_MMF_SWCDWRAP_U_0047(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0048 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0048() ; + ~CTestStep_MMF_SWCDWRAP_U_0048(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0049 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0049() ; + ~CTestStep_MMF_SWCDWRAP_U_0049(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0050 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Decode + { +public: + CTestStep_MMF_SWCDWRAP_U_0050() ; + ~CTestStep_MMF_SWCDWRAP_U_0050(){} ; + virtual TVerdict DoTestStepL(); + } ; + + +#endif /* __TSU_MMF_SWCDWRAP_STEPSTARTDECODE_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartEncode.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartEncode.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1184 @@ +// Copyright (c) 2003-2009 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: +// + +// Test system includes +#include "TSU_MMF_SWCDWRAP_StepStartEncode.h" +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" +#include "TSU_MMF_SWCDWRAP_RecordHwDevObserver.h" +#include "TSU_MMF_SWCDWRAP_AsyncTimer.h" +#include "TSU_MMF_SWCDWRAP_TestDevice.h" + +/** + * sets up test step hw device and observer + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestEncode::InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid) + { + TVerdict verdict = EPass; + + verdict = CTestStep_MMF_SWCDWRAP::DoTestStepPreambleL(); + + if (verdict == EPass) + { + + TRAPD(err, iHwDevice = CMMFHwDevice::NewL(aHwDeviceUid)); + + //check hw device has been created + if (err != KErrNone) + { + INFO_PRINTF2(_L("could not create hw device plugin error %d" ), err ); + verdict = EInconclusive; + } + } + + if (verdict == EPass) + { + iActiveScheduler = CActiveScheduler::Current(); + if (!iActiveScheduler) iActiveScheduler = new(ELeave)CActiveScheduler; + CActiveScheduler::Install(iActiveScheduler); + + iHwDeviceObserver = new(ELeave)CTestRecordMMFHwDeviceObserver(iHwDevice); + + THwDeviceInitParams devInfo; + devInfo.iHwDeviceObserver = iHwDeviceObserver; + TInt error = iHwDevice->Init(devInfo); + + if (error == KErrNone) + { + TUid recordCustomInterfaceUid; + recordCustomInterfaceUid.iUid = KMmfRecordSettingsCustomInterface; + iRecordCustomInterface = + (MRecordCustomInterface*)iHwDevice->CustomInterface(recordCustomInterfaceUid); + iRecordCustomInterface->SetGain(250); + + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = 8000; + taskConfig.iStereoMode = ETaskMono; + + if (iHwDevice->SetConfig(taskConfig) != KErrNone) + { + return EFail; + } + } + else + { + verdict = EInconclusive; + } + } + + return verdict; + } + +/** + * Pre-amble for sw codec test step using 'null' codec hw device + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestEncode::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTestDevice; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + + +/** + * Pre-amble for sw codec test step using 2:1 buffer ratio codec + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTest2To1Encode::DoTestStepPreambleL() + { + TVerdict verdict = EPass; + + TUid hwDeviceUid; + hwDeviceUid.iUid = KMmfUidTSUSWCDWRAPTest2To1Device; + + verdict = InitializeTestStepUsingHwDeviceL(hwDeviceUid); + + return verdict; + } + +/** + * Post-amble for sw codec test step + */ +TVerdict CTestStep_MMF_SWCDWRAP_StartTestEncode::DoTestStepPostambleL() + { + delete iHwDevice; + delete iHwDeviceObserver; + delete iActiveScheduler; + + return CTestStep_MMF_SWCDWRAP::DoTestStepPostambleL(); + } + + + +CTestStep_MMF_SWCDWRAP_U_0100::CTestStep_MMF_SWCDWRAP_U_0100() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0100-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0100::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record one buffer + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 1); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + if (recordedFileSize != KTestBufferSize) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0101::CTestStep_MMF_SWCDWRAP_U_0101() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0101-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0101::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record five buffers + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 5); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 5) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + if (recordedFileSize != KTestBufferSize*5) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0102::CTestStep_MMF_SWCDWRAP_U_0102() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0102-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0102::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record and then pause after 4S of recording + * Note record Pause() does not really 'pause' as such but completes + * recording + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->StopActiveSchedulerOnCall(EFalse); + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000));//4S + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //calculate expected number of buffers + //4S * samplerate * 2 bytes per sample + TUint bytesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = (bytesPlayed/KTestBufferSize)+1;//+1 for flushed buf + + //allow a margin of error of 1 buffer either side of the expected number + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-1)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+1)) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of +/- 1 buffer + if ((static_cast(recordedFileSize) < KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed-1))|| + (static_cast(recordedFileSize) > KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed+1))) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + INFO_PRINTF2(_L("Expected %d" ), KTestBufferSize*expectedNumberOfCompleteBuffersPlayed ); + INFO_PRINTF2(_L("Actual %d" ), recordedFileSize); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0103::CTestStep_MMF_SWCDWRAP_U_0103() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0103-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0103::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record and then Stop after 4S of recording + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000));//4S + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //calculate expected number of buffers + //4S * samplerate * 2 bytes per sample + TUint bytesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = bytesPlayed/KTestBufferSize; + + //allow a margin of error of 2 buffer either side of the expected number + //note we need a margin of 2 because Stop does not flush + //the currently recorded buffer. + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-2)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+2)) + { + INFO_PRINTF2(_L("incorrect number of buffers %d"), iHwDeviceObserver->NumberOfBuffersObserved()); + INFO_PRINTF2(_L("expected %d" ), expectedNumberOfCompleteBuffersPlayed ); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of 1 buffer + if ((static_cast(recordedFileSize) < KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed-2))|| + (static_cast(recordedFileSize) > KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed+2))) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0104::CTestStep_MMF_SWCDWRAP_U_0104() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0104-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0104::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record and then Stop after 2S of recording + * Then resume recording again and Stop a further 2 times + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + // Stop the recording after 4.5 buffers have played + // We stop half way through a buffer to try to ensure we don't stop + // on a buffer boundary which can make buffer counting unpredictable + const TInt KIterations = 3; + const TInt KExpectedBuffers = 5; + const TInt KOneMillion = 1000000; + const TInt KSampleRate = 8000; + const TInt KBytesPerSample = 2; + const TInt KTimeToRecordMicroSeconds = + I64LOW( + TInt64(KTestBufferSize) * TInt64(KOneMillion) * + TInt64(9) / TInt64(2) / // 4.5 + TInt64(KBytesPerSample) / TInt64(KSampleRate) + ); + + if (error == KErrNone) + { + TUint expectedNumberOfCompleteBuffersPlayed = 0; + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + for (TInt i=0; iStart(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + asyncTimer->StopActiveSchedulerOnCall(EFalse); + asyncTimer->Cancel(); //just in case + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(KTimeToRecordMicroSeconds));//2.5 secs + + iActiveScheduler->Start(); + error = iHwDevice->Stop(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error stopping audio record %d" ), error ); + verdict = EFail; + } + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + }//if (error == KErrNone) + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + }//for (i=0, i++, i<=3) + //calculate expected number of buffers + expectedNumberOfCompleteBuffersPlayed = KExpectedBuffers * KIterations; + + //allow a margin of error of +/- 2 buffer either side of the expected number + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-2)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+2)) + { + INFO_PRINTF2(_L("unexpected number of buffers %d"), iHwDeviceObserver->NumberOfBuffersObserved()); + INFO_PRINTF2(_L("expected %d" ), expectedNumberOfCompleteBuffersPlayed ); + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of 1 buffer + if ((static_cast(recordedFileSize) < KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed-2))|| + (static_cast(recordedFileSize) > KTestBufferSize*(expectedNumberOfCompleteBuffersPlayed+2))) + { + INFO_PRINTF2(_L("recorded file was not the expected size %d"), recordedFileSize); + INFO_PRINTF2(_L("expected %d"), KTest2To1SinkBufferSize*expectedNumberOfCompleteBuffersPlayed ); + verdict = EFail; + } + delete asyncTimer; + }//if (error == KErrNone) + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0105::CTestStep_MMF_SWCDWRAP_U_0105() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0105-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0105::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record five buffers + * Using the record custom interface to set sample rate 16000 and stereo record + * and change gain + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + iRecordCustomInterface->SetGain(200); + + TTaskConfig taskConfig; + taskConfig.iUid = KUidRefDevSoundTaskConfig; + taskConfig.iRate = 16000; + taskConfig.iStereoMode = ETaskInterleaved; + + if (iHwDevice->SetConfig(taskConfig) != KErrNone) + { + return EFail; + } + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 5); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 5) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + if (recordedFileSize != KTestBufferSize*5) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + + +CTestStep_MMF_SWCDWRAP_U_0106::CTestStep_MMF_SWCDWRAP_U_0106() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0106-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0106::DoTestStepL() +/** + * DEF075721 : Sound recoding's pause operation causes panic after its stop + * Issuing a Stop/Pause sequence causes panic + */ + { + const TInt KIterations = 3; + TVerdict verdict = EPass; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + return EInconclusive; + } + + const TInt KOneMillion = 1000000; + const TInt KSampleRate = 8000; + const TInt KBytesPerSample = 2; + const TInt KTimeToRecordMicroSeconds = + I64LOW( + TInt64(KTestBufferSize) * TInt64(KOneMillion) * + TInt64(9) / TInt64(2) / // 4.5 + TInt64(KBytesPerSample) / TInt64(KSampleRate) + ); + + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL()); + if (error != KErrNone) + { + return EInconclusive; + } + + CleanupStack::PushL(asyncTimer); + + for (TInt i = 0; i < KIterations; i++) + {//do 3 iterations + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + CleanupStack::PopAndDestroy(asyncTimer); + return EFail; + } + + INFO_PRINTF1(_L("***** RECORDING *****")); + asyncTimer->StopActiveSchedulerOnCall(ETrue); + asyncTimer->Cancel(); //just in case + asyncTimer->CallStopPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(KTimeToRecordMicroSeconds));//2.5 secs + + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + CleanupStack::PopAndDestroy(asyncTimer); + return EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + CleanupStack::PopAndDestroy(asyncTimer); + return EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Stop %d"), error); + CleanupStack::PopAndDestroy(asyncTimer); + return EFail; + } + } + CleanupStack::PopAndDestroy(asyncTimer); + asyncTimer = NULL; + + return verdict; + } + +CTestStep_MMF_SWCDWRAP_U_0140::CTestStep_MMF_SWCDWRAP_U_0140() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0140-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0140::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record one buffer using 2:1 codec + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record2To1.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 1); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 1) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + if (recordedFileSize != KTest2To1SinkBufferSize) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0141::CTestStep_MMF_SWCDWRAP_U_0141() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0141-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0141::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record five buffers using 2:1 codec + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record2To1.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 5); + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + if (iHwDeviceObserver->NumberOfBuffersObserved() != 5) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + if (recordedFileSize != KTest2To1SinkBufferSize*5) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0142::CTestStep_MMF_SWCDWRAP_U_0142() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0142-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0142::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record using 2:1 codec,pause after 4S of recording + * Note record Pause() does not really 'pause' as such but completes + * recording + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record2To1.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->StopActiveSchedulerOnCall(EFalse); + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000));//4S + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //calculate expected number of buffers + //4S * samplerate * 2 bytes per sample + TUint bytesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = bytesPlayed/KTest2To1SourceBufferSize+1; // +1 for the last buffer + + //allow a margin of error of +/- 1 buffer either side of the expected number + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-1)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+1)) + { + INFO_PRINTF3(_L("number of buffers not that expected (found %d, expected %d)"), + iHwDeviceObserver->NumberOfBuffersObserved(), expectedNumberOfCompleteBuffersPlayed); + } + + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of +/- 1 buffer + TInt expectedRecordSize = 4*4000*2; // 4s of 8K samples per sec, but then we divide by two + if ((static_cast(recordedFileSize) < expectedRecordSize-KTest2To1SinkBufferSize)|| + (static_cast(recordedFileSize) > expectedRecordSize+KTest2To1SinkBufferSize)) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + INFO_PRINTF2(_L("Expected %d" ), expectedRecordSize ); + INFO_PRINTF2(_L("Actual %d" ), recordedFileSize); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0143::CTestStep_MMF_SWCDWRAP_U_0143() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0143-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0143::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record using 2:1 codec, Stop after 4S of recording + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record2To1.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + if (error == KErrNone) + { + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error, asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + asyncTimer->CallStopAfter(*iHwDevice, TTimeIntervalMicroSeconds32(4000000));//4S + iActiveScheduler->Start(); + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->StopError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + + //calculate expected number of buffers + //4S * samplerate * 2 bytes per sample + TUint bytesPlayed = 4*8000*2; + TUint expectedNumberOfCompleteBuffersPlayed = bytesPlayed/KTest2To1SourceBufferSize; + + //allow a margin of error of 2 buffers either side of the expected number + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-2)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+2)) + { + INFO_PRINTF1(_L("incorrect number of buffers")); + verdict = EFail; + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of 1 buffer + if ((static_cast(recordedFileSize) < KTest2To1SinkBufferSize*(expectedNumberOfCompleteBuffersPlayed-2))|| + (static_cast(recordedFileSize) > KTest2To1SinkBufferSize*(expectedNumberOfCompleteBuffersPlayed+2))) + { + INFO_PRINTF1(_L("recorded file was not the expected size")); + verdict = EFail; + } + delete asyncTimer; + } + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + } + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + + +CTestStep_MMF_SWCDWRAP_U_0144::CTestStep_MMF_SWCDWRAP_U_0144() +/** Constructor + */ + { + iTestStepName = _L("MM-MMF-SWCDWRAP-U-0144-HP"); + } + + +TVerdict CTestStep_MMF_SWCDWRAP_U_0144::DoTestStepL( void ) +/** + * Use case: N/A + * Use Start() to record using 2:1 codec, Stop after 2S of recording + * Then resume recording again and Stop a further 2 times + * @test Req. under test REQ1931.2 + */ + { + + TVerdict verdict = EPass; + TInt recordedFileSize = 0; + + TFileName filename = _L("\\mm\\mmf\\testfiles\\swcdwrap\\TSU_MMF_SWCDWRAP_record2To1.raw"); + TInt error = iHwDeviceObserver->WriteBufferDirectToFileAsync(filename, 100);//4S should be less than 100 buffers + + if (error == KErrNone) + { + TUint bytesPlayed = 0; + TUint expectedNumberOfCompleteBuffersPlayed = 0; + CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall* asyncTimer = NULL; + TRAP(error,asyncTimer = CMMF_TSU_SWCDWRAP_MakeAsyncHwDeviceCall::NewL();) + if (error) + { + return EInconclusive; + } + for (TUint i=0; i<3; i++) + {//do 3 iterations + TInt error = iHwDevice->Start(EDevEncode, EDevInFlow); + if (error == KErrNone) + { + INFO_PRINTF1(_L("***** RECORDING *****")); + asyncTimer->StopActiveSchedulerOnCall(EFalse); + asyncTimer->Cancel(); //just in case + asyncTimer->CallPauseAfter(*iHwDevice, TTimeIntervalMicroSeconds32(2000000));//2S + iActiveScheduler->Start(); + error = iHwDevice->Stop(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error stopping audio record %d" ), error ); + verdict = EFail; + } + error = iHwDeviceObserver->ErrorStatus(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error during audio record %d" ), error ); + verdict = EFail; + } + error = asyncTimer->PauseError(); + if (error != KErrNone) + { + INFO_PRINTF2(_L("error on Pause %d" ), error ); + verdict = EFail; + } + }//if (error == KErrNone) + else + { + INFO_PRINTF2(_L("error on hw device start %d" ), error ); + verdict = EFail; + } + }//for (i=0, i++, i<=3) + //calculate expected number of buffers + //because of this we give a margin of +/- 2 less than the expected number + bytesPlayed = 3*2*8000;//only half bytes played with 2:1 codec + expectedNumberOfCompleteBuffersPlayed = bytesPlayed/KTest2To1SourceBufferSize + 6; // add 6 for partial and last buffers + //allow a margin of error of +/- 2 buffer either side of the expected number + if ((iHwDeviceObserver->NumberOfBuffersObserved() < expectedNumberOfCompleteBuffersPlayed-2)|| + (iHwDeviceObserver->NumberOfBuffersObserved() > expectedNumberOfCompleteBuffersPlayed+2)) + { + INFO_PRINTF2(_L("unexpected number of buffers %d"), iHwDeviceObserver->NumberOfBuffersObserved()); + INFO_PRINTF2(_L("expected %d" ), expectedNumberOfCompleteBuffersPlayed ); + } + error = iHwDeviceObserver->WriteFile().Size(recordedFileSize); + if (error != KErrNone) + { + INFO_PRINTF2(_L("problem with recorded file error %d"), error); + verdict = EFail; + } + + //allow a margin of error of 2 buffers + TInt numberBytesExpected = 3*2*8000*2/2; // 3 times 2s of 8000 samples/sec PCM16 /2 by codec + if ((static_cast(recordedFileSize) < numberBytesExpected-KTest2To1SinkBufferSize)|| + (static_cast(recordedFileSize) > numberBytesExpected+KTest2To1SinkBufferSize)) + { + INFO_PRINTF2(_L("recorded file was not the expected size %d"), recordedFileSize); + INFO_PRINTF2(_L("expected %d"), numberBytesExpected ); + verdict = EFail; + } + delete asyncTimer; + }//if (error == KErrNone) + else + { + INFO_PRINTF2(_L("problem opening file to record to error %d" ), error ); + verdict = EInconclusive; + } + + return verdict ; + } + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartEncode.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_StepStartEncode.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,150 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_STEPSTARTENCODE_H__ +#define __TSU_MMF_SWCDWRAP_STEPSTARTENCODE_H__ + +#include "TSU_MMF_SWCDWRAP_Step.h" + +class CTestSuite; +class CTestSuite_MMF_SWCDWRAP; +class CTestRecordMMFHwDeviceObserver; + +/** + * + * CTestStep_MMF_SWCDWRAP, which is the base class for all + * the MMF SWCDWRAP suite test steps that test the Start() + * method when used for decode (play). + * + * @xxxx + * + */ +class CTestStep_MMF_SWCDWRAP_StartTestEncode : public CTestStep_MMF_SWCDWRAP + { +protected: + virtual TVerdict DoTestStepPreambleL(); + virtual TVerdict DoTestStepPostambleL(); + TVerdict InitializeTestStepUsingHwDeviceL(TUid aHwDeviceUid); +protected: + CActiveScheduler* iActiveScheduler; + CMMFHwDevice* iHwDevice; + CTestRecordMMFHwDeviceObserver* iHwDeviceObserver; + MRecordCustomInterface* iRecordCustomInterface; + }; + +class CTestStep_MMF_SWCDWRAP_StartTest2To1Encode : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +protected: + virtual TVerdict DoTestStepPreambleL(); + }; + + +class CTestStep_MMF_SWCDWRAP_U_0100 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0100() ; + ~CTestStep_MMF_SWCDWRAP_U_0100(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0101 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0101() ; + ~CTestStep_MMF_SWCDWRAP_U_0101(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0102 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0102() ; + ~CTestStep_MMF_SWCDWRAP_U_0102(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0103 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0103() ; + ~CTestStep_MMF_SWCDWRAP_U_0103(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0104 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0104() ; + ~CTestStep_MMF_SWCDWRAP_U_0104(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0105 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0105() ; + ~CTestStep_MMF_SWCDWRAP_U_0105(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0106 : public CTestStep_MMF_SWCDWRAP_StartTestEncode + { +public: + CTestStep_MMF_SWCDWRAP_U_0106() ; + ~CTestStep_MMF_SWCDWRAP_U_0106(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0140 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Encode + { +public: + CTestStep_MMF_SWCDWRAP_U_0140() ; + ~CTestStep_MMF_SWCDWRAP_U_0140(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0141 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Encode + { +public: + CTestStep_MMF_SWCDWRAP_U_0141() ; + ~CTestStep_MMF_SWCDWRAP_U_0141(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0142 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Encode + { +public: + CTestStep_MMF_SWCDWRAP_U_0142() ; + ~CTestStep_MMF_SWCDWRAP_U_0142(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0143 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Encode + { +public: + CTestStep_MMF_SWCDWRAP_U_0143() ; + ~CTestStep_MMF_SWCDWRAP_U_0143(){} ; + virtual TVerdict DoTestStepL(); + } ; + +class CTestStep_MMF_SWCDWRAP_U_0144 : public CTestStep_MMF_SWCDWRAP_StartTest2To1Encode + { +public: + CTestStep_MMF_SWCDWRAP_U_0144() ; + ~CTestStep_MMF_SWCDWRAP_U_0144(){} ; + virtual TVerdict DoTestStepL(); + } ; + +#endif /* __TSU_MMF_SWCDWRAP_STEPSTARTENCODE_H__ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Suite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Suite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,141 @@ +// Copyright (c) 2003-2009 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: +// This is the main DLL entry point for the TSU_MMF_SWCDWRAP.dll +// +// + +// EPOC includes +#include + +// Test system includes +#include "TSU_MMF_SWCDWRAP_Suite.h" +#include "TSU_MMF_SWCDWRAP_Step.h" +#include "TSU_MMF_SWCDWRAP_StepStartDecode.h" +#include "TSU_MMF_SWCDWRAP_StepStartEncode.h" +#include "TSU_MMF_SWCDWRAP_StepStartConvert.h" + + +/** + * + * Create an instance of this test suite. + * + * NewTestSuiteL is exported at ordinal 1. + * This provides the interface to allow the Test Framework + * to create instances of this test suite. + * + * @return "CTestSuite_MMF_SWCDWRAP*" + * The newly created test suite + */ +EXPORT_C CTestSuite_MMF_SWCDWRAP* NewTestSuiteL() + { + CTestSuite_MMF_SWCDWRAP* result = new (ELeave) CTestSuite_MMF_SWCDWRAP; + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(); // result + return result; + } + + +CTestSuite_MMF_SWCDWRAP::~CTestSuite_MMF_SWCDWRAP() + { + } + + +/** + * + * Get test suite version. + * + * @return "TPtrC" + * The version string. + * + */ +TPtrC CTestSuite_MMF_SWCDWRAP::GetVersion( void ) const + { + _LIT(KTxtVersion,"1.6"); + return KTxtVersion(); + } + +/** + * + * Initialiser for test suite. + * This creates all the test steps and stores them + * inside CTestSuiteSWCDWRAPasses + * + * @xxxx + * + */ +void CTestSuite_MMF_SWCDWRAP::InitialiseL( void ) + { + + // store the name of this test suite + iSuiteName = _L("TSU_MMF_SWCDWRAP"); + + // General tests + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0001 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0002 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0003 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0004 ); + + //play tests + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0010 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0011 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0012 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0013 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0014 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0015 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0016 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0017 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0018 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0019 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0020 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0021 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0040 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0040 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0041 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0042 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0043 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0044 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0045 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0046 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0047 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0048 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0049 ); + // call new methods StopAndDeleteCodec() and DeleteCodec() + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0050 ); + + //record tests + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0100 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0101 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0102 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0103 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0104 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0105 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0106 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0140 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0141 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0142 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0143 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0144 ); + + //convert tests + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0200 ); + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0240 ); + + //OOM test + AddTestStepL( new(ELeave) CTestStep_MMF_SWCDWRAP_U_0300 ); + + } + + +// ------------------------- diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Suite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_Suite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2003-2009 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: +// This contains CTestSuite_MMF_SWCDWRAP +// +// + +#ifndef __TSU_MMF_SWCDWRAP_SUITE_H_ +#define __TSU_MMF_SWCDWRAP_SUITE_H_ + +#include + +class CTestStep_MMF_SWCDWRAP; //forward reference + +/** + * + * CTestSuite_MMF_SWCDWRAP, which is the base class for + * the CMMFSWCodecWrapper MMF_SWCDWRAP suite. + * + * @lib "TSU_MMF_SWCDWRAP.lib" + * + */ +class CTestSuite_MMF_SWCDWRAP : public CTestSuite + { +public: + + void InitialiseL( void ); + virtual ~CTestSuite_MMF_SWCDWRAP(); + virtual TPtrC GetVersion( void ) const; + +private: + + }; + + +#endif /* TSU_MMF_SWCDWRAP_SUITE_H_ */ diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_WINSCW.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_MMF_SWCDWRAP_WINSCW.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ +// +// Copyright (c) 2007 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: +// + +LOAD_SUITE TSU_MMF_SWCDWRAP.dll + +#this test occasionaly fails on EKA2 lubbock due to a sound driver issue +#this test returns EInconclusive on EKA2 lubbock +//! @SYMTestCaseID MM-MMF-SWCDWRAP-U-0048-HP + +RUN_TEST_STEP 50000 TSU_MMF_SWCDWRAP MM-MMF-SWCDWRAP-U-0048-HP +TEST_COMPLETE \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/101FD033.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/101FD033.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ + +// Copyright (c) 2003-2009 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 +#include // for KMmfUidPluginInterfaceHwDevice +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" + + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x101FD033; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidTSUSWCDWRAPTestDevice; + version_no = 1; + display_name = "TSU SWCDWRAP Test Hw Device||||"; + default_data = "WXYZ,WXYZ" ; // FourCC codes + opaque_data = ""; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KMmfUidTSUSWCDWRAPTest2To1Device; + version_no = 1; + display_name = "TSU SWCDWRAP Test 2To1 Hw Device||||"; + default_data = "ABCD, AC" ; // FourCC codes + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,157 @@ +// Copyright (c) 2003-2009 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 "TSU_MMF_SWCDWRAP_TestDevice.h" + +void Panic() + { + _LIT(KMMF_SWCDWRAP_UnitTestPanic, "TSU_MMF_SWCDWRAP"); + User::Panic(KMMF_SWCDWRAP_UnitTestPanic, 0); + } + +/** + * + * test null hw device + * @return "CMMFTestNullDevice" + * + */ +CMMFTestNullDevice* CMMFTestNullDevice::NewL() + { + CMMFTestNullDevice* self = new (ELeave) CMMFTestNullDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/** + * + * Second phase constructor. + * + */ +void CMMFTestNullDevice::ConstructL() + { + // Create device codec + iCodec = new (ELeave) CMMFTestNullCodec(); + } + + +CMMFTestNullDevice::~CMMFTestNullDevice() + { + } + + +CMMFSwCodec& CMMFTestNullDevice::Codec() + { + __ASSERT_ALWAYS(iCodec, Panic()); + return *iCodec; + } + + +CMMFSwCodec::TCodecProcessResult CMMFTestNullCodec::ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/) + {//no processing required for null codec + User::Leave(KErrNotSupported); + //to keep compiler happy + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EEndOfData; + result.iSrcBytesProcessed = 0; + result.iDstBytesAdded = 0; + return result; + }; + + + +/** + * + * test null hw device + * @return "CMMFTestNullDevice" + * + */ +CMMFTest2To1Device* CMMFTest2To1Device::NewL() + { + CMMFTest2To1Device* self = new (ELeave) CMMFTest2To1Device(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/** + * + * Second phase constructor. + * + */ +void CMMFTest2To1Device::ConstructL() + { + // Create device codec + iCodec = new (ELeave) CMMFTest2To1Codec(); + } + + +CMMFTest2To1Device::~CMMFTest2To1Device() + { + } + + +CMMFSwCodec& CMMFTest2To1Device::Codec() + { + __ASSERT_ALWAYS(iCodec, Panic()); + return *iCodec; + } + + +CMMFSwCodec::TCodecProcessResult CMMFTest2To1Codec::ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest) + {//no processing required for null codec + + //convert from generic CMMFBuffer to CMMFDataBuffer + const CMMFDataBuffer* src = static_cast(&aSource); + CMMFDataBuffer* dst = static_cast(&aDest); + + const TUint dstMaxLen = dst->Data().MaxLength(); + + if (!dstMaxLen) + { + User::Leave(KErrArgument); + } + + const TUint srcLen = src->Data().Length(); + + //we need to cast away CONST even on the source, as the TClass needs a TUint8* + const TUint8* pSrc = src->Data().Ptr(); + TUint8* pDst = const_cast(dst->Data().Ptr()); + + TUint numberOfSamplesToGenerate = srcLen/4; // /2 to convert from bytes to samples and /2 as we only take every other + + ASSERT(numberOfSamplesToGenerate*2 <= dstMaxLen); // should be true for test + + TInt numberOfSamples = numberOfSamplesToGenerate; + + while (numberOfSamples--) + { + *pDst++ = *pSrc++; + *pDst++ = *pSrc++; + pSrc += 2; //only send every other sample to destination + } + + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EProcessComplete; + result.iSrcBytesProcessed = numberOfSamplesToGenerate*4; + result.iDstBytesAdded = numberOfSamplesToGenerate*2; + + dst->Data().SetLength(result.iDstBytesAdded); + + return result; + }; diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2003 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: +* +*/ + +#ifndef __TSU_MMF_SWCDWRAP_TESTDEVICE_H__ +#define __TSU_MMF_SWCDWRAP_TESTDEVICE_H__ + + +#include + + +const TInt KTestBufferSize = 0x2000; +const TInt KTest2To1SourceBufferSize = 8192; // these values make sense for current a3f adaptation, but are adaptation specific +const TInt KTest2To1SinkBufferSize = 4096; + +class CMMFTestNullDevice : public CMMFSwCodecWrapper + { +public: + static CMMFTestNullDevice* NewL(); + virtual CMMFSwCodec& Codec(); + inline ~CMMFTestNullDevice(); +private: + void ConstructL(); + }; + + +class CMMFTestNullCodec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/); + virtual TUint SourceBufferSize() {return KTestBufferSize;}; + virtual TUint SinkBufferSize() {return KTestBufferSize;}; + virtual TBool IsNullCodec() {return ETrue;}; + }; + + +class CMMFTest2To1Device : public CMMFSwCodecWrapper + { +public: + static CMMFTest2To1Device* NewL(); + virtual CMMFSwCodec& Codec(); + inline ~CMMFTest2To1Device(); +private: + void ConstructL(); + }; + + +class CMMFTest2To1Codec : public CMMFSwCodec + { +public: + virtual TCodecProcessResult ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/); + virtual TUint SourceBufferSize() {return KTest2To1SourceBufferSize;}; + virtual TUint SinkBufferSize() {return KTest2To1SinkBufferSize;}; + }; +#endif + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDeviceImplementationProxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDeviceImplementationProxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +// Copyright (c) 2003-2009 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 "TSU_MMF_SWCDWRAP_TestDevice.h" +#include +#include "TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh" + + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfUidTSUSWCDWRAPTestDevice, CMMFTestNullDevice::NewL), + IMPLEMENTATION_PROXY_ENTRY(KMmfUidTSUSWCDWRAPTest2To1Device, CMMFTest2To1Device::NewL) + }; + + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/TSU_SWCDWRAP_TestDevice/TSU_MMF_SWCDWRAP_TestDeviceImplementationUID.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,27 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef __TSU_MMF_SWCDWRAP_TESTDEVICEIMPLEMENTATIONUID_HRH__ +#define __TSU_MMF_SWCDWRAP_TESTDEVICEIMPLEMENTATIONUID_HRH__ + + +// These are the ECOM Implementation UIDs for the unit test hw devices used to test the +// sw codec wrapper. +// The ECOM Interface UID for CMMFHwDevice is defined in mmfhwdevice.h + +#define KMmfUidTSUSWCDWRAPTestDevice 0x101FD034 +#define KMmfUidTSUSWCDWRAPTest2To1Device 0x101FD035 + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/bwins/TSU_MMF_SWCDWRAPU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/bwins/TSU_MMF_SWCDWRAPU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewTestSuiteL@@YAPAVCTestSuite_MMF_SWCDWRAP@@XZ @ 1 NONAME ; class CTestSuite_MMF_SWCDWRAP * __cdecl NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/eabi/TSU_MMF_SWCDWRAPU.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/eabi/TSU_MMF_SWCDWRAPU.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,33 @@ +// Copyright (c) 2010 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: +// + + +PRJ_TESTMMPFILES + +// mmp files +../MmpFiles/TSU_MMF_SWCDWRAP.mmp +../MmpFiles/TSU_MMF_SWCDWRAP_TestDevice.mmp + +PRJ_TESTEXPORTS + +../TSU_MMF_SWCDWRAP.script c:/mm/tsu_mmf_swcdwrap.script +../TSU_MMF_SWCDWRAP_WINSCW.script c:/mm/tsu_mmf_swcdwrap_winscw.script + +//SWCDWRAP data files +../Data/TSU_MMF_SWCDWRAPpcm16_8m.raw c:/mm/mmf/testfiles/swcdwrap/tsu_mmf_swcdwrappcm16_8m.raw +../Data/TSU_MMF_SWCDWRAPpcm16_16s.raw c:/mm/mmf/testfiles/swcdwrap/tsu_mmf_swcdwrappcm16_16s.raw + + +tsu_mmf_swcdwrap.iby /epoc32/rom/include/tsu_mmf_swcdwrap.iby diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/group/component_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/group/component_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ +; Copyright (c) 2010 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: +; +;*Files To Copy... +"\epoc32\release\armv5\urel\TSU_MMF_SWCDWRAP.DLL"-"c:\sys\bin\TSU_MMF_SWCDWRAP.DLL" +"\epoc32\release\armv5\urel\tsu_mmf_swcdwrap_testdevice.dll"-"c:\sys\bin\tsu_mmf_swcdwrap_testdevice.dll" +"\epoc32\data\z\resource\plugins\tsu_mmf_swcdwrap_testdevice.rsc"-"c:\resource\plugins\tsu_mmf_swcdwrap_testdevice.rsc" +"\epoc32\localisation\101fd033\rsc\101fd033.rpp"-"c:\localisation\101fd033\rsc\101fd033.rpp" +"\epoc32\localisation\group\101fd033.info"-"c:\localisation\group\101fd033.info" + +"\sf\adapt\mmaudio.nokia.ref\devsound\devsoundrefplugin\tsrc\swcdwrap\TSU_MMF_SWCDWRAP.script"-"c:\tsu_mmf_swcdwrap.script" +"\sf\adapt\mmaudio.nokia.ref\devsound\devsoundrefplugin\tsrc\swcdwrap\data\TSU_MMF_SWCDWRAPpcm16_8m.raw"-"c:\mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_8m.raw" +"\sf\adapt\mmaudio.nokia.ref\devsound\devsoundrefplugin\tsrc\swcdwrap\data\TSU_MMF_SWCDWRAPpcm16_16s.raw"-"c:\mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_16s.raw" diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/group/tsu_mmf_swcdwrap.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/group/tsu_mmf_swcdwrap.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,33 @@ +// Copyright (c) 2010 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: +// + +#ifndef TSUMMFSWCDWRAP_IBY +#define TSUMMFSWCDWRAP_IBY + +#include + +#include + +file=ABI_DIR\DEBUG_DIR\TSU_MMF_SWCDWRAP.DLL System\Libs\TSU_MMF_SWCDWRAP.DLL +data=EPOCROOT##epoc32\data\c\mm\TSU_MMF_SWCDWRAP.script \TSU_MMF_SWCDWRAP.script + +//REM Test files for DEVSOUND_SUITE tests +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_8m.raw \mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_8m.raw +data=EPOCROOT##epoc32\data\c\mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_16s.raw \mm\mmf\testfiles\swcdwrap\TSU_MMF_SWCDWRAPpcm16_16s.raw + +//test HwDevice plugin resource +ECOM_PLUGIN(tsu_mmf_swcdwrap_testdevice.dll,101fd033.rsc) + +#endif diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/mmpfiles/TSU_MMF_SWCDWRAP.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/mmpfiles/TSU_MMF_SWCDWRAP.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2010 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: +// using relative paths for sourcepath and user includes +// +// + +TARGET tsu_mmf_swcdwrap.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID 0x1000008d 0x101fD032 +VENDORID 0x70000001 + +SOURCEPATH ../ +SOURCE TSU_MMF_SWCDWRAP_Suite.cpp +SOURCE TSU_MMF_SWCDWRAP_Step.cpp +SOURCE TSU_MMF_SWCDWRAP_StepStartDecode.cpp +SOURCE TSU_MMF_SWCDWRAP_StepStartEncode.cpp +SOURCE TSU_MMF_SWCDWRAP_StepStartConvert.cpp +SOURCE TSU_MMF_SWCDWRAP_HwDevObserver.cpp +SOURCE TSU_MMF_SWCDWRAP_PlayHwDevObserver.cpp +SOURCE TSU_MMF_SWCDWRAP_RecordHwDevObserver.cpp +SOURCE TSU_MMF_SWCDWRAP_ConvertHwDevObserver.cpp +SOURCE TSU_MMF_SWCDWRAP_AsyncTimer.cpp + + +USERINCLUDE ../ +USERINCLUDE ../TSU_SWCDWRAP_TestDevice +USERINCLUDE ../../../../../mmdevicefw/mdf/src/audio/mdasoundadapter + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY testframeworkclient.lib +LIBRARY ecom.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +LIBRARY mdasoundadapter.lib +#endif + +#ifdef EABI +NOEXPORTLIBRARY +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 devsound/devsoundrefplugin/tsrc/swcdwrap/mmpfiles/TSU_MMF_SWCDWRAP_TestDevice.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/devsound/devsoundrefplugin/tsrc/swcdwrap/mmpfiles/TSU_MMF_SWCDWRAP_TestDevice.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,43 @@ +// Copyright (c) 2010 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: +// + +target tsu_mmf_swcdwrap_testdevice.dll +CAPABILITY ALL -TCB +targettype plugin + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D 0x101FD033 +VENDORID 0x70000001 + +USERINCLUDE ../TSU_SWCDWRAP_TestDevice + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../TSU_SWCDWRAP_TestDevice +SOURCE TSU_MMF_SWCDWRAP_TestDevice.cpp +SOURCE TSU_MMF_SWCDWRAP_TestDeviceImplementationProxy.cpp + + +start resource 101FD033.rss +target tsu_mmf_swcdwrap_testdevice.rsc +end + +LIBRARY euser.lib +LIBRARY mmfswcodecwrapper.lib +#ifdef EABI +library ecom.lib +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,29 @@ +// Copyright (c) 2005-2010 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: +// + + +PRJ_EXPORTS + +// Romkit include files +mdf_audio.iby /epoc32/rom/include/mdf_audio.iby + +PRJ_MMPFILES +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +../mmpfiles/audio/mdasoundadapter.mmp +#endif +../mmpfiles/audio/audiodevice.mmp +../mmpfiles/audio/mdfaudiohwdeviceadapter.mmp +../mmpfiles/audio/vorbisdecoderprocessingunit.mmp +../mmpfiles/audio/vorbisencoderprocessingunit.mmp diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/group/mdf_audio.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/group/mdf_audio.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,39 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef MDFAUDIO_IBY +#define MDFAUDIO_IBY + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #ifndef SYMBIAN_EXCLUDE_OLDSOUNDDRIVERADAPTOR //used to exclude this dll from a particular rom build + file=ABI_DIR\BUILD_DIR\mdasoundadapter.dll System\Libs\mdasoundadapter.dll + #ifdef SYMBIAN_MDASOUNDADAPTER_FORCE_STEREO + patchdata mdasoundadapter.dll@KSoundAdapterForceStereo 1 + #endif + #endif +#endif + +// Audio HwDevice plugin +ECOM_PLUGIN(mdfaudiohwdeviceadapter.dll,mdfaudiohwdeviceadapter.rsc) + +// AudioDevice source sink +ECOM_PLUGIN(audiodevice.dll,audiodevice.rsc) + +// Vorbis decoder and encoder PUs +ECOM_PLUGIN(vorbisdecoderprocessingunit.dll,vorbisdecoderprocessingunit.rsc) +ECOM_PLUGIN(vorbisencoderprocessingunit.dll,vorbisencoderprocessingunit.rsc) + +#endif // MDFAUDIO_IBY + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/audio/audiodevice.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/audio/audiodevice.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2005-2009 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: +// audiodevice.dll Reference Source/Sink Processing Unit plugin that +// implements the Codec API. +// +// + +/** + @file +*/ + +target audiodevice.dll +CAPABILITY ALL -TCB +targettype plugin +UID 0x10009D8D 0x102730BC +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../src/audio/AudioDevice +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +USERINCLUDE ../../src/audio/mdasoundadapter +#endif +SOURCEPATH ../../src/audio/AudioDevice +SOURCE audiodevice.cpp + +RESOURCE audiodevice.rss + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmfserverbaseclasses.lib +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER +LIBRARY mdasoundadapter.lib +#endif + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/audio/mdasoundadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/audio/mdasoundadapter.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +// Copyright (c) 2007-2009 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: +// + +TARGET mdasoundadapter.dll +CAPABILITY ALL -TCB +TARGETTYPE DLL +UID 0x1000008d 0x102833D6 +VENDORID 0x70000001 + +// Enable this for debug output +//MACRO SYMBIAN_SOUNDADAPTER_DEBUG + +//Normally on SetFormat we try and handle failure. If this macro is enabled, skip first step +//Only allow the "CD" rates of 44100, 22050 and 11025 whatever is actually supported. +//Assumes one is supported. +//[Play only - for debugging] +//MACRO SYMBIAN_SOUNDADAPTER_FORCECDRATES + +//Similar to SYMBIAN_SOUNDADAPTER_FORCECDRATES, only play stereo. Assumes stereo is supported +//[Play only - for debugging] +// MACRO SYMBIAN_SOUNDADAPTER_FORCESTEREO + +// For development and debugging, we don't actually resample on stereo even if we should. Instead +// just copy data, preserving the size of the input buffer. +MACRO SYMBIAN_SKIP_RESAMPLE_ON_RECORD + +//If this is enabled devsound adaptor will generate -6 errors if the buffers played are not of length divisible by 4. +//This reflects some hardware. +//MACRO SYMBIAN_FORCE_32BIT_LENGTHS + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../../src/audio/mdasoundadapter +USERINCLUDE ../../../../mmlibs/mmfw/inc // for rateconverter.h + +SOURCEPATH ../../src/audio/mdasoundadapter +SOURCE mdasoundadapter.cpp +SOURCE mdasoundadapterbody.cpp +SOURCE mdasoundadapterconsts.cpp + +LIBRARY euser.lib +LIBRARY hal.lib +LIBRARY audioutils.lib // for rate converter +DEFFILE mdasoundadapter.def +NOSTRICTDEF +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/audio/mdfaudiohwdeviceadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/audio/mdfaudiohwdeviceadapter.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2005-2009 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: +// mdfaudiohwdeviceadapter.dll Reference HwDevice plugin that uses the Codec API. +// +// + +/** + @file +*/ + +#include "../../src/audio/HwDeviceAdapter/mdfhwdeviceadapter.hrh" // get UID + +TARGET mdfaudiohwdeviceadapter.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + +UID KSharedLibraryUidDefine KUidHwDeviceAudioAdapterDll +VENDORID 0x70000001 + +SOURCEPATH ../../src/audio/HwDeviceAdapter +SOURCE mdfhwdeviceadapter.cpp +SOURCE mdfhwdeviceadaptermain.cpp + +USERINCLUDE ../../src/audio +USERINCLUDE ../../inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +RESOURCE mdfaudiohwdeviceadapter.rss + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib +LIBRARY mmfserverbaseclasses.lib + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/audio/vorbisdecoderprocessingunit.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/audio/vorbisdecoderprocessingunit.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2008-2009 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 "../../src/audio/Vorbis/PU/vorbisprocessingunituids.hrh" // get UID + +TARGET vorbisdecoderprocessingunit.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + +UID KSharedLibraryUidDefine KUidVorbisDecoderProcessingUnitDll +VENDORID 0x70000001 + +SOURCEPATH ../../src/audio/Vorbis/PU/decoder +SOURCE vorbisdecoderprocessingunit.cpp +SOURCE vorbisdecoderprocessingunitmain.cpp +SOURCE vorbisdecoderinputport.cpp +SOURCE vorbisdecoderoutputport.cpp + +USERINCLUDE ../../src/audio/Vorbis/PU +USERINCLUDE ../../src/audio/Vorbis/PU/decoder + + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +RESOURCE vorbisdecoderprocessingunit.rss + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib +LIBRARY omxcomponent.lib + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/audio/vorbisencoderprocessingunit.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/audio/vorbisencoderprocessingunit.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2008-2009 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 "../../src/audio/Vorbis/PU/vorbisprocessingunituids.hrh" // get UID + +TARGET vorbisencoderprocessingunit.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + +UID KSharedLibraryUidDefine KUidVorbisEncoderProcessingUnitDll +VENDORID 0x70000001 + +SOURCEPATH ../../src/audio/Vorbis/PU/encoder +SOURCE vorbisencoderprocessingunit.cpp +SOURCE vorbisencoderprocessingunitmain.cpp +SOURCE vorbisencoderinputport.cpp +SOURCE vorbisencoderoutputport.cpp + +USERINCLUDE ../../src/audio/Vorbis/PU +USERINCLUDE ../../src/audio/Vorbis/PU/encoder + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +RESOURCE vorbisencoderprocessingunit.rss + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib +LIBRARY omxcomponent.lib + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/bwins/mdasoundadapter.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/bwins/mdasoundadapter.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,38 @@ +EXPORTS + ??0RMdaDevSound@@QAE@XZ @ 1 NONAME ; RMdaDevSound::RMdaDevSound(void) + ?BytesPlayed@RMdaDevSound@@QAEHXZ @ 2 NONAME ; int RMdaDevSound::BytesPlayed(void) + ?CancelNotifyPlayError@RMdaDevSound@@QAEXXZ @ 3 NONAME ; void RMdaDevSound::CancelNotifyPlayError(void) + ?CancelNotifyRecordError@RMdaDevSound@@QAEXXZ @ 4 NONAME ; void RMdaDevSound::CancelNotifyRecordError(void) + ?CancelPlayData@RMdaDevSound@@QAEXXZ @ 5 NONAME ; void RMdaDevSound::CancelPlayData(void) + ?CancelRecordData@RMdaDevSound@@QAEXXZ @ 6 NONAME ; void RMdaDevSound::CancelRecordData(void) + ?Close@RMdaDevSound@@QAEXXZ @ 7 NONAME ; void RMdaDevSound::Close(void) + ?FlushPlayBuffer@RMdaDevSound@@QAEXXZ @ 8 NONAME ; void RMdaDevSound::FlushPlayBuffer(void) + ?FlushRecordBuffer@RMdaDevSound@@QAEXXZ @ 9 NONAME ; void RMdaDevSound::FlushRecordBuffer(void) + ?GetPlayFormat@RMdaDevSound@@QAEXAAV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 10 NONAME ; void RMdaDevSound::GetPlayFormat(class TPckgBuf &) + ?GetRecordFormat@RMdaDevSound@@QAEXAAV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 11 NONAME ; void RMdaDevSound::GetRecordFormat(class TPckgBuf &) + ?Handle@RMdaDevSound@@QAEHXZ @ 12 NONAME ; int RMdaDevSound::Handle(void) + ?IsMdaSound@RMdaDevSound@@QAEHXZ @ 13 NONAME ; int RMdaDevSound::IsMdaSound(void) + ?NotifyPlayError@RMdaDevSound@@QAEXAAVTRequestStatus@@@Z @ 14 NONAME ; void RMdaDevSound::NotifyPlayError(class TRequestStatus &) + ?NotifyRecordError@RMdaDevSound@@QAEXAAVTRequestStatus@@@Z @ 15 NONAME ; void RMdaDevSound::NotifyRecordError(class TRequestStatus &) + ?Open@RMdaDevSound@@QAEHH@Z @ 16 NONAME ; int RMdaDevSound::Open(int) + ?PausePlayBuffer@RMdaDevSound@@QAEXXZ @ 17 NONAME ; void RMdaDevSound::PausePlayBuffer(void) + ?PlayData@RMdaDevSound@@QAEXAAVTRequestStatus@@ABVTDesC8@@@Z @ 18 NONAME ; void RMdaDevSound::PlayData(class TRequestStatus &, class TDesC8 const &) + ?PlayFormatsSupported@RMdaDevSound@@QAEXAAV?$TPckgBuf@VTSoundFormatsSupported@RMdaDevSound@@@@@Z @ 19 NONAME ; void RMdaDevSound::PlayFormatsSupported(class TPckgBuf &) + ?PlayVolume@RMdaDevSound@@QAEHXZ @ 20 NONAME ; int RMdaDevSound::PlayVolume(void) + ?RecordData@RMdaDevSound@@QAEXAAVTRequestStatus@@AAVTDes8@@@Z @ 21 NONAME ; void RMdaDevSound::RecordData(class TRequestStatus &, class TDes8 &) + ?RecordFormatsSupported@RMdaDevSound@@QAEXAAV?$TPckgBuf@VTSoundFormatsSupported@RMdaDevSound@@@@@Z @ 22 NONAME ; void RMdaDevSound::RecordFormatsSupported(class TPckgBuf &) + ?RecordLevel@RMdaDevSound@@QAEHXZ @ 23 NONAME ; int RMdaDevSound::RecordLevel(void) + ?ResetBytesPlayed@RMdaDevSound@@QAEXXZ @ 24 NONAME ; void RMdaDevSound::ResetBytesPlayed(void) + ?ResumePlaying@RMdaDevSound@@QAEXAAVTRequestStatus@@@Z @ 25 NONAME ; void RMdaDevSound::ResumePlaying(class TRequestStatus &) + ?ResumePlaying@RMdaDevSound@@QAEXXZ @ 26 NONAME ; void RMdaDevSound::ResumePlaying(void) + ?SetPlayFormat@RMdaDevSound@@QAEHABV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 27 NONAME ; int RMdaDevSound::SetPlayFormat(class TPckgBuf const &) + ?SetPlayVolume@RMdaDevSound@@QAEXH@Z @ 28 NONAME ; void RMdaDevSound::SetPlayVolume(int) + ?SetRecordFormat@RMdaDevSound@@QAEHABV?$TPckgBuf@VTCurrentSoundFormat@RMdaDevSound@@@@@Z @ 29 NONAME ; int RMdaDevSound::SetRecordFormat(class TPckgBuf const &) + ?SetRecordLevel@RMdaDevSound@@QAEXH@Z @ 30 NONAME ; void RMdaDevSound::SetRecordLevel(int) + ?VersionRequired@RMdaDevSound@@QBE?AVTVersion@@XZ @ 31 NONAME ; class TVersion RMdaDevSound::VersionRequired(void) const + ?PauseRecordBuffer@RMdaDevSound@@QAEXXZ @ 32 NONAME ; void RMdaDevSound::PauseRecordBuffer(void) + ?ResumeRecording@RMdaDevSound@@QAEXXZ @ 33 NONAME ; void RMdaDevSound::ResumeRecording(void) + ?KSoundAdapterForceStereo@@3HB @ 34 NONAME ; int const KSoundAdapterForceStereo + ?GetTimePlayed@RMdaDevSound@@QAEHAAVTTimeIntervalMicroSeconds@@@Z @ 35 NONAME ; int RMdaDevSound::GetTimePlayed(class TTimeIntervalMicroSeconds &) + ?SetVolume@RMdaDevSound@@QAEXH@Z @ 36 NONAME ; void RMdaDevSound::SetVolume(int) + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/mmpfiles/eabi/mdasoundadapter.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/mmpfiles/eabi/mdasoundadapter.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,39 @@ +EXPORTS + _ZN12RMdaDevSound10IsMdaSoundEv @ 1 NONAME + _ZN12RMdaDevSound10PlayVolumeEv @ 2 NONAME + _ZN12RMdaDevSound10RecordDataER14TRequestStatusR5TDes8 @ 3 NONAME + _ZN12RMdaDevSound11BytesPlayedEv @ 4 NONAME + _ZN12RMdaDevSound11RecordLevelEv @ 5 NONAME + _ZN12RMdaDevSound13GetPlayFormatER8TPckgBufINS_19TCurrentSoundFormatEE @ 6 NONAME + _ZN12RMdaDevSound13ResumePlayingER14TRequestStatus @ 7 NONAME + _ZN12RMdaDevSound13ResumePlayingEv @ 8 NONAME + _ZN12RMdaDevSound13SetPlayFormatERK8TPckgBufINS_19TCurrentSoundFormatEE @ 9 NONAME + _ZN12RMdaDevSound13SetPlayVolumeEi @ 10 NONAME + _ZN12RMdaDevSound14CancelPlayDataEv @ 11 NONAME + _ZN12RMdaDevSound14SetRecordLevelEi @ 12 NONAME + _ZN12RMdaDevSound15FlushPlayBufferEv @ 13 NONAME + _ZN12RMdaDevSound15GetRecordFormatER8TPckgBufINS_19TCurrentSoundFormatEE @ 14 NONAME + _ZN12RMdaDevSound15NotifyPlayErrorER14TRequestStatus @ 15 NONAME + _ZN12RMdaDevSound15PausePlayBufferEv @ 16 NONAME + _ZN12RMdaDevSound15SetRecordFormatERK8TPckgBufINS_19TCurrentSoundFormatEE @ 17 NONAME + _ZN12RMdaDevSound16CancelRecordDataEv @ 18 NONAME + _ZN12RMdaDevSound16ResetBytesPlayedEv @ 19 NONAME + _ZN12RMdaDevSound17FlushRecordBufferEv @ 20 NONAME + _ZN12RMdaDevSound17NotifyRecordErrorER14TRequestStatus @ 21 NONAME + _ZN12RMdaDevSound20PlayFormatsSupportedER8TPckgBufINS_22TSoundFormatsSupportedEE @ 22 NONAME + _ZN12RMdaDevSound21CancelNotifyPlayErrorEv @ 23 NONAME + _ZN12RMdaDevSound22RecordFormatsSupportedER8TPckgBufINS_22TSoundFormatsSupportedEE @ 24 NONAME + _ZN12RMdaDevSound23CancelNotifyRecordErrorEv @ 25 NONAME + _ZN12RMdaDevSound4OpenEi @ 26 NONAME + _ZN12RMdaDevSound5CloseEv @ 27 NONAME + _ZN12RMdaDevSound6HandleEv @ 28 NONAME + _ZN12RMdaDevSound8PlayDataER14TRequestStatusRK6TDesC8 @ 29 NONAME + _ZN12RMdaDevSoundC1Ev @ 30 NONAME + _ZN12RMdaDevSoundC2Ev @ 31 NONAME + _ZNK12RMdaDevSound15VersionRequiredEv @ 32 NONAME + _ZN12RMdaDevSound15ResumeRecordingEv @ 33 NONAME + _ZN12RMdaDevSound17PauseRecordBufferEv @ 34 NONAME + KSoundAdapterForceStereo @ 35 NONAME DATA 4 + _ZN12RMdaDevSound13GetTimePlayedER25TTimeIntervalMicroSeconds @ 36 NONAME + _ZN12RMdaDevSound9SetVolumeEi @ 37 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,749 @@ +// Copyright (c) 2005-2009 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 +#include +#include "audiodevice.hrh" +#include "audiodevice.h" +#include +#include +#include + +// we need 16k to hold a pcm packet +const TInt KBufferSize = 16384; + +const TInt KDefaultSampleRate = 8000; +const TInt KDefaultNumberChannels = 1; +_LIT(KAudioDevicePanic, "CAudioDevice Panic"); + +enum TAudioDevicePanics + { + EObserverNotSet, + EInvalidUsage + }; + +const TInt KInputPortIndex = 0; +const TInt KOutputPortIndex = 1; + +// ------------------------------------------------------------------------------------------ +// CAudioDevice::CInput port class implementation + + +CAudioDevice::CInputPort::CInputPort(CAudioDevice& aParent) + : CActive(EPriorityNormal), + iParent(aParent), + iSampleRate(KDefaultSampleRate), + iChannels(KDefaultNumberChannels), + iBufferSize(KBufferSize) + { + } + +CAudioDevice::CInputPort::~CInputPort() + { + Cancel(); + iBuffers.Close(); + } + +CAudioDevice::CInputPort* CAudioDevice::CInputPort::NewL(CAudioDevice& aParent) + { + CInputPort* self = new (ELeave) CInputPort(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CAudioDevice::CInputPort::ConstructL() + { + CActiveScheduler::Add(this); + } + +TInt CAudioDevice::CInputPort::MipConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? 1 : 2; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig2)) + { + const TTaskConfig2* config = TPuTaskConfig2::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = config->iNumberOfChannels; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + + return KErrNotSupported; + } + +TInt CAudioDevice::CInputPort::MipGetConfig(TPuConfig& /*aConfig*/) + { + return KErrNotSupported; + } + +TInt CAudioDevice::CInputPort::MipTunnelRequest(const MMdfOutputPort& aOutputPortToBeConnectedTo, + TTunnelFlags& /*aTunnelFlags*/, TSupplierType& /*aSupplierType*/) + { + if ((iParent.State()!=EProcessingUnitLoaded) && (!iStopped)) + { + // invalid state + return EInvalidState; + } + + if (iPortConnectedTo) + { + // the port is already connected, return an error + return EPortAlreadyTunnelled; + } + iPortConnectedTo = const_cast(&aOutputPortToBeConnectedTo); + return KErrNone; + } + +void CAudioDevice::CInputPort::MipWriteData(CMMFBuffer& aInputBuffer) + { + TInt err = iBuffers.Append(&aInputBuffer); + if (err == KErrNone) + { + if (iParent.State() == EProcessingUnitExecuting && !IsActive()) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + else + { + if (iObserver) + { + iObserver->MipoWriteDataComplete(this, &aInputBuffer, err); + } + } + } + +void CAudioDevice::CInputPort::Execute() + { + if (!IsActive() && iBuffers.Count()>0) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + +TBool CAudioDevice::CInputPort::MipIsTunnelled() const + { + if (iPortConnectedTo) + { + return ETrue; + } + else + { + return EFalse; + } + } + +TInt CAudioDevice::CInputPort::MipIndex() const + { + return KInputPortIndex; + } + +CMMFBuffer* CAudioDevice::CInputPort::MipCreateBuffer(TInt /*aBufferSize*/) + { + __ASSERT_ALWAYS(EFalse, User::Panic(KAudioDevicePanic, EInvalidUsage)); + return NULL; + } + +TInt CAudioDevice::CInputPort::MipUseBuffer(CMMFBuffer& /*aBuffer*/) + { + return KErrNone; + } + +TInt CAudioDevice::CInputPort::MipFreeBuffer(CMMFBuffer* /*aBuffer*/) + { + return KErrNone; + } + +void CAudioDevice::CInputPort::MipDisconnectTunnel() + { + } + +void CAudioDevice::CInputPort::MipRestartTunnel() + { + } + +TUint32 CAudioDevice::CInputPort::MipBufferSize() const + { + return iBufferSize; + } + +void CAudioDevice::CInputPort::Pause() + { + if (iParent.SoundDevice().Handle()) + { + iParent.SoundDevice().PausePlayBuffer(); + } + } + +void CAudioDevice::CInputPort::Stop() + { + Cancel(); + } + +TInt CAudioDevice::CInputPort::MipCreateCustomInterface(TUid aUid) + { + if (aUid.iUid == KMmfPlaySettingsCustomInterface) + { + return KErrNone; + } + return KErrNotSupported; + } + +TAny* CAudioDevice::CInputPort::MipCustomInterface(TUid aUid) + { + if (aUid.iUid == KMmfPlaySettingsCustomInterface) + { + return static_cast(this); + } + return NULL; + } + +void CAudioDevice::CInputPort::SetVolume(TUint aVolume) + { + iVolume = aVolume; + } + +TUint CAudioDevice::CInputPort::Volume() + { + return iVolume; + } + +TUint CAudioDevice::CInputPort::BytesPlayed() + { + return iBytesPlayed; + } + +void CAudioDevice::CInputPort::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + iRampDuration = aRampDuration; + } + +TTimeIntervalMicroSeconds& CAudioDevice::CInputPort::VolumeRamp() + { + return iRampDuration; + } + +void CAudioDevice::CInputPort::RunL() + { + if (iCurrentBuffer != NULL) + { + // If we've been signalled with a buffer, callback that we've completed the writing of the + // buffer + if (iObserver) + { + iObserver->MipoWriteDataComplete(this, iCurrentBuffer, iStatus.Int()); + if (iCurrentBuffer->LastBuffer()) + { + iParent.Observer()->ExecuteComplete(&iParent, KErrUnderflow); + iParent.SoundDevice().Close(); + } + } + iCurrentBuffer = NULL; + } + // only process the next buffer if there is no error + // error callbacks were handled in the previous block + if (iStatus == KErrNone) + { + if (iBuffers.Count()>0) + { + iCurrentBuffer = iBuffers[0]; + iBuffers.Remove(0); + + if (CMMFBuffer::IsSupportedDataBuffer(iCurrentBuffer->Type())) + { + TDes8& aBufferDes = (static_cast(iCurrentBuffer))->Data(); + iStatus = KRequestPending; + iParent.SoundDevice().PlayData(iStatus, aBufferDes); + SetActive(); + } + } + } + } + +void CAudioDevice::CInputPort::DoCancel() + { + if (iParent.SoundDevice().Handle()) + { + iParent.SoundDevice().CancelPlayData(); + iParent.SoundDevice().FlushPlayBuffer(); + } + } + +// CAudioDevice::CInput port class implementation +CAudioDevice::COutputPort::COutputPort(CAudioDevice& aParent) + : CActive(EPriorityNormal), + iParent(aParent), + iSampleRate(KDefaultSampleRate), + iChannels(KDefaultNumberChannels), + iBufferSize(KBufferSize) + { + } + +TInt CAudioDevice::CInputPort::SampleRate() + { + return iSampleRate; + } + +TInt CAudioDevice::CInputPort::Channels() + { + return iChannels; + } + +void CAudioDevice::CInputPort::MipInitialize() + { + // Nothing to do + } + +CAudioDevice::COutputPort* CAudioDevice::COutputPort::NewL(CAudioDevice& aParent) + { + COutputPort* self = new (ELeave) COutputPort(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CAudioDevice::COutputPort::ConstructL() + { + CActiveScheduler::Add(this); + } + +TInt CAudioDevice::COutputPort::MopConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? 1 : 2; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig2)) + { + const TTaskConfig2* config = TPuTaskConfig2::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = config->iNumberOfChannels; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + return KErrNotSupported; + } + +TInt CAudioDevice::COutputPort::MopGetConfig(TPuConfig& /*aConfig*/) + { + return KErrNotSupported; + } + +void CAudioDevice::COutputPort::MopInitialize() + { + // Nothing to do + } + +TInt CAudioDevice::COutputPort::MopTunnelRequest(const MMdfInputPort& /*aInputPortToBeConnectedTo*/, + TTunnelFlags& /*aTunnelFlags*/, TSupplierType& /*aSupplierType*/) + { + return KErrNone; + } + +void CAudioDevice::COutputPort::MopReadData(CMMFBuffer& aOutputBuffer) + { + TInt err = iBuffers.Append(&aOutputBuffer); + if (err == KErrNone) + { + if ((iParent.State() == EProcessingUnitExecuting || iParent.State() == EProcessingUnitPaused) && !IsActive()) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + else + { + if (iObserver) + { + iObserver->MopoReadDataComplete(this, &aOutputBuffer, err); + } + } + } + +TBool CAudioDevice::COutputPort::MopIsTunnelled() const + { + return EFalse; + } + +TInt CAudioDevice::COutputPort::MopIndex() const + { + return KOutputPortIndex; + } + +CMMFBuffer* CAudioDevice::COutputPort::MopCreateBuffer(TInt /*aBufferSize*/) + { + return NULL; + } + +TInt CAudioDevice::COutputPort::MopUseBuffer(CMMFBuffer& /*aBuffer*/) + { + return KErrNone; + } + +TInt CAudioDevice::COutputPort::MopFreeBuffer(CMMFBuffer* /*aBuffer*/) + { + return KErrNone; + } + +void CAudioDevice::COutputPort::Execute() + { + if (!IsActive() && iBuffers.Count()>0) + { + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + } + +void CAudioDevice::COutputPort::Pause() + { + if(iParent.SoundDevice().Handle()) + { + iParent.SoundDevice().FlushRecordBuffer(); + } + } + +void CAudioDevice::COutputPort::Stop() + { + Cancel(); + } + +void CAudioDevice::COutputPort::MopDisconnectTunnel() + { + // Find the last buffer in the array and set it as the 'LastBuffer' + if(iBuffers.Count() > 0) + { + (iBuffers[iBuffers.Count() - 1])->SetLastBuffer(ETrue); + } + // Still have to send callback and cancel driver + iObserver->MopoDisconnectTunnelComplete(this, KErrNone); + iParent.SoundDevice().CancelRecordData(); + } + +void CAudioDevice::COutputPort::MopRestartTunnel() + { + } + +TUint32 CAudioDevice::COutputPort::MopBufferSize() const + { + return iBufferSize; + } + +void CAudioDevice::CInputPort::MipSetObserver(const MMdfInputPortObserver& aObserver) + { + iObserver = const_cast(&aObserver); + } + +void CAudioDevice::COutputPort::MopSetObserver(const MMdfOutputPortObserver& aObserver) + { + iObserver = const_cast(&aObserver); + } + +TInt CAudioDevice::COutputPort::MopCreateCustomInterface(TUid aUid) + { + if (aUid.iUid == KMmfRecordSettingsCustomInterface) + { + return KErrNone; + } + return KErrNotSupported; + } + +TAny* CAudioDevice::COutputPort::MopCustomInterface(TUid aUid) + { + if (aUid.iUid == KMmfRecordSettingsCustomInterface) + { + return dynamic_cast(this); + } + + return NULL; + } + +void CAudioDevice::COutputPort::RunL() + { + if (iCurrentBuffer != NULL) + { + // If we've been signalled with a buffer, callback that we've completed the writing of the + // buffer + if (iObserver) + { + TInt length = iCurrentBuffer->BufferSize(); + iBytesRecorded += length; + if (lengthSetLastBuffer(ETrue); + iParent.SoundDevice().CancelRecordData(); // Required so that a resume of an encode functions correctly + } + + iObserver->MopoReadDataComplete(this, iCurrentBuffer, iStatus.Int()); + + } + iCurrentBuffer = NULL; + } + + if (iStatus == KErrNone) + { + if (iBuffers.Count()>0) + { + iCurrentBuffer = iBuffers[0]; + iBuffers.Remove(0); + + if (CMMFBuffer::IsSupportedDataBuffer(iCurrentBuffer->Type())) + { + TDes8& aBufferDes = (static_cast(iCurrentBuffer))->Data(); + iStatus = KRequestPending; + iParent.SoundDevice().RecordData(iStatus, aBufferDes); + SetActive(); + } + } + } + } + +void CAudioDevice::COutputPort::DoCancel() + { + if (iParent.SoundDevice().Handle()) + { + iParent.SoundDevice().CancelRecordData(); + iParent.SoundDevice().FlushRecordBuffer(); + } + } + +TInt CAudioDevice::COutputPort::SampleRate() + { + return iSampleRate; + } + +TInt CAudioDevice::COutputPort::Channels() + { + return iChannels; + } + +CAudioDevice::COutputPort::~COutputPort() + { + Cancel(); + iBuffers.Close(); + } + +// from MRecordCustomInterface +void CAudioDevice::COutputPort::SetGain(TUint aGain) + { + iGain = aGain; + } +TUint CAudioDevice::COutputPort::Gain() + { + return iGain; + } + +TUint CAudioDevice::COutputPort::BytesRecorded() + { + return iBytesRecorded; + } + +// ------------------------------------------------------------------------------------------ +// CAudioDevice Implementation + + +CAudioDevice::CAudioDevice() + { + } + +CAudioDevice::~CAudioDevice() + { + delete iInputPort; + delete iOutputPort; + iSoundDevice.Close(); + } + +void CAudioDevice::Execute() + { + __ASSERT_ALWAYS(iObserver, User::Panic(KAudioDevicePanic, EObserverNotSet)); + TInt err = KErrNone; + if(!iSoundDevice.Handle()) + { + err = iSoundDevice.Open(); + } + + RMdaDevSound::TCurrentSoundFormatBuf buf; + if (err == KErrNone) + { + if(iState == EProcessingUnitPaused) + { + iSoundDevice.ResumePlaying(); + } + else + { + // Set play format (for input port) + iSoundDevice.GetPlayFormat(buf); + buf().iRate = iInputPort->SampleRate(); + buf().iChannels = iInputPort->Channels(); + buf().iBufferSize = KBufferSize; + buf().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + err = iSoundDevice.SetPlayFormat(buf); + } + } + iState = EProcessingUnitExecuting; + if (err == KErrNone) + { + // Set record format (for output format) + iSoundDevice.GetRecordFormat(buf); + buf().iRate = iOutputPort->SampleRate(); + buf().iChannels = iOutputPort->Channels(); + buf().iBufferSize = KBufferSize; + buf().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + iSoundDevice.SetRecordFormat(buf); + iInputPort->Execute(); + iOutputPort->Execute(); + } + else + { + iObserver->ExecuteComplete(this, err); + } + } + +TInt CAudioDevice::Pause() + { + iState = EProcessingUnitPaused; + iInputPort->Pause(); + iOutputPort->Pause(); + return KErrNone; + } + +void CAudioDevice::Stop() + { + if(iState == EProcessingUnitExecuting || iState == EProcessingUnitPaused) + { + // Cancel and flush the device driver + iInputPort->Stop(); + iOutputPort->Stop(); + iState = EProcessingUnitIdle; + + // Close the sound device + iSoundDevice.Close(); + } + } + +CAudioDevice* CAudioDevice::NewL() + { + CAudioDevice* self = new (ELeave) CAudioDevice; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +TInt CAudioDevice::Create(const MMdfProcessingUnitObserver& aObserver) + { + iObserver = const_cast(&aObserver); + return KErrNone; + } + +TInt CAudioDevice::Configure(const TPuConfig& /*aConfigurationSetup*/) + { + return KErrNotSupported; + } + +TInt CAudioDevice::GetConfig(TPuConfig& /*aConfigurationSetup*/) + { + return KErrNotSupported; + } + +TInt CAudioDevice::GetInputPorts(RPointerArray& aComponentInputPorts ) + { + return aComponentInputPorts.Append(iInputPort); + } + +TInt CAudioDevice::GetOutputPorts(RPointerArray& aComponentOutputPorts ) + { + return aComponentOutputPorts.Append(iOutputPort); + } + +void CAudioDevice::ConstructL() + { + iInputPort = CInputPort::NewL(*this); + iOutputPort = COutputPort::NewL(*this); + iState = EProcessingUnitLoaded; + } + +void CAudioDevice::Initialize() + { + __ASSERT_ALWAYS(iObserver, User::Panic(KAudioDevicePanic, EObserverNotSet)); + + iObserver->InitializeComplete(this, KErrNone); + iState = EProcessingUnitIdle; + } + +MMdfProcessingUnitObserver* CAudioDevice::Observer() + { + return iObserver; + } + +TProcessingUnitState CAudioDevice::State() + { + return iState; + } + +RMdaDevSound& CAudioDevice::SoundDevice() + { + return iSoundDevice; + } + +TAny* CAudioDevice::CustomInterface(TUid /*aUid*/) + { + return NULL; + } + +TInt CAudioDevice::CreateCustomInterface(TUid /*aUid*/) + { + return KErrNotSupported; + } + +// ------------------------------------------------------------------------------------------ +// ECOM Implementation table entry + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidPUAudioDevice, CAudioDevice::NewL), + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,202 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef AUDIODEVICE_H +#define AUDIODEVICE_H + +#include +#include +#include +#include +#include +#include + +#ifdef SYMBIAN_MDF_SHAREDCHUNK_SOUNDDRIVER + #include "mdasoundadapter.h" +#else + #include +#endif + +class CMMFBuffer; + +/* +Audio Sink/Source processing unit +*/ +class CAudioDevice : public CMdfProcessingUnit + { +public: + /* + Audio Sink/Source input port + */ + class CInputPort: public CActive, + public MMdfInputPort, + public MPlayCustomInterface + { + public: + static CInputPort* NewL(CAudioDevice& aParent); + + // from MMdfInputPort + TInt MipConfigure(const TPuConfig& aConfiguration); + TInt MipGetConfig(TPuConfig& aConfigurationSetup); + void MipInitialize(); + void MipSetObserver(const MMdfInputPortObserver& aInputPortObserver); + CMMFBuffer* MipCreateBuffer(TInt aBufferSize); + TInt MipUseBuffer(CMMFBuffer& aBuffer); + TInt MipFreeBuffer(CMMFBuffer* aBuffer); + TInt MipTunnelRequest(const MMdfOutputPort& aOutputPortToBeConnectedTo, + TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType); + void MipWriteData(CMMFBuffer& aBuffer); + void MipDisconnectTunnel(); + void MipRestartTunnel(); + TBool MipIsTunnelled() const; + TInt MipIndex() const; + TUint32 MipBufferSize() const; + TInt MipCreateCustomInterface(TUid aUid); + TAny* MipCustomInterface(TUid aUid); + + // from MPlayCustomInterface + void SetVolume(TUint aVolume); + TUint Volume(); + TUint BytesPlayed(); + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + TTimeIntervalMicroSeconds& VolumeRamp(); + TInt SampleRate(); + TInt Channels(); + + // from CActive + void RunL(); + void DoCancel(); + + // CInputPort + void Execute(); + void Pause(); + void Stop(); + ~CInputPort(); + + private: + explicit CInputPort(CAudioDevice& aParent); + void ConstructL(); + private: + CMMFBuffer* iCurrentBuffer; + CAudioDevice& iParent; + MMdfOutputPort* iPortConnectedTo; + RPointerArray iBuffers; + MMdfInputPortObserver* iObserver; + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + TUint iVolume; + TTimeIntervalMicroSeconds iRampDuration; + TUint iBytesPlayed; + TBool iPaused; + TBool iStopped; + TUint iBufferSize; + }; + /* + Audio Sink/Source output port + */ + class COutputPort: public CActive, + public MMdfOutputPort, + public MRecordCustomInterface + { + public: + static COutputPort* NewL(CAudioDevice& aParent); + + // from MMdfOutputPort + TInt MopConfigure(const TPuConfig& aConfiguration); + TInt MopGetConfig(TPuConfig& aConfigurationSetup); + void MopInitialize(); + void MopSetObserver(const MMdfOutputPortObserver& aOutputPortObserver); + CMMFBuffer* MopCreateBuffer(TInt aBufferSize); + TInt MopUseBuffer(CMMFBuffer& aBuffer); + TInt MopFreeBuffer(CMMFBuffer* aBuffer); + TInt MopTunnelRequest(const MMdfInputPort& aInputPortToBeConnectedTo, + TTunnelFlags& aTunnelFlags, TSupplierType& aSupplierType); + void MopReadData(CMMFBuffer& aBuffer); + void MopDisconnectTunnel(); + void MopRestartTunnel(); + TBool MopIsTunnelled() const; + TInt MopIndex() const; + TUint32 MopBufferSize() const; + TInt MopCreateCustomInterface(TUid aUid); + TAny* MopCustomInterface(TUid aUid); + + // from MRecordCustomInterface + void SetGain(TUint aGain); + TUint Gain(); + TUint BytesRecorded(); + TInt SampleRate(); + TInt Channels(); + + // from CActive + void RunL(); + void DoCancel(); + + // COutputPort + ~COutputPort(); + void Execute(); + void Pause(); + void Stop(); + + private: + explicit COutputPort(CAudioDevice& aParent); + void ConstructL(); + private: + CMMFBuffer* iCurrentBuffer; + CAudioDevice& iParent; + RPointerArray iBuffers; + MMdfOutputPortObserver* iObserver; + MMdfInputPort* iPortConnectedTo; + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + TUint iGain; + TUint iBytesRecorded; + TBool iPaused; + TUint iBufferSize; + }; +public: + static CAudioDevice* NewL(); + // from CMdfProcessingUnit + TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + TInt GetInputPorts(RPointerArray& aComponentInputPorts); + TInt GetOutputPorts(RPointerArray& aComponentOutputPorts); + TInt Configure(const TPuConfig& aConfigurationSetup); + TInt GetConfig(TPuConfig& aConfigurationSetup); + void Initialize(); + void Execute (); + TInt Pause (); + void Stop (); + TProcessingUnitState State(); + TInt CreateCustomInterface(TUid aUid); + TAny* CustomInterface(TUid aUid); + + // CAudioDevice + RMdaDevSound& SoundDevice(); + MMdfProcessingUnitObserver* Observer(); + ~CAudioDevice(); + +private: + CAudioDevice(); + void ConstructL(); +private: + CInputPort* iInputPort; + COutputPort* iOutputPort; + RMdaDevSound iSoundDevice; + MMdfProcessingUnitObserver* iObserver; + TProcessingUnitState iState; + }; + +#endif // AUDIODEVICE_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef AUDIODEVICE_HRH +#define AUDIODEVICE_HRH + +#define KUidPUAudioDevice 0x102730BB +#define KUidPUAudioDeviceDll 0x102730BC +#define KCMdfProcessingUnit 0x10273789 + +#endif // AUDIODEVICE_HR + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/AudioDevice/audiodevice.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,40 @@ +// Copyright (c) 2005-2009 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 "audiodevice.hrh" +#include "ecom/registryinfo.rh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidPUAudioDeviceDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KCMdfProcessingUnit; // CMDFProcessingPlugin + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidPUAudioDevice; + version_no = 1; + display_name = "AudioDevice"; + default_data = "" ; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfaudiohwdeviceadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfaudiohwdeviceadapter.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,42 @@ +// Copyright (c) 2005-2009 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: +// mdfhwdeviceadapter.rss +// +// + +#include +#include "mdfhwdeviceadapter.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidHwDeviceAudioAdapterDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidHwDeviceAudioAdapter; + version_no = 1; + display_name = "Audio Hw Device Adapter"; + default_data = "*"; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,905 @@ +// Copyright (c) 2005-2009 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 "HwDeviceAdapter/mdfhwdeviceadapter.h" +#include +#include +#include + +// Interface UID for the Sink Processing Unit +const TUid KUidSourceSinkPu = {0x102730BB}; +const TInt KZerothPort = 0; + +/* +The destructor. Unloads the Processing Units, deletes the +Processing Unit Loader and frees any owned buffers. +@see CMMFHwDevice::~CMMFHwDevice() +*/ +CMdfHwDeviceAdapter::~CMdfHwDeviceAdapter() + { + Stop(); + // Unload the PUs + if (iCodecPU) + { + iPuLoader->UnloadProcessingUnit(iCodecPU); + } + if (iAudioDevicePU) + { + iPuLoader->UnloadProcessingUnit(iAudioDevicePU); + } + + delete iInputBuffer; + delete iOutputBuffer; + delete iActiveWait; + delete iPuLoader; + REComSession::DestroyedImplementation(iPuLoaderDtorKey); + } + +/* +Creates a new CMdfHwDeviceAdapter object. The Processing Unit Loader plugin +is also loaded, and so the CMdfHwDeviceAdapter state is set to EProcessingUnitLoaderLoaded. +Will leave with KErrNotFound if it, or the Processing Unit Loader plugin is not found. +@see THwDevAdapterState +*/ +CMdfHwDeviceAdapter* CMdfHwDeviceAdapter::NewL() + { + CMdfHwDeviceAdapter* self = new (ELeave) CMdfHwDeviceAdapter; + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/* +Default constructor. +*/ +CMdfHwDeviceAdapter::CMdfHwDeviceAdapter() + { + } + +/* +Loads the Processing Unit Loader plugin. +*/ +void CMdfHwDeviceAdapter::ConstructL() + { + // Load the PU Loader plugin + iPuLoader = static_cast + (REComSession::CreateImplementationL(TUid::Uid(KUidPuLoaderImplementation), iPuLoaderDtorKey)); + iActiveWait = new (ELeave) CActiveSchedulerWait; + iState = EProcessingUnitLoaderLoaded; + } + +/* +@see CMMFHwDevice::Start() +@see TDeviceFunc +*/ +TInt CMdfHwDeviceAdapter::Start(TDeviceFunc aFuncCmd, TDeviceFlow /*aFlowCmd*/) + { + if (!((aFuncCmd == EDevEncode)|(aFuncCmd == EDevDecode)|(aFuncCmd == EDevNullFunc))) + { + return KErrArgument; + } + + iFuncCmd = aFuncCmd; + + TInt err = KErrNone; + switch(aFuncCmd) + { + case EDevEncode: + { + err = StartEncode(); + } + break; + case EDevDecode: + { + err = StartDecode(); + } + break; + case EDevNullFunc: + { + // nothing at the moment, so fall through + } + //break; + default: + { + err = KErrNotSupported; + } + break; + } + + + return err; + } + +/* +Initialises the encode operation, and set the state of the CMdfHwDeviceAdapter +to EProcessingUnitInitializing. +@return An error code indicating if the function call was successful. +KErrNone on success, otherwise another of the system-wide error codes. +*/ +TInt CMdfHwDeviceAdapter::InitializeEncode() + { + ASSERT(iCodecOutputPort && iSourceOutputPort); + // Create input buffer that passes data from Source -> Codec PU + TRAPD(err, iInputBuffer = CMMFDescriptorBuffer::NewL(iSourceOutputPort->MopBufferSize())); + if(err != KErrNone) + { + return err; + } + + // Create output buffer that passes decoded data from Codec PU -> Out to file + TRAP(err, iOutputBuffer = CMMFDescriptorBuffer::NewL(iCodecOutputPort->MopBufferSize())); + if(err != KErrNone) + { + return err; + } + + err = iSourceOutputPort->MopUseBuffer(*iInputBuffer); + if(err != KErrNone) + { + return err; + } + err = iCodecInputPort->MipUseBuffer(*iInputBuffer); + if(err != KErrNone) + { + return err; + } + err = iCodecOutputPort->MopUseBuffer(*iOutputBuffer); + if(err != KErrNone) + { + return err; + } + + // async calls, that callback to InitializeComplete() + iCodecPU->Initialize(); + iAudioDevicePU->Initialize(); + if (iState == EProcessingUnitLoaded) + { + // only wait for the callbacks if we haven't already received them + iState = EProcessingUnitInitializing; + iActiveWait->Start(); + } + return iInitError; + } + +/* +Starts the encode operation, providing that the intial state of the +CMdfHwDeviceAdapter is EProcessingUnitLoaded. +@return An error code indicating if the function call was successful. +KErrNone on success, otherwise another of the system-wide error codes. +*/ +TInt CMdfHwDeviceAdapter::StartEncode() + { + TInt err = KErrNone; + if (iState == EProcessingUnitLoaded) + { + err = InitializeEncode(); + } + if (err != KErrNone) + { + return err; + } + if (iState == EProcessingUnitPaused) + { + // Ensure that the LastBuffer flags are reset. + iInputBuffer->SetLastBuffer(EFalse); + iOutputBuffer->SetLastBuffer(EFalse); + } + + return StartExecuting(); + } + +/* +Starts the execution of the encode or decode operation, and sets the state +of the CMdfHwDeviceAdapter to EProcessingUnitExecuting. +@return An error code indicating if the function call was successful. +KErrNone on success, otherwise another of the system-wide error codes. +*/ +TInt CMdfHwDeviceAdapter::StartExecuting() + { + TInt err = KErrNone; + if(iFuncCmd == EDevDecode) + { + iCodecOutputPort->MopReadData(*iOutputBuffer); + err = iHwDeviceObserver->FillThisHwBuffer(*iInputBuffer); + if(err != KErrNone) + { + return err; + } + } + else // encode + { + iSourceOutputPort->MopReadData(*iInputBuffer); + iCodecOutputPort->MopReadData(*iOutputBuffer); + } + + iState = EProcessingUnitExecuting; + + iCodecPU->Execute(); + iAudioDevicePU->Execute(); + + return err; + } + +/* +Initialises the decode operation, and set the state of the CMdfHwDeviceAdapter +to EProcessingUnitInitializing. +@return An error code indicating if the function call was successful. +KErrNone on success, otherwise another of the system-wide error codes. +*/ +TInt CMdfHwDeviceAdapter::InitializeDecode() + { + ASSERT(iCodecOutputPort && iSinkInputPort); + + TRAPD(err, iInputBuffer = CMMFDescriptorBuffer::NewL(iCodecInputPort->MipBufferSize())); + if(err != KErrNone) + { + return err; + } + + iCodecInputPort->MipUseBuffer(*iInputBuffer); + TRAP(err, iOutputBuffer = CMMFDescriptorBuffer::NewL(iCodecOutputPort->MopBufferSize())); + if(err != KErrNone) + { + return err; + } + + // Try to set up a tunnelbetween the output port of the PCM Pu + // and the input port of the Sink Pu + if (iPuLoader->TunnelSetup(*iCodecOutputPort, *iSinkInputPort) != KErrNone) + { + iSinkInputPort->MipUseBuffer(*iOutputBuffer); + } + iCodecOutputPort->MopUseBuffer(*iOutputBuffer); + + // async calls, that callback to InitializeComplete() + iCodecPU->Initialize(); + iAudioDevicePU->Initialize(); + iState = EProcessingUnitInitializing; + iActiveWait->Start(); + return KErrNone; + } + +/* +Starts the decode operation, providing that the intial state of the +CMdfHwDeviceAdapter is EProcessingUnitLoaded. +@return An error code indicating if the function call was successful. +KErrNone on success, otherwise another of the system-wide error codes. +*/ +TInt CMdfHwDeviceAdapter::StartDecode() + { + TInt err = KErrNone; + if (iState == EProcessingUnitLoaded) + { + err = InitializeDecode(); + } + if (err != KErrNone) + { + return err; + } + if (iState == EProcessingUnitIdle) + { + // Ensure that the LastBuffer flags are reset. + iInputBuffer->SetLastBuffer(EFalse); + iOutputBuffer->SetLastBuffer(EFalse); + } + return StartExecuting(); + } + +/* +@see CMMFHwDevice::Stop() +*/ +TInt CMdfHwDeviceAdapter::Stop() + { + if(iState == EProcessingUnitExecuting || iState == EProcessingUnitPaused) + { + iStopping = ETrue; // is used as a guard in ExecuteComplete + if(iAudioDevicePU) + { + iAudioDevicePU->Stop(); + } + if(iCodecPU) + { + iCodecPU->Stop(); + } + + iPCMPUCallbackComplete = EFalse; + iSourceSinkPUCallbackComplete = EFalse; + + iState = EProcessingUnitIdle; + iStopping = EFalse; + } + return KErrNone; + } + +/* +@see CMMFHwDevice::Pause() +*/ +TInt CMdfHwDeviceAdapter::Pause() + { + TInt err = KErrNone; + if(iState != EProcessingUnitPaused) + { + if(iAudioDevicePU) + { + err = iAudioDevicePU->Pause(); + } + iState = EProcessingUnitPaused; + } + return err; + } + +/* +@see CMMFHwDevice::Init() +*/ +TInt CMdfHwDeviceAdapter::Init(THwDeviceInitParams& aDevInfo) + { + if(!iCodecPU) + { + return KErrNotSupported; + } + + // Not currently using any other members of aDevInfo, except the Observer + // Set observer + if(!aDevInfo.iHwDeviceObserver) + { + return KErrArgument; + } + iHwDeviceObserver = aDevInfo.iHwDeviceObserver; + + RPointerArray inputPorts; + // Get ports and set observers + TInt err = iCodecPU->GetInputPorts(inputPorts); + if (err == KErrNone && inputPorts.Count() > 0) + { + iCodecInputPort = inputPorts[KZerothPort]; + iCodecInputPort->MipSetObserver(*this); + } + inputPorts.Close(); + if (err != KErrNone) + { + return err; + } + if (!iCodecInputPort) + { + return KErrNotFound; + } + + RPointerArray outputPorts; + // Get ports and set observers + err = iCodecPU->GetOutputPorts(outputPorts); + if (err == KErrNone && outputPorts.Count() > 0) + { + iCodecOutputPort = outputPorts[KZerothPort]; + iCodecOutputPort->MopSetObserver(*this); + } + outputPorts.Close(); + if (err != KErrNone) + { + return err; + } + if (!iCodecOutputPort) + { + return KErrNotFound; + } + + // Load SourceSink Pu + TRAP(err, iAudioDevicePU = iPuLoader->LoadProcessingUnitL(*this, KUidSourceSinkPu)); + if(err!=KErrNone) + { + return err; + } + + err = iAudioDevicePU->GetInputPorts(inputPorts); + if (err == KErrNone && inputPorts.Count() > 0) + { + iSinkInputPort = inputPorts[KZerothPort]; + iSinkInputPort->MipSetObserver(*this); + } + inputPorts.Close(); + if (err != KErrNone) + { + return err; + } + if (!iSinkInputPort) + { + return KErrNotFound; + } + + + err = iAudioDevicePU->GetOutputPorts(outputPorts); + if (err == KErrNone && outputPorts.Count() > 0) + { + iSourceOutputPort = outputPorts[KZerothPort]; + iSourceOutputPort->MopSetObserver(*this); + } + outputPorts.Close(); + if (err != KErrNone) + { + return err; + } + if (!iCodecOutputPort) + { + return KErrNotFound; + } + + iState = EProcessingUnitLoaded; + return KErrNone; + } + +/* +@see CMMFHwDevice::CustomInterface() +*/ +TAny* CMdfHwDeviceAdapter::CustomInterface(TUid aInterfaceId) + { + if (aInterfaceId == KUidHwDeviceSetupInterface) + { + MMdfHwDeviceSetup* hwDeviceSetup = this; + return hwDeviceSetup; + } + else if (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) + { + return iSinkInputPort->MipCustomInterface(aInterfaceId); + } + else if (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface) + { + return iSourceOutputPort->MopCustomInterface(aInterfaceId); + } + else if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate) + { + return iCodecPU->CustomInterface(aInterfaceId); + } + else + { + return NULL; + } + } + +/* +@see CMMFHwDevice::ThisHwBufferFilled() +*/ +TInt CMdfHwDeviceAdapter::ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr) + { + aFillBufferPtr.SetStatus(EFull); + iCodecInputPort->MipWriteData(aFillBufferPtr); + return KErrNone; + } + +/* +@see CMMFHwDevice::ThisHwBufferEmptied() +*/ +TInt CMdfHwDeviceAdapter::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + if (iOutputBuffer->LastBuffer()) + { + CMMFDataBuffer* buffer = static_cast (iOutputBuffer); + buffer->Data().SetLength(0); + iHwDeviceObserver->EmptyThisHwBuffer(*iOutputBuffer); + } + else + { + iCodecOutputPort->MopReadData(*iOutputBuffer); + } + return KErrNone; + } + +/* +@see CMMFHwDevice::SetConfig() +*/ +TInt CMdfHwDeviceAdapter::SetConfig(TTaskConfig& aConfig) + { + TInt err = KErrNone; + // Call to Configure the Codec PU + TPuTaskConfig config(aConfig); + err = iCodecInputPort->MipConfigure(config); + if(err != KErrNone) + { + return err; + } + err = iCodecOutputPort->MopConfigure(config); + if(err != KErrNone) + { + return err; + } + + // configure the audio device + err = iSinkInputPort->MipConfigure(config); + if(err != KErrNone) + { + return err; + } + err = iSourceOutputPort->MopConfigure(config); + if(err != KErrNone) + { + return err; + } + + return KErrNone; + } + +/* +@see CMMFHwDevice::StopAndDeleteCodec() +*/ +TInt CMdfHwDeviceAdapter::StopAndDeleteCodec() + { + TInt stopError = Stop(); + TInt deleteError = DeleteCodec(); + + if (stopError != KErrNone) + { + return stopError; + } + else + { + return deleteError; + } + } + +/* +Unloads all Processing Units, and deletes any locally owned buffers. +State is set to EProcessingUnitLoaderLoaded. + +@see CMMFHwDevice::DeleteCodec() +*/ +TInt CMdfHwDeviceAdapter::DeleteCodec() + { + Stop(); + if (iCodecPU) + { + iPuLoader->UnloadProcessingUnit(iCodecPU); + } + if (iAudioDevicePU) + { + iPuLoader->UnloadProcessingUnit(iAudioDevicePU); + } + + // CMdfHwDeviceAdapter does not own the I/O ports, which + // have been deleted at this point by UnloadProcessingUnit() + iCodecInputPort = NULL; + iCodecOutputPort = NULL; + iSinkInputPort = NULL; + iSourceOutputPort = NULL; + + delete iInputBuffer; + iInputBuffer = NULL; + delete iOutputBuffer; + iOutputBuffer = NULL; + + iState = EProcessingUnitLoaderLoaded; + + return KErrNone; + } + +/* +@see MMdfInputPortObserver::MipoWriteDataComplete() +*/ +void CMdfHwDeviceAdapter::MipoWriteDataComplete(const MMdfInputPort* aInputPort, + CMMFBuffer* aBuffer, TInt aErrorCode) + { + if(aErrorCode != KErrNone) + { + StopHwDevice(aErrorCode); + } + else + { + switch(iFuncCmd) + { + case EDevEncode: + { + if(aInputPort == iCodecInputPort) + { + if(aBuffer->LastBuffer()) + { + iCodecPU->Stop(); + } + else + { + // if not the last buffer, then pass buffer back to source to get more data + iSourceOutputPort->MopReadData(*iInputBuffer); + } + } + } + break; + case EDevDecode: + { + if(aInputPort == iCodecInputPort) + { + if (!aBuffer->LastBuffer()) + { + // JW 22-05-06 + // if the PU is idle (having been Stopped) then + // FillThisHwBuffer will cause a kern-exec, + // as the DevSoundSession no longer has a buffer + if(iState == EProcessingUnitExecuting) + { + TInt err = iHwDeviceObserver->FillThisHwBuffer(*aBuffer); + if(err != KErrNone) + { + StopHwDevice(err); + } + } + } + } + else // aInputPort == iSinkInputPort + { + if (!aBuffer->LastBuffer()) + { + if(iSinkInputPort->MipIsTunnelled()) + { + // This callback shouldn't occur since it should be tunnelled with the sink input port + StopHwDevice(KErrArgument); + } + else + { + iCodecOutputPort->MopReadData(*iOutputBuffer); + } + } + } + } + break; + case EDevNullFunc: + // nothing at the moment, so fall through + default: + StopHwDevice(KErrNotSupported); + } + } + } + +/* +@see MMdfInputPortObserver::MipoDisconnectTunnelComplete() +*/ +void CMdfHwDeviceAdapter::MipoDisconnectTunnelComplete(const MMdfInputPort* aInputPort, + TInt aErrorCode) + { + // The Inputport of the PcmCodecPu will no longer receive data. + if(aErrorCode == KErrNone) + { + if(aInputPort == iCodecInputPort) + { + iPCMPuMipoStopCompleted = ETrue; + } + else if(aInputPort == iSinkInputPort) + { + // This shouldn't be called! + iHwDeviceObserver->Error(KErrNotFound); + } + } + else + { + iHwDeviceObserver->Error(aErrorCode); + } + } + +/* +@see MMdfInputPortObserver::MipoRestartTunnelComplete() +*/ +void CMdfHwDeviceAdapter::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/, + TInt /*aErrorCode*/) + { + + } + +/* +@see MMdfOutputPortObserver::MopoReadDataComplete() +*/ +void CMdfHwDeviceAdapter::MopoReadDataComplete(const MMdfOutputPort* aOutputPort, + CMMFBuffer* aBuffer, TInt aErrorCode) + { + if(aErrorCode != KErrNone) + { + StopHwDevice(aErrorCode); + } + else + { + switch(iFuncCmd) + { + case EDevEncode: + { + if(aOutputPort == iSourceOutputPort) + { + iCodecInputPort->MipWriteData(*aBuffer); + } + else // aPu == iCodecPU + { + TInt err = iHwDeviceObserver->EmptyThisHwBuffer(*aBuffer); + if(err !=KErrNone) + { + StopHwDevice(err); + } + } + } + break; + case EDevDecode: + { + if(aOutputPort == iCodecOutputPort) + { + if(iCodecOutputPort->MopIsTunnelled()) + { + // This callback shouldn't occur since it should be tunnelled with the sink input port + StopHwDevice(KErrArgument); + } + else + { + iSinkInputPort->MipWriteData(*aBuffer); + } + } + } + break; + case EDevNullFunc: + // nothing at the moment, so fall through + default: + StopHwDevice(KErrNotSupported); + } + } + } + +/* +@see MMdfOutputPortObserver::MopoDisconnectTunnelComplete() +*/ +void CMdfHwDeviceAdapter::MopoDisconnectTunnelComplete(const MMdfOutputPort* aOutputPort, + TInt aErrorCode) + { + if(!aOutputPort) + { + iHwDeviceObserver->Error(KErrArgument); + return; + } + + // The last buffer has been set, and called back to MopoReadDataComplete + if(aErrorCode != KErrNone) + { + iHwDeviceObserver->Error(aErrorCode); + return; + } + + if(aOutputPort == iCodecOutputPort) + { + iPCMPuMopoStopCompleted = ETrue; + } + else if(aOutputPort == iSourceOutputPort) + { + iSourceSinkPuMopoStopCompleted = ETrue; + } + else + { + iHwDeviceObserver->Error(KErrArgument); + return; + } + + if(iPCMPuMipoStopCompleted && iPCMPuMopoStopCompleted && iSourceSinkPuMopoStopCompleted) + { + iHwDeviceObserver->Error(KErrNone); + iState = EProcessingUnitIdle; + } + } + +/* +@see MMdfOutputPortObserver::MopoRestartTunnelComplete() +*/ +void CMdfHwDeviceAdapter::MopoRestartTunnelComplete(const MMdfOutputPort* /*aOutputPort*/, + TInt /*aErrorCode*/) + { + + } + +/* +@see MMdfProcessingUnitObserver::InitializeComplete() +*/ +void CMdfHwDeviceAdapter::InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) + { + iInitError = aErrorCode; + if(aErrorCode != KErrNone) + { + // stop waiting on the active scheduler if we were doing so + if (iState == EProcessingUnitInitializing) + { + // change state back to processing unit loaded + iState = EProcessingUnitLoaded; + iActiveWait->AsyncStop(); + } + return; + } + + if(aPu == iCodecPU) + { + iPCMPUCallbackComplete = ETrue; + } + else if(aPu == iAudioDevicePU) + { + iSourceSinkPUCallbackComplete = ETrue; + } + + if(iPCMPUCallbackComplete && iSourceSinkPUCallbackComplete) + { + // reset the flags + iPCMPUCallbackComplete = EFalse; + iSourceSinkPUCallbackComplete = EFalse; + + // Both PUs initialised OK + if (iState == EProcessingUnitInitializing) + { + iActiveWait->AsyncStop(); + } + iState = EProcessingUnitIdle; + } + } + +/* +@see MMdfProcessingUnitObserver::ExecuteComplete() +*/ +void CMdfHwDeviceAdapter::ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) + { + if(iStopping) + { + return; + } + + if (iExecuteError == KErrNone) + { + iExecuteError = aErrorCode; + } + + if(aPu == iCodecPU) + { + iPCMPUCallbackComplete = ETrue; + } + else if(aPu == iAudioDevicePU) + { + iSourceSinkPUCallbackComplete = ETrue; + } + + if(iExecuteError != KErrNone || (iPCMPUCallbackComplete && iSourceSinkPUCallbackComplete)) + { + if (iState == EProcessingUnitExecuting) + { + // stop the hardware device if we are still executing + StopHwDevice(iExecuteError); + iState = EProcessingUnitIdle; + } + // reset the flags + iPCMPUCallbackComplete = EFalse; + iSourceSinkPUCallbackComplete = EFalse; + } + } + +/* +@see MMdfHwDeviceSetup::::SetDataTypesL() +*/ +void CMdfHwDeviceAdapter::SetDataTypesL(TFourCC aSrcType, TFourCC aDestType) + { + // Find and load an appropriate Codec + iCodecPU = iPuLoader->LoadProcessingUnitL(*this, aSrcType, aDestType); + } + +/* +Called to indicate that the Hardware Device has been stopped, leading +to callbacks to the observer. +@see MMMFHwDeviceObserver::Stopped() +@see MMMFHwDeviceObserver::Error() +*/ +void CMdfHwDeviceAdapter::StopHwDevice(TInt error) + { + iHwDeviceObserver->Stopped(); + iHwDeviceObserver->Error(error); + } + +/* +Returns the state of the Hardware Device Adapter object. +*/ +void CMdfHwDeviceAdapter::GetState(THwDevAdapterState& aState) const + { + aState = iState; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,178 @@ +// Copyright (c) 2005-2009 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: +// mmfhwdeviceadapter.h +// +// + +/** + @file + @publishedPartner + @prototype + @see CMMFHwDevice + @see MMdfInputPortObserver + @see MMdfOutputPortObserver + @see MMdfProcessingUnitObserver + @see MMdfHwDeviceSetup +*/ + +#ifndef HWDEVICEADAPTER_H +#define HWDEVICEADAPTER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +class CMMFBuffer; + +/* +Hardware Device Adapter class that uses Processing Units (and their associated Ports) in +order to decode and encode audio data. +*/ +class CMdfHwDeviceAdapter : public CMMFHwDevice, + public MMdfInputPortObserver, + public MMdfOutputPortObserver, + public MMdfProcessingUnitObserver, + public MMdfHwDeviceSetup + { +public: + /* + The current state of the Hardware Device Adapter. + */ + enum THwDevAdapterState + { + /* + The PULoader has been loaded. + */ + EProcessingUnitLoaderLoaded, + /* + The Processing Units have been loaded. + */ + EProcessingUnitLoaded, + /* + The Processing Units are currently being initialised. + */ + EProcessingUnitInitializing, + /* + The Processing Units are currently in the idle state. + */ + EProcessingUnitIdle, + /* + The Processing Units are currently in the executing state. + */ + EProcessingUnitExecuting, + /* + The Processing Units are currently in the paused state. + */ + EProcessingUnitPaused + }; + +public: + static CMdfHwDeviceAdapter* NewL(); + + // from CMMFHwDevice + TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + TInt Stop(); + TInt Pause(); + TInt Init(THwDeviceInitParams& aDevInfo); + TAny* CustomInterface(TUid aInterfaceId); + TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + TInt SetConfig(TTaskConfig& aConfig); + TInt StopAndDeleteCodec(); + TInt DeleteCodec(); + ~CMdfHwDeviceAdapter(); + + // from MMdfInputPortObserver + void MipoWriteDataComplete(const MMdfInputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode); + void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); + void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); + + // from MMdfOutputPortObserver + void MopoReadDataComplete(const MMdfOutputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode); + void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); + void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); + + // from MMdfProcessingUnitObserver + void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + + // from MMdfHwDeviceSetup + void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType); + + // CMdfHwDeviceAdapter + void GetState(THwDevAdapterState& aState) const; + +protected: + /* + Hardware Device Adapter panics raised as a result of a programming error. + */ + enum THwDeviceAdapterPanics + { + /* + Raised when the Codec Processing Unit has not been initialised. + @see CMdfHwDeviceAdapter::CustomInterface + @see CMdfHwDeviceAdapter::SetDataTypesL + */ + EPanicCodecNotSet + }; + +private: + CMdfHwDeviceAdapter(); + void ConstructL(); + TInt CreateBuffers(); + TInt StartEncode(); + TInt StartDecode(); + TInt InitializeEncode(); + TInt InitializeDecode(); + TInt StartExecuting(); + void StopHwDevice(TInt error); +private: + enum TPUType + { + EPcmPu, + ESourceSinkPu + }; + CMdfPuLoader* iPuLoader; + TUid iPuLoaderDtorKey; + MMdfInputPort* iCodecInputPort; + MMdfOutputPort* iCodecOutputPort; + MMdfInputPort* iSinkInputPort; + MMdfOutputPort* iSourceOutputPort; + CMdfProcessingUnit* iCodecPU; + CMdfProcessingUnit* iAudioDevicePU; + THwDevAdapterState iState; + TBool iPCMPUCallbackComplete; + TBool iSourceSinkPUCallbackComplete; + TBool iSourceSinkPuMopoStopCompleted; + TBool iPCMPuMopoStopCompleted; + TBool iPCMPuMipoStopCompleted; + TBool iStopping; + TInt iInitError; + TInt iExecuteError; + CMMFBuffer* iInputBuffer; + CMMFBuffer* iOutputBuffer; + TInt iInputPortBufferData; + TInt iOutputPortBufferData; + CActiveSchedulerWait* iActiveWait; + TDeviceFunc iFuncCmd; + TFourCC iFirstFourCC; + TFourCC iSecondFourCC; + }; + +#endif // HWDEVICEADAPTER_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadapter.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,25 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef MDFHWDEVICEADAPTER_HRH +#define MDFHWDEVICEADAPTER_HRH + +#define KSharedLibraryUidDefine 0x10009d8d +#define KMmfUidPluginInterfaceHwDevice 0x101F4AA8 +#define KUidHwDeviceAudioAdapterDll 0x10273790 +#define KUidHwDeviceAudioAdapter 0x10273791 + +#endif // MDFHWDEVICEADAPTER_HRH + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadaptermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/HwDeviceAdapter/mdfhwdeviceadaptermain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,35 @@ +// Copyright (c) 2005-2009 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 "HwDeviceAdapter/mdfhwdeviceadapter.h" +#include +#include "mdfhwdeviceadapter.hrh" + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidHwDeviceAudioAdapter , CMdfHwDeviceAdapter::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderinputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderinputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,76 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "vorbisdecoderinputport.h" +#include "vorbisdecoderprocessingunit.h" + +#include + +// #define VORBISDECODERINPUTPORT_DEBUG 1 +#if defined(VORBISDECODERINPUTPORT_DEBUG) +#define DEBUG_PRINT RDebug::Print +#else +#define DEBUG_PRINT +#endif + +CVorbisDecoderInputPort* CVorbisDecoderInputPort::NewL(TInt aIndex, CVorbisDecoderProcessingUnit* aComponent) + { + CVorbisDecoderInputPort* self = new (ELeave) CVorbisDecoderInputPort; + CleanupStack::PushL (self); + self->ConstructL(aIndex, aComponent); + CleanupStack::Pop(); + return self; + } + +CVorbisDecoderInputPort::CVorbisDecoderInputPort() + { + } + +TInt CVorbisDecoderInputPort::MipConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + // no configuration to be done for the decoder input port; + // the vorbis decoder will detect that the input buffer is vorbis + // format (or not). + return KErrNone; + } + return KErrNotSupported; + } + +void CVorbisDecoderInputPort::MipInitialize() + { + COmxInputPort::MipInitialize(); + OMX_VERSIONTYPE ver = + { + 1,0 + }; + + // Set Input Port (Vorbis) + OMX_AUDIO_PARAM_VORBISTYPE vorbis; + vorbis.nVersion = ver; + vorbis.nSize = sizeof(OMX_AUDIO_PARAM_VORBISTYPE); + vorbis.nPortIndex = KVorbisDecoderInputPortIndex; + + Component()->OmxSetParameter(OMX_IndexParamAudioVorbis, &vorbis); + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderinputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderinputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISDECODERINPUTPORT_H +#define VORBISDECODERINPUTPORT_H + +#include +#include + +class MMdfOutputPort; +class MMdfOutputPortObserver; +class CVorbisDecoderProcessingUnit; +class CVorbisDecoderOutputPort; +class CMMFBuffer; + +const TInt KVorbisDecoderInputPortIndex = 0; + +class CVorbisDecoderInputPort : public COmxInputPort + { +public: + static CVorbisDecoderInputPort* NewL(TInt aIndex, CVorbisDecoderProcessingUnit* aComponent); + TInt MipConfigure(const TPuConfig& aConfiguration); + virtual void MipInitialize(); +private: + CVorbisDecoderInputPort(); + }; + +#endif // VORBISDECODERINPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderoutputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderoutputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,98 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "vorbisdecoderoutputport.h" +#include "vorbisdecoderprocessingunit.h" + +#include + +const TInt KPcm16BitsPerSample = 16; + +// #define VORBISDECODEROUTPUTPORT_DEBUG 1 +#if defined(VORBISDECODEROUTPUTPORT_DEBUG) +#define DEBUG_PRINT RDebug::Print +#else +#define DEBUG_PRINT +#endif + +const TUint KSampleRate = 44100; +const TUint KMonoChannel = 1; +const TUint KStereoChannel = 2; + +CVorbisDecoderOutputPort* CVorbisDecoderOutputPort::NewL(TInt aIndex, CVorbisDecoderProcessingUnit* aComponent) + { + CVorbisDecoderOutputPort* self = new (ELeave) CVorbisDecoderOutputPort; + CleanupStack::PushL (self); + self->ConstructL(aIndex, aComponent); + CleanupStack::Pop(); + return self; + } + +CVorbisDecoderOutputPort::CVorbisDecoderOutputPort() : + iSampleRate(KSampleRate), + iChannels(KStereoChannel), + iInterleaved(EFalse) + { + } + + + +TInt CVorbisDecoderOutputPort::MopConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + return KErrNotSupported; + } + +void CVorbisDecoderOutputPort::MopInitialize() + { + COmxOutputPort::MopInitialize(); + + OMX_VERSIONTYPE ver = + { + 1,0 + }; + + // Set Output Port (PCM16) + OMX_AUDIO_PARAM_PCMMODETYPE pcm; + pcm.nVersion = ver; + pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE); + pcm.nPortIndex = KVorbisDecoderOutputPortIndex; + pcm.nSamplingRate = iSampleRate; + pcm.ePCMMode = OMX_AUDIO_PCMModeLinear; + pcm.eNumData = OMX_NumericalDataSigned; + pcm.nBitPerSample = KPcm16BitsPerSample; + pcm.nChannels = iChannels; + pcm.bInterleaved = (OMX_BOOL)iInterleaved; + + Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm); + } + +// end diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderoutputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderoutputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISDECODEROUTPUTPORT_H +#define VORBISDECODEROUTPUTPORT_H + +#include +#include +#include + +class CVorbisDecoderProcessingUnit; +class TPuConfig; +class MMdfInputPort; +class CMMFBuffer; + +const TInt KVorbisDecoderOutputPortIndex = 1; + +class CVorbisDecoderOutputPort : public COmxOutputPort + { + friend class CVorbisDecoderProcessingUnit; +public: + static CVorbisDecoderOutputPort* NewL(TInt aIndex, CVorbisDecoderProcessingUnit* aComponent); + TInt MopConfigure(const TPuConfig& aConfiguration); + void MopInitialize(); + +private: + CVorbisDecoderOutputPort(); + +private: + MMdfInputPort* iPortConnectedTo; + MMdfOutputPortObserver* iObserver; + + // PCM settings + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + + TBool iStopped; + }; + +#endif // VORBISDECODEROUTPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,80 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include + +#include "vorbisdecoderprocessingunit.h" +#include "vorbisdecoderinputport.h" +#include "vorbisdecoderoutputport.h" + + +_LIT8(KVorbisDecoderILComponentName,"OMX.SYMBIAN.AUDIO.DECODER.VORBIS"); + +CVorbisDecoderProcessingUnit::CVorbisDecoderProcessingUnit() + : iVorbisDecoderPuObserver(NULL), + iVorbisDecoderInputPort(NULL), + iVorbisDecoderOutputPort(NULL) + + { + } + +CVorbisDecoderProcessingUnit* CVorbisDecoderProcessingUnit::NewL() + { + CVorbisDecoderProcessingUnit* self = new (ELeave) CVorbisDecoderProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CVorbisDecoderProcessingUnit::ConstructL() + { + } + +CVorbisDecoderProcessingUnit::~CVorbisDecoderProcessingUnit() + { + delete iVorbisDecoderOutputPort; + delete iVorbisDecoderInputPort; + } + +TInt CVorbisDecoderProcessingUnit::Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) + { + TRAPD(err, CreateL(aProcessingUnitObserver)); + return err; + } + +void CVorbisDecoderProcessingUnit::CreateL(const MMdfProcessingUnitObserver& aProcessingUnitObserver) + { + iVorbisDecoderPuObserver = const_cast(&aProcessingUnitObserver); + COmxProcessingUnit::ConstructL(KVorbisDecoderILComponentName, aProcessingUnitObserver); + iVorbisDecoderInputPort = CVorbisDecoderInputPort::NewL(KVorbisDecoderInputPortIndex, this); + iVorbisDecoderOutputPort = CVorbisDecoderOutputPort::NewL(KVorbisDecoderOutputPortIndex, this); + User::LeaveIfError(AddInputPort(iVorbisDecoderInputPort)); + User::LeaveIfError(AddOutputPort(iVorbisDecoderOutputPort)); + } + + + +// end + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,63 @@ +// Copyright (c) 2006-2009 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: +// vorbisencoderprocessingunit.h +// +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISDECODERPROCESSINGUNIT_H +#define VORBISDECODERPROCESSINGUNIT_H + +#include +#include +#include +#include + +class CVorbisDecoderOutputPort; +class CVorbisDecoderInputPort; + +class CVorbisDecoderProcessingUnit + : public COmxProcessingUnit + { +public: + enum TDataType + { + EVorbis, + EPCM16 + }; +public: + static CVorbisDecoderProcessingUnit* NewL(); + TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + + ~CVorbisDecoderProcessingUnit(); + +private: + CVorbisDecoderProcessingUnit(); + void ConstructL(); + void CreateL(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + +private: + MMdfProcessingUnitObserver* iVorbisDecoderPuObserver; + CVorbisDecoderInputPort* iVorbisDecoderInputPort; + CVorbisDecoderOutputPort* iVorbisDecoderOutputPort; + }; + +#endif // VORBISDECODERPROCESSINGUNIT_H + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunit.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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 +#include +#include "vorbisprocessingunituids.hrh" + +// 0x1027379e = KUidAudioCodec + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidVorbisDecoderProcessingUnitDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidMdfProcessingUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidVorbisDecoderPU; + version_no = 1; + display_name = "Vorbis Decoder Processing Unit"; + default_data = ""; + opaque_data = "0x1027379eVRB2 P16"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunitmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/decoder/vorbisdecoderprocessingunitmain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2006-2009 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 "vorbisdecoderprocessingunit.h" +#include +#include "vorbisprocessingunituids.hrh" + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidVorbisDecoderPU, CVorbisDecoderProcessingUnit::NewL), + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderinputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderinputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,100 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "vorbisencoderinputport.h" +#include "vorbisencoderprocessingunit.h" + +#include + +// #define VORBISENCODERINPUTPORT_DEBUG 1 +#if defined(VORBISENCODERINPUTPORT_DEBUG) +#define DEBUG_PRINT RDebug::Print +#else +#define DEBUG_PRINT +#endif + +const TUint KSampleRate = 44100; +const TUint KMonoChannel = 1; +const TUint KStereoChannel = 2; + +CVorbisEncoderInputPort* CVorbisEncoderInputPort::NewL(TInt aIndex, CVorbisEncoderProcessingUnit* aParent) + { + CVorbisEncoderInputPort* self = new (ELeave) CVorbisEncoderInputPort; + CleanupStack::PushL(self); + self->ConstructL(aIndex, aParent); + CleanupStack::Pop(); + return self; + } + +CVorbisEncoderInputPort::CVorbisEncoderInputPort() : + iSampleRate(KSampleRate), + iChannels(KStereoChannel), + iInterleaved(EFalse) + { + } + + +TInt CVorbisEncoderInputPort::MipConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + + return KErrNone; + } + else + { + return KErrNotSupported; + } + } + +void CVorbisEncoderInputPort::MipInitialize() + { + COmxInputPort::MipInitialize(); + OMX_VERSIONTYPE ver = + { + 1,0 + }; + + // Set Input Port (PCM16) + OMX_AUDIO_PARAM_PCMMODETYPE pcm; + pcm.nVersion = ver; + pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE); + pcm.nPortIndex = 0; + pcm.nSamplingRate = iSampleRate; + pcm.ePCMMode = OMX_AUDIO_PCMModeLinear; + pcm.eNumData = OMX_NumericalDataSigned; + pcm.nBitPerSample = 16; + pcm.nChannels = iChannels; + pcm.bInterleaved = (OMX_BOOL)iInterleaved; + + Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm); + } + + +// end + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderinputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderinputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISENCODERINPUTPORT_H +#define VORBISENCODERINPUTPORT_H + +#include +#include + +class MMdfOutputPort; +class MMdfOutputPortObserver; +class CVorbisEncoderProcessingUnit; +class CVorbisEncoderOutputPort; +class CMMFBuffer; + +class CVorbisEncoderInputPort : public COmxInputPort + { +public: + static CVorbisEncoderInputPort* NewL(TInt aIndex, CVorbisEncoderProcessingUnit* aParent); + + TInt MipConfigure(const TPuConfig& aConfiguration); + virtual void MipInitialize(); + +private: + CVorbisEncoderInputPort(); +private: + + // PCM settings + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + }; + +#endif // VORBISENCODERINPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderoutputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderoutputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,101 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include + +#include "vorbisencoderoutputport.h" +#include "vorbisencoderprocessingunit.h" + +#include + +// #define VORBISENCODEROUTPUTPORT_DEBUG 1 +#if defined(VORBISENCODEROUTPUTPORT_DEBUG) +#define DEBUG_PRINT RDebug::Print +#else +#define DEBUG_PRINT +#endif + +// from PREQ452 CVorbisEncoder +const TInt KVorbisDefaultBitRate = 128000; + +CVorbisEncoderOutputPort* CVorbisEncoderOutputPort::NewL(TInt aIndex, CVorbisEncoderProcessingUnit* aParent) + { + CVorbisEncoderOutputPort* self = new (ELeave) CVorbisEncoderOutputPort; + CleanupStack::PushL (self); + self->ConstructL(aIndex, aParent); + CleanupStack::Pop(); + return self; + } + +CVorbisEncoderOutputPort::CVorbisEncoderOutputPort() : + iBitRate(KVorbisDefaultBitRate) + { + } + + +TInt CVorbisEncoderOutputPort::MopConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + // there is nothing here to set. iBitRate must be set + // through a custom interface + + return KErrNone; + } + else + { + return KErrNotSupported; + } + } + +void CVorbisEncoderOutputPort::MopInitialize() + { + COmxOutputPort::MopInitialize(); + OMX_VERSIONTYPE ver = + { + 1,0 + }; + // Set Output Port (Vorbis) + OMX_AUDIO_PARAM_VORBISTYPE vorbis; + vorbis.nVersion = ver; + vorbis.nSize = sizeof(OMX_AUDIO_PARAM_VORBISTYPE); + vorbis.nPortIndex = 1; + vorbis.nBitRate = BitRate(); + + Component()->OmxSetParameter(OMX_IndexParamAudioVorbis, &vorbis); + } + + +// get and set bit rate +// NB these are available to the owner of the port only, not as part +// of MMdfOutputPort +TInt CVorbisEncoderOutputPort::BitRate() + { + return iBitRate; + } + +void CVorbisEncoderOutputPort::SetBitRate(TInt aBitRate) + { + iBitRate = aBitRate; + } + +// end + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderoutputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderoutputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISENCODEROUTPUTPORT_H +#define VORBISENCODEROUTPUTPORT_H + +#include +#include +#include + +class TPuConfig; +class CMMFBuffer; +class CVorbisEncoderProcessingUnit; +class MMDFInputPort; + +class CVorbisEncoderOutputPort : public COmxOutputPort + { + friend class CVorbisEncoderProcessingUnit; +public: + static CVorbisEncoderOutputPort* NewL(TInt aIndex, CVorbisEncoderProcessingUnit* aParent); + + TInt MopConfigure(const TPuConfig& aConfiguration); + void MopInitialize(); + + TInt BitRate(); + void SetBitRate(TInt aBitRate); + +private: + CVorbisEncoderOutputPort(); +private: + TBool iStopped; + // Vorbis settings + TInt iBitRate; + }; + +#endif // VORBISENCODEROUTPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,186 @@ +// Copyright (c) 2007-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include +#include + +#include "vorbisencoderprocessingunit.h" +#include "vorbisencoderinputport.h" +#include "vorbisencoderoutputport.h" + +const TInt KVorbisEncoderInputPortIndex = 0; +const TInt KVorbisEncoderOutputPortIndex = 1; + +_LIT8(KVorbisEncoderILComponentName,"OMX.SYMBIAN.AUDIO.ENCODER.VORBIS"); + +// for the derivation of these constants see +// http://en.wikipedia.org/wiki/Vorbis +const TInt KVorbisQualityMinus1 = 4500; +const TInt KVorbisQuality0 = 6000; +const TInt KVorbisQuality1 = 80000; +const TInt KVorbisQuality2 = 96000; +const TInt KVorbisQuality3 = 110000; +const TInt KVorbisQuality4 = 128000; +const TInt KVorbisQuality5 = 160000; +const TInt KVorbisQuality6 = 192000; +const TInt KVorbisQuality7 = 224000; +const TInt KVorbisQuality8 = 256000; +const TInt KVorbisQuality9 = 320000; +const TInt KVorbisQuality10 = 500000; + +CVorbisEncoderProcessingUnit::CVorbisEncoderProcessingUnit() + : iVorbisEncoderInputPort(NULL), + iVorbisEncoderOutputPort(NULL) + { + + // input defaults (EPCM16) + iInputBitsPerSample = 16; + iNumInputType = OMX_NumericalDataSigned; + + // no output defaults (EVorbis) + } + +CVorbisEncoderProcessingUnit* CVorbisEncoderProcessingUnit::NewL() + { + CVorbisEncoderProcessingUnit* self = new (ELeave) CVorbisEncoderProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CVorbisEncoderProcessingUnit::ConstructL() + { + // setup supported bit rates array + iSupportedBitRates.Reset(); + iSupportedBitRates.AppendL(KVorbisQualityMinus1); + iSupportedBitRates.AppendL(KVorbisQuality0); + iSupportedBitRates.AppendL(KVorbisQuality1); + iSupportedBitRates.AppendL(KVorbisQuality2); + iSupportedBitRates.AppendL(KVorbisQuality3); + iSupportedBitRates.AppendL(KVorbisQuality4); + iSupportedBitRates.AppendL(KVorbisQuality5); + iSupportedBitRates.AppendL(KVorbisQuality6); + iSupportedBitRates.AppendL(KVorbisQuality7); + iSupportedBitRates.AppendL(KVorbisQuality8); + iSupportedBitRates.AppendL(KVorbisQuality9); + iSupportedBitRates.AppendL(KVorbisQuality10); + } + +CVorbisEncoderProcessingUnit::~CVorbisEncoderProcessingUnit() + { + iSupportedBitRates.Reset(); + iSupportedBitRates.Close(); + delete iVorbisEncoderOutputPort; + delete iVorbisEncoderInputPort; + } + +TInt CVorbisEncoderProcessingUnit::Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) + { + TRAPD(err, CreateL(aProcessingUnitObserver)); + return err; + } + + +void CVorbisEncoderProcessingUnit::CreateL(const MMdfProcessingUnitObserver& aProcessingUnitObserver) + { + COmxProcessingUnit::ConstructL(KVorbisEncoderILComponentName, aProcessingUnitObserver); + iVorbisEncoderInputPort = CVorbisEncoderInputPort::NewL(KVorbisEncoderInputPortIndex, this); + iVorbisEncoderOutputPort = CVorbisEncoderOutputPort::NewL(KVorbisEncoderOutputPortIndex, this); + User::LeaveIfError(AddInputPort(iVorbisEncoderInputPort)); + User::LeaveIfError(AddOutputPort(iVorbisEncoderOutputPort)); + } + + + + +TInt CVorbisEncoderProcessingUnit::CreateCustomInterface(TUid aInterfaceId) + { + if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate) + { + // There is no work to create this interface, so just return no error + return KErrNone; + } + else + { + return KErrNotSupported; + } + } + +TAny* CVorbisEncoderProcessingUnit::CustomInterface(TUid aInterfaceId) + { + // The vorbis encoder requires the custom interface for bitrates + if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate) + { + return static_cast (this); + } + else + { + return NULL; + } + } + +/** +Gets the bit rates that are supported by DevSound in its current configuration. + +@param aSupportedBitRates +The supported bit rates, in bits per second, shall be appended to this array. Note that +the array shall be reset by this method. +*/ +void CVorbisEncoderProcessingUnit::GetSupportedBitRatesL(RArray& aSupportedBitRates) + { + aSupportedBitRates.Reset(); + TInt c = iSupportedBitRates.Count(); + for(TInt i = 0; i < c; i++) + { + aSupportedBitRates.AppendL(iSupportedBitRates[i]); + } + } + +TInt CVorbisEncoderProcessingUnit::BitRateL() + { + return iVorbisEncoderOutputPort->BitRate(); + } + +void CVorbisEncoderProcessingUnit::SetBitRateL(TInt aBitRate) + { + // We can't strictly set the bit rate outside of calling + // MopConfigure() on the output port. + // However if we own the port we can call its SetBitRateL() method + // which is not part of MMdfOutputPort. + + // set the bitrate to the nearest available, rounding down + TInt c = iSupportedBitRates.Count(); + for(TInt i = c-1; i >= 0; i--) + { + if(aBitRate >= iSupportedBitRates[i]) + { + iVorbisEncoderOutputPort->SetBitRate(iSupportedBitRates[i]); + return; + } + } + User::Leave(KErrNotSupported); + } + +// end + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,73 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef VORBISENCODERPROCESSINGUNIT_H +#define VORBISENCODERPROCESSINGUNIT_H + +#include +#include +#include +#include + +// for the bitrate custom interface +#include + +class CVorbisEncoderOutputPort; +class CVorbisEncoderInputPort; + +class CVorbisEncoderProcessingUnit + : public COmxProcessingUnit, public MMMFDevSoundCustomInterfaceBitRate + { +public: + enum TDataType + { + EVorbis, + EPCM16 + }; +public: + static CVorbisEncoderProcessingUnit* NewL(); + TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + TInt CreateCustomInterface(TUid aUid); + TAny* CustomInterface(TUid aUid); + ~CVorbisEncoderProcessingUnit(); + + //from MMMFDevSoundCustomInterfaceBitRate + void GetSupportedBitRatesL(RArray& aSupportedBitRates); + TInt BitRateL(); + void SetBitRateL(TInt aBitRate); + +private: + CVorbisEncoderProcessingUnit(); + void ConstructL(); + void CreateL(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + +private: + CVorbisEncoderInputPort* iVorbisEncoderInputPort; + CVorbisEncoderOutputPort* iVorbisEncoderOutputPort; + RArray iSupportedBitRates; + + TInt iInputBitsPerSample; + OMX_NUMERICALDATATYPE iNumInputType; + }; + +#endif // VORBISENCODERPROCESSINGUNIT_H + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunit.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 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 +#include +#include "vorbisprocessingunituids.hrh" + +// 0x1027379e = KUidAudioCodec + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidVorbisEncoderProcessingUnitDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidMdfProcessingUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidVorbisEncoderPU; + version_no = 1; + display_name = "Vorbis Encoder Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P16VRB2"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunitmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/encoder/vorbisencoderprocessingunitmain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2006-2009 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 "vorbisencoderprocessingunit.h" +#include +#include "vorbisprocessingunituids.hrh" + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidVorbisEncoderPU, CVorbisEncoderProcessingUnit::NewL), + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/Vorbis/PU/vorbisprocessingunituids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/Vorbis/PU/vorbisprocessingunituids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef __VORBISPROCESSINGUNITUIDS_HRH__ +#define __VORBISPROCESSINGUNITUIDS_HRH__ + +#define KSharedLibraryUidDefine 0x10009D8D + +#define KUidVorbisEncoderProcessingUnitDll 0x102737CD +#define KUidVorbisEncoderPU 0x102737CE + +#define KUidVorbisDecoderProcessingUnitDll 0x102737CF +#define KUidVorbisDecoderPU 0x102737D0 + +#endif // __VORBISPROCESSINGUNITUIDS_HRH__ + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapter.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,485 @@ +// Copyright (c) 2007-2009 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 "mdasoundadapter.h" +#include "mdasoundadapterbody.h" +#include + +EXPORT_C RMdaDevSound::RMdaDevSound() + :iBody(NULL) + { + } + +/* + @capability MultimediaDD + + This function creates the handle to the sound media driver. + + @param aUnit A unit of the device. + + @return KErrNone on success, otherwise system wide error code. + + @capability MultimediaDD +*/ +EXPORT_C TInt RMdaDevSound::Open(TInt aUnit) + { + TInt err = KErrNone; + if(iBody == NULL) + { + TRAP(err, iBody = RMdaDevSound::CBody::NewL()); + } + if(err == KErrNone) + { + err = iBody->Open(aUnit); + } + return err; + } + +/* + Gets the version object of sound media driver. + +@return version object. + +*/ +EXPORT_C TVersion RMdaDevSound::VersionRequired() const + { + if(iBody) + { + return iBody->VersionRequired(); + } + return TVersion(); + } + +/* + Indicates whether the driver is sound media driver. + +@return KErrNone on success, otherwise System wide error code. + +*/ +EXPORT_C TInt RMdaDevSound::IsMdaSound() + { + return iBody->IsMdaSound(); + } + +/* + This function gets the play volume. + The range of volume level supported depends on the physical audio device used. + +@return Volume level. + +*/ +EXPORT_C TInt RMdaDevSound::PlayVolume() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->PlayVolume(); + } + +/* + This function sets the play volume. + The volume level depends on the physical audio device used. + +@param aVolume Play volume level in the range 0 to 255 inclusive +@see TSoundFormatsSupported + +*/ +EXPORT_C void RMdaDevSound::SetPlayVolume(TInt aVolume) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->SetPlayVolume(aVolume); + } + +/* + This function sets the play volume. + The volume level depends on the physical audio device used. + +@param aVolume Play volume level. Logarithmic value. +@see TSoundFormatsSupported + +*/ +EXPORT_C void RMdaDevSound::SetVolume(TInt aLogarithmicVolume) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->SetVolume(aLogarithmicVolume); + } + +/* + This function cancels the currently playing sound. + If paused, the pause will be cancelled. + Will panic if not open. + Will not cancel Notify*Error(). +*/ +EXPORT_C void RMdaDevSound::CancelPlayData() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->CancelPlayData(); + } + +/* + Gets the sound record volume. + This depends on the physical audio device used. +@return Record volume level. + +*/ +EXPORT_C TInt RMdaDevSound::RecordLevel() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->RecordLevel(); + } + +/* + This function sets the device record volume level. + This depends on the physical audio device used. +@param aLevel Record volume level. +@see TSoundFormatsSupported + +*/ +EXPORT_C void RMdaDevSound::SetRecordLevel(TInt aLevel) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->SetRecordLevel(aLevel); + } + +/* + This function cancels the recording in progress. + If paused, the pause will be cancelled. + Any buffered data will be discarded. + Will panic if not open. + Will not cancel Notify*Error(). +*/ +EXPORT_C void RMdaDevSound::CancelRecordData() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->CancelRecordData(); + } + +/* + This function stops recording and completes the outstanding RecordData request immediately with any available data. + Any following RecordData calls will be completed immediately returning any buffered data, they will NOT restart recording. + + It maybe called either when recording or stopped. + + The flushing state should be exited by calling CancelRecordData. + + The adaptor implements this functionality via Pause, which results in slightly different behaviour to the old RMdaDevSound driver. + In particular the flushing state can also be exited by calling ResumeRecording, do NOT do this... If you want this behaviour, use the + new PauseRecording/ResumeRecording functions. + */ +EXPORT_C void RMdaDevSound::FlushRecordBuffer() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->FlushRecordBuffer(); + } + +/* + This function returns the number of bytes played by the driver since calling Open or + calling ResetBytesPlayed(). + + It is not reset by PlayData or PausePlayBuffer/ResumePlayBuffer + +@see RMdaDevSound::ResetBytesPlayed() +@return Number of bytes played. +*/ +EXPORT_C TInt RMdaDevSound::BytesPlayed() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->BytesPlayed(); + } + +/* + Resets the count of bytes played. + + If called whilst playing, the counter might not reset to exactly zero, it will reset to the number of bytes played in the current + internal transfer. +*/ +EXPORT_C void RMdaDevSound::ResetBytesPlayed() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->ResetBytesPlayed(); + } + +/* + This function changes the audio play state to pause. + It is legal to pause whilst not playing, in which case a following (single) PlayData request will be queued until + ResumePlaying is called. +*/ +EXPORT_C void RMdaDevSound::PausePlayBuffer() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->PausePlayBuffer(); + } + + +/* + This function starts the audio play from pause state. + If a PlaData request was active when the Pause was requested it will continue. + If a PlayData request was not active when the Pause was requested, but a one was issued whilst paused, + it will start. + If there is nothing to resume, we will notify KErrUnderflow. +*/ +EXPORT_C void RMdaDevSound::ResumePlaying() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->ResumePlaying(); + } + +/* + This function is identical to RMdaDevSound::ResumePlaying(), the parameter is ignored. +*/ +EXPORT_C void RMdaDevSound::ResumePlaying(TRequestStatus&) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->ResumePlaying(); + } + +/* +The current record request will be completed early with partial contents and further +recording paused. + +Any following RecordData calls will be completed immediately using any buffered data, it will NOT restart recording. + +*/ +EXPORT_C void RMdaDevSound::PauseRecordBuffer() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->PauseRecordBuffer(); + } + +/* + Resume recording. + Recorded data will be buffered internally. + If an outstanding RecordData request was issued whilst paused it will be processed. +*/ +EXPORT_C void RMdaDevSound::ResumeRecording() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->ResumeRecording(); + } + +/* + Return the duration of the audio data which has been played. + Note that this may be less than the amount of data/time queued. +*/ +EXPORT_C TInt RMdaDevSound::GetTimePlayed(TTimeIntervalMicroSeconds& aTimePlayed) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->GetTimePlayed(aTimePlayed); + } + + +/* + Gets the play format(capability) supported by this device. + This record describes supported sample rate, encoding, volume level, channels, buffer size of the audio for playing. + +@param aFormatsSupported A reference to a client supplied TSoundFormatsSupported class to be filled by this function. +@see TSoundFormatsSupported + +*/ +EXPORT_C void RMdaDevSound::PlayFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->PlayFormatsSupported(aFormatsSupported); + } + +/* + This function gets the current play format. + +@param aFormat A reference to a client supplied TCurrentSoundFormat class to be filled by this function. +@see TCurrentSoundFormat + +*/ +EXPORT_C void RMdaDevSound::GetPlayFormat(TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->GetPlayFormat(aFormat); + } + +/* + This functions sets the play format. + +@param aFormat For the details refer to TCurrentSoundFormat. + +@see TCurrentSoundFormat + +@return KErrNone on success, + KErrInUse if playing, + KErrAccessDenied if play and recording sample rate is different, + KErrNotSupported if input sound format does not match with supported capability, + otherwise system wide error code. + +*/ +EXPORT_C TInt RMdaDevSound::SetPlayFormat(const TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->SetPlayFormat(aFormat); + } + +/* + Gets the sound record format. + This record describes supported sample rate, encoding, volume level, buffer size of the audio for recording. + This depends on the physical device used. + +@param aFormatsSupported A reference to a client supplied TSoundFormatsSupported class to be filled by this function. +@see TSoundFormatsSupported + +*/ +EXPORT_C void RMdaDevSound::RecordFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->RecordFormatsSupported(aFormatsSupported); + } + +/* + Gets a current sound format used for recording. + +@param aFormat A reference to a client supplied TCurrentSoundFormat class to be filled by this function. +@see TCurrentSoundFormat + +*/ +EXPORT_C void RMdaDevSound::GetRecordFormat(TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->GetRecordFormat(aFormat); + } + +/* + Call this function to change the sound format used for recording. + +@param aFormat For details refer to TCurrentSoundFormat. +@see TCurrentSoundFormat + +@return KErrNone on sucess, + KErrInUse if recording already in progress, + KErrAccessDenied play and record sample rates are different, + otherwise system wide error code. + +*/ +EXPORT_C TInt RMdaDevSound::SetRecordFormat(const TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + return iBody->SetRecordFormat(aFormat); + } + +EXPORT_C void RMdaDevSound::Close() + { + if(iBody) + { + iBody->Close(); + delete iBody; + iBody = NULL; + } + } + +EXPORT_C TInt RMdaDevSound::Handle() + { + if(iBody) + { + return iBody->Handle(); + } + return 0; + } + +/* + Call this function to play the audio data in the supplied descriptor. + +Only a single request may be outstanding at any point in time. + +If paused, the request will be queued until ResumePlaying is called. + +@param aStatus For details refer to TRequestStatus. +@see TRequestStatus + +@param aData Descriptor with play data + +*/ +EXPORT_C void RMdaDevSound::PlayData(TRequestStatus& aStatus, const TDesC8& aData) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->PlayData(aStatus, aData); + } + +/* + Records audio data into the supplied descriptor. + +Only a single request may be outstanding at any point in time. + +If paused, the request will be queued until ResumeRecording is called. + +@param aStatus Request status +@see TRequestStatus + +@param aData Record buffer descriptor. + +*/ +EXPORT_C void RMdaDevSound::RecordData(TRequestStatus& aStatus, TDes8& aData) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->RecordData(aStatus, aData); + } + +/* + Call this function to notify any error encountered while recording audio. + +@param aStatus request object's completion code value +@see TRequestStatus + +*/ +EXPORT_C void RMdaDevSound::NotifyRecordError(TRequestStatus& aStatus) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->NotifyRecordError(aStatus); + } + +/* + Call this function to notify the play error encountered while playing the sound. + +@param aStatus Error code stating the cause for the play error. + +*/ +EXPORT_C void RMdaDevSound::NotifyPlayError(TRequestStatus& aStatus) + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->NotifyPlayError(aStatus); + } + +/* + This function cancels the play notification error. + +*/ +EXPORT_C void RMdaDevSound::CancelNotifyPlayError() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->CancelNotifyPlayError(); + } + +/* + This function cancels the recording error notification. +*/ +EXPORT_C void RMdaDevSound::CancelNotifyRecordError() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->CancelNotifyRecordError(); + } + +/* +This function cancels the currently playing sound. +If paused, the pause will be cancelled. + + This function is identical to CancelPlayData +*/ +EXPORT_C void RMdaDevSound::FlushPlayBuffer() + { + __ASSERT_DEBUG(iBody != NULL, Panic(EDeviceNotOpened)); + iBody->FlushPlayBuffer(); + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapter.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,241 @@ +// Copyright (c) 2007-2009 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: +// + + +#ifndef MDASOUNDADAPTER_H +#define MDASOUNDADAPTER_H + +#include +#include + + +#define MDADEVSOUNDNAME _L8("RMdaDevSound") + +/* + Adapter class which routes the calls on RMdaDevSound(old sound driver interface) to RSoundSc(new sound driver interface). + The purpose of this class is to use the new sound driver in MDF without changing the calling code. This class + does not support any new functionalities supported by the shared chunk sound driver but supports the functionality of the + of the old driver with the new driver. + */ +class RMdaDevSound + { + class CBody; +public: + /* + enum for major, minor and build version of sound device driver. + */ + enum TVer {EMajorVersionNumber=1,EMinorVersionNumber=0,EBuildVersionNumber=KE32BuildVersionNumber}; + /* + enum for sound media device play/record request. + */ + enum TMdaRequest + { + /* Play data request */ + EMdaRequestPlayData, + /* Play error notification */ + EMdaRequestPlayErrorNotification, + /* Record data request */ + EMdaRequestRecordData, + /* Record error notification */ + EMdaRequestRecordErrorNotification + }; + + /* enum for media device control request */ + enum TMdaControl + { + /* play format (capability) supported request */ + EMdaControlPlayFormatsSupported, + /* get the current play format request */ + EMdaControlGetPlayFormat, + /* set the play format request */ + EMdaControlSetPlayFormat, + /* get play volume request */ + EMdaControlGetPlayVolume, + /* set play volume request */ + EMdaControlSetPlayVolume, + /* record format supported request */ + EMdaControlRecordFormatsSupported, + /* get the current record format request */ + EMdaControlGetRecordFormat, + /* set record format request */ + EMdaControlSetRecordFormat, + /* get record volume request */ + EMdaControlGetRecordLevel, + /* set record volume request */ + EMdaControlSetRecordLevel, + /* stop play request */ + EMdaControlFlushPlayBuffer, + /* stop record request */ + EMdaControlFlushRecordBuffer, + /* bytes played request */ + EMdaControlBytesPlayed, + /* set base value for the bytes played */ + EMdaControlResetBytesPlayed, + /* Investigate for sound media driver request */ + EMdaControlIsMdaSound, + /* pause play request */ + EMdaControlPausePlayBuffer, + /* resume play request */ + EMdaControlResumePlaying + }; + + /* + This enum corresponds to supported sound encoding schemes + */ + enum TMdaSoundEncoding + { + /* sound encoding(compression) using 8 bit PCM (pulse code modulation) */ + EMdaSoundEncoding8BitPCM = 0x00000001, + /* sound encoding using 16 bit PCM */ + EMdaSoundEncoding16BitPCM = 0x00000002, + /* sound encoding using 8 bit A law */ + EMdaSoundEncoding8BitALaw = 0x00000004, + /* sound encoding using 8 bit Mu law */ + EMdaSoundEncoding8BitMuLaw = 0x00000008, + }; + + /* + This class corresponds to a supported sound format. + The format describes the supported audio device's min/max sampling rate, encoding, channels and buffer size of play/record and volume. + */ + class TSoundFormatsSupported + { + public: + /* + This corresponds to minimum sample rate supported. This depends on the physical sound device used(example: 8000 hertz). + */ + TInt iMinRate; + + /* + This corresponds to maximum sample rate supported. This depends on the physical sound device used(example: 48000 hertz). + */ + TInt iMaxRate; + + /* + This corresponds to encoding format supported. + @see TMdaSoundEncoding + */ + TUint32 iEncodings; + + /* + This corresponds to the number of sound channels supported. Possible values are EMono for a single channel and EStereo for two channel sound. + Also this depends on the physical device used. + */ + TInt iChannels; + + /* + This corresponds to minimum buffer size. This depends on the physical device used and sampling rate adapted. + @see KSoundMinBufferSize + */ + TInt iMinBufferSize; + + /* + This corresponds to maximum buffer size.This depends on the physical device used and sampling rate adapted. + @see KSoundPlayBufferSize + @see KSoundRecordBufferSize + */ + TInt iMaxBufferSize; + + /* + This corresponds to minimum play/record volume. + */ + TInt iMinVolume; + + /* + This corresponds to maximum play/record volume. + */ + TInt iMaxVolume; + }; + + /* A typedef'd packaged RMdaDevSound::TSoundFormatsSupported for passing through a generic API method */ + typedef TPckgBuf TSoundFormatsSupportedBuf; + + /* + This class corresponds to current supported sound format. + The format describes the supported audio device's sampling rate, encoding, channels and buffer size of play/record. + */ + class TCurrentSoundFormat + { + public: + /* + This corresponds to sound sampling rate like (44000 Hertz, 8000 Hertz). The possible values depends on the physical device used. + */ + TInt iRate; + + /* + @see TMdaSoundEncoding + */ + TMdaSoundEncoding iEncoding; + + /* + This corresponds to the number of sound channels supported. Possible values are EMono for a single channel and EStereo for two channel sound. + Also this depends on the physical device used. + */ + TInt iChannels; + + /* + Play or Record buffer size. The possible value depends on the physical device used. + */ + TInt iBufferSize; + }; + + /* A typedef'd packaged RMdaDevSound::TCurrentSoundFormat for passing through a generic API method */ + typedef TPckgBuf TCurrentSoundFormatBuf; +public: + IMPORT_C RMdaDevSound(); + IMPORT_C TInt Open(TInt aUnit=KNullUnit); + IMPORT_C TVersion VersionRequired() const; + IMPORT_C TInt IsMdaSound(); + IMPORT_C void PlayFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported); + IMPORT_C void GetPlayFormat(TCurrentSoundFormatBuf& aFormat); + IMPORT_C TInt SetPlayFormat(const TCurrentSoundFormatBuf& aFormat); + IMPORT_C TInt PlayVolume(); + // This function mimics RMdaDevSound interface with linear volume semantics + IMPORT_C void SetPlayVolume(TInt aLinearVolume); + // This function supports volume change with logarithmic semantics + IMPORT_C void SetVolume(TInt aLogarithmicVolume); + IMPORT_C void PlayData(TRequestStatus& aStatus,const TDesC8& aData); + IMPORT_C void CancelPlayData(); + IMPORT_C void NotifyPlayError(TRequestStatus& aStatus); + IMPORT_C void CancelNotifyPlayError(); + + IMPORT_C void RecordFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported); + IMPORT_C void GetRecordFormat(TCurrentSoundFormatBuf& aFormat); + IMPORT_C TInt SetRecordFormat(const TCurrentSoundFormatBuf& aFormat); + IMPORT_C TInt RecordLevel(); + IMPORT_C void SetRecordLevel(TInt aLevel); + IMPORT_C void RecordData(TRequestStatus& aStatus,TDes8& aData); + IMPORT_C void CancelRecordData(); + IMPORT_C void NotifyRecordError(TRequestStatus& aStatus); + IMPORT_C void CancelNotifyRecordError(); + + IMPORT_C void FlushPlayBuffer(); + IMPORT_C void FlushRecordBuffer(); + IMPORT_C TInt BytesPlayed(); + IMPORT_C void ResetBytesPlayed(); + IMPORT_C void PausePlayBuffer(); + IMPORT_C void ResumePlaying(); + IMPORT_C void ResumePlaying(TRequestStatus&); + IMPORT_C void Close(); + IMPORT_C TInt Handle(); + IMPORT_C void PauseRecordBuffer(); + IMPORT_C void ResumeRecording(); + IMPORT_C TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTimePlayed); +private: + CBody* iBody; + }; + +#endif + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1944 @@ +// Copyright (c) 2008-2009 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 "mdasoundadapterconsts.h" +#include "mdasoundadapterbody.h" +#include + +#include "mmf/utils/rateconvert.h" // if we need to resample + +#include + +_LIT(KPddFileName,"SOUNDSC.PDD"); +_LIT(KLddFileName,"ESOUNDSC.LDD"); + + +const TInt KBytesPerSample = 2; +const TInt KMinBufferSize = 2; + +/** +This function raises a panic +EDeviceNotOpened is raised when any of the RMdaDevSound APIs are called before opening the device. +*/ +GLDEF_C void Panic(TSoundAdapterPanicCodes aPanicCode) + { + User::Panic(KSoundAdapterPanicCategory, aPanicCode); + } + + +const TText8 *RMdaDevSound::CBody::TState::Name() const + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + switch(iState) + { + case ENotReady: return _S8("ENotReady"); + case EStopped: return _S8("EStopped"); + case ERecording: return _S8("ERecording"); + case ERecordingPausedInHw: return _S8("ERecordingPausedInHw"); + case ERecordingPausedInSw: return _S8("ERecordingPausedInSw"); + case EPlaying: return _S8("EPlaying"); + case EPlayingPausedInHw: return _S8("EPlayingPausedInHw"); + case EPlayingPausedInSw: return _S8("EPlayingPausedInSw"); + case EPlayingUnderrun: return _S8("EPlayingUnderrun"); + } + return _S8("CorruptState"); + #else + return _S8(""); + #endif + } + + + +RMdaDevSound::CBody::TState &RMdaDevSound::CBody::TState::operator=(TStateEnum aNewState) + { + if(iState != aNewState) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound state %s -> %s", Name(), TState(aNewState).Name()); + #endif + iState = aNewState; + } + return *this; + } + +RMdaDevSound::CBody* RMdaDevSound::CBody::NewL() + { + CBody* self = new(ELeave) CBody(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +RMdaDevSound::CBody::~CBody() + { + for(TInt i = 0; i < KPlaySharedChunkBuffers; i++) + { + delete iPlayers[i]; + iPlayers[i] = NULL; + } + delete iRecorder; + iRecorder = NULL; + delete iPlayFormatData.iConverter; + delete iRecordFormatData.iConverter; + iPlayChunk.Close(); + iPlaySoundDevice.Close(); + iRecordChunk.Close(); + iRecordSoundDevice.Close(); + iConvertedPlayData.Close(); + iSavedTrailingData.Close(); + iBufferedRecordData.Close(); + } + +RMdaDevSound::CBody::CBody() + :iState(ENotReady), iBufferOffset(-1) + { + + } + +TVersion RMdaDevSound::CBody::VersionRequired() const + { + if(iPlaySoundDevice.Handle()) + { + return iPlaySoundDevice.VersionRequired(); + } + else + { + return TVersion(); + } + } + +TInt RMdaDevSound::CBody::IsMdaSound() + { + return ETrue; + } + +void RMdaDevSound::CBody::ConstructL() + { + // Try to load the audio physical driver + TInt err = User::LoadPhysicalDevice(KPddFileName); + if ((err!=KErrNone) && (err!=KErrAlreadyExists)) + { + User::Leave(err); + } + // Try to load the audio logical driver + err = User::LoadLogicalDevice(KLddFileName); + if ((err!=KErrNone) && (err!=KErrAlreadyExists)) + { + User::Leave(err); + } + for(TInt i=0; i=0 && aVolume<=KSoundMaxVolume) + { + iPlaySoundDevice.SetVolume(KLinerToDbConstantLookup[aVolume].iDBValue); + } + } +void RMdaDevSound::CBody::SetVolume(TInt aLogarithmicVolume) + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + if(aLogarithmicVolume >= 0 && aLogarithmicVolume <= KSoundMaxVolume) + { + iPlaySoundDevice.SetVolume(aLogarithmicVolume); + } + } + +void RMdaDevSound::CBody::CancelPlayData() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::CancelPlayData: state %s", iState.Name()); + #endif + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + // If there is a client request, cancel it + // Must do this before canceling players because otherwise they may just restart! + if(iClientPlayStatus) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("msp PlayCancelled complete iClientPlayStatus"); + #endif + User::RequestComplete(iClientPlayStatus, KErrCancel); // Call also sets iClientPlayStatus to NULL + } + + // Discard any buffered data + iClientPlayData.Set(0,0); + // Discard any saved trailing data (ie. data saved due driver requiring all requests to be a multiple of iRequestMinSize). + iSavedTrailingData.SetLength(0); + + // Emulator RSoundSc PDD when running without a soundcard has a major + // issue with cancelling whilst paused. It will not clear the pending + // list (because the timer is not active) and therefore this list will + // later overflow causing hep corruption. + // This means that, for now, we MUST Resume before calling CancelPlayData + // to avoid kernel panics... + + // The device driver will not cancel a request which is in progress... + // So, if we are paused in hw, we must resume before cancelling the + // player otherwise it will hang in CActive::Cancel + if(iState == EPlayingPausedInHw) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("msp Resume to avoid hang"); + #endif + (void) iPlaySoundDevice.Resume(); + } + + // Update state + iState = EStopped; + + + // The RSoundSc driver will not cancel a request which is in progress (or paused). + // If we just loop across the players, cancelling each individual request and waiting for it to complete, + // several of them will actually play, which is both wrong and time consuming.... + // Issue a block cancel upfront to avoid this + iPlaySoundDevice.CancelPlayData(); + + // Cancel all players + for (TUint playerIndex=0; playerIndexCancel(); + } + + iBufferOffset = -1; + iBufferLength = 0; + + return; + } + +TInt RMdaDevSound::CBody::RecordLevel() + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + return iRecordSoundDevice.Volume(); + } + +void RMdaDevSound::CBody::SetRecordLevel(TInt aLevel) + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + iRecordSoundDevice.SetVolume(aLevel); + } + +void RMdaDevSound::CBody::CancelRecordData() + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::CancelRecordData: state %s", iState.Name()); + #endif + + // Stop recorder object (and its request) + iRecorder->Cancel(); + + // Stop driver from recording + iRecordSoundDevice.CancelRecordData(); + + // If there is a client request, cancel it + if(iClientRecordStatus) + { + User::RequestComplete(iClientRecordStatus, KErrNone); // Call also sets iClientPlayStatus to NULL + } + + iState = EStopped; + return; + } + +void RMdaDevSound::CBody::FlushRecordBuffer() + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::FlushRecordBuffer - implemented by calling PauseRecordBuffer")); + #endif + + PauseRecordBuffer(); + } + +TInt RMdaDevSound::CBody::BytesPlayed() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::BytesPlayed %s", iState.Name()); + #endif + + return I64LOW(BytesPlayed64()); + } + + +TUint64 RMdaDevSound::CBody::BytesPlayed64() + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + TUint64 currentBytesPlayed = KMaxTUint64; + + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + currentBytesPlayed = iBytesPlayed; + break; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + Panic(EBadState); + break; + + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + // Paused, so use pause time + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("EPlayingPausedInHw: iPausedBytes %x %x", I64HIGH(iPausedBytesPlayed), I64LOW(iPausedBytesPlayed)); + #endif + currentBytesPlayed = iPausedBytesPlayed; + break; + + case EPlayingPausedInSw: // ie. Driver not playing or paused + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("EPlayingPausedInSw: iPausedBytesPlayed %x %x", I64HIGH(iPausedBytesPlayed), I64LOW(iPausedBytesPlayed)); + #endif + currentBytesPlayed = iPausedBytesPlayed; + break; + case EPlayingUnderrun: + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("EPlayingUnderrun: iBytesPlayed %x %x", I64HIGH(iBytesPlayed), I64LOW(iBytesPlayed)); + #endif + currentBytesPlayed = iBytesPlayed; + break; + + case EPlaying: + { + // Playing so calculate time since last update to iBytesPlayed + TUint32 curTime = CurrentTimeInMsec(); + TUint32 curRequestSize = iActivePlayRequestSizes.Peek(); + + TUint32 extraPlayTime = (curTime >= iStartTime) ? (curTime-iStartTime) : (KMaxTUint32 - (iStartTime-curTime)); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("iStartTime %d curTime %d extraPlayTime %d", iStartTime, curTime, extraPlayTime); + + RDebug::Printf("iPlayFormatData.iSampleRate %d KBytesPerSample %d iNTickPeriodInUsec %d", + iPlayFormatData.iSampleRate, KBytesPerSample, iNTickPeriodInUsec); + #endif + TUint32 extraBytesPlayed = TUint32((TUint64(extraPlayTime) * iPlayFormatData.iSampleRate * iPlayFormatData.iRequestedChannels * KBytesPerSample)/1000); + if(extraBytesPlayed > curRequestSize) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("caping extraBytes played from %d to %d", extraBytesPlayed, curRequestSize); + #endif + extraBytesPlayed = curRequestSize; + } + + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("iBytesPlayed %d extraBytesPlayed %d (curRequestSize %d) -> currentBytesPlayed %x %x", + iBytesPlayed, extraBytesPlayed, curRequestSize, I64HIGH(currentBytesPlayed), I64LOW(currentBytesPlayed)); + #endif + + currentBytesPlayed = iBytesPlayed + extraBytesPlayed; + break; + } + + default: + Panic(EBadState); + break; + } + + + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("iPlayFormatData.iConverter %x", iPlayFormatData.iConverter); + #endif + + if (iPlayFormatData.iConverter) + { + // need to scale bytes played to fit with requested rate and channels, not actual + if (iPlayFormatData.iActualChannels != iPlayFormatData.iRequestedChannels) + { + if (iPlayFormatData.iActualChannels == 2) + { + // requested was mono, we have stereo + currentBytesPlayed /= 2; + } + else + { + // requested was stereo, we have mono + currentBytesPlayed *= 2; + } + } + if (iPlayFormatData.iSampleRate != iPlayFormatData.iActualRate) + { + currentBytesPlayed = TUint64(currentBytesPlayed* + TReal(iPlayFormatData.iSampleRate)/TReal(iPlayFormatData.iActualRate)); // don't round + } + } + + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("currentBytesPlayed %x %x", I64HIGH(currentBytesPlayed), I64LOW(currentBytesPlayed)); + #endif + return currentBytesPlayed; + } + +void RMdaDevSound::CBody::ResetBytesPlayed() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::ResetBytesPlayed %s", iState.Name()); + #endif + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + iBytesPlayed = 0; + iPlaySoundDevice.ResetBytesTransferred(); + return; + } + +void RMdaDevSound::CBody::PausePlayBuffer() + { +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::PausePlayBuffer %s", iState.Name()); +#endif + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // Driver is not playing so pause in s/w + break; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + Panic(EBadState); + break; + + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + case EPlayingPausedInSw: // ie. Driver not playing or paused + // Already paused so nothing to do. + break; + case EPlayingUnderrun: + iState = EPlayingPausedInSw; + break; + + case EPlaying: + { + iPauseTime = CurrentTimeInMsec(); + iPausedBytesPlayed = BytesPlayed64(); + TInt res = iPlaySoundDevice.Pause(); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("iPlaySoundDevice.Pause res = %d", res); + #endif + if(res == KErrNone) + { + iState = EPlayingPausedInHw; + } + else + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("msp PausePlayBuffer hw pause unexpectedly failed, doing sw pause"); + #endif + iState = EPlayingPausedInSw; + } + break; + } + + default: + Panic(EBadState); + break; + } + + return; + } + +void RMdaDevSound::CBody::ResumePlaying() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::ResumePlaying %s", iState.Name()); + #endif + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // No change + break; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + Panic(EBadState); + break; + + case EPlaying: + // No change + break; + + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + { + // Re-enable reporting of KErrUnderflow (will re-raise KErrUnderflow if nothing to start playing). + iUnderFlowReportedSinceLastPlayOrRecordRequest = EFalse; + + TInt res = iPlaySoundDevice.Resume(); +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("ResumePlayBuffer EPlayingPausedInHw res = %d", res); +#endif + if(res == KErrNone) + { + // Resume ok so a pending request will complete + iState = EPlaying; + // Update iStartTime to allow for time spent paused + TUint32 curTime = CurrentTimeInMsec(); + TUint32 timePaused = (curTime >= iPauseTime) ? (curTime-iPauseTime) : (KMaxTUint32 - (iPauseTime-curTime)); + iStartTime += timePaused; // nb. It is harmless if this wraps. + } + else + { + // Resume failed, therefore driver is not playing + // No need to update iStartTime/iPauseTime because these are only used within a driver request + // Change state to Stopped + iState = EStopped; + // Attempt to start a new (pending) request. + StartPlayersAndUpdateState(); + } + break; + } + case EPlayingPausedInSw: // ie. Driver not playing/paused + { + // Driver not playing + // Re-enable reporting of KErrUnderflow (will re-raise KErrUnderflow if nothing to start playing). + iUnderFlowReportedSinceLastPlayOrRecordRequest = EFalse; + // No need to update iStartTime/iPauseTime because these are only used within a driver request + // Change state to Stopped + iState = EStopped; + // Attempt to start a new (pending) request. + StartPlayersAndUpdateState(); + break; + } + case EPlayingUnderrun: + break; + + default: + Panic(EBadState); + break; + } + + return; + } + +void RMdaDevSound::CBody::PauseRecordBuffer() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::PauseRecordBuffer %s", iState.Name()); + #endif + + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // Driver is not recording so pause in s/w + // Do not pause because that will cause problems when CAudioDevice::Pause calls + break; + + case ERecording: + { + TInt res = iRecordSoundDevice.Pause(); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("PauseRecordBuffer EPlaying res = %d", res); + #endif + if(res == KErrNone) + { + iState = ERecordingPausedInHw; + } + else + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("PauseRecordBuffer hw pause unexpectedly failed, doing sw pause"); + #endif + iState = ERecordingPausedInSw; + } + break; + } + + case ERecordingPausedInHw: + case ERecordingPausedInSw: + // Already paused so nothing to do. + break; + + case EPlaying: + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + Panic(EBadState); + break; + + case EPlayingPausedInSw: + // This is an ugly hack to maintain compatibility with CAudioDevice::Pause which + // calls both PausePlayBuffer and PauseRecordBuffer whilst in stopped, then later calls ResumePlaying + break; + case EPlayingUnderrun: // ie. Play request pending on h/w and paused + Panic(EBadState); + break; + + default: + Panic(EBadState); + break; + } + + return; + } + +void RMdaDevSound::CBody::ResumeRecording() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::ResumeRecording %s", iState.Name()); + #endif + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // No change + break; + + case ERecording: + // No change + break; + + case ERecordingPausedInHw: + { + TInt res = iRecordSoundDevice.Resume(); + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("ResumeRecordBuffer ERecordingPausedInHw res = %d", res); + #endif + if(res == KErrNone) + { + // Resume ok so a pending request will complete + iState = ERecording; + } + else + { + iState = EStopped; + // Resume failed, so attempt to start a new (pending) request. + // If this works, it will update the state to ERecording. + StartRecordRequest(); + } + break; + } + case ERecordingPausedInSw: + { + // Update state to stopped and attempt to start any pending request + iState = EStopped; + // If this works, it will update the state to ERecording. + StartRecordRequest(); + break; + } + + case EPlaying: + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + case EPlayingPausedInSw: // ie. Driver not playing/paused + case EPlayingUnderrun: + default: + Panic(EBadState); + break; + } + + return; + + + } + +TInt RMdaDevSound::CBody::GetTimePlayed(TTimeIntervalMicroSeconds& aTimePlayed) + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + + TUint64 bytesPlayed = BytesPlayed64(); + + TUint64 timePlayed = 1000 * 1000 * bytesPlayed / (iPlayFormatData.iSampleRate * iPlayFormatData.iRequestedChannels * KBytesPerSample); + + aTimePlayed = TTimeIntervalMicroSeconds(timePlayed); + + return KErrNone; + } + + +void RMdaDevSound::CBody::FormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported, RSoundSc& aSoundDevice) + { + TSoundFormatsSupportedV02Buf supportedFormat; + aSoundDevice.Caps(supportedFormat); + TUint32 rates = supportedFormat().iRates; + + for(TInt i = KNumSampleRates-1; i > 0 ;i--)//min to max + { + if(rates & KRateEnumLookup[i].iRateConstant) + { + aFormatsSupported().iMinRate = KRateEnumLookup[i].iRate; + break; + } + } + for(TInt i = 0; i < KNumSampleRates; i++)//max to min + { + if(rates & KRateEnumLookup[i].iRateConstant) + { + aFormatsSupported().iMaxRate = KRateEnumLookup[i].iRate; + break; + } + } + TUint32 enc = supportedFormat().iEncodings; + + if (enc & KSoundEncoding16BitPCM) + { + aFormatsSupported().iEncodings = EMdaSoundEncoding16BitPCM;// Always defaults to this + } + if (enc & KSoundEncoding8BitPCM) + { + aFormatsSupported().iEncodings |= EMdaSoundEncoding8BitPCM; + } + TUint32 channels = supportedFormat().iChannels; + + if (channels & KSoundStereoChannel) + { + aFormatsSupported().iChannels = 2; + } + else + { + aFormatsSupported().iChannels = 1; + } + aFormatsSupported().iMinBufferSize = supportedFormat().iRequestMinSize; + aFormatsSupported().iMaxBufferSize = KMaxBufferSize; + aFormatsSupported().iMinVolume = 0; + aFormatsSupported().iMaxVolume = KSoundMaxVolume; + } + +void RMdaDevSound::CBody::GetFormat(TCurrentSoundFormatBuf& aFormat, + RSoundSc& /*aSoundDevice*/, + const TFormatData &aFormatData) + { + // always return the requested, or the initial, not current device setting + aFormat().iChannels = aFormatData.iRequestedChannels; // never clear if this is bitmap or value, but effectively the same + aFormat().iRate = aFormatData.iSampleRate; + } + +void RMdaDevSound::CBody::StartPlayersAndUpdateState() + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // Allow following code to queue more driver play requests and check for stopped + break; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + Panic(EBadState); + break; + + case EPlaying: + // Allow following code to queue more driver play requests and check for stopped + break; + case EPlayingPausedInHw: // ie. Play request pending on h/w and paused + // Allow following code to queue more driver play requests + break; + + case EPlayingPausedInSw: + // Paused but driver not playing+paused, therefore do not queue new requests until ResumePlaying + return; + case EPlayingUnderrun: + break; + + default: + Panic(EBadState); + break; + } + + // iState is now either EStopped, EPlaying or EPlayingPausedInHw + __ASSERT_DEBUG(((iState == EStopped) || (iState == EPlaying) || (iState == EPlayingPausedInHw) || (iState == EPlayingUnderrun)), Panic(EBadState)); + + while( (iClientPlayData.Length() != 0) && (! iFreePlayers.IsEmpty())) + { + // More data to play and more players, so issue another request + + bool wasIdle = iFreePlayers.IsFull(); + // Get a free player + CPlayer *player = iFreePlayers.Pop(); + // Calculate length of request + TUint32 lengthToPlay = iClientPlayData.Length(); + if(lengthToPlay > iDeviceBufferLength) + { + lengthToPlay = iDeviceBufferLength; + } + + // Remember request length, so we can update bytes played when it finishes + iActivePlayRequestSizes.Push(lengthToPlay); + + // Find offset to copy data to + TUint playerIndex = player->GetPlayerIndex(); + ASSERT(playerIndex < KPlaySharedChunkBuffers); + TUint chunkOffset = iPlayBufferConfig.iBufferOffsetList[playerIndex]; + + // Copy data + TPtr8 destPtr(iPlayChunk.Base()+ chunkOffset, 0, iDeviceBufferLength); + destPtr.Copy(iClientPlayData.Mid(0, lengthToPlay)); + + // Update iClientPlayData to remove the data just queued + iClientPlayData.Set(iClientPlayData.Right(iClientPlayData.Length()-lengthToPlay)); + + // Start the CPlayer + player->PlayData(chunkOffset, lengthToPlay); + if(wasIdle) + { + iState = EPlaying; + iStartTime = CurrentTimeInMsec(); + + } + + } + + // Check if the client request is now complete + if(iClientPlayData.Length() == 0 && iClientPlayStatus) + { + // We have queued all the client play data to the driver so we can now complete the client request. + // If actual playback fails, we will notify the client via the Play Error notification mechanism. + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::StartPlayersAndUpdateState completing client request"); + #endif + User::RequestComplete(iClientPlayStatus, KErrNone); // This call also sets iClientPlayStatus to NULL + } + + //nb. iState is now either EStopped, EPlaying or EPlayingPausedInHw (see previous switch and assert) + if(iState != EPlayingPausedInHw) + { + if(iFreePlayers.IsFull()) + { + // Free fifo is full, therefore there are no active players + iState = EPlayingUnderrun; + if(! iUnderFlowReportedSinceLastPlayOrRecordRequest) + { + // We report KErrUnderflow if we have not already reported it since the last PlayData call. + // Note that + // i) We do NOT report driver underflows. + // ii) We report underflow when we run out of data to pass to the driver. + // iii) We throttle this reporting + // iv) We WILL report KErrUnderflow if already stopped and asked to play a zero length buffer + // The last point is required because the client maps a manual stop command into a devsound play with a + // zero length buffer and the last buffer flag set, this in turn is mapped to a Playdata calll with an empty buffer + // which is expected to complete ok and cause a KErrUnderflow error to be reported... + iUnderFlowReportedSinceLastPlayOrRecordRequest = ETrue; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::StartPlayersAndUpdateState stopped and iUnderFlowReportedSinceLastPlayOrRecordRequest false so raising KErrUnderflow"); + #endif + + // Discard any saved trailing data (ie. data saved due driver requiring all requests to be a multiple of iRequestMinSize). + // This maybe because client is delibrately letting us underflow to play silence. In that case we do not want to + // play the trailing data at the beginning of the new data issued after the silence... + iSavedTrailingData.SetLength(0); + + SoundDeviceError(KErrUnderflow); + } + } + else + { + // Free fifo not full, therefore there are active players + iState = EPlaying; + } + } + return; + } + +TInt RMdaDevSound::CBody::SetFormat(const TCurrentSoundFormatBuf& aFormat, + RSoundSc& aSoundDevice, + TFormatData &aFormatData) + { + TInt err = KErrNotFound; + TCurrentSoundFormatV02Buf formatBuf; + + delete aFormatData.iConverter; + aFormatData.iConverter = NULL; // setting this to NULL indicates we are not using converter. No other flag + iConvertedPlayData.Close(); + + TInt wantedRate = aFormat().iRate; + for(TInt index = 0; index < KNumSampleRates; index++ ) + { + if(wantedRate == KRateEnumLookup[index].iRate) + { + formatBuf().iRate = KRateEnumLookup[index].iRateEnum; + aFormatData.iSampleRate = wantedRate; + err = KErrNone; + break; + } + } + + if(err == KErrNone) + { + // Assume, for now, we support the requested channels and rate + aFormatData.iActualChannels = aFormatData.iRequestedChannels; + aFormatData.iActualRate = aFormatData.iSampleRate; + + // Attempt to configure driver + formatBuf().iChannels = aFormat().iChannels; + formatBuf().iEncoding = ESoundEncoding16BitPCM; + formatBuf().iDataFormat = ESoundDataFormatInterleaved; + err = aSoundDevice.SetAudioFormat(formatBuf); + #if defined(SYMBIAN_SOUNDADAPTER_FORCECDRATES) || defined (SYMBIAN_SOUNDADAPTER_FORCESTEREO) + err = KErrNotSupported; // force Negotiate - for debugging + #endif + if (err==KErrNotSupported) + { + // don't support directly. Perhaps can rate convert? + err = NegotiateFormat(aFormat, aSoundDevice, aFormatData); + } + } + return err; + } + +TInt RMdaDevSound::CBody::NegotiateFormat(const TCurrentSoundFormatBuf& aFormat, + RSoundSc& aSoundDevice, + TFormatData &aFormatData) + { + ASSERT(!aFormatData.iConverter); // we don't clear on fail - so assuming NULL to start with + + TInt err = KErrNotFound; + TCurrentSoundFormatV02Buf formatBuf; + + // find out first what the driver supports + TSoundFormatsSupportedV02Buf supportedFormat; + aSoundDevice.Caps(supportedFormat); + TUint32 supportedRates = supportedFormat().iRates; + #ifdef SYMBIAN_SOUNDADAPTER_FORCECDRATES + supportedRates &= KSoundRate11025Hz| KSoundRate22050Hz | KSoundRate44100Hz; // only use CD rates - for debugging + #endif + + // For PlayCase: + // first try to find the first rate below or equal to the requested that is supported + // initially go down and be fussy, but if we pass the requested rate find the first that + // is supported + // For RecordCase: + // We want the next rate above consistently - we go down from this to the requested rate. + // If there is one, we don't support - we _never_ upsample. + // note that the table is given in descending order, so we start with the highest + TInt wantedRate = aFormat().iRate; + TInt takeTheFirst = EFalse; + TInt nextUpValidIndex = -1; + for(TInt index = 0; index < KNumSampleRates; index++ ) + { + TBool lookingAtRequestedRate = wantedRate == KRateEnumLookup[index].iRate; + TSoundRate wantedEnum = KRateEnumLookup[index].iRateEnum; + TUint32 equivBitmap = KRateEnumLookup[index].iRateConstant; + TBool isSupported = (equivBitmap & supportedRates) != EFalse; + if (lookingAtRequestedRate || takeTheFirst) + { + if (isSupported) + { + // this rate is supported + formatBuf().iRate = wantedEnum; + aFormatData.iActualRate = KRateEnumLookup[index].iRate; + err = KErrNone; + break; + } + } + else if (!takeTheFirst) + { + // while we are still looking for the rate, want to cache any supported index + // at end of loop, this will be the first rate above ours that is supported + // use for fallback if required + if (isSupported) + { + nextUpValidIndex = index; + } + } + if (lookingAtRequestedRate) + { + // if we get this far we've gone passed the wanted rate. For play we enable + // "takeTheFirst". For record we just abort. + if (&aSoundDevice==&iPlaySoundDevice) + { + takeTheFirst = ETrue; + } + else + { + break; + } + } + } + + if (err) + { + // if there is one above the requested rate, use that + if (nextUpValidIndex>=0) + { + TSoundRate wantedEnum = KRateEnumLookup[nextUpValidIndex].iRateEnum; + formatBuf().iRate = wantedEnum; + aFormatData.iActualRate = KRateEnumLookup[nextUpValidIndex].iRate; + err = KErrNone; + } + } + + if (err) + { + // should have something! + return err; + } + + aFormatData.iSampleRate = wantedRate; // iSampleRate is our requested/apparent rate, not the device rate. + + TUint32 channelsSupported = supportedFormat().iChannels; + #ifdef SYMBIAN_SOUNDADAPTER_FORCESTEREO + channelsSupported &= KSoundStereoChannel; // don't use mono - for debugging + #endif + if(KSoundAdapterForceStereo==1) + { + channelsSupported &= KSoundStereoChannel; +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("Added stereo support.")); +#endif + } + if (aFormat().iChannels == 1) + { + aFormatData.iRequestedChannels = 1; + // want mono + if (channelsSupported & KSoundMonoChannel) + { + // mono is supported, as usual + aFormatData.iActualChannels = 1; + } + else if (channelsSupported & KSoundStereoChannel) + { + aFormatData.iActualChannels = 2; + } + else + { + return KErrNotSupported; // should not get this far for real + } + } + else if (aFormat().iChannels == 2) + { + aFormatData.iRequestedChannels = 2; + // want stereo + if (channelsSupported & KSoundStereoChannel) + { + // stereo is supported, as usual + aFormatData.iActualChannels = 2; + } + else if (channelsSupported & KSoundMonoChannel) + { + aFormatData.iActualChannels = 1; + } + else + { + return KErrNotSupported; // should not get this far for real + } + } + else + { + return KErrNotSupported; // unknown number of channels requested! + } + + formatBuf().iChannels = aFormatData.iActualChannels; + + formatBuf().iEncoding = ESoundEncoding16BitPCM; + formatBuf().iDataFormat = ESoundDataFormatInterleaved; + err = aSoundDevice.SetAudioFormat(formatBuf); + + if (!err) + { + ASSERT(!aFormatData.iConverter); // pre-condition at top of function anyway + if (&aSoundDevice==&iPlaySoundDevice) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::NegotiateFormat: Convert:CreateL from %d/%d to %d/%d"), + aFormatData.iSampleRate, aFormatData.iRequestedChannels, + aFormatData.iActualRate, aFormatData.iActualChannels); + #endif + // when playing we convert from requested to actual + TRAP(err, aFormatData.iConverter = CChannelAndSampleRateConverter::CreateL(aFormatData.iSampleRate, + aFormatData.iRequestedChannels, + aFormatData.iActualRate, + aFormatData.iActualChannels)); + } + else + { + // when recording we convert from actual to requested + TInt outputRateToUse = aFormatData.iSampleRate; + #ifdef SYMBIAN_SKIP_RESAMPLE_ON_RECORD + // with this macro just channel convert at most + outputRateToUse = aFormatData.iActualRate; + #endif + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::NegotiateFormat: Convert:CreateL from %d/%d to %d/%d"), + aFormatData.iActualRate, aFormatData.iActualChannels, + aFormatData.iSampleRate, aFormatData.iRequestedChannels); + #endif + TRAP(err, aFormatData.iConverter = CChannelAndSampleRateConverter::CreateL(aFormatData.iActualRate, + aFormatData.iActualChannels, + outputRateToUse, + aFormatData.iRequestedChannels)); + } + } + if(err != KErrNone) + { + delete aFormatData.iConverter; + aFormatData.iConverter= NULL; + iConvertedPlayData.Close(); + } + + return err; + } + +void RMdaDevSound::CBody::StartRecordRequest() + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + + iRecorder->RecordData(iBufferLength); + } + +// Note both InRecordMode and InPlayMode return EFalse for ENotReady and EStopped +TBool RMdaDevSound::CBody::InRecordMode()const + { + switch(iState) + { + case ENotReady: + case EStopped: + return EFalse; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + return ETrue; + + case EPlaying: + case EPlayingPausedInHw: + case EPlayingPausedInSw: + case EPlayingUnderrun: + return EFalse; + + default: + Panic(EBadState); + break; + } + return EFalse; + } + +TBool RMdaDevSound::CBody::InPlayMode() const + { + switch(iState) + { + case ENotReady: + case EStopped: + return EFalse; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + return EFalse; + + case EPlaying: + case EPlayingPausedInHw: + case EPlayingPausedInSw: + case EPlayingUnderrun: + return ETrue; + + default: + Panic(EBadState); + break; + } + + return EFalse; + } + + +TUint32 RMdaDevSound::CBody::CurrentTimeInMsec() const + { + TUint64 tmp = User::NTickCount(); + tmp *= iNTickPeriodInUsec; + tmp /= 1000; + return TUint32(tmp); + } + +void RMdaDevSound::CBody::PlayFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported) + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + FormatsSupported(aFormatsSupported, iPlaySoundDevice); + } + +void RMdaDevSound::CBody::GetPlayFormat(TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + GetFormat(aFormat, iPlaySoundDevice, iPlayFormatData); + } + +TInt RMdaDevSound::CBody::SetPlayFormat(const TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + return SetFormat(aFormat, iPlaySoundDevice, iPlayFormatData); + } + +void RMdaDevSound::CBody::RecordFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported) + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + FormatsSupported(aFormatsSupported, iRecordSoundDevice); + } + +void RMdaDevSound::CBody::GetRecordFormat(TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + GetFormat(aFormat, iRecordSoundDevice, iRecordFormatData); + } + +TInt RMdaDevSound::CBody::SetRecordFormat(const TCurrentSoundFormatBuf& aFormat) + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + return SetFormat(aFormat, iRecordSoundDevice, iRecordFormatData); + } + +void RMdaDevSound::CBody::Close() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("void RMdaDevSound::CBody::Close() started"); + #endif + iBufferOffset = -1; + iBufferLength = 0; + + if(iPlaySoundDevice.Handle() != KNullHandle) + { + // Make sure all player objects are idle + CancelPlayData(); + iPlayChunk.Close(); + iPlaySoundDevice.Close(); + } + + if(iRecordSoundDevice.Handle() != KNullHandle) + { + CancelRecordData(); + iRecordChunk.Close(); + iRecordSoundDevice.Close(); + } + + iState = ENotReady; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("void RMdaDevSound::CBody::Close() ended"); + #endif + } + +TInt RMdaDevSound::CBody::Handle() + {//This method is actually used to check whether the device is opened. Below logic should work + if(iPlaySoundDevice.Handle()) + { + return iPlaySoundDevice.Handle(); + } + if(iRecordSoundDevice.Handle()) + { + return iRecordSoundDevice.Handle(); + } + return 0; + } + + +void RMdaDevSound::CBody::PlayData(TRequestStatus& aStatus, const TDesC8& aData) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::PlayData(0x%x,%d) State=%s Handle=%d.",&aStatus, + aData.Length(), iState.Name(), iPlayChunk.Handle()); + #endif + + __ASSERT_DEBUG(iPlaySoundDevice.Handle(), Panic(EDeviceNotOpened)); + aStatus = KRequestPending; + + if((iClientPlayStatus != NULL) || InRecordMode()) + { + // We only support one outstanding request + // No support for simultaneous play and record in RMdaDevSound + TRequestStatus *pRequest = &aStatus; + User::RequestComplete(pRequest, KErrInUse); + return; + } + iClientPlayStatus = &aStatus;//store the status of datapath player + + if(iPlayFormatData.iConverter || iSavedTrailingData.Length() != 0) + { + // Need a conversion buffer + // Needs to hold any trailing data truncated from the previous request (due + // to alignment requirements) and either the new data, or the new rate adapted data + TUint32 spaceRequired = iSavedTrailingData.Length(); + if(iPlayFormatData.iConverter) + { + // Doing rate conversion so also need space for the converted data + spaceRequired += iPlayFormatData.iConverter->MaxConvertBufferSize(aData.Length()); + } + else + { + // Not doing rate adaptation therefore only need to allow for the new incoming data + spaceRequired += aData.Length(); + } + // Check if existing buffer exists and is big enough + if(iConvertedPlayData.MaxLength() < spaceRequired) + { + iConvertedPlayData.Close(); + TInt err = iConvertedPlayData.Create(spaceRequired); + if(err) + { + User::RequestComplete(iClientPlayStatus, err); + return; + } + } + + // Truncate iConvertedPlayData and copy in saved trailing data (if any) + iConvertedPlayData = iSavedTrailingData; + iSavedTrailingData.SetLength(0); + + // Now append rate adapted data or incoming data + if (iPlayFormatData.iConverter) + { + // The convertor will panic if it fails to convert any data, therefore + // we avoid passing it an empty source buffer + if(aData.Length() != 0) + { + TPtr8 destPtr((TUint8 *)iConvertedPlayData.Ptr()+iConvertedPlayData.Length(), 0, iConvertedPlayData.MaxLength()-iConvertedPlayData.Length()); + TInt len = iPlayFormatData.iConverter->Convert(aData, destPtr); + iConvertedPlayData.SetLength(iConvertedPlayData.Length() + destPtr.Length()); + if(len != aData.Length()) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::PlayData converted %d but expected to convert %d", len, aData.Length()); + #endif + } + } + } + else + { + iConvertedPlayData.Append(aData); + } + iClientPlayData.Set(iConvertedPlayData); + } + else + { + // Do not need a conversion buffer so just aim the descriptor at the data + iClientPlayData.Set(aData); + } + iUnderFlowReportedSinceLastPlayOrRecordRequest = EFalse; + + // All driver requests must be an exact multiple of iRequestMinSize + TUint32 trailingDataLen = iClientPlayData.Length() % iRequestMinSize; + if(trailingDataLen) + { + // Not a multiple of iRequestMinSize, so need to truncate current request, and save trailing bytes for + // inclusion at the beginning of the next request + iSavedTrailingData = iClientPlayData.Right(trailingDataLen); + iClientPlayData.Set(iClientPlayData.Left(iClientPlayData.Length()-trailingDataLen)); + } + + #ifdef SYMBIAN_FORCE_32BIT_LENGTHS + if (iClientPlayData.Length()%4 != 0) + { + // simulate the limitation of some hardware, where -6 is generated if the + // buffer length is not divisible by 4. + TRequestStatus *pRequest = &aStatus; + User::RequestComplete(pRequest, KErrArgument); + } + #endif + + iRecordChunk.Close(); + if(!iPlayChunk.Handle()) + { + //This is where we setup to play. + //Configure the shared chunk for two buffers with iBufferSize each + iPlayBufferConfig.iNumBuffers = KPlaySharedChunkBuffers; + iDeviceBufferLength = KPlaySharedChunkBufferSize; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("iDeviceBufferLength %d", iDeviceBufferLength); + #endif + iPlayBufferConfig.iFlags = 0;//data will be continuous + // If required, use rate converter etc + iPlayBufferConfig.iBufferSizeInBytes = iDeviceBufferLength; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("number of buffers: [%d]",iPlayBufferConfig.iNumBuffers); + RDebug::Printf("BufferSize in Bytes [%d]",iPlayBufferConfig.iBufferSizeInBytes); + #endif + TPckg bufferConfigBuf(iPlayBufferConfig); + TInt error = iPlaySoundDevice.SetBufferChunkCreate(bufferConfigBuf,iPlayChunk); + if(error == KErrNone) + { + iPlaySoundDevice.GetBufferConfig(bufferConfigBuf); + } + if (error) + { + SoundDeviceError(error); + return; + } + } + + StartPlayersAndUpdateState(); + + return; + } + +void RMdaDevSound::CBody::RecordData(TRequestStatus& aStatus, TDes8& aData) + { + __ASSERT_DEBUG(iRecordSoundDevice.Handle(), Panic(EDeviceNotOpened)); + aStatus = KRequestPending; + if((iClientPlayStatus != NULL) || InPlayMode()) + { + // We only support one outstanding request + // No support for simultaneous play and record in RMdaDevSound + TRequestStatus *pRequest = &aStatus; + User::RequestComplete(pRequest, KErrInUse); + return; + } + iClientRecordStatus = &aStatus; + iClientRecordData = &aData; + iUnderFlowReportedSinceLastPlayOrRecordRequest = EFalse; + + iPlayChunk.Close(); + if(!iRecordChunk.Handle()) + { + //Configure the shared chunk for two buffers with iBufferSize each + iRecordBufferConfig.iNumBuffers = KRecordMaxSharedChunkBuffers; + iDeviceBufferLength = KRecordSharedChunkBufferSize; // initial size - resize if needs be + if (iRecordFormatData.iConverter) + { + // if number of channels used differs from request, resize buffer + // assume we have nice rounded values for buffer. + if (iRecordFormatData.iActualChannels>iRecordFormatData.iRequestedChannels) + { + iDeviceBufferLength *= 2; // will record at stereo and convert to mono + } + else if (iRecordFormatData.iActualChannels bufferConfigBuf(iRecordBufferConfig); + TInt error = iRecordSoundDevice.SetBufferChunkCreate(bufferConfigBuf,iRecordChunk); + if(error == KErrNone) + { + iRecordSoundDevice.GetBufferConfig(bufferConfigBuf); + } + else + { + SoundDeviceError(error); + return; + } + iState = ERecording; + } + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::RecordData,iBufferOffset[%d]",iBufferOffset); + #endif + + switch(iState) + { + case ENotReady: + Panic(EBadState); + break; + + case EStopped: + case ERecording: + // Either idle or recording is in progress, therefore we can issue another request + StartRecordRequest(); + break; + + case ERecordingPausedInHw: + // Driver is paused, therefore we can issue a request which will immediately return buffered data + // or be aborted (in the driver) with KErrCancelled if there is no more data). nb. That KErrCancelled should not be + // returned to the client because the old RMdaDevSound driver would have completed with KErrNone and zero data length. + StartRecordRequest(); + break; + + case ERecordingPausedInSw: + // Paused in s/w but driver is not paused, therefore can not issue a new request to driver because + // it would re-start recording. + // This implies we were paused whilst the h/w was not recording, so there is no buffered data. + + // Complete the request with KErrNone and no data. + iClientRecordData->SetLength(0); + User::RequestComplete(iClientRecordStatus, KErrNone); + break; + + case EPlaying: + case EPlayingPausedInHw: + case EPlayingPausedInSw: + case EPlayingUnderrun: + Panic(EBadState); + break; + + default: + Panic(EBadState); + break; + } + } + +/** + Notify client of error. + + Note that we continue playing/recording if possible. + + We do not maintain information which could map the error back to a particular client play/record request + and therefore we have to notify the client of error every time it happens. + + nb. A client play/record request is completed with KErrNone if it queues ok - All errors are reported via the Notify*Error + mechanism. + */ +void RMdaDevSound::CBody::SoundDeviceError(TInt aError) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::SoundDeviceError: Error[%d] state %s", aError, iState.Name()); + #endif + + ASSERT(aError != KErrNone); + + if(iClientPlayErrorStatus) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::SoundDeviceError Completing iPlayerErrorStatus"); + #endif + + User::RequestComplete(iClientPlayErrorStatus, aError); // nb call also sets iClientPlayErrorStatus to NULL + } + + if(iClientRecordErrorStatus) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::SoundDeviceError Completing iClientRecordErrorStatus"); + #endif + User::RequestComplete(iClientRecordErrorStatus, aError); // nb call also sets iClientRecordErrorStatus to NULL + } + + return; + } + +void RMdaDevSound::CBody::NotifyRecordError(TRequestStatus& aStatus) + { + aStatus = KRequestPending; + iClientRecordErrorStatus = &aStatus; + } + +void RMdaDevSound::CBody::NotifyPlayError(TRequestStatus& aStatus) + { + aStatus = KRequestPending; + iClientPlayErrorStatus = &aStatus; + } + +void RMdaDevSound::CBody::CancelNotifyPlayError() + { + if(iClientPlayErrorStatus) + { + User::RequestComplete(iClientPlayErrorStatus, KErrCancel); + } + } + +void RMdaDevSound::CBody::CancelNotifyRecordError() + { + if(iClientRecordErrorStatus) + { + User::RequestComplete(iClientRecordErrorStatus, KErrCancel); + } + else + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("msp BufferEmptied but iClientPlayStatus==NULL"); + #endif + } + } + +void RMdaDevSound::CBody::FlushPlayBuffer() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::FlushPlayBuffer calling CancelPlayData"); + #endif + CancelPlayData(); + } + +RSoundSc& RMdaDevSound::CBody::PlaySoundDevice() + { + return iPlaySoundDevice; + } + +RSoundSc& RMdaDevSound::CBody::RecordSoundDevice() + { + return iRecordSoundDevice; + } + +const RMdaDevSound::CBody::TState &RMdaDevSound::CBody::State() const + { + return iState; + } + + +void RMdaDevSound::CBody::BufferFilled(TInt aBufferOffset) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::BufferFilled:")); + #endif + + ASSERT(aBufferOffset>=0 || aBufferOffset==KErrCancel); + ASSERT(iClientRecordData); // request should not get this without + + if(aBufferOffset==KErrCancel) + { + //we can get KErrCancel when we call pause and there is no more data left with the driver + //we send the empty buffer to the HwDevice, where this should trigger the shutdown mechanism + iClientRecordData->SetLength(0); + User::RequestComplete(iClientRecordStatus, KErrNone); + iClientRecordStatus = NULL; + return; + } + + iBufferOffset = aBufferOffset; + //when last buffer is flushed, new driver sometimes gives buffer size of odd number. One of our codecs + //expects that the buffer size should always be even. Base suggested that we fix in multimedia + //as it is quite complicated to fix in overthere. + iBufferLength = iBufferLength & 0xfffffffe; + TPtr8 dataPtr(iRecordChunk.Base()+ iBufferOffset, iBufferLength, iClientRecordData->MaxLength()); + if (iRecordFormatData.iConverter) + { + iRecordFormatData.iConverter->Convert(dataPtr, *iClientRecordData); + } + else + { + iClientRecordData->Copy(dataPtr); + } + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::BufferFilled: BufferOffset[%d] BufferLen[%d]"), iBufferOffset, iBufferLength); + #endif + if(iBufferOffset >= 0) + { + iRecordSoundDevice.ReleaseBuffer(iBufferOffset); + } + if(iClientRecordStatus) + { + User::RequestComplete(iClientRecordStatus, KErrNone); + iClientRecordStatus = NULL; + } + else + { + RDebug::Printf("msp PlayCancelled but iClientPlayStatus==NULL"); + } + } + +/* + This function is called to notify us that a CPlayer's request has completed and what its status was. + + It is important to note that:- + 1) RSoundSc driver PlayData requests are guaranteed to complete in order, oldest first + 2) If we are overloaded, it is possible for more than one request to complete before any CPlayer::RunL is ran. In + this situation the CPlayer::RunL functions, and hence this callback, maybe invoked in non-oldest first order + + but + + a) It is impossible for callback for the second oldest CPlayer to occur before the driver request for the oldest has + been complete (because of 1) + b) We will always get exactly one callback for every complete request. + + Therefore this callback notifies us of two subtly separate things:- + + i) The oldest request has been completed (so we can reduce can increase the bytes played counter by its length + ii) CPlayer aPlayerIndex is free for re-use + + but we can not assume that aPlayerIndex is the oldest request, therefore we save the play request lengths outside of + the CPlayer object. +*/ +void RMdaDevSound::CBody::PlayRequestHasCompleted(CPlayer *aPlayer, TInt aStatus, TBool aDueToCancelCommand) + { + // CPlayer is done so put it on the free queue + iFreePlayers.Push(aPlayer); + + TUint32 bytesPlayed = iActivePlayRequestSizes.Pop(); + // Request has finished therefore now timing the following request to simulate bytes played + iStartTime = CurrentTimeInMsec(); + if(aDueToCancelCommand) + { + // Callback due to CPlayer::Cancel/DoCancel being called, therefore we + // do not want to update bytes played, process state, report a error or start new players + return; + } + + // Update iBytesPlayed by the length of the oldest request (which might not be the one that CPlayer was + // handling). + iBytesPlayed += bytesPlayed; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("PlayRequestHasCompleted increasing iBytesPlayed by %d to %d", bytesPlayed, iBytesPlayed); + #endif + + // Process state + switch(iState) + { + case ENotReady: + Panic(EDeviceNotOpened); + break; + + case EStopped: + // Will happen if we are doing CancelPlayData processing with active players + break; + + case ERecording: + case ERecordingPausedInHw: + case ERecordingPausedInSw: + Panic(EBadState); + break; + + case EPlaying: + // Normal situation + break; + + case EPlayingPausedInHw: + // H/W was/is paused, but there must have been an already complete request that we had not + // processed yet. + // There must be at least one more pending request on h/w, otherwise the h/w would have refused to pause + // I would expect this be rare, but it happens quite often... + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + ASSERT(iActivePlayRequestSizes.Length() != 0); + #endif + // Need to update the start and pause time to now because we have just updated the actual iBytesPlayed + // and logically the h/w is paused at the beginning of the next request + iStartTime = CurrentTimeInMsec(); + iPauseTime = iStartTime; + break; + + case EPlayingPausedInSw: + // This will happen if there is only a single hw request outstanding, and the hardware has finished it, but the + // corresponding RunL has not run yet (in which case PausePlayBuffer will have attempted to use h/w pause, + // but the driver call would have failed, and the state changed to EPlayingPausedInSw). + iStartTime = CurrentTimeInMsec(); + iPauseTime = iStartTime; + return; + case EPlayingUnderrun: + break; + + default: + Panic(EBadState); + break; + } + + + // If we have an error, report it to the client + // We NEVER report driver underflow, instead we report KErrUnderflow if we run out of data to pass to driver. + if( (aStatus != KErrNone) && (aStatus != KErrUnderflow) ) + { + SoundDeviceError(aStatus); + } + + // If appropriate start more players + StartPlayersAndUpdateState(); + return; + } + +RMdaDevSound::CBody::CPlayer::CPlayer(TInt aPriority, RMdaDevSound::CBody& aParent, TInt aIndex): + CActive(aPriority), iParent(aParent), iIndex(aIndex), iBufferOffset(-1), iBufferLength(0) + { + CActiveScheduler::Add(this); + } + +RMdaDevSound::CBody::CPlayer::~CPlayer() + { + Cancel(); + } + + +void RMdaDevSound::CBody::CPlayer::RunL() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("****RMdaDevSound::CBody::CPlayer(%d)::RunL: Error[%d] ParentState[%s]", + iIndex, iStatus.Int(), iParent.State().Name()); + RDebug::Printf("iActivePlayRequestSizes.Length() = %d iFreePlayers.Length() = %d (including this one as active)", + iParent.iActivePlayRequestSizes.Length(), + iParent.iFreePlayers.Length()); + #endif + iParent.PlayRequestHasCompleted(this, iStatus.Int(), EFalse); + return; + } + +TInt RMdaDevSound::CBody::CPlayer::RunError(TInt aError) + { + iParent.PlayRequestHasCompleted(this, aError, EFalse); + return KErrNone; + } + +void RMdaDevSound::CBody::CPlayer::DoCancel() + { +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::CPlayer(%d)::DoCancel", iIndex); +#endif + if(iStatus == KRequestPending) + { + // Avoid cancelling requests which have already completed. + // It wastes time, and might provoke a sound driver problem + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::CPlayer::DoCancel - would have cancelled driver request"); + #endif + iParent.PlaySoundDevice().Cancel(iStatus); + } + iParent.PlayRequestHasCompleted(this, KErrCancel, ETrue); + } + +void RMdaDevSound::CBody::CPlayer::PlayData(TUint aChunkOffset, TInt aLength) + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::CPlayer(%d)::PlayData : IsActive[%d]"), + iIndex, IsActive()); + RDebug::Printf("iActivePlayRequestSizes.Length() = %d iFreePlayers.Length() = %d (inc this player)", + iParent.iActivePlayRequestSizes.Length(), + iParent.iFreePlayers.Length()); + #endif + + iBufferOffset = aChunkOffset; + iBufferLength = aLength; + + //Make sure the length is a multiple of 4 to work around an h6 limitation. + iBufferLength = iBufferLength & 0xfffffffc; + + // Issue the RSoundSc request + iParent.PlaySoundDevice().PlayData(iStatus, iBufferOffset, iBufferLength, EFalse); + SetActive(); + return; + } + +TUint RMdaDevSound::CBody::CPlayer::GetPlayerIndex() const + { + return iIndex; + } + +RMdaDevSound::CBody::CRecorder::CRecorder(TInt aPriority, RMdaDevSound::CBody& aParent): + CActive(aPriority), iParent(aParent), iBufferOffset(-1), iBufferLength(0) + { + CActiveScheduler::Add(this); + } + +RMdaDevSound::CBody::CRecorder::~CRecorder() + { + Cancel(); + } + +void RMdaDevSound::CBody::CRecorder::RecordData(TInt& aBufferLength) + { + if (!IsActive()) + { + iStatus = KRequestPending; + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("Recording request: BufferLength[%d]", aBufferLength); + #endif + iParent.RecordSoundDevice().RecordData(iStatus, aBufferLength); + SetActive(); + } + } + +void RMdaDevSound::CBody::CRecorder::RunL() + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("****RMdaDevSound::CBody::CRecorder()::RunL: Error[%d] ParentState[%s]", + iStatus.Int(), iParent.State().Name()); + #endif + + + TInt error = iStatus.Int(); + + if((error >= 0) || (error == KErrCancel)) + {//we can get KErrCancel when we call pause and there is no more data left with the driver + iParent.BufferFilled(error); + } + else + { + #ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Print(_L("RMdaDevSound::CBody::CPlayer()::RunL: Error[%d]"), error); + #endif + iParent.SoundDeviceError(error); + } + } + + +TInt RMdaDevSound::CBody::CRecorder::RunError(TInt aError) + { + iParent.SoundDeviceError(aError); + return KErrNone; + } + +void RMdaDevSound::CBody::CRecorder::DoCancel() + { +#ifdef SYMBIAN_SOUNDADAPTER_DEBUG + RDebug::Printf("RMdaDevSound::CBody::CRecorder()::DoCancel"); +#endif + iParent.RecordSoundDevice().Cancel(iStatus); + } + + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterbody.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,639 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MDASOUNDADAPTERBODY_H +#define MDASOUNDADAPTERBODY_H + +#include "mdasoundadapter.h" +#include +#include +#include + +/** +Panic category and codes for the mdasoundadapter +*/ +_LIT(KSoundAdapterPanicCategory, "mdasoundadapter"); +enum TSoundAdapterPanicCodes + { + EDeviceNotOpened, + EPanicPartialBufferConverterNotSupported, + EBadState, + ENoClientPlayRequest, + EFifoEmpty, + EFifoFull + }; + +//Structure used to map samples per second to the corresponding enums in RSoundSc +struct TSampleRateEnumTable + { + TInt iRate; + TSoundRate iRateEnum; + TUint iRateConstant; + }; + +//Table that maps given samples per second to the corresponding enums in RSoundSc +const TSampleRateEnumTable KRateEnumLookup[] = + { + {48000,ESoundRate48000Hz,KSoundRate48000Hz}, + {44100,ESoundRate44100Hz,KSoundRate44100Hz}, + {32000,ESoundRate32000Hz,KSoundRate32000Hz}, + {24000,ESoundRate24000Hz,KSoundRate24000Hz}, + {22050,ESoundRate22050Hz,KSoundRate22050Hz}, + {16000,ESoundRate16000Hz,KSoundRate16000Hz}, + {12000,ESoundRate12000Hz,KSoundRate12000Hz}, + {11025,ESoundRate11025Hz,KSoundRate11025Hz}, + {8000, ESoundRate8000Hz, KSoundRate8000Hz} + }; +//Structure used to map linear value of the volume to the decibel value. +struct TLinearToDbTable + { + TInt iLiniearValue; + TInt iDBValue; + }; + + +//Table that maps given linear value of volume to the corresponding decibel value. +const TLinearToDbTable KLinerToDbConstantLookup[] = + { + {0,0}, + {1,158}, + {2,170}, + {3,177}, + {4,182}, + {5,186}, + {6,189}, + {7,192}, + {8,194}, + {9,196}, + {10,198}, + {11,200}, + {12,201}, + {13,203}, + {14,204}, + {15,205}, + {16,206}, + {17,207}, + {18,208}, + {19,209}, + {20,210}, + {21,211}, + {22,212}, + {23,213}, + {24,213}, + {25,214}, + {26,215}, + {27,215}, + {28,216}, + {29,217}, + {30,217}, + {31,218}, + {32,218}, + {33,219}, + {34,219}, + {35,220}, + {36,220}, + {37,221}, + {38,221}, + {39,222}, + {40,222}, + {41,223}, + {42,223}, + {43,224}, + {44,224}, + {45,224}, + {46,225}, + {47,225}, + {48,225}, + {49,226}, + {50,226}, + {51,226}, + {52,227}, + {53,227}, + {54,227}, + {55,228}, + {56,228}, + {57,228}, + {58,229}, + {59,229}, + {60,229}, + {61,230}, + {62,230}, + {63,230}, + {64,230}, + {65,231}, + {66,231}, + {67,231}, + {68,231}, + {69,232}, + {70,232}, + {71,232}, + {72,232}, + {73,233}, + {74,233}, + {75,233}, + {76,233}, + {77,234}, + {78,234}, + {79,234}, + {80,234}, + {81,235}, + {82,235}, + {83,235}, + {84,235}, + {85,235}, + {86,236}, + {87,236}, + {88,236}, + {89,236}, + {90,236}, + {91,237}, + {92,237}, + {93,237}, + {94,237}, + {95,237}, + {96,237}, + {97,238}, + {98,238}, + {99,238}, + {100,238}, + {101,238}, + {102,239}, + {103,239}, + {104,239}, + {105,239}, + {106,239}, + {107,239}, + {108,240}, + {109,240}, + {110,240}, + {111,240}, + {112,240}, + {113,240}, + {114,240}, + {115,241}, + {116,241}, + {117,241}, + {118,241}, + {119,241}, + {120,241}, + {121,241}, + {122,242}, + {123,242}, + {124,242}, + {125,242}, + {126,242}, + {127,242}, + {128,242}, + {129,243}, + {130,243}, + {131,243}, + {132,243}, + {133,243}, + {134,243}, + {135,243}, + {136,244}, + {137,244}, + {138,244}, + {139,244}, + {140,244}, + {141,244}, + {142,244}, + {143,244}, + {144,245}, + {145,245}, + {146,245}, + {147,245}, + {148,245}, + {149,245}, + {150,245}, + {151,245}, + {152,245}, + {153,246}, + {154,246}, + {155,246}, + {156,246}, + {157,246}, + {158,246}, + {159,246}, + {160,246}, + {161,246}, + {162,247}, + {163,247}, + {164,247}, + {165,247}, + {166,247}, + {167,247}, + {168,247}, + {169,247}, + {170,247}, + {171,247}, + {172,248}, + {173,248}, + {174,248}, + {175,248}, + {176,248}, + {177,248}, + {178,248}, + {179,248}, + {180,248}, + {181,248}, + {182,249}, + {183,249}, + {184,249}, + {185,249}, + {186,249}, + {187,249}, + {188,249}, + {189,249}, + {190,249}, + {191,249}, + {192,250}, + {193,250}, + {194,250}, + {195,250}, + {196,250}, + {197,250}, + {198,250}, + {199,250}, + {200,250}, + {201,250}, + {202,250}, + {203,250}, + {204,251}, + {205,251}, + {206,251}, + {207,251}, + {208,251}, + {209,251}, + {210,251}, + {211,251}, + {212,251}, + {213,251}, + {214,251}, + {215,251}, + {216,252}, + {217,252}, + {218,252}, + {219,252}, + {220,252}, + {221,252}, + {222,252}, + {223,252}, + {224,252}, + {225,252}, + {226,252}, + {227,252}, + {228,252}, + {229,253}, + {230,253}, + {231,253}, + {232,253}, + {233,253}, + {234,253}, + {235,253}, + {236,253}, + {237,253}, + {238,253}, + {239,253}, + {240,253}, + {241,253}, + {242,254}, + {243,254}, + {244,254}, + {245,254}, + {246,254}, + {247,254}, + {248,254}, + {249,254}, + {250,254}, + {251,254}, + {252,254}, + {253,254}, + {254,254}, + {255,254} + }; + +// Total Number of sample rates +const TUint KNumSampleRates = 9; +// Number of shared chunk buffers used for playing +// Each buffer is permanently mapped, via an index number, to a particular buffer in the chunk +// The esoundsc.ldd can only handle a max of 8 pending play requests, therefore no point in having +// more than 8 play buffers... +const TUint KPlaySharedChunkBuffers = 8; +// Size of RSoundSc play buffers +const TUint KPlaySharedChunkBufferSize = 4096; + +//Number of shared chunk buffers used for recording +const TUint KRecordMaxSharedChunkBuffers = 8; +// Size of RSoundSc record buffers +const TUint KRecordSharedChunkBufferSize = 4096; + +//Shared chunk driver does not support max. buffer size. 16K is given in order to simulate the old driver behavior. +const TUint KMaxBufferSize = 0x4000; + +class TPlaySharedChunkBufConfig : public TSharedChunkBufConfigBase + { +public: + TInt iBufferOffsetList[KPlaySharedChunkBuffers]; + }; + +class TRecordSharedChunkBufConfig : public TSharedChunkBufConfigBase + { +public: + TInt iBufferOffsetList[KRecordMaxSharedChunkBuffers]; + }; + +class CChannelAndSampleRateConverter; // forward dec + +GLDEF_C void Panic(TSoundAdapterPanicCodes aPanicCode);//forward declaration + +// RFifo class which manages a fifo of up to COUNT items of type T +template class RFifo + { +public: + RFifo() + : iWriteIndex(0), iReadIndex(0) + {} + TBool IsEmpty() const + { + return iWriteIndex == iReadIndex; + } + TBool IsFull() const + { + // Full if writing one more item would make iWriteIndex equal to iReadIndex + TUint32 next = NextIndex(iWriteIndex); + return next == iReadIndex; + } + /// Push item into FIFO. Does not take ownership. Will PANIC with EFifoFull if full. + void Push(const T &aItem) + { + if(IsFull()) + { + Panic(EFifoFull); + } + iFifo[iWriteIndex] = aItem; + iWriteIndex = NextIndex(iWriteIndex); + } + /// Pop item from FIFO. Will PANIC with EFifoEmpty if empty + T Pop() + { + if(IsEmpty()) + { + Panic(EFifoEmpty); + } + TUint32 tmp = iReadIndex; + iReadIndex = NextIndex(iReadIndex); + return iFifo[tmp]; + } + + /// Peek first item from FIFO. Will PANIC with EFifoEmpty if empty + T Peek() + { + if(IsEmpty()) + { + Panic(EFifoEmpty); + } + return iFifo[iReadIndex]; + } + TUint Length() const + { + TUint len; + if(iWriteIndex >= iReadIndex) + { + len = iWriteIndex - iReadIndex; + } + else + { + len = COUNT+1 - (iReadIndex - iWriteIndex); + } + return len; + } +private: + TUint32 NextIndex(TUint32 aIndex) const + { + ++aIndex; + aIndex %= (COUNT+1); + return aIndex; + } + T iFifo[COUNT+1]; + TUint32 iWriteIndex; + TUint32 iReadIndex; + }; + + + +//Body class for the adapter +NONSHARABLE_CLASS( RMdaDevSound::CBody ): public CBase + { +public: + //This class handles the play/record completions from the new sound driver + NONSHARABLE_CLASS( CPlayer ) : public CActive + { + public: + explicit CPlayer(TInt aPriority, RMdaDevSound::CBody& aParent, TInt aIndex); + ~CPlayer(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + void PlayData(TUint aChunkOffset, TInt aLength); + + TUint GetPlayerIndex() const; + + private: + RMdaDevSound::CBody& iParent; + const TUint iIndex; // index of this object in parent + + TInt iBufferOffset; + TInt iBufferLength; + }; + + + NONSHARABLE_CLASS( CRecorder ) : public CActive + { + public: + explicit CRecorder(TInt aPriority, RMdaDevSound::CBody& aParent); + ~CRecorder(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + void RecordData(TInt& aLength); + + private: + RMdaDevSound::CBody& iParent; + + TInt iBufferOffset; + TInt iBufferLength; + }; + + enum TStateEnum + { + ENotReady, + EStopped, + ERecording, + ERecordingPausedInHw, + ERecordingPausedInSw, + EPlaying, + EPlayingPausedInHw, // ie. Play request pending on h/w and paused + EPlayingPausedInSw, // ie. Driver not playing or paused + EPlayingUnderrun + }; + + NONSHARABLE_CLASS( TState ) + { + public: + TState(TStateEnum aState) : iState(aState) {} + const TText8 *Name() const; + TState &operator=(TStateEnum aNewState); + operator TStateEnum() const { return iState; } + private: + TStateEnum iState; + }; + + class TFormatData + { + public: + inline TFormatData(): + iSampleRate(8000), iRequestedChannels(1) // default + { + } + public: + CChannelAndSampleRateConverter* iConverter; + TInt iSampleRate; + TInt iActualRate; + TInt iRequestedChannels; + TInt iActualChannels; + }; + +public: + ~CBody(); + static CBody* NewL(); + TInt Open(TInt aUnit=KNullUnit); + TVersion VersionRequired() const; + TInt IsMdaSound(); + void PlayFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported); + void GetPlayFormat(TCurrentSoundFormatBuf& aFormat); + TInt SetPlayFormat(const TCurrentSoundFormatBuf& aFormat); + TInt PlayVolume(); + void SetPlayVolume(TInt aVolume); + void SetVolume(TInt aLogarithmicVolume); + void CancelPlayData(); + void RecordFormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported); + void GetRecordFormat(TCurrentSoundFormatBuf& aFormat); + TInt SetRecordFormat(const TCurrentSoundFormatBuf& aFormat); + TInt RecordLevel(); + void SetRecordLevel(TInt aLevel); + void CancelRecordData(); + void FlushRecordBuffer(); + TInt BytesPlayed(); + void ResetBytesPlayed(); + void PausePlayBuffer(); + void ResumePlaying(); + void PauseRecordBuffer(); + void ResumeRecording(); + TInt GetTimePlayed(TTimeIntervalMicroSeconds& aTimePlayed); + void Close(); + TInt Handle(); + void PlayData(TRequestStatus& aStatus,const TDesC8& aData); + void RecordData(TRequestStatus& aStatus,TDes8& aData); + void NotifyRecordError(TRequestStatus& aStatus); + void NotifyPlayError(TRequestStatus& aStatus); + void CancelNotifyPlayError(); + void CancelNotifyRecordError(); + void FlushPlayBuffer(); + //internal methods added to reduce the code + void FormatsSupported(TSoundFormatsSupportedBuf& aFormatsSupported, RSoundSc& aDevice); + void GetFormat(TCurrentSoundFormatBuf& aFormat, RSoundSc& aDevice, const TFormatData &aFormatData); + TInt SetFormat(const TCurrentSoundFormatBuf& aFormat, RSoundSc& aDevice, TFormatData &aFormatData); + + //for players + void SoundDeviceError(TInt aError); + RSoundSc& PlaySoundDevice(); + RSoundSc& RecordSoundDevice(); + const TState &State() const; + void BufferFilled(TInt aError); + + // Called whenever a player becomes inactive. + // This includes driver request ok, driver request failed, CPlayer:::RunError invoked. + void PlayRequestHasCompleted(CPlayer *aPlayer, TInt aStatus, TBool aDueToCancelCommand); + +private: + CBody(); + void ConstructL(); + + TInt NegotiateFormat(const TCurrentSoundFormatBuf& aFormat, RSoundSc& aDevice, TFormatData &aFormatData); + + void StartPlayersAndUpdateState(); + void StartRecordRequest(); + + const char *StateName() const; + + TBool InRecordMode() const; + TBool InPlayMode() const; + + TUint32 CurrentTimeInMsec() const; + TUint64 BytesPlayed64(); + +private: + RSoundSc iPlaySoundDevice; + RChunk iPlayChunk;//handle to the shared chunk + RSoundSc iRecordSoundDevice; + RChunk iRecordChunk;//handle to the shared chunk + TState iState; + + //Playing Properties + TPlaySharedChunkBufConfig iPlayBufferConfig; + TInt iDeviceBufferLength; + + //Stores the status of CDataPathPlayer + TRequestStatus* iClientPlayStatus; + TPtrC8 iClientPlayData; + //Stores the status of CSoundDevPlayErrorReceiver + TRequestStatus* iClientPlayErrorStatus; + RBuf8 iConvertedPlayData; + RBuf8 iSavedTrailingData; + + CPlayer* iPlayers[KPlaySharedChunkBuffers]; + RFifo iFreePlayers; + RFifo iActivePlayRequestSizes; + + TInt iRequestMinSize; + TUint iRequestMinMask; + + //Recording Properties + TRecordSharedChunkBufConfig iRecordBufferConfig; + TInt iBufferOffset; + TInt iBufferLength; + + //Stores the status of CDataPathRecorder + TRequestStatus* iClientRecordStatus; + //Stores the status of CSoundDevRecordErrorReceiver + TRequestStatus* iClientRecordErrorStatus; + TDes8* iClientRecordData;//stores the data pointer from datapath recorder + RBuf8 iBufferedRecordData; // Used if RSoundSc returns more data than current client request requires. + + CRecorder* iRecorder; // We only need one recorder. The driver will buffer data for us. + + TBool iUnderFlowReportedSinceLastPlayOrRecordRequest; + + TUint64 iBytesPlayed; + TUint32 iNTickPeriodInUsec; + TUint32 iStartTime; // Time when previous driver PlayData completed (or first was issued) in msec + TUint32 iPauseTime; // Time when pause started in msec + TUint64 iPausedBytesPlayed; + + TFormatData iPlayFormatData; + TFormatData iRecordFormatData; + }; +#endif diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterconsts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterconsts.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,19 @@ +// Copyright (c) 2007-2009 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 +#include + +EXPORT_C extern const TInt KSoundAdapterForceStereo=0; diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdf/src/audio/mdasoundadapter/mdasoundadapterconsts.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef MDASOUNDADAPTERCONSTVALUES_H +#define MDASOUNDADAPTERCONSTVALUES_H + +#include + +/** +@SYMPatchable +@publishedPartner + +Patchable constant for licencee to set force the adapter to output stereo data. +The constant can be changed at ROM build time using patchdata OBY keyword. + */ +IMPORT_C extern const TInt KSoundAdapterForceStereo; + +#endif // MDASOUNDADAPTERCONSTVALUES_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/MMPFiles/pcmprocessingunit.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/MMPFiles/pcmprocessingunit.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2005-2009 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 "../inc/uids.hrh" // get UID + +TARGET pcmprocessingunit.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + +UID KSharedLibraryUidDefine KUidPcmProcessingUnitDll +VENDORID 0x70000001 + +/* +The PCM PU has false test UIDs to avoid conflict with the existing HwDevice +implementation. Commenting the following #define in allows it to +be used in preference to the HwDevice ones, and thus be tested by running +normal apps. +*/ +//#define TEST_REALFOURCC + +SOURCEPATH ../src +SOURCE pcmprocessingunit.cpp +SOURCE pcmprocessingunitmain.cpp +SOURCE pcminputport.cpp +SOURCE pcmoutputport.cpp + +USERINCLUDE ../src +USERINCLUDE ../inc +USERINCLUDE ../ + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +#ifdef TEST_REALFOURCC +START RESOURCE pcmprocessingunittest.rss +TARGET pcmprocessingunit.rss +END +#else +RESOURCE pcmprocessingunit.rss +#endif + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib +LIBRARY omxcomponent.lib + + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/group/TSU_MDF_PCMPROCESSINGUNIT.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/group/TSU_MDF_PCMPROCESSINGUNIT.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,22 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_PCMPROCESSINGUNIT_IBY +#define TSU_MDF_PCMPROCESSINGUNIT_IBY + +// put test plugins into rom +ECOM_PLUGIN(pcmprocessingunit.dll,pcmprocessingunit.rsc) + +#endif // TSU_MDF_PCMPROCESSINGUNIT_IBY diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,29 @@ +// Copyright (c) 2005-2009 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: +// + + + +PRJ_EXPORTS +../inc/pcmprocessingunit.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(mdf/pcmprocessingunit.h) + +// .iby +TSU_MDF_PCMPROCESSINGUNIT.iby /epoc32/rom/include/tsu_mdf_pcmprocessingunit.iby + +PRJ_MMPFILES +../MMPFiles/pcmprocessingunit.mmp + +PRJ_TESTMMPFILES +PRJ_TESTEXPORTS + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcminputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcminputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef PCMINPUTPORT_H +#define PCMINPUTPORT_H + + +#include "pcmprocessingunit.h" +#include "omxinputport.h" + +class MMdfOutputPort; +class MMdfOutputPortObserver; +class CPcmOutputPort; +class CMMFBuffer; + + +class CPcmInputPort : public COmxInputPort + { +public: + static CPcmInputPort* NewL(TInt aIndex, COmxProcessingUnit* aParent, TPcmDataType aDataType); + + TInt MipConfigure(const TPuConfig& aConfiguration); + virtual void MipInitialize(); + +private: + void ConstructL(TInt aIndex, COmxProcessingUnit* aParent); + CPcmInputPort(TPcmDataType aDataType); +private: + + // PCM configuration parameters + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + TPcmDataType iDataType; + }; + +#endif // PCMINPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcmoutputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcmoutputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef PCMOUTPUTPORT_H +#define PCMOUTPUTPORT_H + +#include "pcmprocessingunit.h" +#include "omxoutputport.h" + +class TPuConfig; +class CMMFBuffer; +class CPcmProcessingUnit; +class MMDFInputPort; + + +class CPcmOutputPort : public COmxOutputPort + { +public: + static CPcmOutputPort* NewL(TInt aIndex, COmxProcessingUnit* aParent, TPcmDataType aDataType); + TInt MopConfigure(const TPuConfig& aConfiguration); + void MopInitialize(); + +protected: + void ConstructL(TInt aIndex, COmxProcessingUnit* aParent); + CPcmOutputPort(TPcmDataType aDataType); + +private: + // PCM configuration parameters + TInt iSampleRate; + TInt iChannels; + TBool iInterleaved; + TBool iStopped; + TPcmDataType iDataType; + }; + + +#endif // PCMOUTPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcmprocessingunit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/pcmprocessingunit.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,63 @@ +// Copyright (c) 2005-2009 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: +// + + +#ifndef PCMPROCESSINGUNIT_H +#define PCMPROCESSINGUNIT_H + +#include +#include +#include + +class CPcmOutputPort; +class CPcmInputPort; + +enum TPcmDataType + { + EPCM8, + EPCMU8, + EPCM16 + }; + +class CPcmProcessingUnit : public COmxProcessingUnit + { +public: + // entry points for each codec variant + static CPcmProcessingUnit* NewP8P16L(); + static CPcmProcessingUnit* NewP16P8L(); + static CPcmProcessingUnit* NewPU8P16L(); + static CPcmProcessingUnit* NewP16PU8L(); + + virtual TInt Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver); + + virtual TInt Configure(const TPuConfig& aConfigurationSetup); + virtual ~CPcmProcessingUnit(); + +private: + CPcmProcessingUnit(); + void ConstructL(TPcmDataType aSrcDataType, TPcmDataType aDestDataType); + +private: + CPcmInputPort* iInputPort; + CPcmOutputPort* iOutputPort; + + TPcmDataType iSrcDataType; + TPcmDataType iDestDataType; + }; + +#endif // PCMPROCESSINGUNIT_H + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/uids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/inc/uids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef UIDS_HRH +#define UIDS_HRH + +#define KSharedLibraryUidDefine 0x10009d8d +#define KUidPcmProcessingUnitDll 0x10273779 +#define KUidPcmP8P16PU 0x102737B9 +#define KUidPcmP16P8PU 0x102737BA +#define KUidPcmPU8P16PU 0x102737BB +#define KUidPcmP16PU8PU 0x102737BC +#define KUidPcmDummyP8P16U 0x10283435 + +#endif // UIDS_HRH + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcminputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcminputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,96 @@ +// Copyright (c) 2005-2009 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 "pcminputport.h" +#include "pcmprocessingunit.h" +#include + +const TUint KSampleRate = 8000; +const TUint KMonoChannel = 1; +const TUint KStereoChannel = 2; + + +CPcmInputPort* CPcmInputPort::NewL(TInt aIndex, COmxProcessingUnit* aParent, TPcmDataType aDataType) + { + CPcmInputPort* self = new (ELeave) CPcmInputPort(aDataType); + CleanupStack::PushL (self); + self->ConstructL(aIndex, aParent); + CleanupStack::Pop(); + return self; + } + +void CPcmInputPort::ConstructL(TInt aIndex, COmxProcessingUnit* aParent) + { + COmxInputPort::ConstructL(aIndex, aParent); + } + +CPcmInputPort::CPcmInputPort(TPcmDataType aDataType) : + COmxInputPort(), + iSampleRate(KSampleRate), + iChannels(KMonoChannel), + iInterleaved(EFalse), + iDataType(aDataType) + { + } + +TInt CPcmInputPort::MipConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + return KErrNotSupported; + } + +void CPcmInputPort::MipInitialize() + { + OMX_AUDIO_PARAM_PCMMODETYPE pcm; + OMX_VERSIONTYPE ver = + { + 1,0 + }; + pcm.nVersion = ver; + pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE); + pcm.nPortIndex = MipIndex(); + pcm.nSamplingRate = iSampleRate; + pcm.ePCMMode = OMX_AUDIO_PCMModeLinear; + pcm.nChannels = iChannels; + pcm.bInterleaved = (OMX_BOOL)iInterleaved; + + switch (iDataType) + { + case EPCM8: + pcm.nBitPerSample = 8; + pcm.eNumData = OMX_NumericalDataSigned; + break; + case EPCMU8: + pcm.nBitPerSample = 8; + pcm.eNumData = OMX_NumericalDataUnsigned; + break; + case EPCM16: + pcm.nBitPerSample = 16; + pcm.eNumData = OMX_NumericalDataSigned; + break; + } + + // Set Input Port + Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm); + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmoutputport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmoutputport.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,95 @@ +// Copyright (c) 2005-2009 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 "pcmoutputport.h" +#include "pcmprocessingunit.h" +#include + +const TUint KSampleRate = 8000; +const TUint KMonoChannel = 1; +const TUint KStereoChannel = 2; + + +CPcmOutputPort* CPcmOutputPort::NewL(TInt aIndex, COmxProcessingUnit* aParent, TPcmDataType aDataType) + { + CPcmOutputPort* self = new (ELeave) CPcmOutputPort(aDataType); + CleanupStack::PushL (self); + self->ConstructL(aIndex, aParent); + CleanupStack::Pop(); + return self; + } + +void CPcmOutputPort::ConstructL(TInt aIndex, COmxProcessingUnit* aParent) + { + COmxOutputPort::ConstructL(aIndex, aParent); + } + +CPcmOutputPort::CPcmOutputPort(TPcmDataType aDataType) : + COmxOutputPort(), + iSampleRate(KSampleRate), + iChannels(KMonoChannel), + iInterleaved(EFalse), + iDataType(aDataType) + { + } + +TInt CPcmOutputPort::MopConfigure(const TPuConfig& aConfig) + { + if (aConfig.Uid() == TUid::Uid(KUidTTaskConfig)) + { + const TTaskConfig* config = TPuTaskConfig::GetStructure(aConfig); + iSampleRate = config->iRate; + iChannels = (config->iStereoMode & ETaskMono)? KMonoChannel : KStereoChannel; + iInterleaved = (config->iStereoMode & ETaskInterleaved)?ETrue : EFalse; + return KErrNone; + } + return KErrNotSupported; + } + +void CPcmOutputPort::MopInitialize() + { + COmxOutputPort::MopInitialize(); + OMX_AUDIO_PARAM_PCMMODETYPE pcm; + OMX_VERSIONTYPE ver = + { + 1,0 + }; + pcm.nVersion = ver; + pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE); + pcm.nPortIndex = MopIndex(); + pcm.nSamplingRate = iSampleRate; + pcm.ePCMMode = OMX_AUDIO_PCMModeLinear; + pcm.nChannels = iChannels; + pcm.bInterleaved = (OMX_BOOL)iInterleaved; + + switch (iDataType) + { + case EPCM8: + pcm.nBitPerSample = 8; + pcm.eNumData = OMX_NumericalDataSigned; + break; + case EPCMU8: + pcm.nBitPerSample = 8; + pcm.eNumData = OMX_NumericalDataUnsigned; + break; + case EPCM16: + pcm.nBitPerSample = 16; + pcm.eNumData = OMX_NumericalDataSigned; + break; + } + + // Set Input Port + Component()->OmxSetParameter(OMX_IndexParamAudioPcm, &pcm); + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunit.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,126 @@ +// Copyright (c) 2005-2009 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 +#include "pcmprocessingunit.h" +#include "pcminputport.h" +#include "pcmoutputport.h" +#include + +const TInt KPcmInputPortIndex = 0; +const TInt KPcmOutputPortIndex = 1; +_LIT8(KPcmILComponentName, "OMX.SYMBIAN.AUDIO.CODEC.PCM"); + + +CPcmProcessingUnit::CPcmProcessingUnit() + { + } + +CPcmProcessingUnit* CPcmProcessingUnit::NewP8P16L() + { + CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(EPCM8, EPCM16); + CleanupStack::Pop(self); + return self; + } + +CPcmProcessingUnit* CPcmProcessingUnit::NewP16P8L() + { + CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(EPCM16, EPCM8); + CleanupStack::Pop(self); + return self; + } + +CPcmProcessingUnit* CPcmProcessingUnit::NewPU8P16L() + { + CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(EPCMU8, EPCM16); + CleanupStack::Pop(self); + return self; + } + +CPcmProcessingUnit* CPcmProcessingUnit::NewP16PU8L() + { + CPcmProcessingUnit* self = new (ELeave) CPcmProcessingUnit; + CleanupStack::PushL(self); + self->ConstructL(EPCM16, EPCMU8); + CleanupStack::Pop(self); + return self; + } + +void CPcmProcessingUnit::ConstructL(TPcmDataType aSrcDataType, TPcmDataType aDestDataType) + { + iSrcDataType = aSrcDataType; + iDestDataType = aDestDataType; + } + + +CPcmProcessingUnit::~CPcmProcessingUnit() + { + // Delete input and output ports + delete iInputPort; + iInputPort = NULL; + delete iOutputPort; + iOutputPort = NULL; + } + + +TInt CPcmProcessingUnit::Create(const MMdfProcessingUnitObserver& aProcessingUnitObserver) + { + TInt err = KErrNone; + // Create underlying OMX component + TRAP(err, COmxProcessingUnit::ConstructL(KPcmILComponentName, aProcessingUnitObserver)); + if (err == KErrNone) + { + SetPuState(EProcessingUnitLoaded); + + // Create Input and output ports + TRAP(err, iInputPort = CPcmInputPort::NewL(KPcmInputPortIndex, this, iSrcDataType)); + if(err != KErrNone) + { + return err; + } + + TRAPD(err, iOutputPort = CPcmOutputPort::NewL(KPcmOutputPortIndex, this, iDestDataType)); + if(err != KErrNone) + { + return err; + } + + // Add them to processing unit + err = AddInputPort(iInputPort); + if (err != KErrNone) + { + return err; + } + err = AddOutputPort(iOutputPort); + } + return err; + } + + +TInt CPcmProcessingUnit::Configure(const TPuConfig& /*aConfig*/) + { + return KErrNone; + } + + + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunit.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunit.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,77 @@ +// Copyright (c) 2005-2009 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 +#include +#include "inc/uids.hrh" + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidPcmProcessingUnitDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidMdfProcessingUnit ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP8P16PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e TP8 P16"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP16P8PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P16 TP8"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmPU8P16PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379eTPU8 P16"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP16PU8PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P16TPU8"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmDummyP8P16U ; + version_no = 1; + display_name = "Dummy PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e TP8 P16"; + } + + }; + } + }; + } + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunitmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunitmain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,38 @@ +// Copyright (c) 2005-2009 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 "pcmprocessingunit.h" +#include +#include "uids.hrh" + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidPcmP8P16PU, CPcmProcessingUnit::NewP8P16L), + IMPLEMENTATION_PROXY_ENTRY(KUidPcmP16P8PU, CPcmProcessingUnit::NewP16P8L), + IMPLEMENTATION_PROXY_ENTRY(KUidPcmPU8P16PU, CPcmProcessingUnit::NewPU8P16L), + IMPLEMENTATION_PROXY_ENTRY(KUidPcmP16PU8PU, CPcmProcessingUnit::NewP16PU8L), + IMPLEMENTATION_PROXY_ENTRY(KUidPcmDummyP8P16U, CPcmProcessingUnit::NewP8P16L), + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunittest.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/PU/pcmcodec/src/pcmprocessingunittest.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,70 @@ +// Copyright (c) 2005-2009 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: +// pcmprocessingunit.rss +// +// + +#include +#include +#include "inc/uids.hrh" + + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidPcmProcessingUnitDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidMdfProcessingUnit ; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP8P16PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P8 P16"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP16P8PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P16 P8"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmPU8P16PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e PU8 P16"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KUidPcmP16PU8PU ; + version_no = 1; + display_name = "PCM Processing Unit"; + default_data = ""; + opaque_data = "0x1027379e P16 PU8"; + } + + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/bwins/tsu_mdf_audiocodecs.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/bwins/tsu_mdf_audiocodecs.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewTestSuiteL@@YAPAVCTestSuiteAudioCodecs@@XZ @ 1 NONAME ; class CTestSuiteAudioCodecs * NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/data/depeche1.wav Binary file mmdevicefw/mdfunittest/codecapi/audio/data/depeche1.wav has changed diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/eabi/tsu_mdf_audiocodecs.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/eabi/tsu_mdf_audiocodecs.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/group/TSU_MDF_AUDIOCODECS.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/group/TSU_MDF_AUDIOCODECS.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,25 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_IBY +#define TSU_MDF_AUDIOCODECS_IBY + +// debug build + +file=ABI_DIR\DEBUG_DIR\tsu_mdf_audiocodecs.dll System\Libs\tsu_mdf_audiocodecs.dll + +data=EPOCROOT##epoc32\data\c\tsu_mdf_audiocodecs_01.script tsu_mdf_audiocodecs_01.script + +#endif // TSU_MDF_AUDIOCODECS_IBY diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,26 @@ +// Copyright (c) 2005-2009 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: +// + +PRJ_TESTEXPORTS +../scripts/tsu_mdf_audiocodecs_01.script c:/tsu_mdf_audiocodecs_01.script + +// Export test file +../data/depeche1.wav c:/mm/mmf/testfiles/mdf/depeche1.wav + +// .iby +TSU_MDF_AUDIOCODECS.iby /epoc32/rom/include/tsu_mdf_audiocodecs.iby + +PRJ_TESTMMPFILES +../mmpfiles/tsu_mdf_audiocodecs.mmp diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/group/component_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/group/component_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,2 @@ +"\sf\os\mm\mmdevicefw\mdfunittest\codecapi\audio\scripts\tsu_mdf_audiocodecs_01.script"-"c:\tsu_mdf_audiocodecs_01.script" +"\sf\os\mm\mmdevicefw\mdfunittest\codecapi\audio\data\depeche1.wav"-"c:\mm\mmf\testfiles\mdf\depeche1.wav" \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/mmpfiles/tsu_mdf_audiocodecs.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/mmpfiles/tsu_mdf_audiocodecs.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2005-2009 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 "../src/uids.hrh" + +TARGET tsu_mdf_audiocodecs.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID KSharedLibraryUidDefine KUidTsuMdfAudioCodecsDll +VENDORID 0x70000001 + +SOURCEPATH ../src +SOURCE tsu_mdf_audiocodecs_suite.cpp +SOURCE tsu_mdf_audiocodecs_step.cpp +SOURCE tsu_mdf_audiocodecs_load.cpp +SOURCE tsu_mdf_audiocodecs_play.cpp +SOURCE tsu_mdf_audiocodecs_record.cpp +SOURCE tsu_mdf_audiocodecs_resolver.cpp + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY testframeworkclient.lib +LIBRARY mmfdevsound.lib +LIBRARY ecom.lib +LIBRARY omxilcoreclient.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY puresolverutils.lib + +NOSTRICTDEF +#ifdef EABI +NOEXPORTLIBRARY +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/scripts/tsu_mdf_audiocodecs_01.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/scripts/tsu_mdf_audiocodecs_01.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,72 @@ +// Copyright (c) 2005-2009 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: +// + +LOAD_SUITE tsu_mdf_audiocodecs.dll + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0001 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0001 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0002 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0002 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0003 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0003 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0004 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0004 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0005 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0005 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0006 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0006 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0008 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0008 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0009 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0009 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0010 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0010 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0011 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0011 +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-AUDIOCODECS-0012 + +RUN_TEST_STEP 10000 tsu_mdf_audiocodecs MM-MDF-AUDIOCODECS-0012 +TEST_COMPLETE + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_constants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_constants.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,32 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_CONSTANTS_H +#define TSU_MDF_AUDIOCODECS_CONSTANTS_H + +#define KUidHwDeviceAudioAdapter 0x10273791 +#define KMaxDataTypeLength 126 +#define KUidMdfProcessingUnit 0x10273789 +const TUint KVersionOne = 1; + +// file we are going to record into +_LIT(KTestRecordedFile, "c:\\mm\\mmf\\testfiles\\mdf\\Record.wav"); + +//const TTimeIntervalMicroSeconds32 KMdfTest0003RecordTime = 3000000; + +const TUint32 KMMFFourCCCodeTestPCM8 = 0x38505420; //( ' ', 'T', 'P', '8' ) +const TUint32 KMMFFourCCCodeTestPCMU8 = 0x38555054; //('T', 'P', 'U', '8') + +#endif // TSU_MDF_AUDIOCODECS_CONSTANTS_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_load.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_load.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2005-2009 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 "tsu_mdf_audiocodecs_load.h" +#include +#include + +// loads an audio PCM codec +RTestStepAudioCodecLoad::RTestStepAudioCodecLoad() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0001"); + } + +TVerdict RTestStepAudioCodecLoad::DoTestStepL() + { + TVerdict verdict = EFail; + __UHEAP_MARK; + INFO_PRINTF1(_L("Test loading a CMMFHwDevice")); + + TInt err = OMX_Init(); + if (err == KErrNone) + { + CMMFHwDevice* hwDevice = NULL; + TRAP(err, hwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioAdapter))); + + if (err != KErrNone) + { + INFO_PRINTF2(_L("Could not create Hw Device, error %d"), err); + } + else + { + THwDeviceInitParams initParams; + initParams.iHwDeviceObserver = this; + MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)(hwDevice->CustomInterface(KUidHwDeviceSetupInterface)); + if (setup != NULL) + { + TRAPD(err, setup->SetDataTypesL(KMMFFourCCCodeTestPCMU8,KMMFFourCCCodePCM16)); + if (err == KErrNotFound) + { + delete hwDevice; + OMX_Deinit(); + REComSession::FinalClose(); + return EFail; + } + + err = hwDevice->Init(initParams); + if (err == KErrNone) + { + verdict = EPass; + } + else + { + INFO_PRINTF2(_L("Hw Device initialisation failed, error %d"), err); + } + } + else + { + INFO_PRINTF2(_L("Failed to create custom interface, error %d"), KErrNotFound); + } + } + delete hwDevice; + OMX_Deinit(); + } + else + { + INFO_PRINTF2(_L("Failed to initialise OpenMAX core, error: %d"), err); + } + REComSession::FinalClose(); + __UHEAP_MARKEND; + return verdict; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_load.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_load.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,35 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_LOAD_H +#define TSU_MDF_AUDIOCODECS_LOAD_H + +#include "tsu_mdf_audiocodecs_step.h" +#include + +class RTestStepAudioCodecLoad : public RTestStepAudioCodecs, public MMMFHwDeviceObserver + { +public: + virtual TInt FillThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/) {return 0;} + virtual TInt EmptyThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/) {return 0;} + virtual TInt MsgFromHwDevice(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {return 0;} + virtual void Stopped() {} + virtual void Error(TInt /*aError=KErrNone*/) {} + + RTestStepAudioCodecLoad(); + virtual TVerdict DoTestStepL(); + }; + +#endif // TSU_MDF_AUDIOCODECS_LOAD_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_play.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_play.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,292 @@ +// Copyright (c) 2005-2009 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 "tsu_mdf_audiocodecs_play.h" +#include +#include + + +RTestStepAudioCodecPlay::RTestStepAudioCodecPlay() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0002"); + } + + +void RTestStepAudioCodecPlay::SetVerdict(TPtrC16 aText, TVerdict aVerdict) + { + iVerdict = aVerdict; + INFO_PRINTF2(_L("---> %s"), aText.Ptr()); + } + +TVerdict RTestStepAudioCodecPlay::DoTestStepL() + { + iPlayAudioFile = CPlayAudioFile::NewL(this); + iPlayAudioFile->StartL(); + delete iPlayAudioFile; + return iVerdict; + } + +/* +/ +/ +/ Play implementation +/ +/ +*/ + +// ************************************************** +// instructs the Hw Device Adapter to play a file +// ************************************************** +CPlayAudioFile::CPlayAudioFile(RTestStepAudioCodecs* aParent) : + CActive(EPriorityNormal), + iState(EHwDeviceCreateAndInit), + iParent(aParent) + { + } + +void CPlayAudioFile::ConstructL() + { + CActiveScheduler::Add(this); + } + +CPlayAudioFile* CPlayAudioFile::NewL(RTestStepAudioCodecs* aParent) + { + CPlayAudioFile* self = new (ELeave) CPlayAudioFile(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CPlayAudioFile::StartL() + { + SetState(EHwDeviceCreateAndInit); + CActiveScheduler::Start(); + } + +void CPlayAudioFile::DoCancel() + { + } + +CPlayAudioFile::~CPlayAudioFile() + { + } + +void CPlayAudioFile::SetState(TPlayAudioFileState aState) + { + iState = aState; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + +TInt CPlayAudioFile::ReadTestFileInBuffer() + { + RFs fs; + TInt err = fs.Connect(); + if(err != KErrNone) + { + return err; + } + + RFile file; + err = file.Open(fs,_L("c:\\mm\\mmf\\testfiles\\mdf\\depeche1.wav"), EFileRead); + if (err == KErrNone) + { + TInt size; + err = file.Size(size); + if (err == KErrNone) + { + iSourceFile = HBufC8::NewMax(size); + if(!iSourceFile) + { + return KErrNoMemory; + } + TPtr8 ptr = iSourceFile->Des(); + file.Read(ptr,size); + file.Close(); + } + fs.Close(); + } + return err; + } + + +TInt CPlayAudioFile::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + iParent->SetVerdict(_L("FillThisHwBuffer")); + ReadNextBuffer(aHwDataBuffer); + return KErrNone; + } + + +TInt CPlayAudioFile::EmptyThisHwBuffer(CMMFBuffer& /*aEmptyBufferPtr*/) + { + return KErrNotSupported; + } + +void CPlayAudioFile::ReadNextBuffer(CMMFBuffer& aHwDataBuffer) + { + TBool finished = EFalse; + TInt length = iSourceFile->Size(); + if (iSourceFilePos < length) + { + TInt size = length - iSourceFilePos; + CMMFDataBuffer* dataBuffer = static_cast(&aHwDataBuffer); + if (size > dataBuffer->Data().MaxLength()) + { + size = dataBuffer->Data().MaxLength(); + } + else + { + dataBuffer->SetLastBuffer(ETrue); + finished = ETrue; + } + dataBuffer->Data().SetLength(size); + Mem::Copy((TAny*)dataBuffer->Data().Ptr(), (TAny*)iSourceFile->Mid(iSourceFilePos).Ptr(), size); + iSourceFilePos += size; + } + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + if (finished) + { + SetState(EHwDeviceAllowToComplete); + } + } + +void CPlayAudioFile::RunL() + { + THwDeviceInitParams initParams; + TInt err = KErrNone; + switch (iState) + { + case EHwDeviceCreateAndInit: + { + err = OMX_Init(); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The OMX Core cannot be initialised"), EFail); + SetState(EHwDeviceError); + } + initParams.iHwDeviceObserver = this; + TRAP(err, iHwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioAdapter))); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The Hw Device Adapter cannot be created"), EFail); + OMX_Deinit(); + SetState(EHwDeviceError); + } + MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)iHwDevice->CustomInterface(KUidHwDeviceSetupInterface); + if (setup != NULL) + { + //Play is pcmU8 -> pcm16 + + TRAPD(err, setup->SetDataTypesL(KMMFFourCCCodeTestPCMU8, KMMFFourCCCodePCM16)); + if (err == KErrNotFound) + { + iParent->SetVerdict(_L("Cannot load the PU"), EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + break; + } + } + err = iHwDevice->Init(initParams); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot be initialised")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter created & initialised")); + SetState(EHwDeviceStartDecode); + break; + } + case EHwDeviceStartDecode: + { + // if we are playing a file, first we have to open the file + err = ReadTestFileInBuffer(); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("Cannot open the file to be played")); + break; + } + iParent->SetVerdict(_L("The files to be played has opened successfully")); + + // tell the HwDeviceAdapter to play the file + err = iHwDevice->Start(EDevDecode, EDevInFlow); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot start")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter has started successfully")); + break; + } + case EHwDeviceAllowToComplete: + break; + case EHwDeviceDone: + { + delete iHwDevice; + OMX_Deinit(); + Cancel(); + CActiveScheduler::Stop(); + break; + } + case EHwDeviceError: + { + CActiveScheduler::Stop(); + break; + } + default: + { + CleanupAndSetDeviceError(_L("Unknown CPlayAudioFile iState")); + break; + } + } + } + +void CPlayAudioFile::CleanupAndSetDeviceError(TPtrC16 aText) + { + iParent->SetVerdict(aText, EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + } + +void CPlayAudioFile::Error(TInt aError) + { + // Completion is signified by KErrUnderflow + if (aError == KErrUnderflow && iStoppedReceived) + { + iParent->SetVerdict(_L("Success")); + } + else + { + iParent->SetVerdict(_L("Error from Hw Device"), EFail); + } + SetState(EHwDeviceDone); + } + +void CPlayAudioFile::Stopped() + { + iStoppedReceived = ETrue; + } + +/* +/ +/ +/ End of Play Implementation +/ +/ +*/ diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_play.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_play.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,88 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_PLAY_H +#define TSU_MDF_AUDIOCODECS_PLAY_H + +#include "tsu_mdf_audiocodecs_step.h" +#include + +class RTestStepAudioCodecs; +class CPlayAudioFile; + +class RTestStepAudioCodecPlay : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecPlay(); + virtual TVerdict DoTestStepL(); + void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass); +private: + CPlayAudioFile* iPlayAudioFile; + TVerdict iVerdict; + }; + +// For Play tests +class CPlayAudioFile : public CActive, public MMMFHwDeviceObserver + { +public: +enum TPlayAudioFileState + { + EHwDeviceCreateAndInit, + EHwDeviceStartDecode, + EHwDeviceStartEncode, + EHwDeviceAllowToComplete, + EHwDeviceEncodeCheckData, + EHwDeviceDone, + EHwDeviceError + }; +public: + static CPlayAudioFile* NewL(RTestStepAudioCodecs* aParent); + ~CPlayAudioFile(); + void StartL(); + TInt ReadTestFileInBuffer(); + void SetState(TPlayAudioFileState aState); + void ReadNextBuffer(CMMFBuffer& aHwDataBuffer); + void CleanupAndSetDeviceError(TPtrC16 aText); + + // From MMMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt MsgFromHwDevice(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {return 0;} + virtual void Stopped(); + virtual void Error(TInt aError=KErrNone); + +protected: + // From CActive + void RunL(); + void DoCancel(); + +private: + CPlayAudioFile(RTestStepAudioCodecs* aParent); + void ConstructL(); + +private: + // data section + RFs iFileServerSession; + TPlayAudioFileState iState; + HBufC8* iSourceFile; + TInt iSourceFilePos; + CMMFHwDevice* iHwDevice; + RTestStepAudioCodecs* iParent; + TBool iStoppedReceived; + }; + +#endif // TSU_MDF_AUDIOCODECS_PLAY_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_record.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_record.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,323 @@ +// Copyright (c) 2005-2009 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 "tsu_mdf_audiocodecs_record.h" +#include +#include + + +RTestStepAudioCodecRecord::RTestStepAudioCodecRecord() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0003"); + } + + +void RTestStepAudioCodecRecord::SetVerdict(TPtrC16 aText, TVerdict aVerdict) + { + iVerdict = aVerdict; + INFO_PRINTF2(_L("---> %s"), aText.Ptr()); + } + +TVerdict RTestStepAudioCodecRecord::DoTestStepL() + { + iRecordAudioFile = CRecordAudioFile::NewL(this); + iRecordAudioFile->StartL(); + delete iRecordAudioFile; + return iVerdict; + } + +// ************************************************** +// instructs the Hw Device Adapter to record a file +// ************************************************** +CRecordAudioFile::CRecordAudioFile(RTestStepAudioCodecs* aParent) : + CActive(EPriorityNormal), + iState(EHwDeviceCreateAndInit), + iParent(aParent) + { + } + +void CRecordAudioFile::ConstructL() + { + CActiveScheduler::Add(this); + } + +CRecordAudioFile* CRecordAudioFile::NewL(RTestStepAudioCodecs* aParent) + { + CRecordAudioFile* self = new (ELeave) CRecordAudioFile(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +void CRecordAudioFile::StartL() + { + SetState(EHwDeviceCreateAndInit); + CActiveScheduler::Start(); + } + +void CRecordAudioFile::DoCancel() + { + } + +CRecordAudioFile::~CRecordAudioFile() + { + } + +void CRecordAudioFile::SetState(TRecordAudioFileState aState) + { + iState = aState; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + + +TInt CRecordAudioFile::FillThisHwBuffer(CMMFBuffer& /*aHwDataBuffer*/) + { + return KErrNotSupported; + } + + +TInt CRecordAudioFile::EmptyThisHwBuffer(CMMFBuffer& aEmptyBufferPtr) + { + iParent->SetVerdict(_L("ThisHwBufferEmptied")); + CMMFDataBuffer* dataBuffer = static_cast(&aEmptyBufferPtr); + if(iWrittenDataTotal == 0) + { + iBufferSize = dataBuffer->Data().Size(); + } + TInt err = KErrNone; + err = WriteDataToFile(dataBuffer->Data()); + if(err != KErrNone) + { + return err; + } + + if(dataBuffer->LastBuffer()) + { + SetState(EHwDeviceEncodeCheckData); + iLastBufferSize = dataBuffer->Data().Size(); + iHwDevice->Stop(); + } + else + { + err = iHwDevice->ThisHwBufferEmptied(aEmptyBufferPtr); + } + + return err; + } + +TInt CRecordAudioFile::WriteDataToFile(TDes8& aData) + { + TInt err = KErrNone; + err = iRecordFile.Write(aData); + if(err != KErrNone) + { + return err; + } + // keep record of amount of data and the number of buffers written out + iWrittenDataTotal += aData.Size(); + iBuffersWrittenCount++; + return err; + } + +TInt CRecordAudioFile::SetUpRecordFile() + { + iFileServerSession.Connect(); + TInt err = iRecordFile.Replace(iFileServerSession, KTestRecordedFile, EFileWrite|EFileShareExclusive); + return err; + } + +void CRecordAudioFile::CloseRecordFile() + { + iRecordFile.Close(); + iFileServerSession.Close(); + } + +void CRecordAudioFile::RunL() + { + THwDeviceInitParams initParams; + TInt err = KErrNone; + switch (iState) + { + case EHwDeviceCreateAndInit: + { + err = OMX_Init(); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The OMX Core cannot be initialised"), EFail); + SetState(EHwDeviceError); + } + initParams.iHwDeviceObserver = this; + TRAP(err, iHwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioAdapter))); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The Hw Device Adapter cannot be created"), EFail); + OMX_Deinit(); + SetState(EHwDeviceError); + } + MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)iHwDevice->CustomInterface(KUidHwDeviceSetupInterface); + if (setup != NULL) + { + //Record is pcm16 -> pcmU8 + TRAPD(err, setup->SetDataTypesL(KMMFFourCCCodePCM16, KMMFFourCCCodeTestPCMU8)); + if (err == KErrNotFound) + { + iParent->SetVerdict(_L("Cannot load the PU"), EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + break; + } + } + err = iHwDevice->Init(initParams); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot be initialised")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter created & initialised")); + SetState(EHwDeviceStartEncode); + break; + } + case EHwDeviceStartEncode: + { + User::LeaveIfError(SetUpRecordFile()); + // tell the HwDeviceAdapter to record the file + err = iHwDevice->Start(EDevEncode, EDevOutFlow); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot start")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter has started successfully")); + iRecordTimer = CMdfTimerRecordStop::NewL(this, iHwDevice, 3000000); + iRecordTimer->Start(); + SetState(EHwDeviceAllowToComplete); + break; + } + case EHwDeviceEncodeCheckData: + { + iParent->SetVerdict(_L("The Hw Device Adapter has stopped successfully")); + TInt fileSize = 0; + err = iRecordFile.Size(fileSize); + if(err != KErrNone) + { + CleanupAndSetDeviceError(_L("Problem with accessing the file after writing to it")); + break; + } + TInt dataWritten = ((iBuffersWrittenCount - 1) * iBufferSize) + iLastBufferSize; + if(fileSize != dataWritten) + { + CleanupAndSetDeviceError(_L("Unexpected amount of data written to file")); + break; + } + //iParent->SetVerdict(_L("Encode was a success")); + SetState(EHwDeviceDone); + break; + } + case EHwDeviceAllowToComplete: + break; + case EHwDeviceDone: + { + delete iHwDevice; + OMX_Deinit(); + Cancel(); + CActiveScheduler::Stop(); + CloseRecordFile(); + break; + } + case EHwDeviceError: + { + CActiveScheduler::Stop(); + CloseRecordFile(); + break; + } + default: + { + CleanupAndSetDeviceError(_L("Unknown CRecordAudioFile iState")); + break; + } + } + } + +void CRecordAudioFile::CleanupAndSetDeviceError(TPtrC16 aText) + { + iParent->SetVerdict(aText, EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + } + +void CRecordAudioFile::Error(TInt aError) + { + // Completion is signified by KErrUnderflow + if (aError == KErrUnderflow && iStoppedReceived) + { + iParent->SetVerdict(_L("Success")); + } + else + { + iParent->SetVerdict(_L("Error from Hw Device"), EFail); + } + SetState(EHwDeviceDone); + } + +void CRecordAudioFile::Stopped() + { + iStoppedReceived = ETrue; + } + +/* +/ +/ +/ End of Record Implementation +/ +/ +*/ +CMdfTimerRecordStop* CMdfTimerRecordStop::NewL(CRecordAudioFile* aParent, + CMMFHwDevice* aHwDevice, TTimeIntervalMicroSeconds32 aWaitTime) + { + CMdfTimerRecordStop* self = new (ELeave) CMdfTimerRecordStop(aParent, aHwDevice, aWaitTime); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CMdfTimerRecordStop::CMdfTimerRecordStop(CRecordAudioFile* aParent, + CMMFHwDevice* aHwDevice, TTimeIntervalMicroSeconds32 aWaitTime) + : CTimer(EPriorityNormal), iParent(aParent), iHwDevice(aHwDevice), iWaitTime(aWaitTime) + { + CActiveScheduler::Add(this); + } + +void CMdfTimerRecordStop::Start() + { + After(iWaitTime); + } + +void CMdfTimerRecordStop::RunL() + { + User::LeaveIfError(iHwDevice->Pause()); + // Need to wait for LastBuffer to be processed by the AudioDevice then call Stop() + } + +TInt CMdfTimerRecordStop::RunError(TInt aError) + { + iParent->CleanupAndSetDeviceError(_L("CMdfTimerRecordStop::RunL() left due to problem stopping HwDevice")); + return aError; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_record.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_record.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,113 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_RECORD_H +#define TSU_MDF_AUDIOCODECS_RECORD_H + +#include "tsu_mdf_audiocodecs_step.h" +#include + +class RTestStepAudioCodecs; +class CRecordAudioFile; +class CMdfTimerRecordStop; + +class RTestStepAudioCodecRecord : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecRecord(); + virtual TVerdict DoTestStepL(); + void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass); +private: + CRecordAudioFile* iRecordAudioFile; + TVerdict iVerdict; + }; + +// For Record tests +class CRecordAudioFile : public CActive, public MMMFHwDeviceObserver + { +public: +enum TRecordAudioFileState + { + EHwDeviceCreateAndInit, + EHwDeviceStartDecode, + EHwDeviceStartEncode, + EHwDeviceAllowToComplete, + EHwDeviceEncodeCheckData, + EHwDeviceDone, + EHwDeviceError + }; + +public: + static CRecordAudioFile* NewL(RTestStepAudioCodecs* aParent); + ~CRecordAudioFile(); + void StartL(); + TInt SetUpRecordFile(); + void CloseRecordFile(); + TInt WriteDataToFile(TDes8& aHwDataBuffer); + void SetState(TRecordAudioFileState aState); + void ReadNextBuffer(CMMFBuffer& aHwDataBuffer); + void CleanupAndSetDeviceError(TPtrC16 aText); + + // From MMMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt MsgFromHwDevice(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {return 0;} + virtual void Stopped(); + virtual void Error(TInt aError=KErrNone); + + // From CActive + void RunL(); + void DoCancel(); + +private: + CRecordAudioFile(RTestStepAudioCodecs* aParent); + void ConstructL(); + +private: + // data section + RFs iFileServerSession; + RFile iRecordFile; + TRecordAudioFileState iState; + CMMFHwDevice* iHwDevice; + RTestStepAudioCodecs* iParent; + TInt iBufferSize; + TInt iWrittenDataTotal; + TInt iBuffersWrittenCount; + TInt iLastBufferSize; + CMdfTimerRecordStop* iRecordTimer; + TBool iStoppedReceived; + }; + +class CMdfTimerRecordStop : CTimer + { +public: + static CMdfTimerRecordStop* NewL(CRecordAudioFile* aParent, + CMMFHwDevice* aHwDevice, TTimeIntervalMicroSeconds32 aWaitTime); + void Start(); +protected: + TInt RunError(TInt aError); + void RunL(); +private: + CMdfTimerRecordStop(CRecordAudioFile* aParent, + CMMFHwDevice* aHwDevice, TTimeIntervalMicroSeconds32 aWaitTime); + CRecordAudioFile* iParent; + CMMFHwDevice* iHwDevice; + TTimeIntervalMicroSeconds32 iWaitTime; + }; + + +#endif // TSU_MDF_AUDIOCODECS_RECORD_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_resolver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_resolver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,605 @@ +// Copyright (c) 2005-2009 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 "tsu_mdf_audiocodecs_resolver.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const TInt KPicSizeX = 320; +const TInt KPicSizeY = 200; + +const TReal KPicRate = 100; +const TInt KPicWidth = 20; +const TInt KPicHeight = 4000; +_LIT8(KTextManufactor, "Manufacturer"); + +// ********************************************************* +// Loads a PU using the FourCC and using the Custom Resolver +// ********************************************************* + +RTestStepAudioCodecLoadFourCC::RTestStepAudioCodecLoadFourCC() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0004"); + } + +TVerdict RTestStepAudioCodecLoadFourCC::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aSrcDataType, aDestDataType; + INFO_PRINTF1(_L("Test loading two PU using 2 FourCCs")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchInputAndOutputDataFormat); + customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 sourceData = packageData->Des(); + TFourCC srcDataType = KMMFFourCCCodeTestPCM8; + srcDataType.FourCC(&sourceData); + customMatchData->SetInputDataL(sourceData); + + TFourCC destDataType = KMMFFourCCCodePCM16; + destDataType.FourCC(&sourceData); + customMatchData->SetOutputDataL(sourceData); + + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // verify if the resolver found any PUs + TInt noOfProcessingUnits = ecomArray.Count(); + if(noOfProcessingUnits == 0) + { + INFO_PRINTF1(_L("PU Resolver did not find any PU with these data")); + return EFail; + } + + // verify if one of the PUs found is what we are looking for + for(TInt index = 0; index < noOfProcessingUnits; index++) + { + TUid uid = ecomArray[index]->ImplementationUid(); + CCodecApiOpaqueData* parse = NULL; + const TDesC8* opaqueData = &(ecomArray[index]->OpaqueData()); + // if opaque data is empty, move to the next element in the list + if (opaqueData->Length() == 0) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with empty opaque data")); + return EFail; + } + + TRAPD(error, parse = CCodecApiOpaqueData::NewL(*opaqueData)); + if (error!=KErrNone) + { + if (error==KErrNotSupported) + { + // means that the resource entry was not valid + INFO_PRINTF1(_L("PU Resolver returned a PU with invalid opaque data")); + return EFail; + } + } + CleanupStack::PushL(parse); + HBufC8* inputDataFormat = customMatchData->InputDataFormat().AllocLC(); + HBufC8* outputDataFormat = customMatchData->OutputDataFormat().AllocLC(); + if(!parse->CompareInputDataType(*inputDataFormat) + && !parse->CompareOutputDataType(*outputDataFormat)) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with a different input and output data type")); + return EFail; + } + CleanupStack::PopAndDestroy(3); + } + + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARKEND; + + INFO_PRINTF1(_L("PU Resolver returned the correct PU")); + return EPass; + } + +// *************************************************************** +// Finds a PU using the FourCC and Custom Resolver with P8 src +// *************************************************************** + +RTestStepAudioCodecFindP8InputFourCC::RTestStepAudioCodecFindP8InputFourCC() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0005"); + } + +TVerdict RTestStepAudioCodecFindP8InputFourCC::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aSrcDataType; + INFO_PRINTF1(_L("Test locates the PU using just the source data type (P8) and the version")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchInputDataFormat); + customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 sourceData = packageData->Des(); + TFourCC srcDataType = KMMFFourCCCodeTestPCM8; + srcDataType.FourCC(&sourceData); + customMatchData->SetInputDataL(sourceData); + + // Not setting destination type + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // check if there are any + TInt noOfProcessingUnits = ecomArray.Count(); + if(noOfProcessingUnits == 0) + { + return EFail; + } + // verify if one of the PUs found is what we are looking for + for(TInt index = 0; index < noOfProcessingUnits; index++) + { + TUid uid = ecomArray[index]->ImplementationUid(); + CCodecApiOpaqueData* parse = NULL; + const TDesC8* opaqueData = &(ecomArray[index]->OpaqueData()); + // if opaque data is empty, move to the next element in the list + if (opaqueData->Length() == 0) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with empty opaque data")); + return EFail; + } + + TRAPD(error, parse = CCodecApiOpaqueData::NewL(*opaqueData)); + if (error!=KErrNone) + { + if (error==KErrNotSupported) + { + // means that the resource entry was not valid + INFO_PRINTF1(_L("PU Resolver returned a PU with invalid opaque data")); + return EFail; + } + } + CleanupStack::PushL(parse); + HBufC8* inputDataFormat = customMatchData->InputDataFormat().AllocLC(); + if(!parse->CompareInputDataType(*inputDataFormat) ) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with a different input data type")); + return EFail; + } + CleanupStack::PopAndDestroy(2); + } + + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARKEND; + INFO_PRINTF1(_L("The resolver located correctly the PU using just the source data type (P8) and the version")); + return EPass; + } + +// ******************************************************************************** +// Finds a PU using the FourCC and using the Custom Resolver with PU8 destination +// ******************************************************************************** + +RTestStepAudioCodecFindPU8OutputFourCC::RTestStepAudioCodecFindPU8OutputFourCC() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0006"); + } + +TVerdict RTestStepAudioCodecFindPU8OutputFourCC::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aDestDataType; + INFO_PRINTF1(_L("Test locates the PU using just the destination data type (PU8) and the version")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchOutputDataFormat); + customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 destData = packageData->Des(); + + // Not setting source type + + TFourCC destDataType = KMMFFourCCCodeTestPCMU8; + destDataType.FourCC(&destData); + customMatchData->SetOutputDataL(destData); + + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // check if there are any + TInt noOfProcessingUnits = ecomArray.Count(); + if(noOfProcessingUnits == 0) + { + return EFail; + } + + // verify if one of the PUs found is what we are looking for + for(TInt index = 0; index < noOfProcessingUnits; index++) + { + TUid uid = ecomArray[index]->ImplementationUid(); + CCodecApiOpaqueData* parse = NULL; + const TDesC8* opaqueData = &(ecomArray[index]->OpaqueData()); + // if opaque data is empty, move to the next element in the list + if (opaqueData->Length() == 0) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with empty opaque data")); + return EFail; + } + + TRAPD(error, parse = CCodecApiOpaqueData::NewL(*opaqueData)); + if (error!=KErrNone) + { + if (error==KErrNotSupported) + { + // means that the resource entry was not valid + INFO_PRINTF1(_L("PU Resolver returned a PU with invalid opaque data")); + return EFail; + } + } + CleanupStack::PushL(parse); + HBufC8* outputDataFormat = customMatchData->OutputDataFormat().AllocLC(); + if(!parse->CompareOutputDataType(*outputDataFormat)) + { + INFO_PRINTF1(_L("PU Resolver returned a PU with a different output data type")); + return EFail; + } + CleanupStack::PopAndDestroy(2); + } + + + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARKEND; + INFO_PRINTF1(_L("The resolver located the PU using just the destination data type (PU8) and the version")); + return EPass; + } + +// ************************************************************************************************** +// Attempts to find a PU using the FourCC and Custom Resolver with correct version but incorrect src +// ************************************************************************************************** + +RTestStepAudioCodecFindIncorrectInputFourCC::RTestStepAudioCodecFindIncorrectInputFourCC() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0008"); + } + +TVerdict RTestStepAudioCodecFindIncorrectInputFourCC::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aSrcDataType; + INFO_PRINTF1(_L("Test attempts to locate the PU using the correct version, but incorrect source data type")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchInputDataFormat); + customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 sourceData = packageData->Des(); + TFourCC srcDataType = KMMFFourCCCodeNULL; + srcDataType.FourCC(&sourceData); + customMatchData->SetInputDataL(sourceData); + + // Not setting destination type + + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // check if there are any + TInt noOfProcessingUnits = ecomArray.Count(); + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARK; + if(noOfProcessingUnits == 0) + { + // Should be zero, since no implementations of type KCMdfProcessingUnit can deal with KMMFFourCCCodeNULL + return EPass; + } + + return EFail; + } + + +// ******************************************************************************************* +// Attempts to find a PU using the FourCC and Custom Resolver with the correct interface UID, +// but incorrect implementation UID. +// ******************************************************************************************* + +RTestStepAudioCodecFindIncorrectImpUid::RTestStepAudioCodecFindIncorrectImpUid() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0009"); + } + +TVerdict RTestStepAudioCodecFindIncorrectImpUid::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aSrcDataType; + INFO_PRINTF1(_L("Test attempts to locate the PU with the correct interface UID, but incorrect implementation UID.")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchInputDataFormat); + // Set implementation interface as incorrect - from KUidMediaTypeAudio + customMatchData->SetImplementationType(TUid::Uid(0x101f5d07)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 sourceData = packageData->Des(); + TFourCC srcDataType = KMMFFourCCCodeTestPCM8; + srcDataType.FourCC(&sourceData); + customMatchData->SetInputDataL(sourceData); + + TFourCC destDataType = KMMFFourCCCodePCM16; + destDataType.FourCC(&sourceData); + customMatchData->SetOutputDataL(sourceData); + + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + // Interface Uid is correct + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(KUidMdfProcessingUnit), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // check if there are any + TInt noOfProcessingUnits = ecomArray.Count(); + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARKEND; + if(noOfProcessingUnits == 0) + { + // Should be zero, since no implementations + return EPass; + } + + return EFail; + } + +// ******************************************************************************************* +// Attempts to find a PU using the FourCC and Custom Resolver with the correct implementation +// UID, but incorrect interface UID. +// ******************************************************************************************* + +RTestStepAudioCodecFindIncorrectInterfaceUid::RTestStepAudioCodecFindIncorrectInterfaceUid() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0010"); + } + +TVerdict RTestStepAudioCodecFindIncorrectInterfaceUid::DoTestStepL() + { + __UHEAP_MARK; + TFourCC aSrcDataType; + INFO_PRINTF1(_L("Test attempts to locate the PU with the correct interface UID, but incorrect implementation UID.")); + // create the OMX Core + CCodecApiResolverData* customMatchData = CCodecApiResolverData::NewLC(); + customMatchData->SetMatchType(EMatchInputDataFormat); + // Set implementation interface as correct + customMatchData->SetImplementationType(TUid::Uid(0x1027379e)); + // string value of the input source data + HBufC8* packageData = HBufC8::NewLC(KMaxDataTypeLength); + TPtr8 sourceData = packageData->Des(); + TFourCC srcDataType = KMMFFourCCCodeTestPCM8; + srcDataType.FourCC(&sourceData); + customMatchData->SetInputDataL(sourceData); + + TFourCC destDataType = KMMFFourCCCodePCM16; + destDataType.FourCC(&sourceData); + customMatchData->SetOutputDataL(sourceData); + + HBufC8* package = customMatchData->NewPackLC(); + TPtr8 packageDes = package->Des(); + TEComResolverParams resolverParams; // Parameters on which to match + resolverParams.SetDataType(packageDes); + + RImplInfoPtrArray ecomArray; + CleanupResetAndDestroyPushL(ecomArray); + + // Interface Uid is incorrect - from KMmfUidPluginInterfaceDataSource + TRAPD(error, REComSession::ListImplementationsL(TUid::Uid(0x101F53AF), + resolverParams, TUid::Uid(0x1027379b), ecomArray)); + + if (error != KErrNone) + { + CleanupStack::PopAndDestroy(3); // customMatchData, packageData, package + return EFail; + } + + // check if there are any + TInt noOfProcessingUnits = ecomArray.Count(); + CleanupStack::PopAndDestroy(4); // customMatchData, packageData, package, ecomArray + REComSession::FinalClose(); + __UHEAP_MARKEND; + if(noOfProcessingUnits == 0) + { + // Should be zero, since no implementations + return EPass; + } + + return EFail; + } + + +RTestStepVideoResolverUtils::RTestStepVideoResolverUtils() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0011"); + } + +TVerdict RTestStepVideoResolverUtils::DoTestStepL() + { + INFO_PRINTF1(_L("Tests the video resolver utility ")); + _LIT8(KText, "Manufacturer

320,200100,20,4000"); + TBufC8<50> data(KText); + TPtr8 ptrData = data.Des(); + + CCodecApiVideoOpaqueData* codecApiVideoOpaqueData = CCodecApiVideoOpaqueData::NewLC(ptrData); + + // verify the picture size + TSize picSize = codecApiVideoOpaqueData->MaxPictureSize(); + if (picSize.iWidth != KPicSizeX && + picSize.iHeight != KPicSizeY) + { + INFO_PRINTF1(_L("Incorrect picture size")); + return EFail; + } + + RArray pictureRateAndSize = codecApiVideoOpaqueData->MaxPictureRates(); + TUint arraySize = pictureRateAndSize.Count(); + if (arraySize == 0) + { + INFO_PRINTF1(_L("No picture rate and size extracted from the opaque data")); + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EFail; + } + + INFO_PRINTF2(_L("No picture rate and size extracted from the opaque data, %d"), pictureRateAndSize[0].iPictureRate); + if (pictureRateAndSize[0].iPictureRate != KPicRate) + { + INFO_PRINTF1(_L("Incorrect picture rate")); + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EFail; + } + + if (pictureRateAndSize[0].iPictureSize.iWidth != KPicWidth) + { + INFO_PRINTF1(_L("Incorrect picture width")); + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EFail; + } + + if (pictureRateAndSize[0].iPictureSize.iHeight != KPicHeight) + { + INFO_PRINTF1(_L("Incorrect picture heigh")); + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EFail; + } + + TDesC8 manufacturer = codecApiVideoOpaqueData->Manufacturer(); + if(manufacturer.Compare(KTextManufactor) == 0) + { + INFO_PRINTF1(_L("Incorrect manufacturer")); + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EFail; + } + + CleanupStack::PopAndDestroy(codecApiVideoOpaqueData); + return EPass; + } + + +// ******************************************************************************************* +// Attempts to find a PU using the FourCC and Custom Resolver with the correct implementation +// UID, but incorrect interface UID. +// ******************************************************************************************* +RTestStepResolverUtils::RTestStepResolverUtils() + { + iTestStepName = _L("MM-MDF-AUDIOCODECS-0012"); + } + +TVerdict RTestStepResolverUtils::DoTestStepL() + { + INFO_PRINTF1(_L("Tests the video resolver utility ")); + _LIT8(KText, ""); + TBufC8<50> data(KText); + TPtr8 ptrData = data.Des(); + + CCodecApiOpaqueData* codecApiOpaqueData = CCodecApiOpaqueData::NewLC(ptrData); + const TDesC8 inputData = codecApiOpaqueData->InputDataType(); + if (inputData.CompareF(KNullDesC8) != 0) + { + INFO_PRINTF1(_L("Incorrect manufacturer")); + CleanupStack::PopAndDestroy(codecApiOpaqueData); + return EFail; + } + + const TDesC8 outputData = codecApiOpaqueData->OutputDataType(); + if (outputData.CompareF(KNullDesC8) != 0) + { + INFO_PRINTF1(_L("Incorrect manufacturer")); + CleanupStack::PopAndDestroy(codecApiOpaqueData); + return EFail; + } + + CleanupStack::PopAndDestroy(codecApiOpaqueData); + return EPass; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_resolver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_resolver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,89 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_RESOLVER_H +#define TSU_MDF_AUDIOCODECS_RESOLVER_H + +#include "tsu_mdf_audiocodecs_step.h" +#include + +class RTestStepAudioCodecLoadFourCC : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecLoadFourCC(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindP8InputFourCC : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindP8InputFourCC(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindPU8OutputFourCC : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindPU8OutputFourCC(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindIncorrectInputFourCC : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindIncorrectInputFourCC(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindIncorrectUid : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindIncorrectUid(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindIncorrectImpUid : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindIncorrectImpUid(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepAudioCodecFindIncorrectInterfaceUid : public RTestStepAudioCodecs + { +public: + RTestStepAudioCodecFindIncorrectInterfaceUid(); + virtual TVerdict DoTestStepL(); + }; + + +class RTestStepVideoResolverUtils : public RTestStepAudioCodecs + { +public: + RTestStepVideoResolverUtils(); + virtual TVerdict DoTestStepL(); + }; + +class RTestStepResolverUtils : public RTestStepAudioCodecs + { +public: + RTestStepResolverUtils(); + virtual TVerdict DoTestStepL(); + }; + + +#endif // TSU_MDF_AUDIOCODECS_RESOLVER_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_step.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2005-2009 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 +#include "tsu_mdf_audiocodecs_step.h" + +RTestStepAudioCodecs::RTestStepAudioCodecs() + { + } + +RTestStepAudioCodecs::~RTestStepAudioCodecs() + { + } + +TVerdict RTestStepAudioCodecs::OpenL() + { + iActiveScheduler = new(ELeave) CActiveScheduler; + CleanupStack::PushL( iActiveScheduler ); + CActiveScheduler::Install(iActiveScheduler); + CleanupStack::Pop(); + return EPass; + } + +void RTestStepAudioCodecs::CleanupAfterOpenFail() + { + } + +void RTestStepAudioCodecs::Close() + { + delete iActiveScheduler; + iActiveScheduler = NULL; + } + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_step.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_step.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef TSU_MDF_AUDIOCODECS_STEP_H +#define TSU_MDF_AUDIOCODECS_STEP_H + +#include +#include +#include "tsu_mdf_audiocodecs_constants.h" + +/** + */ +class RTestStepAudioCodecs : public RTestStep + { +public: + RTestStepAudioCodecs(); + ~RTestStepAudioCodecs(); + + // will be used by the audio play/record test cases + virtual void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass){ + INFO_PRINTF3(_L("Text: %s, Verdict:%d"), aText.Ptr(), aVerdict); + } +protected: + virtual TVerdict OpenL(); + virtual void CleanupAfterOpenFail(); + virtual void Close(); + virtual TVerdict DoTestStepL() = 0; +private: + CActiveScheduler* iActiveScheduler; + }; + +#endif// TSU_MDF_AUDIOCODECS_STEP_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_suite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_suite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,126 @@ +// Copyright (c) 2005-2009 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: +// + +// System includes +#include + +// Test system includes +#include "tsu_mdf_audiocodecs_suite.h" +#include "tsu_mdf_audiocodecs_step.h" +#include "tsu_mdf_audiocodecs_load.h" +#include "tsu_mdf_audiocodecs_play.h" +#include "tsu_mdf_audiocodecs_record.h" +#include "tsu_mdf_audiocodecs_resolver.h" + +/** + * + * NewTestSuiteL + * NewTestSuite is exported at ordinal 1 + * this provides the interface to allow schedule test + * to create instances of this test suite + * @result CTestSuiteAudioCodecs* + * + */ +EXPORT_C CTestSuiteAudioCodecs* NewTestSuiteL() + { + CTestSuiteAudioCodecs* result = new (ELeave) CTestSuiteAudioCodecs; + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(); // result + return result; + } + +/** + * + * CTestSuiteAudioCodecs + * + */ +CTestSuiteAudioCodecs::CTestSuiteAudioCodecs() + { + + } + + +/** + * + * ~CTestSuiteAudioCodecs + * + */ +CTestSuiteAudioCodecs::~CTestSuiteAudioCodecs() + {} + +/** + * + * GetVersion + * Get Test Suite version + * @result TPtrC + * + */ +TPtrC CTestSuiteAudioCodecs::GetVersion( void ) const + { + _LIT(KTxtVersion,"1.08"); + return KTxtVersion(); + } + + + +/** + * + * InitialiseL + * Constructor for test suite + * this creates all the test steps and + * stores them inside CTestSuiteAudioCodecs + * + */ +void CTestSuiteAudioCodecs::InitialiseL(void) + { + // store the name of this test suite + iSuiteName = _L("TSU_MDF_AUDIOCODECS"); + // initialize default pcm16 play + AddTestStepL(new(ELeave) RTestStepAudioCodecLoad()); + // play a file + AddTestStepL(new(ELeave) RTestStepAudioCodecPlay()); + // record a file + AddTestStepL(new(ELeave) RTestStepAudioCodecRecord()); + + // RESOLVER Test Cases + // load a PU using the resolver + AddTestStepL(new(ELeave) RTestStepAudioCodecLoadFourCC); + // load a P8 PU using the resolver source data and version only + AddTestStepL(new(ELeave) RTestStepAudioCodecFindP8InputFourCC); + // load a PU8 PU using the resolver destination data and version only + AddTestStepL(new(ELeave) RTestStepAudioCodecFindPU8OutputFourCC); + // attempt to load a PU using the correct version but incorrect source info + AddTestStepL(new(ELeave) RTestStepAudioCodecFindIncorrectInputFourCC); + // attempt to load a PU using the correct version, src, dest and interface UID but incorrect implementation UID + AddTestStepL(new(ELeave) RTestStepAudioCodecFindIncorrectImpUid); + // attempt to load a PU using the correct version, src, dest and implementation UID, but incorrect interface UID + AddTestStepL(new(ELeave) RTestStepAudioCodecFindIncorrectInterfaceUid); + // parse opaque data containing ,

and tags + AddTestStepL(new(ELeave) RTestStepVideoResolverUtils); + // parse opaque data missing one of the expected tags + AddTestStepL(new(ELeave) RTestStepResolverUtils); + } + + + + + + + + + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_suite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/tsu_mdf_audiocodecs_suite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,39 @@ +// Copyright (c) 2005-2009 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: +// This contains CTestSuiteDevSound +// +// + +#ifndef TSU_MDF_AUDIOCODECS_SUITE_H +#define TSU_MDF_AUDIOCODECS_SUITE_H + +#include + +/** + * + * CTestSuiteDevSound defines the test suite for DevSound tests + * + * + * + */ +class CTestSuiteAudioCodecs : public CTestSuite + { +public: + CTestSuiteAudioCodecs(); + void InitialiseL(void); + virtual ~CTestSuiteAudioCodecs(); + virtual TPtrC GetVersion( void ) const; + }; + +#endif // TSU_MDF_AUDIOCODECS_SUITE_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/audio/src/uids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/audio/src/uids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,24 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef UIDS_HRH +#define UIDS_HRH + +#define KSharedLibraryUidDefine 0x1000008d +#define KUidTsuMdfAudioCodecsDll 0x10273795 + +#endif // UIDS_HRH + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/group/TSU_MDF_OMXPCMCODEC.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/group/TSU_MDF_OMXPCMCODEC.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,22 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef TSU_MDF_OMXPCMCODEC_IBY +#define TSU_MDF_OMXPCMCODEC_IBY + +// put test plugins into rom +ECOM_PLUGIN(omxpcmcodec.dll,omxpcmcodec.rsc) + +#endif // TSU_MDF_OMXPCMCODEC_IBY diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,23 @@ +// Copyright (c) 2005-2009 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: +// + +PRJ_MMPFILES +../mmpfiles/OmxPCMCodec.mmp + +PRJ_EXPORTS + +// .iby +TSU_MDF_OMXPCMCODEC.iby /epoc32/rom/include/tsu_mdf_omxpcmcodec.iby + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/mmpfiles/OmxPCMCodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/mmpfiles/OmxPCMCodec.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +// Copyright (c) 2005-2009 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: +// + +/** + @file +*/ + +#include "../src/OmxPCMCodec.hrh" + +TARGET omxpcmcodec.dll +TARGETTYPE PLUGIN +CAPABILITY ALL -TCB + +// ECom Dll recognition UID followed by the unique UID for this dll +UID 0x10009D8D KUidOmxPCMCodecDll +VENDORID 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +OS_LAYER_ESTLIB_SYSTEMINCLUDE + +USERINCLUDE ../../../../../../mmlibs/mmfw/Codecs/Inc/MMFCodecCommon + +USERINCLUDE ../src + +SOURCEPATH ../src +SOURCE OmxPCMCodec.cpp +SOURCE component.cpp +SOURCE OmxImpl.cpp + + +RESOURCE OmxPCMCodec.RSS + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmfcodeccommon.lib +STATICLIBRARY omxilcomponentif.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxImpl.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,275 @@ +// Copyright (c) 2005-2009 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 +#include "OmxImpl.h" + + +OMX_ERRORTYPE OMXComponentGetComponentVersion( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STRING pComponentName, + OMX_OUT OMX_VERSIONTYPE* pComponentVersion, + OMX_OUT OMX_VERSIONTYPE* pSpecVersion, + OMX_OUT OMX_UUIDTYPE* pComponentUUID); +OMX_ERRORTYPE OMXComponentSendCommand( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_COMMANDTYPE Cmd, + OMX_IN OMX_U32 nParam1, + OMX_IN OMX_PTR pCmdData); +OMX_ERRORTYPE OMXComponentGetParameter( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nParamIndex, + OMX_INOUT OMX_PTR ComponentParameterStructure); +OMX_ERRORTYPE OMXComponentSetParameter( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR ComponentParameterStructure); +OMX_ERRORTYPE OMXComponentGetConfig( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_INOUT OMX_PTR value); +OMX_ERRORTYPE OMXComponentSetConfig( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR value); +OMX_ERRORTYPE OMXComponentGetExtensionIndex( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_STRING ParameterName, + OMX_OUT OMX_INDEXTYPE* pIndexType); +OMX_ERRORTYPE OMXComponentGetState( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STATETYPE* pState); +OMX_ERRORTYPE OMXComponentComponentTunnelRequest( + OMX_IN OMX_HANDLETYPE hInput, + OMX_IN OMX_U32 nPortInput, + OMX_IN OMX_HANDLETYPE hOutput, + OMX_IN OMX_U32 nPortOutput, + OMX_IN OMX_TUNNELSETUPTYPE* pTunnelSetup); +OMX_ERRORTYPE OMXComponentUseBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppPrivate, + OMX_IN OMX_U32 nSizeBytes, + OMX_IN OMX_U8* pBuffer); +OMX_ERRORTYPE OMXComponentAllocateBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** pBuffer, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_U32 nSizeBytes); +OMX_ERRORTYPE OMXComponentFreeBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); +OMX_ERRORTYPE OMXComponentEmptyThisBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); +OMX_ERRORTYPE OMXComponentFillThisBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); +OMX_ERRORTYPE OMXComponentSetCallbacks( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_CALLBACKTYPE* pCallbacks, + OMX_IN OMX_PTR pAppData); +OMX_ERRORTYPE OMXComponentDeInit(OMX_IN OMX_HANDLETYPE hComponent); + + +void EventHandler(OMX_OUT OMX_HANDLETYPE hComponent, + OMX_OUT OMX_PTR pAppData, + OMX_OUT OMX_EVENTTYPE eEvent, + OMX_OUT OMX_U32 Data, + OMX_OUT OMX_STRING cExtraInfo); + +void InputBufferCallback( + OMX_OUT OMX_HANDLETYPE hComponent, + OMX_OUT OMX_PTR pAppData, + OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); + +void OutputBufferCallback( + OMX_OUT OMX_HANDLETYPE hComponent, + OMX_OUT OMX_PTR pAppData, + OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer); + +COmxComponentImpl::COmxComponentImpl(OMX_HANDLETYPE hComponent) + { + iHandle = static_cast(hComponent); + OMX_VERSIONTYPE ver = + { + 1,0 + }; + + // fill in handle structure + iHandle->nVersion = ver; + iHandle->pComponentPrivate = this; + iHandle->GetComponentVersion = &::OMXComponentGetComponentVersion; + iHandle->SendCommand = &::OMXComponentSendCommand; + iHandle->GetParameter = &::OMXComponentGetParameter; + iHandle->SetParameter = &::OMXComponentSetParameter; + iHandle->GetConfig = &::OMXComponentGetConfig; + iHandle->SetConfig = &::OMXComponentSetConfig; + iHandle->GetExtensionIndex = &::OMXComponentGetExtensionIndex; + iHandle->GetState = &::OMXComponentGetState; + iHandle->ComponentTunnelRequest = &::OMXComponentComponentTunnelRequest; + iHandle->UseBuffer = &::OMXComponentUseBuffer; + iHandle->AllocateBuffer = &::OMXComponentAllocateBuffer; + iHandle->FreeBuffer = &::OMXComponentFreeBuffer; + iHandle->EmptyThisBuffer = &::OMXComponentEmptyThisBuffer; + iHandle->FillThisBuffer = &::OMXComponentFillThisBuffer; + iHandle->SetCallbacks = &::OMXComponentSetCallbacks; + iHandle->ComponentDeInit = &::OMXComponentDeInit; + } + +COmxComponentImpl::~COmxComponentImpl() + { + } + +COmxComponentImpl::operator OMX_HANDLETYPE() + { + return (OMX_HANDLETYPE)&iHandle; + } + +OMX_ERRORTYPE OMXComponentGetComponentVersion( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STRING pComponentName, + OMX_OUT OMX_VERSIONTYPE* pComponentVersion, + OMX_OUT OMX_VERSIONTYPE* pSpecVersion, + OMX_OUT OMX_UUIDTYPE* pComponentUUID) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetComponentVersion(pComponentName,pComponentVersion,pSpecVersion, pComponentUUID); + } + +OMX_ERRORTYPE OMXComponentSendCommand( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_COMMANDTYPE Cmd, + OMX_IN OMX_U32 nParam1, + OMX_IN OMX_PTR pCmdData) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SendCommand(Cmd ,nParam1, pCmdData); + } + +OMX_ERRORTYPE OMXComponentGetParameter( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nParamIndex, + OMX_INOUT OMX_PTR ComponentParameterStructure) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetParameter(nParamIndex, ComponentParameterStructure); + } + +OMX_ERRORTYPE OMXComponentSetParameter( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR ComponentParameterStructure) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetParameter(nIndex, ComponentParameterStructure); + } + +OMX_ERRORTYPE OMXComponentGetConfig( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_INOUT OMX_PTR value) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetConfig(nIndex, value); + } + +OMX_ERRORTYPE OMXComponentSetConfig( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_PTR value) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetConfig(nIndex, value); + } + +OMX_ERRORTYPE OMXComponentGetExtensionIndex( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_STRING ParameterName, + OMX_OUT OMX_INDEXTYPE* pIndexType) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetExtensionIndex(ParameterName, pIndexType); + } + +OMX_ERRORTYPE OMXComponentGetState( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_OUT OMX_STATETYPE* pState) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->GetState(pState); + } + +OMX_ERRORTYPE OMXComponentComponentTunnelRequest( + OMX_IN OMX_HANDLETYPE hInput, + OMX_IN OMX_U32 nInputPort, + OMX_IN OMX_HANDLETYPE hOutput, + OMX_IN OMX_U32 nOutputPort, + OMX_IN OMX_TUNNELSETUPTYPE* pTunnelSetup) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hInput)->pComponentPrivate)->ComponentTunnelRequest(hInput, nInputPort, hOutput, nOutputPort, pTunnelSetup); + } + +OMX_ERRORTYPE OMXComponentUseBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** ppBufferHdr, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppPrivate, + OMX_IN OMX_U32 nSizeBytes, + OMX_IN OMX_U8* pBuffer) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->UseBuffer(ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer); + } + +OMX_ERRORTYPE OMXComponentAllocateBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_INOUT OMX_BUFFERHEADERTYPE** pBuffer, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_PTR pAppData, + OMX_IN OMX_U32 nSizeBytes) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->AllocateBuffer(pBuffer, nPortIndex, pAppData, nSizeBytes); + } + +OMX_ERRORTYPE OMXComponentFreeBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_U32 nPortIndex, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->FreeBuffer(nPortIndex, pBuffer); + } + +OMX_ERRORTYPE OMXComponentEmptyThisBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->EmptyThisBuffer(pBuffer); + } + +OMX_ERRORTYPE OMXComponentFillThisBuffer( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->FillThisBuffer(pBuffer); + } + +OMX_ERRORTYPE OMXComponentSetCallbacks( + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_CALLBACKTYPE* pCallbacks, + OMX_IN OMX_PTR pAppData) + { + return ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate)->SetCallbacks(pCallbacks, pAppData); + } + +OMX_ERRORTYPE OMXComponentDeInit(OMX_IN OMX_HANDLETYPE hComponent) + { + delete ((COmxComponentImpl*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate); + return OMX_ErrorNone; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxImpl.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,94 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef OMXIMPL_H +#define OMXIMPL_H + +#include +#include +#include + + +class COmxComponentImpl : public CBase + { +public: + COmxComponentImpl(OMX_HANDLETYPE hComponent); + virtual ~COmxComponentImpl(); + + virtual OMX_ERRORTYPE GetComponentVersion( + OMX_STRING pComponentName, + OMX_VERSIONTYPE* pComponentVersion, + OMX_VERSIONTYPE* pSpecVersion, + OMX_UUIDTYPE* pComponentUUID)=0; + + virtual OMX_ERRORTYPE SendCommand( + OMX_COMMANDTYPE Cmd, + TUint32 nParam1, + TAny* pCmdData)=0; + virtual OMX_ERRORTYPE GetParameter( + OMX_INDEXTYPE nParamIndex, + TAny* ComponentParameterStructure)=0; + virtual OMX_ERRORTYPE SetParameter( + OMX_INDEXTYPE nIndex, + TAny* ComponentParameterStructure)=0; + virtual OMX_ERRORTYPE GetConfig( + OMX_INDEXTYPE nIndex, + TAny* value)=0; + virtual OMX_ERRORTYPE SetConfig( + OMX_INDEXTYPE nIndex, + TAny* value)=0; + virtual OMX_ERRORTYPE GetExtensionIndex( + OMX_STRING ParameterName, + OMX_INDEXTYPE* pIndexType)=0; + virtual OMX_ERRORTYPE GetState( + OMX_STATETYPE* pState)=0; + virtual OMX_ERRORTYPE ComponentTunnelRequest( + OMX_HANDLETYPE hInput, + TUint32 nPortInput, + OMX_HANDLETYPE hOutput, + TUint32 nPortOutput, + OMX_TUNNELSETUPTYPE* pTunnelSetup) = 0; + virtual OMX_ERRORTYPE UseBuffer( + OMX_BUFFERHEADERTYPE** ppBufferHdr, + TUint32 nPortIndex, + TAny* pAppPrivate, + TUint32 nSizeBytes, + TUint8* pBuffer)=0; + virtual OMX_ERRORTYPE AllocateBuffer( + OMX_BUFFERHEADERTYPE** pBuffer, + TUint32 nPortIndex, + TAny* pAppData, + TUint32 nSizeBytes)=0; + virtual OMX_ERRORTYPE FreeBuffer( + TUint32 nPortIndex, + OMX_BUFFERHEADERTYPE* pBuffer)=0; + virtual OMX_ERRORTYPE EmptyThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer)=0; + virtual OMX_ERRORTYPE FillThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer)=0; + virtual OMX_ERRORTYPE SetCallbacks( + OMX_CALLBACKTYPE* pCallbacks, + TAny* pAppData)=0; + + + operator OMX_HANDLETYPE(); + +private: + + OMX_COMPONENTTYPE* iHandle; + }; + + +#endif // OMXIMPL_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.RSS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.RSS Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2005-2009 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 +#include "OmxPCMCodec.hrh" +#include + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidOmxPCMCodecDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidOmxILSymbianComponentIf; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidOmxPCMCodec; + version_no = 1; + display_name = "OMX.SYMBIAN.AUDIO.CODEC.PCM"; + default_data = "Symbian IL PCM Codec" ; // Component name + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,730 @@ +// Copyright (c) 2005-2009 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 +#include +#include +#include +#include +#include + +#include "OmxImpl.h" +#include "OmxPCMCodec.h" + +const TInt KPCMBufferSize = 4096; + +const TInt KThreadStackSize = 16384; + +const TInt KShutDownTime = 5000000; + + +TInt ProcessingThread(TAny* aComponent) + { + // get our class + CCodecProcessor* codecprocessor = static_cast(aComponent); + + // run the thread + TRAPD(err, codecprocessor->RunThreadL()); + // thread has exited or failed to start so return error to the client. + return err; + } + + +TInt COmxPCMCodec::CreateComponent(OMX_HANDLETYPE hComponent) + { + COmxPCMCodec* self = new COmxPCMCodec(hComponent); + if (self==NULL) + { + return KErrNoMemory; + } + TRAPD(err, self->ConstructL()); + // self is stored in the handle, so we won't return it + return err; + } + +OMX_ERRORTYPE COmxPCMCodec::GetComponentVersion( + OMX_STRING /*pComponentName*/, + OMX_VERSIONTYPE* /*pComponentVersion*/, + OMX_VERSIONTYPE* /*pSpecVersion*/, + OMX_UUIDTYPE* /*pComponentUUID*/) + { +// to be implemented + return OMX_ErrorNone; + } + + +void COmxPCMCodec::ConstructL() + { + iCodecProcessor = CCodecProcessor::NewL(*this); + iState = OMX_StateLoaded; + } + +COmxPCMCodec::COmxPCMCodec(OMX_HANDLETYPE hComponent) + :COmxComponentImpl(hComponent) + { + } + +COmxPCMCodec::~COmxPCMCodec() + { + if (iState == OMX_StateExecuting) + { + iCodecProcessor->Stop(); + iState = OMX_StateIdle; + } + + if (iCreatedThread &&(iProcessingThread.Handle() != KNullHandle) && (iProcessingThread.ExitType() == EExitPending)) + { + TRequestStatus logonStatus; + TBool logonFailed = EFalse; + iProcessingThread.Logon(logonStatus); + if(logonStatus != KRequestPending) + {//logon failed. Mostly due to no memory + logonFailed = ETrue; + } + iCodecProcessor->Exit(); + RTimer timer; + TInt err = timer.CreateLocal(); + if(err==KErrNone && !logonFailed) //both timer and logon successful + { + TRequestStatus timeout; + timer.After(timeout, KShutDownTime); + User::WaitForRequest(logonStatus, timeout); + if(logonStatus==KRequestPending) + {//Thread has not exited after the timeout. Kill it! + iProcessingThread.LogonCancel(logonStatus); + User::WaitForRequest(logonStatus); + iProcessingThread.Kill(KErrDied); + } + else + {//Thread exited. Cancel the timer + timer.Cancel(); + User::WaitForRequest(timeout); + } + } + else + {//either timer or Logon method has failed.Poll the thread status a maximum + // of 10 times and kill the thread if it hasn't exited after the polling + for (TInt i=0; i<10 && iProcessingThread.ExitType() == EExitPending; ++i) + { + User::After(KShutDownTime/10); // wait for a while + } + + if (iProcessingThread.ExitType() == EExitPending) + { + // The polling hasn't been succesful so we kill the thread + iProcessingThread.Kill(KErrDied); + } + if(!logonFailed) + { + User::WaitForRequest(logonStatus); + } + } + iProcessingThread.Close(); + } + delete iCodecProcessor; + } + +OMX_ERRORTYPE COmxPCMCodec::SendCommand( + OMX_COMMANDTYPE Cmd, + TUint32 nParam1, + TAny* /*pCmdData*/) + { + OMX_ERRORTYPE error = OMX_ErrorNone; + switch (Cmd) + { + case OMX_CommandStateSet: + OMX_STATETYPE state = (OMX_STATETYPE)nParam1; + if (state == iState) + { + error = OMX_ErrorSameState; + } + else + { + // notify client of the state change + switch (state) + { + case OMX_StateIdle: + { + if (iState == OMX_StateExecuting) + { + iCodecProcessor->Stop(); + } + break; + } + case OMX_StateExecuting: + StartExecution(); + break; + }; + + iState = state; + + EventHandlerCallback( + OMX_EventCmdComplete, + OMX_CommandStateSet, + iState, + NULL); + break; + } + }; + return error; + } + +OMX_ERRORTYPE COmxPCMCodec::GetParameter( + OMX_INDEXTYPE nParamIndex, + TAny* ComponentParameterStructure) + { + switch (nParamIndex) + { + case OMX_IndexParamAudioInit : + { + OMX_PORT_PARAM_TYPE* param = static_cast(ComponentParameterStructure); + param->nPorts = 2; + } + break; + case OMX_IndexParamPortDefinition: + { + OMX_PARAM_PORTDEFINITIONTYPE* portDef = static_cast(ComponentParameterStructure); + if (portDef->nPortIndex==0) + { + portDef->eDir = OMX_DirInput; + portDef->nBufferSize = KPCMBufferSize; + } + else + { + portDef->eDir = OMX_DirOutput; + portDef->nBufferSize = KPCMBufferSize; + } + } + break; + default: + return OMX_ErrorUnsupportedIndex; + } + return OMX_ErrorNone; + } + +OMX_ERRORTYPE COmxPCMCodec::SetParameter( + OMX_INDEXTYPE nIndex, + TAny* ComponentParameterStructure) + { + ASSERT(iState == OMX_StateLoaded); + switch (nIndex) + { + case OMX_IndexParamAudioPcm: + { + OMX_AUDIO_PARAM_PCMMODETYPE* param = static_cast(ComponentParameterStructure); + switch(param->nPortIndex) + { + case 0: // Input port + { + iCodecProcessor->SetInputBitsPerSample(param->nBitPerSample); + iCodecProcessor->SetInputDataType(param->eNumData); + //break; + return OMX_ErrorNone; + } + case 1: // Output port + { + iCodecProcessor->SetOutputBitsPerSample(param->nBitPerSample); + iCodecProcessor->SetOutputDataType(param->eNumData); + //break; + return OMX_ErrorNone; + } + default: + { + return OMX_ErrorUnsupportedIndex; + } + }; + } + default: + { + return OMX_ErrorUnsupportedIndex; + } + }; + //return OMX_ErrorNone; + } + +OMX_ERRORTYPE COmxPCMCodec::GetConfig( + OMX_INDEXTYPE /*nIndex*/, + TAny* /*value*/) + { + return OMX_ErrorUnsupportedIndex; + } + +OMX_ERRORTYPE COmxPCMCodec::SetConfig( + OMX_INDEXTYPE /*nIndex*/, + TAny* /*value*/) + { + return OMX_ErrorUnsupportedIndex; + } + +OMX_ERRORTYPE COmxPCMCodec::GetExtensionIndex( + OMX_STRING /*ParameterName*/, + OMX_INDEXTYPE* /*pIndexType*/) + { + return OMX_ErrorNotImplemented; + } + +OMX_ERRORTYPE COmxPCMCodec::GetState( + OMX_STATETYPE* pState) + { + *pState = iState; + return OMX_ErrorNone; + } + +OMX_ERRORTYPE COmxPCMCodec::ComponentTunnelRequest( + OMX_HANDLETYPE /*hInput*/, + TUint32 /*nInputPort*/, + OMX_HANDLETYPE /*hOutput*/, + TUint32 /*nOutputPort*/, + OMX_TUNNELSETUPTYPE* /*pTunnelSetup*/) + { + return OMX_ErrorNotImplemented; + } + +OMX_ERRORTYPE COmxPCMCodec::UseBuffer( + OMX_BUFFERHEADERTYPE** ppBufferHeader, + TUint32 /*nPortIndex*/, + TAny* pAppPrivate, + TUint32 nSizeBytes, + TUint8* pBuffer) + { + ASSERT(iState == OMX_StateLoaded); + *ppBufferHeader = new OMX_BUFFERHEADERTYPE; + if (*ppBufferHeader != NULL) + { + (*ppBufferHeader)->pBuffer = pBuffer; + (*ppBufferHeader)->pAppPrivate = pAppPrivate; + (*ppBufferHeader)->nAllocLen = nSizeBytes; + (*ppBufferHeader)->nFilledLen = 0; + (*ppBufferHeader)->nFlags = 0; + (*ppBufferHeader)->pInputPortPrivate = NULL; + (*ppBufferHeader)->pOutputPortPrivate = NULL; + } + + if (*ppBufferHeader) + { + return OMX_ErrorNone; + } + else + { + return OMX_ErrorInsufficientResources; + } + } + +OMX_ERRORTYPE COmxPCMCodec::AllocateBuffer( + OMX_BUFFERHEADERTYPE** pBuffer, + TUint32 nPortIndex, + TAny* pAppData, + TUint32 nSizeBytes) + { + ASSERT(iState == OMX_StateLoaded); + + *pBuffer = new OMX_BUFFERHEADERTYPE; + if (*pBuffer != NULL) + { + (*pBuffer)->pBuffer = new unsigned char[nSizeBytes]; + // store our allocated memory in component's private store + switch (nPortIndex) + { + case 0: + (*pBuffer)->pInputPortPrivate = (*pBuffer)->pBuffer; + (*pBuffer)->pOutputPortPrivate = NULL; + break; + case 1: + (*pBuffer)->pOutputPortPrivate = (*pBuffer)->pBuffer; + (*pBuffer)->pInputPortPrivate = NULL; + break; + }; + + + (*pBuffer)->nAllocLen = nSizeBytes; + (*pBuffer)->nFilledLen = 0; + (*pBuffer)->pAppPrivate = pAppData; + } + + if (*pBuffer && (*pBuffer)->pBuffer) + { + return OMX_ErrorNone; + } + else + { + return OMX_ErrorInsufficientResources; + } + } + +OMX_ERRORTYPE COmxPCMCodec::FreeBuffer( + TUint32 /*nPortIndex*/, + OMX_BUFFERHEADERTYPE* pBuffer) + { + if (pBuffer->pInputPortPrivate || + pBuffer->pOutputPortPrivate) + delete[] pBuffer->pBuffer; + delete pBuffer; + return OMX_ErrorNone; + } +OMX_ERRORTYPE COmxPCMCodec::EmptyThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer) + { + ASSERT(iState == OMX_StateExecuting || + iState == OMX_StateIdle || + iState == OMX_StatePause); + return iCodecProcessor->EmptyThisBuffer(pBuffer); + } +OMX_ERRORTYPE COmxPCMCodec::FillThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer) + { + ASSERT(iState == OMX_StateExecuting || + iState == OMX_StateIdle || + iState == OMX_StatePause); + return iCodecProcessor->FillThisBuffer(pBuffer); + } + +OMX_ERRORTYPE COmxPCMCodec::SetCallbacks( + OMX_CALLBACKTYPE* pCallbacks, + TAny* pAppData) + { + iCallback = pCallbacks; + iAppData = pAppData; + return OMX_ErrorNone; + } + + +CCodecProcessor::CCodecProcessor(COmxPCMCodec& aParent) + : iParent(&aParent) + { + } + +void CCodecProcessor::RunThreadL() + { + iQueueStatus = KRequestPending; + iMessageQueue.NotifyDataAvailable(iQueueStatus); + + for (;;) + { + User::WaitForRequest(iQueueStatus); + TCodecMessage msg; + + TBool exit = EFalse; + + while (iMessageQueue.Receive(msg)==KErrNone) + { + switch (msg.iType) + { + case EStopProcessing: + iStarted = EFalse; + break; + case EExit: + exit = ETrue; + break; + case EInputBuffer: + iBuffersToEmpty.Append(msg.iBuffer); + break; + case EOutputBuffer: + iBuffersToFill.Append(msg.iBuffer); + break; + } + } + + if (exit) + { + break; + } + else + { + // process all available buffers + ProcessAvailableBuffers(); + + // request notification of further queue events + iQueueStatus = KRequestPending; + iMessageQueue.NotifyDataAvailable(iQueueStatus); + } + } + + } + + +CCodecProcessor* CCodecProcessor::NewL(COmxPCMCodec& aParent) + { + CCodecProcessor* self = new (ELeave) CCodecProcessor(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + + +void CCodecProcessor::ConstructL() + { + User::LeaveIfError(iMessageQueue.CreateLocal(10)); + // set the default case + iInputBitsPerSample = 8; + iInputDataType = OMX_NumericalDataUnsigned; + iOutputBitsPerSample = 16; + iOutputDataType = OMX_NumericalDataSigned; + } + +OMX_ERRORTYPE CCodecProcessor::EmptyThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer) + { + TCodecMessage message; + message.iType = EInputBuffer; + message.iBuffer = pBuffer; + if (iMessageQueue.Send(message) == KErrNone) + { + return OMX_ErrorNone; + } + else + { + return OMX_ErrorUndefined; + } + } + +void CCodecProcessor::Stop() + { + TCodecMessage message; + message.iType = EStopProcessing; + message.iBuffer = NULL; + iMessageQueue.Send(message); + } + +void CCodecProcessor::Exit() + { + TCodecMessage message; + message.iType = EExit; + message.iBuffer = NULL; + iMessageQueue.SendBlocking(message); + } + +OMX_ERRORTYPE CCodecProcessor::FillThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer) + { + TCodecMessage message; + message.iType = EOutputBuffer; + message.iBuffer = pBuffer; + if (iMessageQueue.Send(message)== KErrNone) + { + return OMX_ErrorNone; + } + else + { + return OMX_ErrorUndefined; + } + } + +void CCodecProcessor::SetInputBitsPerSample(TInt aInputBitsPerSample) + { + iInputBitsPerSample = aInputBitsPerSample; + } + +void CCodecProcessor::SetInputDataType(OMX_NUMERICALDATATYPE aType) + { + iInputDataType = aType; + } + +void CCodecProcessor::SetOutputBitsPerSample(TInt aInputBitsPerSample) + { + iOutputBitsPerSample = aInputBitsPerSample; + } + +void CCodecProcessor::SetOutputDataType(OMX_NUMERICALDATATYPE aType) + { + iOutputDataType = aType; + } + +void CCodecProcessor::ChooseCodec() + { + // choose correct conversion codec + if (iInputBitsPerSample == 8 && iOutputBitsPerSample == 16) + { + iOutputSamplesPerInputSample = 2; + if (iInputDataType == OMX_NumericalDataSigned && + iOutputDataType == OMX_NumericalDataSigned) + { + iCurrentCodec = &iAudioS8ToS16PcmCodec; + } + else if (iInputDataType == OMX_NumericalDataUnsigned && + iOutputDataType == OMX_NumericalDataSigned) + { + iCurrentCodec = &iAudioU8ToS16PcmCodec; + } + } + else if (iInputBitsPerSample == 16 && iOutputBitsPerSample == 8) + { + iOutputSamplesPerInputSample = .5; + if (iInputDataType == OMX_NumericalDataSigned && + iOutputDataType == OMX_NumericalDataSigned) + { + iCurrentCodec = &iAudioS16ToS8PcmCodec; + } + else if (iInputDataType == OMX_NumericalDataSigned && + iOutputDataType == OMX_NumericalDataUnsigned) + { + iCurrentCodec = &iAudioS16ToU8PcmCodec; + } + } + + } + +void CCodecProcessor::ProcessAvailableBuffers() + { + // Setup wait for data in queue + while (iBuffersToFill.Count()>0 && iBuffersToEmpty.Count() > 0) + { + TBool lastBuffer = EFalse; + if (!iStarted) + { + ChooseCodec(); + iStarted = ETrue; + } + + OMX_BUFFERHEADERTYPE* srcBuffer = iBuffersToEmpty[0]; + OMX_BUFFERHEADERTYPE* destBuffer = iBuffersToFill[0]; + if (srcBuffer->nFlags & OMX_BUFFERFLAG_EOS) + { + lastBuffer = ETrue; + } + TInt destBufferPos = destBuffer->nFilledLen; + + TInt destBufferSize = destBuffer->nAllocLen - destBufferPos; + TInt inputSamplesRequired = (TInt)((TReal)destBufferSize / iOutputSamplesPerInputSample); + + TInt availableSamples = srcBuffer->nFilledLen - iInputBufferPos; + + if (availableSamples <= inputSamplesRequired) + { + TInt samplesToConvert = availableSamples; + if (iOutputSamplesPerInputSample == .5) + { + samplesToConvert >>= 1; + } + iCurrentCodec->Convert(&srcBuffer->pBuffer[iInputBufferPos], &destBuffer->pBuffer[destBufferPos], samplesToConvert); + iInputBufferPos = 0; // finished buffer - so reset + inputSamplesRequired -= availableSamples; + destBuffer->nFilledLen = (TInt)((TReal)availableSamples * iOutputSamplesPerInputSample); + srcBuffer->nFilledLen = 0; + iBuffersToEmpty.Remove(0); + iParent->EmptyBufferDoneCallback(srcBuffer); + + if (inputSamplesRequired == 0 || lastBuffer) + { + iBuffersToFill.Remove(0); + if (lastBuffer) + { + destBuffer->nFlags |= OMX_BUFFERFLAG_EOS; + // propagate the EOS flag + iParent->EventHandlerCallback( + OMX_EventBufferFlag, + 0, + destBuffer->nFlags, + NULL); + } + iParent->FillBufferDoneCallback(destBuffer); + } + } + else + { + TInt samplesToConvert = inputSamplesRequired; + if (iOutputSamplesPerInputSample == .5) + { + samplesToConvert >>= 2; + } + + iCurrentCodec->Convert(&srcBuffer->pBuffer[iInputBufferPos], &destBuffer->pBuffer[destBufferPos], samplesToConvert); + iInputBufferPos += inputSamplesRequired; + destBuffer->nFilledLen = destBuffer->nAllocLen; + iBuffersToFill.Remove(0); + iParent->FillBufferDoneCallback(destBuffer); + } + } + } + +CCodecProcessor::~CCodecProcessor() + { + iBuffersToEmpty.Close(); + iBuffersToFill.Close(); + iMessageQueue.Close(); + } + + +TInt COmxPCMCodec::StartExecution() + { + // create thread with current thread's heap + // we can thus allocate and free memory across threads + if (!iCreatedThread) + { + TInt err = iProcessingThread.Create(_L("PCMCodec"), + &ProcessingThread, + KThreadStackSize, + &User::Heap(), + iCodecProcessor); + + if (err!=KErrNone) + { + return err; + } + iCreatedThread = ETrue; + iThreadDeath = KRequestPending; + iProcessingThread.Resume(); + } + + return KErrNone; + } + +// Callbacks for the PCM codec +void COmxPCMCodec::EventHandlerCallback( + OMX_OUT OMX_EVENTTYPE eEvent, + OMX_OUT TUint32 nData1, + OMX_OUT TUint32 nData2, + OMX_OUT OMX_STRING cExtraInfo) + { + iCallback->EventHandler( + this, + iAppData, + eEvent, + nData1, + nData2, + cExtraInfo); + } + + +void COmxPCMCodec::FillBufferDoneCallback(OMX_BUFFERHEADERTYPE* aBuffer) + { + iCallback->FillBufferDone( + *this, + iAppData, + aBuffer); + } + +void COmxPCMCodec::EmptyBufferDoneCallback(OMX_BUFFERHEADERTYPE* aBuffer) + { + iCallback->EmptyBufferDone( + *this, + iAppData, + aBuffer); + } + +// Component Entry Point +OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE hComponent) + { + TInt err = COmxPCMCodec::CreateComponent(hComponent); + if (err == KErrNone) + { + return OMX_ErrorNone; + } + else + { + // return problem + return OMX_ErrorInsufficientResources; + } + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,201 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef OMXPCMCODEC_H +#define OMXPCMCODEC_H + +#include +#include +#include +#include "OmxImpl.h" + +#include +#include +#include +#include + +class COmxPCMCodec; + + +class CCodecProcessor : public CBase + { + + enum TCodecMessageType + { + EStopProcessing, + EPauseProcessing, + EInputBuffer, + EOutputBuffer, + EExit + }; + + class TCodecMessage + { + public: + TCodecMessageType iType; + OMX_BUFFERHEADERTYPE* iBuffer; + }; + + public: + static CCodecProcessor* NewL(COmxPCMCodec& aParent); + + void RunThreadL(); + void Stop(); + void Exit(); + + OMX_ERRORTYPE EmptyThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer); + OMX_ERRORTYPE FillThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer); + + void SetInputDataType(OMX_NUMERICALDATATYPE aType); + void SetInputBitsPerSample(TInt aBitsPerSample); + void SetOutputDataType(OMX_NUMERICALDATATYPE aType); + void SetOutputBitsPerSample(TInt aBitsPerSample); + + virtual ~CCodecProcessor(); + + private: + void ConstructL(); + CCodecProcessor(COmxPCMCodec& aParent); + + void ProcessAvailableBuffers(); + void ChooseCodec(); + + private: + COmxPCMCodec* iParent; + RPointerArray iBuffersToEmpty; + RPointerArray iBuffersToFill; + + TRequestStatus iQueueStatus; + RMsgQueue iMessageQueue; + + OMX_BUFFERHEADERTYPE* iInputBuffer; + OMX_BUFFERHEADERTYPE* iOutputBuffer; + + TMMFAudioCodecBase* iCodec; + + // codec configuration settings + TInt iInputBitsPerSample; + TInt iOutputBitsPerSample; + OMX_NUMERICALDATATYPE iInputDataType; + OMX_NUMERICALDATATYPE iOutputDataType; + + TInt iInputBufferPos; + + TMMFAudioCodecBase* iCurrentCodec; + + TMMFAudioU8ToS16PcmCodec iAudioU8ToS16PcmCodec; + TMMFAudioPcm8ToPcm16Codec iAudioS8ToS16PcmCodec; + + TMMFAudioPcmS16ToPcmS8Codec iAudioS16ToS8PcmCodec; + TMMFAudioS16ToU8PcmCodec iAudioS16ToU8PcmCodec; + + TBool iStarted; + TReal iOutputSamplesPerInputSample; + }; + + + +class COmxPCMCodec : public COmxComponentImpl + { +public: + friend class CCodecProcessor; + friend class CCodecCallbacks; + + static TInt CreateComponent(OMX_HANDLETYPE hComponent); + ~COmxPCMCodec(); + + OMX_ERRORTYPE GetComponentVersion( + OMX_STRING pComponentName, + OMX_VERSIONTYPE* pComponentVersion, + OMX_VERSIONTYPE* pSpecVersion, + OMX_UUIDTYPE* pComponentUUID); + OMX_ERRORTYPE SendCommand( + OMX_COMMANDTYPE Cmd, + TUint32 nParam1, + TAny* pCmdData); + OMX_ERRORTYPE GetParameter( + OMX_INDEXTYPE nParamIndex, + TAny* ComponentParameterStructure); + OMX_ERRORTYPE SetParameter( + OMX_INDEXTYPE nIndex, + TAny* ComponentParameterStructure); + OMX_ERRORTYPE GetConfig( + OMX_INDEXTYPE nIndex, + TAny* value); + OMX_ERRORTYPE SetConfig( + OMX_INDEXTYPE nIndex, + TAny* value); + OMX_ERRORTYPE GetExtensionIndex( + OMX_STRING ParameterName, + OMX_INDEXTYPE* pIndexType); + OMX_ERRORTYPE GetState( + OMX_STATETYPE* pState); + OMX_ERRORTYPE ComponentTunnelRequest( + OMX_HANDLETYPE hInput, + TUint32 nInputPort, + OMX_HANDLETYPE hOutput, + TUint32 nOutputPort, + OMX_TUNNELSETUPTYPE* pTunnelSetup); + virtual OMX_ERRORTYPE UseBuffer( + OMX_BUFFERHEADERTYPE** pBufferHdr, + TUint32 nPortIndex, + TAny* pAppPrivate, + TUint32 nSizeBytes, + TUint8* pBuffer); + virtual OMX_ERRORTYPE AllocateBuffer( + OMX_BUFFERHEADERTYPE** pBuffer, + TUint32 nPortIndex, + TAny* pAppData, + TUint32 nSizeBytes); + OMX_ERRORTYPE FreeBuffer( + TUint32 nPortIndex, + OMX_BUFFERHEADERTYPE* pBuffer); + OMX_ERRORTYPE EmptyThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer); + OMX_ERRORTYPE FillThisBuffer( + OMX_BUFFERHEADERTYPE* pBuffer); + OMX_ERRORTYPE SetCallbacks( + OMX_CALLBACKTYPE* pCallbacks, + TAny* pAppData); + + TInt StartExecution(); + + void EventHandlerCallback( + OMX_EVENTTYPE eEvent, + TUint32 nData1, + TUint32 nData2, + OMX_STRING cExtraInfo); + void FillBufferDoneCallback(OMX_BUFFERHEADERTYPE* pBuffer); + void EmptyBufferDoneCallback(OMX_BUFFERHEADERTYPE* pBuffer); + + +private: + COmxPCMCodec(OMX_HANDLETYPE hComponent); + void ConstructL(); + +private: + OMX_CALLBACKTYPE* iCallback; + TAny* iAppData; + OMX_STATETYPE iState; + + TRequestStatus iThreadDeath; + CCodecProcessor* iCodecProcessor; + TBool iCreatedThread; + RThread iProcessingThread; + }; + +#endif // OMXPCMCODEC_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/OmxPCMCodec.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,23 @@ +// Copyright (c) 2005-2009 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: +// + +#ifndef OMXPCMCODEC_HRH +#define OMXPCMCODEC_HRH + +#define KUidOmxPCMCodec 0x102730BA +#define KUidOmxPCMCodecDll 0x102730B9 + +#endif // OMXPCMCODEC_HRH + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/component.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omx/pcmcodec/src/component.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,25 @@ +// Copyright (c) 2005-2009 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 +#include + +#include "OmxPCMCodec.hrh" + +OMXIL_COMPONENT_ECOM_ENTRYPOINT(KUidOmxPCMCodec); + + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/bwins/tsu_mdf_omxvorbiscodecs.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/bwins/tsu_mdf_omxvorbiscodecs.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewTestSuiteL@@YAPAVCTestSuiteOmxVorbisCodecs@@XZ @ 1 NONAME ; class CTestSuiteOmxVorbisCodecs * NewTestSuiteL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/data/ogg-decode-in.ogg Binary file mmdevicefw/mdfunittest/codecapi/omxvorbis/data/ogg-decode-in.ogg has changed diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/data/ogg-encode-in.wav Binary file mmdevicefw/mdfunittest/codecapi/omxvorbis/data/ogg-encode-in.wav has changed diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/eabi/tsu_mdf_omxvorbiscodecs.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/eabi/tsu_mdf_omxvorbiscodecs.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _Z13NewTestSuiteLv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/group/TSU_MDF_OMXVORBISCODECS.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/group/TSU_MDF_OMXVORBISCODECS.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef TSU_MDF_OMXVORBISCODECS_IBY +#define TSU_MDF_OMXVORBISCODECS_IBY + +// debug build + +file=ABI_DIR\DEBUG_DIR\tsu_mdf_omxvorbiscodecs.dll System\Libs\tsu_mdf_omxvorbiscodecs.dll + +data=EPOCROOT##epoc32\data\c\tsu_mdf_omxvorbiscodecs_01.script tsu_mdf_omxvorbiscodecs_01.script + +ECOM_PLUGIN(audiocodectestadapter.dll,audiocodectestadapter.rsc) + +#endif // TSU_MDF_OMXVORBISCODECS_IBY diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +// Copyright (c) 2006-2009 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: +// + +PRJ_TESTEXPORTS +../scripts/tsu_mdf_omxvorbiscodecs_01.script c:/tsu_mdf_omxvorbiscodecs_01.script + +// Export test file +../data/ogg-encode-in.wav c:/mm/mmf/testfiles/mdf/ogg-encode-in.wav +../data/ogg-decode-in.ogg c:/mm/mmf/testfiles/mdf/ogg-decode-in.ogg + +// .iby +TSU_MDF_OMXVORBISCODECS.iby /epoc32/rom/include/tsu_mdf_omxvorbiscodecs.iby + +PRJ_TESTMMPFILES +../mmpfiles/tsu_mdf_omxvorbiscodecs.mmp +../mmpfiles/audiocodectestadapter.mmp \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/group/component_test.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/group/component_test.pkg Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,5 @@ +"\epoc32\release\armv5\urel\audiocodectestadapter.dll"-"c:\sys\bin\audiocodectestadapter.dll" +"\epoc32\data\z\resource\plugins\audiocodectestadapter.rsc"-"c:\resource\plugins\audiocodectestadapter.rsc" +"\sf\os\mm\mmdevicefw\mdfunittest\codecapi\omxvorbis\scripts\tsu_mdf_omxvorbiscodecs_01.script"-"c:\tsu_mdf_omxvorbiscodecs_01.script" +"\sf\os\mm\mmdevicefw\mdfunittest\codecapi\omxvorbis\data\ogg-encode-in.wav"-"c:\mm\mmf\testfiles\mdf\ogg-encode-in.wav" +"\sf\os\mm\mmdevicefw\mdfunittest\codecapi\omxvorbis\data\ogg-decode-in.ogg"-"c:\mm\mmf\testfiles\mdf\ogg-decode-in.ogg" diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,527 @@ +// Copyright (c) 2006-2009 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: +// This is a re-implementation of CMdfHwDeviceCodecTestAdapter +// primarily intended for unit testing codec PUs in PREQ1024. +// It is NOT a subclass, as CMdfHwDeviceCodecTestAdapter itself has no +// virtual or protected methods to override. +// The only difference is that it encodes and decodes from codec +// to codec, unlike CMdfHwDeviceCodecTestAdapter which encodes from sounddev +// (mic) to codec and decodes from codec to sounddev (speaker) +// +// + +/** + @file + @internalComponent +*/ + +#include "audiocodectestadapter.h" +#include +#include +// for the bitrate custom interface +#include + +#include + +// #define AUDIOCODECTESTADAPTER_DEBUG 1 +#if defined(AUDIOCODECTESTADAPTER_DEBUG) +#define DEBUG_PRINT RDebug::Print +#else +#define DEBUG_PRINT +#endif + +// Interface UID for the Processing Unit Loader +const TUid KUidPuLoader = {KUidPuLoaderImplementation}; + + +CMdfHwDeviceCodecTestAdapter::~CMdfHwDeviceCodecTestAdapter() + { + Stop(); + // Unload the PUs + if (iCodecPU) + { + iPuLoader->UnloadProcessingUnit(iCodecPU); + } + + // The I/O ports should have been deleted at this point + + delete iInputBuffer; + delete iOutputBuffer; + delete iActiveWait; + delete iPuLoader; + REComSession::DestroyedImplementation(iPuLoaderDtorKey); + } + +CMdfHwDeviceCodecTestAdapter* CMdfHwDeviceCodecTestAdapter::NewL() + { + CMdfHwDeviceCodecTestAdapter* self = new (ELeave) CMdfHwDeviceCodecTestAdapter; + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +CMdfHwDeviceCodecTestAdapter::CMdfHwDeviceCodecTestAdapter() + { + } + +void CMdfHwDeviceCodecTestAdapter::ConstructL() + { + // Load the PU Loader plugin + iPuLoader = static_cast + (REComSession::CreateImplementationL(KUidPuLoader, iPuLoaderDtorKey)); + iActiveWait = new (ELeave) CActiveSchedulerWait; + iState = EProcessingUnitLoaderLoaded; + } + +TInt CMdfHwDeviceCodecTestAdapter::Start(TDeviceFunc aFuncCmd, TDeviceFlow /*aFlowCmd*/) + { + if (!((aFuncCmd == EDevEncode)|(aFuncCmd == EDevDecode)|(aFuncCmd == EDevNullFunc))) + { + return KErrArgument; + } + + iFuncCmd = aFuncCmd; + + // NB: aFlowCmd not used - this is codec-codec processing by default. + + TInt err = KErrNone; + switch(aFuncCmd) + { + case EDevEncode: + { + err = StartEncode(); + } + break; + case EDevDecode: + { + err = StartDecode(); + } + break; + case EDevNullFunc: + default: + { + err = KErrNotSupported; + } + break; + } + + + return err; + } + +// encode and decode logic is identical for codec-codec processing + +TInt CMdfHwDeviceCodecTestAdapter::InitializeEncodeDecode() + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::InitializeEncodeDecode")); + + ASSERT(iOutputPort); + + iInputPortBufferSize = iInputPort->MipBufferSize(); + TRAPD(err, iInputBuffer = CMMFDescriptorBuffer::NewL(iInputPortBufferSize)); + if(err != KErrNone) + { + return err; + } + iInputBuffer->SetLastBuffer(EFalse); + iInputPort->MipUseBuffer(*iInputBuffer); + + iOutputPortBufferSize = iOutputPort->MopBufferSize(); + TRAP(err, iOutputBuffer = CMMFDescriptorBuffer::NewL(iOutputPortBufferSize)); + if(err != KErrNone) + { + return err; + } + iOutputBuffer->SetLastBuffer(EFalse); + iOutputPort->MopUseBuffer(*iOutputBuffer); + + // VD: should not move the set up of the state after sending the Initialize() calls??? + iState = EProcessingUnitInitializing; + + iCodecPU->Initialize(); + + iActiveWait->Start(); + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::StartEncode() + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartEncode")); + TInt err = KErrNone; + if (iState == EProcessingUnitLoaded) + { + err = InitializeEncodeDecode(); + } + if (err != KErrNone) + { + return err; + } + + return StartExecuting(); + } + +TInt CMdfHwDeviceCodecTestAdapter::StartDecode() + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartDecode")); + + TInt err = KErrNone; + if (iState == EProcessingUnitLoaded) + { + err = InitializeEncodeDecode(); + } + if (err != KErrNone) + { + return err; + } + + return StartExecuting(); + } + +TInt CMdfHwDeviceCodecTestAdapter::StartExecuting() + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartExecuting")); + TInt err = KErrNone; + + iOutputPort->MopReadData(*iOutputBuffer); + err = iHwDeviceObserver->FillThisHwBuffer(*iInputBuffer); + if(err != KErrNone) + { + return err; + } + + iState = EProcessingUnitExecuting; + iCodecPU->Execute(); + + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::Stop() + { + if(iState == EProcessingUnitExecuting || iState == EProcessingUnitPaused) + { + iStopping = ETrue; // is used as a guard in ExecuteComplete + + if(iCodecPU) + { + iCodecPU->Stop(); + } + + iPCMPUCallbackComplete = EFalse; + + iState = EProcessingUnitIdle; + iStopping = EFalse; + } + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::Pause() + { + return iCodecPU->Pause(); + } + +TInt CMdfHwDeviceCodecTestAdapter::Init(THwDeviceInitParams& aDevInfo) + { + if(!iCodecPU) + { + return KErrNotSupported; + } + + // Not currently using any other members of aDevInfo, except the Observer + if(!aDevInfo.iHwDeviceObserver) + { + return KErrArgument; + } + iHwDeviceObserver = aDevInfo.iHwDeviceObserver; + + // Get ports and set observers + RPointerArray inputPorts; + TInt err = iCodecPU->GetInputPorts(inputPorts); + if(err != KErrNone) + { + return err; + } + + if (inputPorts.Count()<1) + { + return KErrNotFound; + } + + iInputPort = inputPorts[0]; + inputPorts.Close(); + + iInputPort->MipSetObserver(*this); + + RPointerArray outputPorts; + err = iCodecPU->GetOutputPorts(outputPorts); + if(err != KErrNone) + { + return err; + } + + if (outputPorts.Count()<1) + { + return KErrNotFound; + } + + iOutputPort = outputPorts[0]; + outputPorts.Close(); + iOutputPort->MopSetObserver(*this); + + iState = EProcessingUnitLoaded; + + return KErrNone; + } + +TAny* CMdfHwDeviceCodecTestAdapter::CustomInterface(TUid aInterfaceId) + { + if (aInterfaceId == KUidHwDeviceSetupInterface) + { + return static_cast(this); + } + else if (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) + { + return reinterpret_cast(iInputPort); + } + else if (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface) + { + return reinterpret_cast(iOutputPort); + } + // if the PU is an encoder it may have a BitRate custom interface + else if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate) + { + return static_cast(iCodecPU->CustomInterface(aInterfaceId)); + } + else + { + return NULL; + } + } + +TInt CMdfHwDeviceCodecTestAdapter::ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr) + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::ThisHwBufferFilled")); + + aFillBufferPtr.SetStatus(EFull); + + // if the buffer is empty or the last buffer, write it anyway - + // the stop / error will be generated elsewhere + + iInputPort->MipWriteData(aFillBufferPtr); + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::ThisHwBufferEmptied")); + + iOutputPort->MopReadData(*iOutputBuffer); + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::SetConfig(TTaskConfig& aConfig) + { + TInt err = KErrNone; + // Call to Configure the Codec PU + TPuTaskConfig config(aConfig); + err = iInputPort->MipConfigure(config); + if(err != KErrNone) + { + return err; + } + err = iOutputPort->MopConfigure(config); + if(err != KErrNone) + { + return err; + } + +// iState = EProcessingUnitConfigured; + + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::StopAndDeleteCodec() + { + return KErrNone; + } + +TInt CMdfHwDeviceCodecTestAdapter::DeleteCodec() + { + return KErrNone; + } + +void CMdfHwDeviceCodecTestAdapter::MipoWriteDataComplete(const MMdfInputPort* aInputPort, + CMMFBuffer* aBuffer, TInt aErrorCode) + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::MipoWriteDataComplete")); + + if (aErrorCode == KErrNone && aInputPort == iInputPort) + { + if(aBuffer->LastBuffer()) + { + if(iFuncCmd == EDevEncode) + { + // we must cancel the PU here if it's an encoder - the decoder + // will be done elsewhere + iCodecPU->Stop(); + } + } + else + { + iHwDeviceObserver->FillThisHwBuffer(*aBuffer); + } + } + else + { + StopHwDevice(aErrorCode); + } + } + +void CMdfHwDeviceCodecTestAdapter::MipoDisconnectTunnelComplete(const MMdfInputPort* aInputPort, + TInt aErrorCode) + { + // The Inputport of the PcmCodecPu will no longer receive data. + // Set flag to indicate that the sink outputport has been stopped? + if(aErrorCode == KErrNone) + { + if(aInputPort == iInputPort) + { + iPCMPuMipoStopCompleted = ETrue; + } + } + else + { + iHwDeviceObserver->Error(aErrorCode); + } + } + +void CMdfHwDeviceCodecTestAdapter::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/, + TInt /*aErrorCode*/) + { + + } + +void CMdfHwDeviceCodecTestAdapter::MopoReadDataComplete(const MMdfOutputPort* aOutputPort, + CMMFBuffer* aBuffer, TInt aErrorCode) + { + DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::MopoReadDataComplete")); + + if(aErrorCode == KErrNone && aOutputPort == iOutputPort) + { + iHwDeviceObserver->EmptyThisHwBuffer(*aBuffer); + } + else + { + StopHwDevice(aErrorCode); + } + } + +void CMdfHwDeviceCodecTestAdapter::MopoDisconnectTunnelComplete(const MMdfOutputPort* aOutputPort, + TInt aErrorCode) + { + if(aErrorCode == KErrNone) + { + if(aOutputPort == iOutputPort) + { + iPCMPuMopoStopCompleted = ETrue; + } + } + else + { + iHwDeviceObserver->Error(aErrorCode); + } + if(iPCMPuMipoStopCompleted && iPCMPuMopoStopCompleted) + { + iState = EProcessingUnitIdle; + } + } + +void CMdfHwDeviceCodecTestAdapter::MopoRestartTunnelComplete(const MMdfOutputPort* /* aOutputPort */, + TInt /*aErrorCode*/) + { + + } + +void CMdfHwDeviceCodecTestAdapter::InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) + { + if(aErrorCode != KErrNone) + { + iHwDeviceObserver->Error(aErrorCode); + return; + } + + if(aPu == iCodecPU) + { + iPCMPUCallbackComplete = ETrue; + } + + if(iPCMPUCallbackComplete) + { + + // reset the flags + iPCMPUCallbackComplete = EFalse; + + // PUs initialised OK + iActiveWait->AsyncStop(); + + } + } + +void CMdfHwDeviceCodecTestAdapter::ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode) + { + if(iStopping) + { + return; + } + + if (iExecuteError == KErrNone) + { + iExecuteError = aErrorCode; + } + + if(aPu == iCodecPU) + { + iPCMPUCallbackComplete = ETrue; + } + + if(iExecuteError != KErrNone || (iPCMPUCallbackComplete) ) + { + if (iState == EProcessingUnitExecuting) + { + // stop the hardware device if we are still executing + StopHwDevice(iExecuteError); + iState = EProcessingUnitIdle; + } + // reset the flags + iPCMPUCallbackComplete = EFalse; + } + } + +void CMdfHwDeviceCodecTestAdapter::SetDataTypesL(TFourCC aSrcType, TFourCC aDestType) + { + // Find and load an appropriate Codec + iCodecPU = iPuLoader->LoadProcessingUnitL(*this, aSrcType, aDestType); + } + + +void CMdfHwDeviceCodecTestAdapter::StopHwDevice(TInt error) + { + iHwDeviceObserver->Stopped(); + iHwDeviceObserver->Error(error); + } + +void CMdfHwDeviceCodecTestAdapter::GetState(THwDevAdapterState& aState) const + { + aState = iState; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2006-2008 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: +* +*/ + + +/** +@file +@internalComponent +*/ + +#ifndef AUDIOCODECTESTADAPTER_H +#define AUDIOCODECTESTADAPTER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +class CMMFBuffer; + +class CMdfHwDeviceCodecTestAdapter : public CMMFHwDevice, + public MMdfInputPortObserver, + public MMdfOutputPortObserver, + public MMdfProcessingUnitObserver, + public MMdfHwDeviceSetup + { +public: + /* + Hardware Device Adapter panics raised as a result of a programming error. + */ + enum THwDeviceAdapterPanics + { + /* + Raised when the Codec Processing Unit has not been initialised. + @see CMdfHwDeviceAdapter::CustomInterface + @see CMdfHwDeviceAdapter::SetDataTypesL + */ + EPanicCodecNotSet + }; + /** + The current state of the Hardware Device Adapter. + */ + enum THwDevAdapterState + { + /* + The PULoader has been loaded. + */ + EProcessingUnitLoaderLoaded, + /* + The Processing Units have been loaded. + */ + EProcessingUnitLoaded, + /* + The Processing Units are currently being initialised. + */ + EProcessingUnitInitializing, + /* + The Processing Units are currently in the idle state. + */ + EProcessingUnitIdle, + /* + The Processing Units are currently in the executing state. + */ + EProcessingUnitExecuting, + /* + The Processing Units are currently in the paused state. + */ + EProcessingUnitPaused + }; + +public: + static CMdfHwDeviceCodecTestAdapter* NewL(); + + // from CMMFHwDevice + TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); + TInt Stop(); + TInt Pause(); + TInt Init(THwDeviceInitParams& aDevInfo); + TAny* CustomInterface(TUid aInterfaceId); + TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); + TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); + TInt SetConfig(TTaskConfig& aConfig); + TInt StopAndDeleteCodec(); + TInt DeleteCodec(); + ~CMdfHwDeviceCodecTestAdapter(); + + // from MMdfInputPortObserver + void MipoWriteDataComplete(const MMdfInputPort* aPu, + CMMFBuffer* aBuffer, TInt aErrorCode); + void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); + void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); + + // from MMdfOutputPortObserver + void MopoReadDataComplete(const MMdfOutputPort* aPu, + CMMFBuffer* aBuffer, TInt aErrorCode); + void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); + void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); + + // from MMdfProcessingUnitObserver + void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + + // from MMdfHwDeviceSetup + void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType); + + void GetState(THwDevAdapterState& aState) const; + +private: + CMdfHwDeviceCodecTestAdapter(); + void ConstructL(); + TInt CreateBuffers(); + TInt StartEncode(); + TInt StartDecode(); + TInt InitializeEncodeDecode(); + TInt StartExecuting(); + + void StopHwDevice(TInt error); + +private: + CMdfPuLoader* iPuLoader; + TUid iPuLoaderDtorKey; + MMdfInputPort* iInputPort; + MMdfOutputPort* iOutputPort; + + CMdfProcessingUnit* iCodecPU; + + THwDevAdapterState iState; + TBool iStopping; + + TBool iPCMPUCallbackComplete; + + TBool iPCMPuMopoStopCompleted; + TBool iPCMPuMipoStopCompleted; + + TInt iExecuteError; + + enum TPUType + { + EPcmPu + }; + + CMMFBuffer* iInputBuffer; + CMMFBuffer* iOutputBuffer; + + TUint32 iInputPortBufferSize; + TUint32 iOutputPortBufferSize; + TInt iInputPortBufferData; + TInt iOutputPortBufferData; + + CActiveSchedulerWait* iActiveWait; + + TDeviceFunc iFuncCmd; + + TFourCC iFirstFourCC; + TFourCC iSecondFourCC; + }; + +#endif // AUDIOCODECTESTADAPTER_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,25 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef AUDIOCODECTESTADAPTER_HRH +#define AUDIOCODECTESTADAPTER_HRH + +#define KSharedLibraryUidDefine 0x10009d8d +#define KMmfUidPluginInterfaceHwDevice 0x101F4AA8 +#define KUidHwDeviceAudioCodecTestAdapterDll 0x102737dc +#define KUidHwDeviceAudioCodecTestAdapter 0x102737dd + +#endif // AUDIOCODECTESTADAPTER_HRH + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 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 +#include "audiocodectestadapter.hrh" + +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = KUidHwDeviceAudioCodecTestAdapterDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KUidHwDeviceAudioCodecTestAdapter; + version_no = 1; + display_name = "Audio Hw Device Codec Test Adapter"; + default_data = "OMXTestAdapter"; + opaque_data = ""; + } + }; + } + }; + } diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadaptermain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadaptermain.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +// Copyright (c) 2006-2009 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: +// audiocodectestadapter.cpp +// +// + +#include "audiocodectestadapter.h" +#include +#include "audiocodectestadapter.hrh" + +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidHwDeviceAudioCodecTestAdapter , CMdfHwDeviceCodecTestAdapter::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + + return ImplementationTable; + } + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/mmpfiles/audiocodectestadapter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/mmpfiles/audiocodectestadapter.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2008-2009 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 "../hwdeviceadapter/audiocodectestadapter.hrh" // get UID + +TARGET audiocodectestadapter.dll +CAPABILITY ALL -TCB +TARGETTYPE plugin + +UID KSharedLibraryUidDefine KUidHwDeviceAudioCodecTestAdapterDll +VENDORID 0x70000001 + +SOURCEPATH ../hwdeviceadapter +SOURCE audiocodectestadapter.cpp +SOURCE audiocodectestadaptermain.cpp + +USERINCLUDE ../hwdeviceadapter +USERINCLUDE ../../../../../devsound/devsoundrefplugin/inc/plugin + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +RESOURCE audiocodectestadapter.rss + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmcommonutils.lib +LIBRARY mmfserverbaseclasses.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/mmpfiles/tsu_mdf_omxvorbiscodecs.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/mmpfiles/tsu_mdf_omxvorbiscodecs.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2008-2009 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 "../src/uids.hrh" + +TARGET tsu_mdf_omxvorbiscodecs.dll +CAPABILITY ALL -TCB +TARGETTYPE dll +UID KSharedLibraryUidDefine KUidTsuMdfOmxVorbisCodecsDll +VENDORID 0x70000001 + +SOURCEPATH ../src +SOURCE tsu_mdf_omxvorbiscodecs_suite.cpp +SOURCE tsu_mdf_omxvorbiscodecs_step.cpp +SOURCE tsu_mdf_omxvorbiscodecs_play.cpp +SOURCE tsu_mdf_omxvorbiscodecs_record.cpp +SOURCE tsu_mdf_omxvorbiscodecs_pu.cpp +SOURCE tsu_mdf_omxvorbiscodecs_omx.cpp + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +USERINCLUDE ../src +USERINCLUDE ../../../../../../../oggvorbiscodec/src/tremor +USERINCLUDE ../../../../mdf/src/audio/Vorbis + +LIBRARY estlib.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY testframeworkclient.lib +LIBRARY mmfdevsound.lib +LIBRARY ecom.lib +LIBRARY omxilcoreclient.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY puresolverutils.lib + +LIBRARY oggvorbisintutil.lib + +NOSTRICTDEF +#ifdef EABI +NOEXPORTLIBRARY +#endif + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/scripts/tsu_mdf_omxvorbiscodecs_01.script --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/scripts/tsu_mdf_omxvorbiscodecs_01.script Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +// Copyright (c) 2006-2009 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: +// + +LOAD_SUITE tsu_mdf_omxvorbiscodecs.dll + +//! @SYMTestCaseID MM-MDF-OMXVORBISCODECS-U-0001-HP + +//RUN_TEST_STEP -1 tsu_mdf_omxvorbiscodecs MM-MDF-OMXVORBISCODECS-U-0001-HP +//TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-OMXVORBISCODECS-U-0002-HP + +//RUN_TEST_STEP -1 tsu_mdf_omxvorbiscodecs MM-MDF-OMXVORBISCODECS-U-0002-HP +//TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-OMXVORBISCODECS-U-0010-HP + +RUN_TEST_STEP -1 tsu_mdf_omxvorbiscodecs MM-MDF-OMXVORBISCODECS-U-0010-HP +TEST_COMPLETE + +//! @SYMTestCaseID MM-MDF-OMXVORBISCODECS-U-0020-HP + +//RUN_TEST_STEP -1 tsu_mdf_omxvorbiscodecs MM-MDF-OMXVORBISCODECS-U-0020-HP +//TEST_COMPLETE + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_constants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_constants.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_CONSTANTS_H +#define TSU_MDF_OMXVORBISCODECS_CONSTANTS_H + +#define KUidHwDeviceAudioCodecTestAdapter 0x102737dd +#define KUidHwDeviceAudioAdapter 0x10273791 +#define KMaxDataTypeLength 126 +#define KUidMdfProcessingUnit 0x10273789 +const TUint KVersionOne = 1; + +// heap size - we will be opening some large files. +const TInt KTestHeapSize = 0x200000; // 2 Mb + +// files we are going to play from +_LIT(KTestDecoderPlayFile, "c:\\mm\\mmf\\testfiles\\mdf\\ogg-decode-in.ogg"); +_LIT(KTestEncoderPlayFile, "c:\\mm\\mmf\\testfiles\\mdf\\ogg-encode-in.wav"); + +// files we are going to record into, with expected sizes +_LIT(KTestDecoderRecordedFile, "c:\\ogg-decode-out.wav"); +const TInt KTestDecoderRecordedFileExpectedSize = 1066284; +_LIT(KTestEncoderRecordedFile, "c:\\ogg-encode-out.ogg"); +const TInt KTestEncoderRecordedFileExpectedSize = 54942; + +// sound parameters for init / config +// appropriate to our test files +const TInt KTestWavFormatPCMChunkHeaderSize = 36; +const TInt KTestWavFormatPCMSubchunk1Size = 16; +const TInt KTestAudioFormatPCM = 1; +const TInt KTestSampleRate = 44100; +const TInt KTestNumChannels = 2; +const TInt KTestBitsPerSample = 16; +const TInt KTestBitRate = 128000; + + +const TUint32 KMMFFourCCCodeTestVorbis = 0x32425256; //('V', 'R', 'B', '2') + +#endif // TSU_MDF_OMXVORBISCODECS_CONSTANTS_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_omx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_omx.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,425 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include "tsu_mdf_omxvorbiscodecs_omx.h" +#include +#include +#include +#include "PU/decoder/vorbisdecoderprocessingunit.h" +#include "PU/vorbisprocessingunituids.hrh" +// for the bitrate custom interface +#include + +#include + +// +// RTestStepOmxVorbisCodecOmx +// general tests relating to OpenMax layer + +/** + * Constructor + */ +RTestStepOmxVorbisCodecOmx::RTestStepOmxVorbisCodecOmx() + { + iTestStepName = _L("MM-MDF-OMXVORBISCODECS-U-0020-HP"); + iHeapSize = KTestHeapSize; + } + +/** + * @see MMdfProcessingUnitObserver + */ +void RTestStepOmxVorbisCodecOmx::InitializeComplete(const CMdfProcessingUnit* /* aPu */, TInt /* aErrorCode */) + { + } + +/** + * @see MMdfProcessingUnitObserver + */ +void RTestStepOmxVorbisCodecOmx::ExecuteComplete(const CMdfProcessingUnit* /* aPu */, TInt /* aErrorCode */) + { + } + +/** + * Do the test step + */ +TVerdict RTestStepOmxVorbisCodecOmx::DoTestStepL() + { + // *** TO DO + // (Mip/Mop)Configure / GetConfig() are largely stubbed for both PU and + // input / output ports in the Vorbis PU. + // This ought to be fixed. + + iVerdict = EPass; + + CMdfProcessingUnit* theDecPu=NULL; + CMdfProcessingUnit* theEncPu=NULL; + + _LIT8(KTestGarbage, "I am Garbage"); + + const TDesC8& testGarbageDes = KTestGarbage; + const MMdfProcessingUnitObserver* garbageObs = NULL; + + // NB we *deliberately* use an unsafe cast + garbageObs = (const MMdfProcessingUnitObserver*)&testGarbageDes; + + TInt err = OMX_Init(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't initialise OpenMax")); + return EFail; + } + + TRAPD(err1, theDecPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisDecoderPU) )); + if(err1 == KErrNone) + { + err1 = theDecPu->Create(*garbageObs); + } + + TRAPD(err2, theEncPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisEncoderPU) )); + if(err2 == KErrNone) + { + err2 = theEncPu->Create(*garbageObs); + } + + if(err1 || err2) + { + ERR_PRINTF1(_L("Error - couldn't initialise PUs (1)")); + delete theDecPu; + delete theEncPu; + OMX_Deinit(); + REComSession::FinalClose(); + return EFail; + } + + // re-initialise using ourselves as observer + delete theDecPu; + delete theEncPu; + TRAP(err1, theDecPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisDecoderPU) )); + if(err1 == KErrNone) + { + err1 = theDecPu->Create(*this); + } + + TRAP(err2, theEncPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisEncoderPU) )); + if(err2 == KErrNone) + { + err2 = theEncPu->Create(*this); + } + + if(err1 || err2) + { + ERR_PRINTF1(_L("Error - couldn't initialise PUs (2)")); + delete theDecPu; + delete theEncPu; + OMX_Deinit(); + REComSession::FinalClose(); + return EFail; + } + + RPointerArray ipa; + RPointerArray opa; + + // decoder + if(theDecPu) + { + MMdfInputPort* inputPort = NULL; + MMdfOutputPort* outputPort = NULL; + + err1 = theDecPu->GetInputPorts(ipa); + if(err1 == KErrNone && ipa.Count()) + { + inputPort = ipa[0]; + } + err2 = theDecPu->GetOutputPorts(opa); + if(err2 == KErrNone && opa.Count()) + { + outputPort = opa[0]; + } + + if(!inputPort || !outputPort) + { + ERR_PRINTF1(_L("Error - couldn't get input/output ports")); + iVerdict = EFail; + } + else + { + // set port observers + inputPort->MipSetObserver(*this); + outputPort->MopSetObserver(*this); + + // configure + TTaskConfig config; + config.iRate = 0; + config.iStereoMode = 0; + TPuTaskConfig puConfig2(config); + err = theDecPu->Configure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure PU")); + iVerdict = EFail; + } + err = theDecPu->GetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get PU configuration")); + iVerdict = EFail; + } + + // create / free buffers + CMMFBuffer* inputBuffer = NULL; + CMMFBuffer* outputBuffer = NULL; + + // try and create oversized buffers + inputBuffer = inputPort->MipCreateBuffer(20480000); + if(inputBuffer) + { + ERR_PRINTF1(_L("Error - oversize buffer creation was non-null")); + iVerdict = EFail; + } + outputBuffer = outputPort->MopCreateBuffer(0); + if(outputBuffer) + { + ERR_PRINTF1(_L("Error - zero buffer creation was non-null")); + iVerdict = EFail; + } + + TUint32 inputBufSize = 2048; + inputBufSize = inputPort->MipBufferSize(); + inputBuffer = inputPort->MipCreateBuffer(inputBufSize); + outputBuffer = outputPort->MopCreateBuffer(inputBufSize); + if(!inputBuffer || !outputBuffer) + { + ERR_PRINTF1(_L("Error - failed to create input or output buffer")); + iVerdict = EFail; + } + + // direct port config + err = inputPort->MipConfigure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure input port")); + iVerdict = EFail; + } + err = inputPort->MipGetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get input port configuration")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure output port")); + iVerdict = EFail; + } + err = outputPort->MopGetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get output port configuration")); + iVerdict = EFail; + } + + // --- get state + theDecPu->State(); + + // try and initialize twice; try and execute twice + + theDecPu->Initialize(); + theDecPu->Initialize(); + + theDecPu->Execute(); + theDecPu->Execute(); + + // try and action the ports when we're not running + // NB we should give some delay here so we don't free them before + // they are actioned + theDecPu->Pause(); + inputPort->MipWriteData(*inputBuffer); + outputPort->MopReadData(*outputBuffer); + User::After(2000000L); + + theDecPu->Stop(); + inputPort->MipWriteData(*inputBuffer); + outputPort->MopReadData(*outputBuffer); + User::After(2000000L); + + err = inputPort->MipFreeBuffer(inputBuffer); + err += outputPort->MopFreeBuffer(outputBuffer); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't free input/output buffer")); + iVerdict = EFail; + } + + opa.Close(); + ipa.Close(); + } + } + + // encoder + if(theEncPu) + { + MMdfInputPort* inputPort = NULL; + MMdfOutputPort* outputPort = NULL; + + err1 = theEncPu->GetInputPorts(ipa); + if(err1 == KErrNone && ipa.Count()) + { + inputPort = ipa[0]; + } + err2 = theEncPu->GetOutputPorts(opa); + if(err2 == KErrNone && opa.Count()) + { + outputPort = opa[0]; + } + + if(!inputPort || !outputPort) + { + ERR_PRINTF1(_L("Error - couldn't get input/output ports")); + iVerdict = EFail; + } + else + { + + // configure + TTaskConfig config; + config.iRate = 0; + config.iStereoMode = 0; + TPuTaskConfig puConfig2(config); + err = theEncPu->Configure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure PU")); + iVerdict = EFail; + } + err = theEncPu->GetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get PU configuration")); + iVerdict = EFail; + } + + // create / free buffers + CMMFBuffer* inputBuffer = NULL; + CMMFBuffer* outputBuffer = NULL; + + // try and create oversized buffers + inputBuffer = inputPort->MipCreateBuffer(20480000); + if(inputBuffer) + { + ERR_PRINTF1(_L("Error - oversize buffer creation was non-null")); + iVerdict = EFail; + } + outputBuffer = outputPort->MopCreateBuffer(0); + if(outputBuffer) + { + ERR_PRINTF1(_L("Error - zero buffer creation was non-null")); + iVerdict = EFail; + } + + TUint32 inputBufSize = 2048; + inputBufSize = inputPort->MipBufferSize(); + inputBuffer = inputPort->MipCreateBuffer(inputBufSize); + outputBuffer = outputPort->MopCreateBuffer(inputBufSize); + if(!inputBuffer || !outputBuffer) + { + ERR_PRINTF1(_L("Error - failed to create input or output buffer")); + iVerdict = EFail; + } + + // direct port config + err = inputPort->MipConfigure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure input port")); + iVerdict = EFail; + } + err = inputPort->MipGetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get input port configuration")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't configure output port")); + iVerdict = EFail; + } + err = outputPort->MopGetConfig(puConfig2); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't get output port configuration")); + iVerdict = EFail; + } + + // --- get state + theEncPu->State(); + + // try and initialize twice; try and execute twice + + theEncPu->Initialize(); + theEncPu->Initialize(); + + theEncPu->Execute(); + theEncPu->Execute(); + + // try and action the ports when we're not running + // NB we should give some delay here so we don't free them before + // they are actioned + + // *** there is a problem with this at the moment - + // VorbisEncoder will kern-exec:3 when passed garbage data + // directly. To be resolved before this test goes back in. + /* + CMMFDataBuffer* dataBuffer = static_cast(inputBuffer); + TUint8* data_pointer = const_cast(dataBuffer->Data().Ptr()); + memset(data_pointer, 0, dataBuffer->Data().MaxLength()); + dataBuffer = static_cast(outputBuffer); + data_pointer = const_cast(dataBuffer->Data().Ptr()); + memset(data_pointer, 0, dataBuffer->Data().MaxLength()); + + theEncPu->Pause(); + inputPort->MipWriteData(*inputBuffer); + outputPort->MopReadData(*outputBuffer); + User::After(2000000L); + */ + + err = inputPort->MipFreeBuffer(inputBuffer); + err += outputPort->MopFreeBuffer(outputBuffer); + if(err) + { + ERR_PRINTF1(_L("Error - couldn't free input/output buffer")); + iVerdict = EFail; + } + + opa.Close(); + ipa.Close(); + } + } + + delete theDecPu; + delete theEncPu; + OMX_Deinit(); + REComSession::FinalClose(); + return iVerdict; + } + +// end diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_omx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_omx.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,76 @@ +// Copyright (c) 2006-2009 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: +// Header file: OpenMax related tests for PREQ1024 OpenMax Vorbis PU. +// +// + +/** + @file tsu_mdf_omxvorbiscodecs_omx.h +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_OMX_H +#define TSU_MDF_OMXVORBISCODECS_OMX_H + +#include "tsu_mdf_omxvorbiscodecs_step.h" +#include +#include +#include + +class RTestStepOmxVorbisCodecs; + +/** + * + * Test Case : MM-MDF-OMXVORBISCODECS-U-0020-HP + * General testing relating to OpenMax layer + * + * @class RTestStepOmxVorbisCodecOmx + * + */ +class RTestStepOmxVorbisCodecOmx + : public RTestStepOmxVorbisCodecs, + public MMdfProcessingUnitObserver, + public MMdfInputPortObserver, + public MMdfOutputPortObserver + { +public: + // MMdfProcessingUnitObserver + void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); + + // MMdfInputPortObserver + virtual void MipoWriteDataComplete(const MMdfInputPort* /*aInputPort */, + CMMFBuffer* /* aBuffer */, TInt /* aErrorCode */) { } + virtual void MipoDisconnectTunnelComplete(const MMdfInputPort* /*aInputPort */, + TInt /* aErrorCode */) { } + virtual void MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort */, + TInt /* aErrorCode */) { } + + // MMdfOutputPortObserver + virtual void MopoReadDataComplete(const MMdfOutputPort* /* aOutputPort */, + CMMFBuffer* /* aBuffer */, TInt /* aErrorCode */) { } + virtual void MopoDisconnectTunnelComplete(const MMdfOutputPort* /* aOutputPort */, + TInt /* aErrorCode */) { } + virtual void MopoRestartTunnelComplete(const MMdfOutputPort* /* aOutputPort */, + TInt /* aErrorCode */) { } + + RTestStepOmxVorbisCodecOmx(); + virtual TVerdict DoTestStepL(); + +private: + TVerdict iVerdict; + }; + +#endif // TSU_MDF_OMXVORBISCODECS_OMX_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_play.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_play.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,614 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include "tsu_mdf_omxvorbiscodecs_play.h" +#include +#include + +#include + +// for ogg_packet +#include "ogg.h" + +// +// RTestStepOmxVorbisCodecPlay +// play a Vorbis file + +/** + * Constructor + */ +RTestStepOmxVorbisCodecPlay::RTestStepOmxVorbisCodecPlay() + { + iTestStepName = _L("MM-MDF-OMXVORBISCODECS-U-0001-HP"); + iHeapSize = KTestHeapSize; + } + +/** + * So that CPlayAudioFile can set the test verdict and output messages + */ +void RTestStepOmxVorbisCodecPlay::SetVerdict(TPtrC16 aText, TVerdict aVerdict) + { + iVerdict = aVerdict; + INFO_PRINTF2(_L("---> %s"), aText.Ptr()); + } + +/** + * Do the test step + */ +TVerdict RTestStepOmxVorbisCodecPlay::DoTestStepL() + { + iPlayAudioFile = CPlayAudioFile::NewL(this); + iPlayAudioFile->StartL(); + delete iPlayAudioFile; + return iVerdict; + } + +// +// CPlayAudioFile +// Active player for RTestStepOmxVorbisCodecPlay and derived test classes. + +/** + * Constructor + */ +CPlayAudioFile::CPlayAudioFile(RTestStepOmxVorbisCodecs* aParent) : + CActive(EPriorityNormal), + iState(EHwDeviceCreateAndInit), + iSourceFile(NULL), + iSourceFilePos(0), + iSourceFileReadPos(0), + iFinished(EFalse), + iParent(aParent) + { + } + +/** + * ConstructL + */ +void CPlayAudioFile::ConstructL() + { + // create an Ogg pager + iPager = COggPager::NewL(); + iStream = COggStream::NewL(); + + CActiveScheduler::Add(this); + } + +/** + * NewL + */ +CPlayAudioFile* CPlayAudioFile::NewL(RTestStepOmxVorbisCodecs* aParent) + { + CPlayAudioFile* self = new (ELeave) CPlayAudioFile(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * StartL + */ +void CPlayAudioFile::StartL() + { + SetState(EHwDeviceCreateAndInit); + CActiveScheduler::Start(); + } + +/** + * @see CActive + */ +void CPlayAudioFile::DoCancel() + { + } + +/** + * Destructor + */ +CPlayAudioFile::~CPlayAudioFile() + { + // delete Ogg pager + delete iStream; + delete iPager; + } + +/** + * SetState + */ +void CPlayAudioFile::SetState(TPlayAudioFileState aState) + { + iState = aState; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + +/** + * ReadTestFileInBuffer + * reads file into buffer referenced by iSourceFile + */ +TInt CPlayAudioFile::ReadTestFileInBuffer() + { + RFs fs; + fs.Connect(); + + RFile file; + TInt err = file.Open(fs, KTestDecoderPlayFile, EFileRead); + if (err == KErrNone) + { + TInt size; + err = file.Size(size); + if (err == KErrNone) + { + iSourceFile = HBufC8::NewMax(size); + if(!iSourceFile) + { + return KErrNoMemory; + } + TPtr8 ptr = iSourceFile->Des(); + file.Read(ptr,size); + file.Close(); + } + fs.Close(); + } + return err; + } + +/** + * @see MMMFHwDeviceObserver + */ +TInt CPlayAudioFile::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + // RDebug::Print(_L("CPlayAudioFile::FillThisHwBuffer")); + + ReadNextBuffer(aHwDataBuffer); + return KErrNone; + } + +/** + * @see MMMFHwDeviceObserver + */ +TInt CPlayAudioFile::EmptyThisHwBuffer(CMMFBuffer& aEmptyBufferPtr) + { + // RDebug::Print(_L("CPlayAudioFile::EmptyThisHwBuffer")); + + // write to file + CMMFDataBuffer* dataBuffer = static_cast(&aEmptyBufferPtr); + TInt err = KErrNone; + err = WriteDataToFile(dataBuffer->Data()); + if(err != KErrNone) + { + return err; + } + + err = iHwDevice->ThisHwBufferEmptied(aEmptyBufferPtr); + if(err != KErrNone) + { + return err; + } + + return err; + } + +/** + * writes decoded data to file + */ +TInt CPlayAudioFile::WriteDataToFile(TDes8& aData) + { + TInt err = KErrNone; + err = iRecordFile.Write(aData); + if(err != KErrNone) + { + return err; + } + // keep record of amount of data and the number of buffers written out + iWrittenDataTotal += aData.Size(); + iBuffersWrittenCount++; + return err; + } + +/** + * opens record file + */ +TInt CPlayAudioFile::SetUpRecordFile() + { + iFileServerSession.Connect(); + TInt err = iRecordFile.Replace(iFileServerSession, KTestDecoderRecordedFile, EFileWrite|EFileShareExclusive); + return err; + } + +/** + * closes record file + */ +void CPlayAudioFile::CloseRecordFile() + { + iRecordFile.Close(); + iFileServerSession.Close(); + } + +/** + * adds a WAV header to recorded data + */ +void CPlayAudioFile::AddWavHeader() + { + // add a WAV header to the decoded file, so we can play it + + HBufC8* rawDecFile = NULL; + RFs fs; + fs.Connect(); + + RFile file; + TInt err = file.Open(fs, KTestDecoderRecordedFile, EFileRead); + if (err != KErrNone) + { + iParent->SetVerdict(_L("Couldn't open recorded file for reading"), EFail); + return; + } + + TInt size; + err = file.Size(size); + if (err != KErrNone) + { + iParent->SetVerdict(_L("Recorded file was empty"), EFail); + return; + } + + rawDecFile = HBufC8::NewMax(size); + if(!rawDecFile) + { + iParent->SetVerdict(_L("Couldn't allocate memory to read back recorded file"), EFail); + return; + } + + TPtr8 ptr = rawDecFile->Des(); + file.Read(ptr,size); + file.Close(); + + // add headers + err = file.Replace(fs, KTestDecoderRecordedFile, EFileWrite); + if (err != KErrNone) + { + iParent->SetVerdict(_L("Couldn't open recorded file for writing wave headers"), EFail); + return; + } + + // this is canonical WAV file format header + TInt32 chunkSize = size + KTestWavFormatPCMChunkHeaderSize; + TInt32 subchunk1size = KTestWavFormatPCMSubchunk1Size; + TInt16 audioFormat = KTestAudioFormatPCM; + TInt16 numChannels = KTestNumChannels; + TInt32 sampleRate = KTestSampleRate; + TInt16 bitsPerSample = KTestBitsPerSample; + TInt32 byteRate = sampleRate * numChannels * (bitsPerSample / 8); + TInt16 blockAlign = numChannels * (bitsPerSample / 8); + TInt32 subchunk2size = size; + + file.Write(_L8("RIFF")); + { TPtrC8 buf((TText8*)&chunkSize,sizeof(TInt32)); file.Write(buf); } + file.Write(_L8("WAVEfmt ")); + { TPtrC8 buf((TText8*)&subchunk1size,sizeof(TInt32)); file.Write(buf); } + { TPtrC8 buf((TText8*)&audioFormat,sizeof(TInt16)); file.Write(buf); } + { TPtrC8 buf((TText8*)&numChannels,sizeof(TInt16)); file.Write(buf); } + { TPtrC8 buf((TText8*)&sampleRate,sizeof(TInt32)); file.Write(buf); } + { TPtrC8 buf((TText8*)&byteRate,sizeof(TInt32)); file.Write(buf); } + { TPtrC8 buf((TText8*)&blockAlign,sizeof(TInt16)); file.Write(buf); } + { TPtrC8 buf((TText8*)&bitsPerSample,sizeof(TInt16)); file.Write(buf); } + file.Write(_L8("data")); + { TPtrC8 buf((TText8*)&subchunk2size,sizeof(TInt32)); file.Write(buf); } + file.Write(ptr,size); + + // store file size + file.Size(iWrittenDataTotal); + + file.Close(); + fs.Close(); + } + +/** + * send chunks of data into the encoder. + */ +void CPlayAudioFile::ReadNextBuffer(CMMFBuffer& aHwDataBuffer) + { + // Logic of ReadNextBuffer is similar to logic of COggPlayController's + // SendPacketToSinkL + + CMMFDataBuffer* dataBuffer = static_cast(&aHwDataBuffer); + while (ETrue) + { + // check if finished + if (iFinished) + { + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + SetState(EHwDeviceAllowToComplete); + return; + } + + TInt srcLength = iSourceFile->Size(); + TInt err = iStream->PacketOut(iPacket); + if (err == KErrNone) + { + // put the packet into the data buffer. + // ensure it's fully copied. + ogg_packet pckt; + pckt.packet = reinterpret_cast(const_cast(iPacket.iData.Ptr())); + pckt.bytes = iPacket.iData.Length(); + + TUint8* data_pointer = const_cast(dataBuffer->Data().Ptr()); + + long begin =pckt.packet->begin; //position in buffer for start of packet + long length = pckt.packet->length; //length of packet + + ogg_buffer *buffer= pckt.packet->buffer; //pointer to buffer + ogg_reference *next= pckt.packet->next; //pointer to next ogg reference if needed + + //buffer details + unsigned char *data = buffer->data; + //Keep record of how far through data buffer + TInt ptr_count=0; + + //read data from first buffer + for(int i=0;ibegin; //position in buffer for start of packet + length = pckt.packet->length; //length of packet + + buffer= pckt.packet->buffer; //pointer to buffer + next= pckt.packet->next; //pointer to next ogg reference if needed + + data = buffer->data; + + //read data + for(int i=0;iData().SetLength(ptr_count); + + // set SourceFilePos to this length, so we read from the + // correct position next time + iSourceFilePos += ptr_count; + iSourceFileReadPos = iSourceFilePos; + + // callback + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + return; + } + else + { + err = iPager->NextPage(iPage); + if (err==KErrNone) + { + iStream->PageIn(iPage); + } + else + { + + // NB file position (from last read) is what we should be + // checking, not fileposition decoded + + // request for more data + if (iSourceFileReadPos < srcLength) + { + TInt size = srcLength - iSourceFilePos; + TPtr8 buf(NULL, 0); + if (size > dataBuffer->Data().MaxLength()) + { + size = dataBuffer->Data().MaxLength(); + } + err = iPager->GetBuffer(buf, size); + if(!err) + { + Mem::Copy((TAny*)buf.Ptr(), (TAny*)iSourceFile->Mid(iSourceFilePos).Ptr(), size); + buf.SetLength(size); + err = iPager->DataWritten(buf); + iSourceFileReadPos += size; + + RDebug::Print(_L("CPlayAudioFile::data read = %d bytes"), iSourceFileReadPos); + } + } + else + { + // no more data + RDebug::Print(_L("CPlayAudioFile::end of data")); + iFinished = ETrue; + dataBuffer->SetLastBuffer(ETrue); + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + SetState(EHwDeviceAllowToComplete); + return; + } + } + } + } + } + +/** + * @see CActive + */ +void CPlayAudioFile::RunL() + { + THwDeviceInitParams initParams; + TInt err; + switch (iState) + { + case EHwDeviceCreateAndInit: + { + err = OMX_Init(); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The OMX Core cannot be initialised"), EFail); + SetState(EHwDeviceError); + } + initParams.iHwDeviceObserver = this; + + // now using the AudioCodecTestAdapter + TRAP(err, iHwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioCodecTestAdapter))); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The Hw Device Adapter cannot be created"), EFail); + OMX_Deinit(); + SetState(EHwDeviceError); + } + MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)iHwDevice->CustomInterface(KUidHwDeviceSetupInterface); + if (setup != NULL) + { + //Play is Vorbis -> pcm16 + TRAP(err,setup->SetDataTypesL(KMMFFourCCCodeTestVorbis, KMMFFourCCCodePCM16)); + if(err==KErrNotFound) + { + iParent->SetVerdict(_L("Cannot Load pu"),EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + break; + } + } + err = iHwDevice->Init(initParams); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot be initialised")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter created & initialised")); + SetState(EHwDeviceStartDecode); + break; + } + case EHwDeviceStartDecode: + { + // if we are playing a file, first we have to open the file + err = ReadTestFileInBuffer(); + if (err == KErrNotFound) + { + CleanupAndSetDeviceError(_L("Cannot open the file to be played")); + break; + } + iParent->SetVerdict(_L("The file to be played has opened successfully")); + + err = SetUpRecordFile(); + if (err) + { + CleanupAndSetDeviceError(_L("Cannot open the file to record")); + break; + } + + // tell the HwDeviceAdapter to play the file + err = iHwDevice->Start(EDevDecode, EDevInFlow); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot start")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter has started successfully")); + break; + } + case EHwDeviceAllowToComplete: + break; + case EHwDeviceDone: + { + delete iHwDevice; + OMX_Deinit(); + Cancel(); + CActiveScheduler::Stop(); + CloseRecordFile(); + + // add wave header + AddWavHeader(); + + // check the recorded file against expected file size for the test to pass. + if(iWrittenDataTotal != KTestDecoderRecordedFileExpectedSize) + { + iParent->SetVerdict(_L("Unexpected amount of data written to file"), EFail); + } + + break; + } + case EHwDeviceError: + { + CActiveScheduler::Stop(); + break; + } + default: + { + CleanupAndSetDeviceError(_L("Unknown CPlayAudioFile iState")); + break; + } + } + } + +/** + * will close down the hardware device on error + */ +void CPlayAudioFile::CleanupAndSetDeviceError(TPtrC16 aText) + { + iParent->SetVerdict(aText, EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + } + +/** + * @see MMMFHwDeviceObserver + */ +void CPlayAudioFile::Error(TInt aError) + { + // Completion is signified by :- + // (a) KErrUnderflow + // (b) KErrNone, iStoppedReceived and iFinished) + + if (aError == KErrUnderflow && iStoppedReceived) + { + iParent->SetVerdict(_L("Success (KErrUnderflow)")); + } + else if (aError == KErrNone && iStoppedReceived && iFinished) + { + iParent->SetVerdict(_L("Success (iFinished)")); + } + else + { + iParent->SetVerdict(_L("Error from Hw Device"), EFail); + } + SetState(EHwDeviceDone); + } + +/** + * @see MMMFHwDeviceObserver + */ +void CPlayAudioFile::Stopped() + { + iStoppedReceived = ETrue; + } + +// end diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_play.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_play.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,126 @@ +// Copyright (c) 2006-2009 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: +// Header file: Play related tests for PREQ1024 OpenMax Vorbis PU. +// +// + +/** + @file tsu_mdf_omxvorbiscodecs_play.h +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_PLAY_H +#define TSU_MDF_OMXVORBISCODECS_PLAY_H + +#include "tsu_mdf_omxvorbiscodecs_step.h" +#include +#include + +class RTestStepOmxVorbisCodecs; +class CPlayAudioFile; + +/** + * + * Test Case : MM-MDF-OMXVORBISCODECS-U-0001-HP + * Play a Vorbis file + * + * @class RTestStepOmxVorbisCodecPlay + * + */ +class RTestStepOmxVorbisCodecPlay : public RTestStepOmxVorbisCodecs + { +public: + RTestStepOmxVorbisCodecPlay(); + virtual TVerdict DoTestStepL(); + void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass); +private: + CPlayAudioFile* iPlayAudioFile; + TVerdict iVerdict; + + }; + +/** + * + * Active player for RTestStepOmxVorbisCodecPlay and derived test classes. + * + * @class CPlayAudioFile + * + */ +class CPlayAudioFile : public CActive, public MMMFHwDeviceObserver + { +public: +enum TPlayAudioFileState + { + EHwDeviceCreateAndInit, + EHwDeviceStartDecode, + EHwDeviceStartEncode, + //EHwDevicePlayFile, //used? + EHwDeviceAllowToComplete, + EHwDeviceEncodeCheckData, + EHwDeviceDone, + EHwDeviceError + }; +public: + static CPlayAudioFile* NewL(RTestStepOmxVorbisCodecs* aParent); + ~CPlayAudioFile(); + void RunL(); + void DoCancel(); + void StartL(); + TInt ReadTestFileInBuffer(); + void SetState(TPlayAudioFileState aState); + void ReadNextBuffer(CMMFBuffer& aHwDataBuffer); + + TInt SetUpRecordFile(); + void CloseRecordFile(); + void AddWavHeader(); + TInt WriteDataToFile(TDes8& aHwDataBuffer); + + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt MsgFromHwDevice(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {return 0;} + virtual void Stopped(); + virtual void Error(TInt aError=KErrNone); + + void CleanupAndSetDeviceError(TPtrC16 aText); + +private: + CPlayAudioFile(RTestStepOmxVorbisCodecs* aParent); + void ConstructL(); + +private: + // data section + RFs iFileServerSession; + TPlayAudioFileState iState; + HBufC8* iSourceFile; + TInt iSourceFilePos; + TInt iSourceFileReadPos; + TBool iFinished; + CMMFHwDevice* iHwDevice; + RTestStepOmxVorbisCodecs* iParent; + TBool iStoppedReceived; + + // for record file + RFile iRecordFile; + TInt iWrittenDataTotal; + TInt iBuffersWrittenCount; + + // for Ogg pager + COggPager* iPager; + COggStream* iStream; + TOggPage iPage; + TOggPacket iPacket; + }; + +#endif // TSU_MDF_OMXVORBISCODECS_PLAY_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_pu.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_pu.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,331 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include "tsu_mdf_omxvorbiscodecs_pu.h" +#include +#include +#include +#include "PU/decoder/vorbisdecoderprocessingunit.h" +#include "PU/vorbisprocessingunituids.hrh" +// for the bitrate custom interface +#include + +#include + +// +// RTestStepOmxVorbisCodecPu +// general tests relating to Processing Unit + +/** + * Constructor + */ +RTestStepOmxVorbisCodecPu::RTestStepOmxVorbisCodecPu() + { + iTestStepName = _L("MM-MDF-OMXVORBISCODECS-U-0010-HP"); + iHeapSize = KTestHeapSize; + } + +/** + * Do the test step + */ +TVerdict RTestStepOmxVorbisCodecPu::DoTestStepL() + { + iVerdict = EPass; + + // try and create PUs with invalid observers. it should succeed. + + _LIT8(KTestGarbage, "I am Garbage"); + const TDesC8& testGarbageDes = KTestGarbage; + const MMdfProcessingUnitObserver* garbageObs = NULL; + + // NB: we *deliberately* use an unsafe cast + garbageObs = (const MMdfProcessingUnitObserver*)&testGarbageDes; + + CMdfProcessingUnit* theDecPu = NULL; + CMdfProcessingUnit* theEncPu = NULL; + + TInt err = OMX_Init(); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't initialise OpenMax")); + return EFail; + } + + TRAPD(err1, theDecPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisDecoderPU) )); + if(err1 == KErrNone) + { + err1 = theDecPu->Create(*garbageObs); + } + + TRAPD(err2, theEncPu = CMdfProcessingUnit::NewL(TUid::Uid(KUidVorbisEncoderPU) )); + if(err2 == KErrNone) + { + err2 = theEncPu->Create(*garbageObs); + } + + if(err1 || err2) + { + ERR_PRINTF1(_L("Error - couldn't initialise PUs")); + delete theDecPu; + delete theEncPu; + OMX_Deinit(); + REComSession::FinalClose(); + return EFail; + } + + // --- test : configure the ports with different params + + RPointerArray ipa; + RPointerArray opa; + TTaskConfig config; + + // decoder tests + if(theDecPu) + { + MMdfInputPort* inputPort = NULL; + MMdfOutputPort* outputPort = NULL; + + err1 = theDecPu->GetInputPorts(ipa); + if(err1 == KErrNone && ipa.Count()) + { + inputPort = ipa[0]; + } + err2 = theDecPu->GetOutputPorts(opa); + if(err2 == KErrNone && opa.Count()) + { + outputPort = opa[0]; + } + + if(!inputPort || !outputPort) + { + ERR_PRINTF1(_L("Error - couldn't get input/output ports")); + } + else + { + config.iRate = 0; + config.iStereoMode = 0; + + TPuTaskConfig puConfig(config); + err = inputPort->MipConfigure(puConfig); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure input port (1)")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure output port (1)")); + iVerdict = EFail; + } + + config.iStereoMode |= ETaskMono; + config.iStereoMode |= ETaskInterleaved; + + TPuTaskConfig puConfig2(config); + err = inputPort->MipConfigure(puConfig2); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure input port (2)")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig2); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure output port (2)")); + iVerdict = EFail; + } + + // now cast a different type so that it's not recognised + TPuConfig* puConfig3 = (TPuConfig*)&testGarbageDes; + err = inputPort->MipConfigure(*puConfig3); + if(err != KErrNotSupported) + { + ERR_PRINTF2(_L("Error - configure input port (3) returned %d"), err); + iVerdict = EFail; + } + err = outputPort->MopConfigure(*puConfig3); + if(err != KErrNotSupported) + { + ERR_PRINTF2(_L("Error - configure output port (3) returned %d"), err); + iVerdict = EFail; + } + + opa.Close(); + ipa.Close(); + } + } + + // encoder tests + if(theEncPu) + { + MMdfInputPort* inputPort = NULL; + MMdfOutputPort* outputPort = NULL; + + err1 = theEncPu->GetInputPorts(ipa); + if(err1 == KErrNone && ipa.Count()) + { + inputPort = ipa[0]; + } + err2 = theEncPu->GetOutputPorts(opa); + if(err2 == KErrNone && opa.Count()) + { + outputPort = opa[0]; + } + + if(!inputPort || !outputPort) + { + ERR_PRINTF1(_L("Error - couldn't get input/output ports")); + } + else + { + config.iRate = 0; + config.iStereoMode = 0; + + TPuTaskConfig puConfig(config); + err = inputPort->MipConfigure(puConfig); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure input port (1)")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure output port (1)")); + iVerdict = EFail; + } + + config.iStereoMode |= ETaskMono; + config.iStereoMode |= ETaskInterleaved; + + TPuTaskConfig puConfig2(config); + err = inputPort->MipConfigure(puConfig2); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure input port (2)")); + iVerdict = EFail; + } + err = outputPort->MopConfigure(puConfig2); + if(err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't configure output port (2)")); + iVerdict = EFail; + } + + // now cast a different type so that it's not recognised + TPuConfig* puConfig3 = (TPuConfig*)&testGarbageDes; + err = inputPort->MipConfigure(*puConfig3); + if(err != KErrNotSupported) + { + ERR_PRINTF2(_L("Error - configure input port (3) returned %d"), err); + iVerdict = EFail; + } + err = outputPort->MopConfigure(*puConfig3); + if(err != KErrNotSupported) + { + ERR_PRINTF2(_L("Error - configure output port (3) returned %d"), err); + iVerdict = EFail; + } + + opa.Close(); + ipa.Close(); + } + } + + // --- test : custom interface on encoder + + // invalid uid + TUid garbageUid = {0x12345678}; + MMMFDevSoundCustomInterfaceBitRate* bitrateCI = (MMMFDevSoundCustomInterfaceBitRate*)theEncPu->CustomInterface(garbageUid); + if (bitrateCI != NULL) + { + ERR_PRINTF2(_L("Error - CustomInterface returned 0x%08x"), bitrateCI); + iVerdict = EFail; + } + + err = theEncPu->CreateCustomInterface(garbageUid); + if (err == KErrNone) + { + ERR_PRINTF2(_L("Error - CreateCustomInterface returned %d"), err); + iVerdict = EFail; + } + + // create + err = theEncPu->CreateCustomInterface(KUidCustomInterfaceDevSoundBitRate); + if (err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't create custom interface")); + iVerdict = EFail; + } + + // fetch & use + bitrateCI = (MMMFDevSoundCustomInterfaceBitRate*)theEncPu->CustomInterface(KUidCustomInterfaceDevSoundBitRate); + if (bitrateCI == NULL) + { + ERR_PRINTF1(_L("Error - couldn't get custom interface")); + iVerdict = EFail; + } + else + { + TRAP(err, bitrateCI->SetBitRateL(KTestBitRate)); + if (err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't set bitrate")); + iVerdict = EFail; + } + + TInt thisBitRate = 0; + TRAP(err, thisBitRate = bitrateCI->BitRateL()); + if (err != KErrNone || thisBitRate > KTestBitRate) + { + ERR_PRINTF1(_L("Error - couldn't get bitrate, or bitrate incorrect")); + iVerdict = EFail; + } + + RArray bitRates; + TRAP(err, bitrateCI->GetSupportedBitRatesL(bitRates)); + if (err != KErrNone) + { + ERR_PRINTF1(_L("Error - couldn't get supported bitrates")); + iVerdict = EFail; + } + TInt count = bitRates.Count(); + if(count <= 0) + { + ERR_PRINTF1(_L("Error - zero supported bitrates")); + iVerdict = EFail; + } + bitRates.Close(); + + } + + + // --- + + delete theDecPu; + delete theEncPu; + OMX_Deinit(); + + REComSession::FinalClose(); + return iVerdict; + } + +// end diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_pu.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_pu.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2006-2009 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: +// Header file: PU related tests for PREQ1024 OpenMax Vorbis PU. +// +// + +/** + @file tsu_mdf_omxvorbiscodecs_pu.h +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_PU_H +#define TSU_MDF_OMXVORBISCODECS_PU_H + +#include "tsu_mdf_omxvorbiscodecs_step.h" +#include +#include + +class RTestStepOmxVorbisCodecs; + +/** + * + * Test Case : MM-MDF-OMXVORBISCODECS-U-0010-HP + * General testing relating to PU layer + * + * @class RTestStepOmxVorbisCodecPu + * + */ +class RTestStepOmxVorbisCodecPu : public RTestStepOmxVorbisCodecs + { +public: + RTestStepOmxVorbisCodecPu(); + virtual TVerdict DoTestStepL(); +private: + TVerdict iVerdict; + }; + +#endif // TSU_MDF_OMXVORBISCODECS_PU_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_record.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_record.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,470 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include "tsu_mdf_omxvorbiscodecs_record.h" +#include +#include +#include + +// for the bitrate custom interface +#include + +// +// RTestStepOmxVorbisCodecRecord +// record a Vorbis file + +/** + * Constructor + */ +RTestStepOmxVorbisCodecRecord::RTestStepOmxVorbisCodecRecord() + { + iTestStepName = _L("MM-MDF-OMXVORBISCODECS-U-0002-HP"); + iHeapSize = KTestHeapSize; + } + +/** + * So that CRecordAudioFile can set the test verdict and output messages + */ +void RTestStepOmxVorbisCodecRecord::SetVerdict(TPtrC16 aText, TVerdict aVerdict) + { + iVerdict = aVerdict; + INFO_PRINTF2(_L("---> %s"), aText.Ptr()); + } + +/** + * Do the test step + */ +TVerdict RTestStepOmxVorbisCodecRecord::DoTestStepL() + { + iRecordAudioFile = CRecordAudioFile::NewL(this); + iRecordAudioFile->StartL(); + delete iRecordAudioFile; + return iVerdict; + } + +// instructs the Hw Device Adapter to record a file +CRecordAudioFile::CRecordAudioFile(RTestStepOmxVorbisCodecs* aParent) : + CActive(EPriorityNormal), + iState(EHwDeviceCreateAndInit), + iParent(aParent) + { + } + +// +// CRecordAudioFile +// Active recorder for RTestStepOmxVorbisCodecRecord and derived test classes. + +/** + * ConstructL + */ +void CRecordAudioFile::ConstructL() + { + CActiveScheduler::Add(this); + } + +/** + * NewL + */ +CRecordAudioFile* CRecordAudioFile::NewL(RTestStepOmxVorbisCodecs* aParent) + { + CRecordAudioFile* self = new (ELeave) CRecordAudioFile(aParent); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +/** + * StartL + */ +void CRecordAudioFile::StartL() + { + SetState(EHwDeviceCreateAndInit); + CActiveScheduler::Start(); + } + +/** + * @see CActive + */ +void CRecordAudioFile::DoCancel() + { + } + +/** + * Destructor + */ +CRecordAudioFile::~CRecordAudioFile() + { + } + +/** + * SetState + */ +void CRecordAudioFile::SetState(TRecordAudioFileState aState) + { + iState = aState; + SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + } + +/** + * ReadTestFileInBuffer + * reads file into buffer referenced by iSourceFile + */ +TInt CRecordAudioFile::ReadTestFileInBuffer() + { + // we don't need to strip off the wav header + + RFs fs; + fs.Connect(); + + RFile file; + TInt err = file.Open(fs, KTestEncoderPlayFile, EFileRead); + if (err == KErrNone) + { + TInt size; + err = file.Size(size); + if (err == KErrNone) + { + iSourceFile = HBufC8::NewMax(size); + if(!iSourceFile) + { + return KErrNoMemory; + } + TPtr8 ptr = iSourceFile->Des(); + file.Read(ptr,size); + file.Close(); + } + fs.Close(); + } + return err; + } + +/** + * @see MMMFHwDeviceObserver + */ +TInt CRecordAudioFile::FillThisHwBuffer(CMMFBuffer& aHwDataBuffer) + { + // RDebug::Print(_L("CRecordAudioFile::FillThisHwBuffer")); + + ReadNextBuffer(aHwDataBuffer); + return KErrNone; + } + +/** + * @see MMMFHwDeviceObserver + */ +TInt CRecordAudioFile::EmptyThisHwBuffer(CMMFBuffer& aEmptyBufferPtr) + { + // RDebug::Print(_L("CRecordAudioFile::EmptyThisHwBuffer")); + + CMMFDataBuffer* dataBuffer = static_cast(&aEmptyBufferPtr); + TInt err = KErrNone; + if(dataBuffer->Data().Size()) + { + RDebug::Print(_L("CRecordAudioFile writing buffer size %d"), dataBuffer->Data().Size()); + err = WriteDataToFile(dataBuffer->Data()); + if(err != KErrNone) + { + return err; + } + } + + err = iHwDevice->ThisHwBufferEmptied(aEmptyBufferPtr); + if(err != KErrNone) + { + return err; + } + + if(dataBuffer->LastBuffer()) + { + SetState(EHwDeviceEncodeCheckData); + iHwDevice->Stop(); + } + return err; + } + +TInt CRecordAudioFile::WriteDataToFile(TDes8& aData) + { + TInt err = KErrNone; + err = iRecordFile.Write(aData); + if(err != KErrNone) + { + return err; + } + // keep record of amount of data and the number of buffers written out + iWrittenDataTotal += aData.Size(); + iBuffersWrittenCount++; + RDebug::Print(_L("CRecordAudioFile: buffers written %d, total bytes %d"), iBuffersWrittenCount, iWrittenDataTotal); + return err; + } + +/** + * opens record file + */ +TInt CRecordAudioFile::SetUpRecordFile() + { + iFileServerSession.Connect(); + TInt err = iRecordFile.Replace(iFileServerSession, KTestEncoderRecordedFile, EFileWrite|EFileShareExclusive); + return err; + } + +/** + * closes record file + */ +void CRecordAudioFile::CloseRecordFile() + { + iRecordFile.Close(); + iFileServerSession.Close(); + } + +/** + * send chunks of data into the encoder. + */ +void CRecordAudioFile::ReadNextBuffer(CMMFBuffer& aHwDataBuffer) + { + // check if finished + if (iFinished) + { + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + SetState(EHwDeviceAllowToComplete); + return; + } + + // get a chunk of data and send it straight to the encoder + CMMFDataBuffer* dataBuffer = static_cast(&aHwDataBuffer); + + TInt srcLength = iSourceFile->Size(); + if (iSourceFileReadPos < srcLength) + { + TUint8* data_pointer = const_cast(dataBuffer->Data().Ptr()); + + TInt size = srcLength - iSourceFileReadPos; + if (size > dataBuffer->Data().MaxLength()) + { + size = dataBuffer->Data().MaxLength(); + } + Mem::Copy((TAny*)data_pointer, (TAny*)iSourceFile->Mid(iSourceFileReadPos).Ptr(), size); + + // set buffer size into the CMMFBuffer + dataBuffer->Data().SetLength(size); + iSourceFileReadPos += size; + + RDebug::Print(_L("CRecordAudioFile::data read = %d bytes"), iSourceFileReadPos); + + // callback + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + } + else + { + // no more data + RDebug::Print(_L("CRecordAudioFile::end of data")); + iFinished = ETrue; + dataBuffer->SetLastBuffer(ETrue); + iHwDevice->ThisHwBufferFilled(aHwDataBuffer); + SetState(EHwDeviceAllowToComplete); + } + } + +/** + * @see CActive + */ +void CRecordAudioFile::RunL() + { + THwDeviceInitParams initParams; + TInt err; + switch (iState) + { + case EHwDeviceCreateAndInit: + { + err = OMX_Init(); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The OMX Core cannot be initialised"), EFail); + SetState(EHwDeviceError); + } + initParams.iHwDeviceObserver = this; + + // now using the AudioCodecTestAdapter + TRAP(err, iHwDevice = CMMFHwDevice::NewL(TUid::Uid(KUidHwDeviceAudioCodecTestAdapter))); + if (err != KErrNone) + { + iParent->SetVerdict(_L("The Hw Device Adapter cannot be created"), EFail); + OMX_Deinit(); + SetState(EHwDeviceError); + } + MMdfHwDeviceSetup* setup = (MMdfHwDeviceSetup*)iHwDevice->CustomInterface(KUidHwDeviceSetupInterface); + if (setup != NULL) + { + //Record is pcm16 -> pcmU8 + setup->SetDataTypesL(KMMFFourCCCodePCM16, KMMFFourCCCodeTestVorbis); + } + err = iHwDevice->Init(initParams); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot be initialised")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter created & initialised")); + SetState(EHwDeviceStartEncode); + break; + } + case EHwDeviceStartEncode: + { + // if we are playing a file, first we have to open the file + err = ReadTestFileInBuffer(); + if (err == KErrNotFound) + { + CleanupAndSetDeviceError(_L("Cannot open the file to be played")); + break; + } + iParent->SetVerdict(_L("The file to be played has opened successfully")); + + err = SetUpRecordFile(); + if (err) + { + CleanupAndSetDeviceError(_L("Cannot open the file to record")); + break; + } + + // configure the HwDevice + TTaskConfig config; + config.iUid = KUidTTaskConfig; + config.iRate = KTestSampleRate; + config.iStereoMode = KTestNumChannels; + err = iHwDevice->SetConfig(config); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot configure")); + break; + } + + // set bitrate in the encoder - this requires a custom interface + MMMFDevSoundCustomInterfaceBitRate* bitrateCI = (MMMFDevSoundCustomInterfaceBitRate*)iHwDevice->CustomInterface(KUidCustomInterfaceDevSoundBitRate); + if (bitrateCI == NULL) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot find a bitrate custom interface")); + break; + } + else + { + TRAP(err, bitrateCI->SetBitRateL(KTestBitRate)); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter failed to set the bitrate")); + break; + } + } + + // tell the HwDeviceAdapter to record the file + err = iHwDevice->Start(EDevEncode, EDevOutFlow); + if (err != KErrNone) + { + CleanupAndSetDeviceError(_L("The Hw Device Adapter cannot start")); + break; + } + iParent->SetVerdict(_L("The Hw Device Adapter has started successfully")); + SetState(EHwDeviceAllowToComplete); + break; + } + case EHwDeviceEncodeCheckData: + { + iParent->SetVerdict(_L("The Hw Device Adapter has stopped successfully")); + TInt fileSize = 0; + err = iRecordFile.Size(fileSize); + if(err != KErrNone) + { + CleanupAndSetDeviceError(_L("Problem with accessing the file after writing to it")); + break; + } + + // check the recorded file against expected file size for the test to pass. + if(fileSize != KTestEncoderRecordedFileExpectedSize) + { + CleanupAndSetDeviceError(_L("Unexpected amount of data written to file")); + break; + } + // encode succeeded + SetState(EHwDeviceDone); + break; + } + case EHwDeviceAllowToComplete: + break; + case EHwDeviceDone: + { + delete iHwDevice; + OMX_Deinit(); + Cancel(); + CActiveScheduler::Stop(); + CloseRecordFile(); + break; + } + case EHwDeviceError: + { + CActiveScheduler::Stop(); + CloseRecordFile(); + break; + } + default: + { + CleanupAndSetDeviceError(_L("Unknown CRecordAudioFile iState")); + break; + } + } + } + +/** + * will close down the hardware device on error + */ +void CRecordAudioFile::CleanupAndSetDeviceError(TPtrC16 aText) + { + iParent->SetVerdict(aText, EFail); + delete iHwDevice; + OMX_Deinit(); + SetState(EHwDeviceError); + } + +/** + * @see MMMFHwDeviceObserver + */ +void CRecordAudioFile::Error(TInt aError) + { + // Completion is signified by KErrUnderflow + if (aError == KErrUnderflow && iStoppedReceived) + { + iParent->SetVerdict(_L("Success")); + } + else + { + iParent->SetVerdict(_L("Error from Hw Device"), EFail); + } + SetState(EHwDeviceDone); + } + +/** + * @see MMMFHwDeviceObserver + */ +void CRecordAudioFile::Stopped() + { + iStoppedReceived = ETrue; + } + +// end diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_record.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_record.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,116 @@ +// Copyright (c) 2006-2009 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: +// Header file: Record related tests for PREQ1024 OpenMax Vorbis PU. +// +// + +/** + @file tsu_mdf_omxvorbiscodecs_record.h +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_RECORD_H +#define TSU_MDF_OMXVORBISCODECS_RECORD_H + +#include "tsu_mdf_omxvorbiscodecs_step.h" +#include + +class RTestStepOmxVorbisCodecs; +class CRecordAudioFile; +class CMTSU_MDF_OMXVORBISCODECS_STEP_HdfTimerRecordStop; + +/** + * + * Test Case : MM-MDF-OMXVORBISCODECS-U-0002-HP + * Record a Vorbis file + * + * @class RTestStepOmxVorbisCodecRecord + * + */ +class RTestStepOmxVorbisCodecRecord : public RTestStepOmxVorbisCodecs + { +public: + RTestStepOmxVorbisCodecRecord(); + virtual TVerdict DoTestStepL(); + void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass); +private: + CRecordAudioFile* iRecordAudioFile; + TVerdict iVerdict; + }; + +/** + * + * Active recorder for RTestStepOmxVorbisCodecRecord and derived test classes. + * + * @class CRecordAudioFile + * + */ +class CRecordAudioFile : public CActive, public MMMFHwDeviceObserver + { +public: +enum TRecordAudioFileState + { + EHwDeviceCreateAndInit, + EHwDeviceStartDecode, + EHwDeviceStartEncode, + //EHwDevicePlayFile, //used? + EHwDeviceAllowToComplete, + EHwDeviceEncodeCheckData, + EHwDeviceDone, + EHwDeviceError + }; + +public: + static CRecordAudioFile* NewL(RTestStepOmxVorbisCodecs* aParent); + ~CRecordAudioFile(); + void RunL(); + void DoCancel(); + void StartL(); + TInt SetUpRecordFile(); + void CloseRecordFile(); + TInt WriteDataToFile(TDes8& aHwDataBuffer); + void SetState(TRecordAudioFileState aState); + TInt ReadTestFileInBuffer(); + void ReadNextBuffer(CMMFBuffer& aHwDataBuffer); + + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwDataBuffer); + virtual TInt MsgFromHwDevice(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {return 0;} + virtual void Stopped(); + virtual void Error(TInt aError=KErrNone); + + void CleanupAndSetDeviceError(TPtrC16 aText); + +private: + CRecordAudioFile(RTestStepOmxVorbisCodecs* aParent); + void ConstructL(); + +private: + // data section + RFs iFileServerSession; + RFile iRecordFile; + TRecordAudioFileState iState; + HBufC8* iSourceFile; + TInt iSourceFileReadPos; + TBool iFinished; + CMMFHwDevice* iHwDevice; + RTestStepOmxVorbisCodecs* iParent; + TInt iWrittenDataTotal; + TInt iBuffersWrittenCount; + TInt iLastBufferSize; + TBool iStoppedReceived; + }; + +#endif // TSU_MDF_OMXVORBISCODECS_RECORD_H + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_step.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_step.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#include +#include "tsu_mdf_omxvorbiscodecs_step.h" + +RTestStepOmxVorbisCodecs::RTestStepOmxVorbisCodecs() + { + } + +RTestStepOmxVorbisCodecs::~RTestStepOmxVorbisCodecs() + { + // nothing here just yet + } + +TVerdict RTestStepOmxVorbisCodecs::OpenL() + { + iActiveScheduler = new(ELeave) CActiveScheduler; + CleanupStack::PushL( iActiveScheduler ); + CActiveScheduler::Install(iActiveScheduler); + CleanupStack::Pop(); + return EPass; + } + +void RTestStepOmxVorbisCodecs::CleanupAfterOpenFail() + { + // nothing here just yet + } + +void RTestStepOmxVorbisCodecs::Close() + { + delete iActiveScheduler; + iActiveScheduler = NULL; + } + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_step.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_step.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_STEP_H +#define TSU_MDF_OMXVORBISCODECS_STEP_H + +#include +#include +#include "tsu_mdf_omxvorbiscodecs_constants.h" + +/** + */ +class RTestStepOmxVorbisCodecs : public RTestStep + { +public: + RTestStepOmxVorbisCodecs(); + ~RTestStepOmxVorbisCodecs(); + + // will be used by the audio play/record test cases + virtual void SetVerdict(TPtrC16 aText, TVerdict aVerdict = EPass){ + INFO_PRINTF3(_L("Text: %s, Verdict:%d"), aText.Ptr(), aVerdict); + } +protected: + virtual TVerdict OpenL(); + virtual void CleanupAfterOpenFail(); + virtual void Close(); + virtual TVerdict DoTestStepL() = 0; +private: + CActiveScheduler* iActiveScheduler; + }; + +#endif// TSU_MDF_OMXVORBISCODECS_STEP_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_suite.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_suite.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,117 @@ +// Copyright (c) 2006-2009 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: +// + +/** + @file + @internalComponent +*/ + +// System includes +#include + +// Test system includes +#include "tsu_mdf_omxvorbiscodecs_suite.h" +#include "tsu_mdf_omxvorbiscodecs_step.h" +#include "tsu_mdf_omxvorbiscodecs_play.h" +#include "tsu_mdf_omxvorbiscodecs_record.h" +#include "tsu_mdf_omxvorbiscodecs_pu.h" +#include "tsu_mdf_omxvorbiscodecs_omx.h" + +/** + * + * NewTestSuiteL + * NewTestSuite is exported at ordinal 1 + * this provides the interface to allow schedule test + * to create instances of this test suite + * @result CTestSuiteOmxVorbisCodecs* + * + */ +EXPORT_C CTestSuiteOmxVorbisCodecs* NewTestSuiteL() + { + CTestSuiteOmxVorbisCodecs* result = new (ELeave) CTestSuiteOmxVorbisCodecs; + CleanupStack::PushL(result); + result->ConstructL(); + CleanupStack::Pop(); // result + return result; + } + +/** + * + * CTestSuiteOmxVorbisCodecs + * + */ +CTestSuiteOmxVorbisCodecs::CTestSuiteOmxVorbisCodecs() + { + + } + + +/** + * + * ~CTestSuiteOmxVorbisCodecs + * + */ +CTestSuiteOmxVorbisCodecs::~CTestSuiteOmxVorbisCodecs() + {} + +/** + * + * GetVersion + * Get Test Suite version + * @result TPtrC + * + */ +TPtrC CTestSuiteOmxVorbisCodecs::GetVersion( void ) const + { + _LIT(KTxtVersion,"1.00"); + return KTxtVersion(); + } + + + +/** + * + * InitialiseL + * Constructor for test suite + * this creates all the test steps and + * stores them inside CTestSuiteOmxVorbisCodecs + * + */ +void CTestSuiteOmxVorbisCodecs::InitialiseL(void) + { + // store the name of this test suite + iSuiteName = _L("TSU_MDF_OMXVORBISCODECS"); + // play a file + AddTestStepL(new(ELeave) RTestStepOmxVorbisCodecPlay()); + // record a file + AddTestStepL(new(ELeave) RTestStepOmxVorbisCodecRecord()); + + // general tests for PU + AddTestStepL(new(ELeave) RTestStepOmxVorbisCodecPu()); + // general tests for OMX layer + AddTestStepL(new(ELeave) RTestStepOmxVorbisCodecOmx()); + + } + + + + + + + + + + + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_suite.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/tsu_mdf_omxvorbiscodecs_suite.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// This contains CTestSuiteOmxVorbisCodecs +// +// + +/** + @file + @internalComponent +*/ + +#ifndef TSU_MDF_OMXVORBISCODECS_SUITE_H +#define TSU_MDF_OMXVORBISCODECS_SUITE_H + +#include + +/** + * + * CTestSuiteOmxVorbisCodecs defines the test suite for OmxVorbisCodecs tests + * + * + * + */ +class CTestSuiteOmxVorbisCodecs : public CTestSuite + { +public: + CTestSuiteOmxVorbisCodecs(); + void InitialiseL(void); + virtual ~CTestSuiteOmxVorbisCodecs(); + virtual TPtrC GetVersion( void ) const; + }; + +#endif // TSU_MDF_OMXVORBISCODECS_SUITE_H diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/codecapi/omxvorbis/src/uids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/codecapi/omxvorbis/src/uids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,23 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef UIDS_HRH +#define UIDS_HRH + +#define KSharedLibraryUidDefine 0x1000008d +#define KUidTsuMdfOmxVorbisCodecsDll 0x102737d5 + +#endif // UIDS_HRH + diff -r 000000000000 -r 79dd3e2336a0 mmdevicefw/mdfunittest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmdevicefw/mdfunittest/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,27 @@ +// Copyright (c) 2005-2009 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: +// bld.inf - Overall mdf audio UnitTest bld.inf file +// +// + + +PRJ_PLATFORMS + +DEFAULT +#ifdef SYMBIAN_MULTIMEDIA_CODEC_API +#include "../codecapi/audio/group/bld.inf" +#include "../codecapi/omx/pcmcodec/group/bld.inf" +#include "../codecapi/pu/pcmcodec/group/bld.inf" +#include "../codecapi/omxvorbis/group/bld.inf" +#endif // SYMBIAN_MULTIMEDIA_CODEC_API diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/bwins/audiocomponentframework.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/bwins/audiocomponentframework.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,7 @@ +EXPORTS + ??1CAudioContext@@UAE@XZ @ 1 NONAME ; CAudioContext::~CAudioContext(void) + ?GetLogicalChain@CAudioContext@@QAEPAVMLogicalChain@@H@Z @ 2 NONAME ; class MLogicalChain * CAudioContext::GetLogicalChain(int) + ?NewL@CAudioContext@@SAPAV1@XZ @ 3 NONAME ; class CAudioContext * CAudioContext::NewL(void) + ?MsgVersion@CAudioContext@@QAEHXZ @ 4 NONAME ; int CAudioContext::MsgVersion(void) + ?CriticalSection@CAudioContext@@QAEAAVRCriticalSection@@XZ @ 5 NONAME ; class RCriticalSection & CAudioContext::CriticalSection(void) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/eabi/audiocomponentframework.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/eabi/audiocomponentframework.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,9 @@ +EXPORTS + _ZN13CAudioContext15GetLogicalChainEi @ 1 NONAME + _ZN13CAudioContext4NewLEv @ 2 NONAME + _ZN13CAudioContextD0Ev @ 3 NONAME + _ZN13CAudioContextD1Ev @ 4 NONAME + _ZN13CAudioContextD2Ev @ 5 NONAME + _ZN13CAudioContext10MsgVersionEv @ 6 NONAME + _ZN13CAudioContext15CriticalSectionEv @ 7 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/group/acl.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/group/acl.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2006-2009 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: +// + + + +#ifndef ACL_IBY +#define ACL_IBY + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +// Audio Control fw dll's +// Audio Control fw dll's + + +file=ABI_DIR\BUILD_DIR\audiocomponentframework.dll System\Libs\audiocomponentframework.dll + +//audiocomponentlibrary plugins +ECOM_PLUGIN(logicalaudiocodec.dll, logicalaudiocodec.rsc) +ECOM_PLUGIN(logicalaudiostream.dll, logicalaudiostream.rsc) + +ECOM_PLUGIN(logicalbuffersource.dll, logicalbuffersource.rsc) +ECOM_PLUGIN(logicalaudiodevicesource.dll, logicalaudiodevicesource.rsc) + +ECOM_PLUGIN(logicalaudiogaincontrol.dll, logicalaudiogaincontrol.rsc) +ECOM_PLUGIN(logicalbuffersink.dll, logicalbuffersink.rsc) +ECOM_PLUGIN(logicalaudiodevicesink.dll, logicalaudiodevicesink.rsc) + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#endif //ACL_IBY diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,38 @@ +// Copyright (c) 2007-2009 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: +// + + + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS +./acl.iby /epoc32/rom/include/acl.iby + +PRJ_MMPFILES +../mmpfiles/audiocomponentframework.mmp +../mmpfiles/audiocontextfactory.mmp + +../mmpfiles/logicalaudiocodec.mmp +../mmpfiles/logicalbuffersink.mmp +../mmpfiles/logicalaudiodevicesink.mmp +../mmpfiles/logicalbuffersource.mmp +../mmpfiles/logicalaudiodevicesource.mmp +../mmpfiles/logicalaudiogaincontrol.mmp +../mmpfiles/logicalaudiostream.mmp + +#endif diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/group/multimedia_a3f_acl.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/group/multimedia_a3f_acl.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,16 @@ +#multimedia_a3f_acl.mrp +# +#Copyright (c) Symbian Software Ltd 2007. All rights reserved. +# + +component multimedia_a3f_acl + +source \sf\os\mm\mmhais\a3facl + +binary \sf\os\mm\mmhais\a3facl\group all + +exports \sf\os\mm\mmhais\a3facl\group + +notes_source \component_defs\release.src + +ipr T diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/audiocomponentframework.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/audiocomponentframework.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 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: +// @suppliedImplementation (Full) +// @symbianImplementationNeeded (No) +// + + + +#include //get the UID + +// Comment in macro to remove support for Auto-Pause-Resume/Resorce-Notification from standard acl component +//MACRO SYMBIAN_DISABLE_ARN + +TARGET audiocomponentframework.dll +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x1028344E + +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI +VENDORID 0x70000001 + +SOURCEPATH ../src/audiocontext +SOURCE audiocontext.cpp + +// Check if needed +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiocontext +USERINCLUDE ../src/audiostream // LOGICAL AUDIOSTREAM +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc + +// TODO: TO BE REMOVED WHEN MMRC SERVER IS READY +USERINCLUDE ../../refacladapt/src/shared // MAUDIOSTREAMDAPTATION OBSERVER + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY mmrcclient.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE audiocomponentframework.def +NOSTRICTDEF + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/audiocontextfactory.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/audiocontextfactory.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2006-2009 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: +// @suppliedImplementation (Full) +// @symbianImplementationNeeded (No) +// + + + +#include + +TARGET audiocontextfactory.dll +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x1028343C + +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI +VENDORID 0x70000001 + +SOURCEPATH ../src/audiocontextfactory +SOURCE audiocontextfactory.cpp + +USERINCLUDE ../src/audiocontextfactory +USERINCLUDE ../src/audiocontext +USERINCLUDE ../src/shared +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc + +// TODO: REMOVE WHEN MMRC SERVER IS READY +USERINCLUDE ../../refacladapt/src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY mmfcontrollerframework.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY audiocomponentframework.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE /epoc32/include/def/~/audiocontextfactory.def + +NOSTRICTDEF +noexportlibrary +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalaudiocodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalaudiocodec.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalaudiocodec.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x1028344F + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/audiocodec +SOURCE logicalaudiocodec.cpp + + +USERINCLUDE ../src/audiocodec +USERINCLUDE ../src/shared + +// TODO: TO BE REMOVED WHEN MMRC SERVER IS READY +USERINCLUDE ../../refacladapt/src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/audiocodec +START RESOURCE logicalaudiocodec.rss +TARGET logicalaudiocodec.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalaudiodevicesink.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalaudiodevicesink.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalaudiodevicesink.dll + +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283450 + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/audiodevicesink +SOURCE logicalaudiodevicesink.cpp + +USERINCLUDE ../src/audiodevicesink +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +// Required Resource Files +SOURCEPATH ../src/audiodevicesink +START RESOURCE logicalaudiodevicesink.rss +TARGET logicalaudiodevicesink.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalaudiodevicesource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalaudiodevicesource.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalaudiodevicesource.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283451 + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/audiodevicesource +SOURCE logicalaudiodevicesource.cpp + +USERINCLUDE ../src/audiodevicesource +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/audiodevicesource +START RESOURCE logicalaudiodevicesource.rss +TARGET logicalaudiodevicesource.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalaudiogaincontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalaudiogaincontrol.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalaudiogaincontrol.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283452 + +VENDORID 0x70000001 +CAPABILITY All -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/audiogaincontrol +SOURCE logicalaudiogaincontrol.cpp + +USERINCLUDE ../src/audiogaincontrol +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/audiogaincontrol +START RESOURCE logicalaudiogaincontrol.rss +TARGET logicalaudiogaincontrol.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY a3f_trace_heap.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalaudiostream.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalaudiostream.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalaudiostream.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283453 + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/audiostream +SOURCE logicalaudiostream.cpp + +USERINCLUDE ../src/audiostream +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc // reference MMRC - for mmrcclient +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiocontext +USERINCLUDE ../src/audiocodec +USERINCLUDE ../src/audiogaincontrol +USERINCLUDE ../src/audiodevicesink +USERINCLUDE ../src/buffersink +USERINCLUDE ../src/audiodevicesource +USERINCLUDE ../src/buffersource + +// TODO: TO BE REMOVED WHEN MMRC SERVER IS READY +USERINCLUDE ../../refacladapt/src/shared // MAUDIOSTREAMDAPTATION OBSERVER + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/audiostream +START RESOURCE logicalaudiostream.rss +TARGET logicalaudiostream.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalbuffersink.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalbuffersink.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalbuffersink.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283454 + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/buffersink +SOURCE logicalbuffersink.cpp + +USERINCLUDE ../src/buffersink +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/buffersink +START RESOURCE logicalbuffersink.rss +TARGET logicalbuffersink.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/mmpfiles/logicalbuffersource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/mmpfiles/logicalbuffersource.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,46 @@ +// Copyright (c) 2006-2009 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 +#include + +TARGET logicalbuffersource.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283455 + +VENDORID 0x70000001 +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/buffersource +SOURCE logicalbuffersource.cpp + +USERINCLUDE ../src/buffersource +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SOURCEPATH ../src/buffersource +START RESOURCE logicalbuffersource.rss +TARGET logicalbuffersource.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY a3f_trace_heap.lib + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocodec/logicalaudiocodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocodec/logicalaudiocodec.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,307 @@ +// Copyright (c) 2007-2009 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 "logicalaudiocodec.h" +#include + +#include // For making it ECom plugin +// Map the interface implementation UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioDecoderUid, CLogicalAudioCodec::NewL), + IMPLEMENTATION_PROXY_ENTRY(KAudioEncoderUid, CLogicalAudioCodec::NewL), + }; + +// Exported proxy for instantiation method resolution. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +CLogicalAudioCodec* CLogicalAudioCodec::NewL(TAny* aParam) + { + DP_STATIC_CONTEXT(CLogicalAudioCodec::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* self = new(ELeave)CLogicalAudioCodec(aParam); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- + +CLogicalAudioCodec::CLogicalAudioCodec(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalAudioCodec::CLogicalAudioCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if(iSettingsObserver) + { + iSettingsObserver->ReceiveComponentSettingsChange(iType, ERegisterCodecObserver); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::ConstructL() + { + DP_CONTEXT(CLogicalAudioCodec::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CLogicalAudioCodec::~CLogicalAudioCodec() + { + DP_CONTEXT(CLogicalAudioCodec::~CLogicalAudioCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iAudioCodecObserver.Close(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodec +// CLogicalAudioCodec::SetFormat +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::SetFormat(TUid aFormat) + { + DP_CONTEXT(CLogicalAudioCodec::SetFormat *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iFormat = aFormat; + if(iSettingsObserver) + { + iSettingsObserver->ReceiveComponentSettingsChange(iType, EComponentAlterationCodec); + } + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodec +// CLogicalAudioCodec::SetSampleRate +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::SetSampleRate(TInt aSampleRate) + { + DP_CONTEXT(CLogicalAudioCodec::SetSampleRate *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iSampleRateConfig = aSampleRate; + if(iSettingsObserver) + { + iSettingsObserver->ReceiveComponentSettingsChange(iType, EComponentAlterationCodec); + } + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodec +// CLogicalAudioCodec::SetMode +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::SetMode(TUid aMode) + { + DP_CONTEXT(CLogicalAudioCodec::SetMode *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iModeConfig = aMode; + if(iSettingsObserver) + { + iSettingsObserver->ReceiveComponentSettingsChange(iType, EComponentAlterationCodec); + } + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodec +// CLogicalAudioCodec::GetSupportedSamplesRates +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::GetSupportedSamplesRates(RArray& aSupportedRates) + { + DP_CONTEXT(CLogicalAudioCodec::GetSupportedSamplesRates *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + if(iAdaptationStream) + { + err = iAdaptationStream->GetSupportedSampleRates(aSupportedRates); + } + else + { + err = KErrNotFound; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodec +// CLogicalAudioCodec::GetSupportedMode +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::GetSupportedModes(RArray& aSupportedModes) + { + DP_CONTEXT(CLogicalAudioCodec::GetSupportedModes *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + if(iAdaptationStream) + { + err = iAdaptationStream->GetSupportedModes(aSupportedModes); + } + else + { + err = KErrNotFound; + } + DP0_RET(err, "%d"); + } +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioCodec::IsTypeOf +// --------------------------------------------------------------------------- +TBool CLogicalAudioCodec::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalAudioCodec::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if ( iType == aTypeId || aTypeId == KUidAudioCodec) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioCodec::Interface +// --------------------------------------------------------------------------- +// +TAny* CLogicalAudioCodec::Interface(TUid aType) + { + DP_CONTEXT(CLogicalAudioCodec::Interface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TAny* interface = NULL; + if (aType == KUidAudioCodec) + { + interface = static_cast(this); + } + else if (aType == KUidAudioCodecAdaptationObserver) + { + interface = static_cast(this); + } + DP0_RET(interface, "0x%08x"); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodecAdaptationObserver +// CLogicalAudioCodec::AllBuffersProcessed +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::AllBuffersProcessed() + { + DP_CONTEXT(CLogicalAudioCodec::AllBuffersProcessed *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodecAdaptationObserver +// CLogicalAudioCodec::GetSupportedConfigurationComplete +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::GetSupportedAModesComplete(TInt aError) + { + DP_CONTEXT(CLogicalAudioCodec::GetSupportedModesComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioCodecObserver[idx]->GetSupportedModesComplete(aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodecAdaptationObserver +// CLogicalAudioCodec::GetSupportedConfigurationComplete +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::GetSupportedARatesComplete(TInt aError) + { + DP_CONTEXT(CLogicalAudioCodec::GetSupportedRatesComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioCodecObserver[idx]->GetSupportedSampleRatesComplete(aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioCodecAdaptationObserver +// CLogicalAudioCodec::ProcessingUnitError +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::ProcessingUnitError(TInt aError) + { + DP_CONTEXT(CLogicalAudioCodec::ProcessingUnitError *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TUint count = iAudioProcessingUnitObservers.Count(); + MAudioProcessingUnit* pUnit = static_cast(this); + for(TUint index=0; index < count; index++) + { + iAudioProcessingUnitObservers[index]->ProcessingUnitError(pUnit, aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioCodec::RegisterAudioCodecObserver +// --------------------------------------------------------------------------- +TInt CLogicalAudioCodec::RegisterAudioCodecObserver(MAudioCodecObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioCodec::RegisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iAudioCodecObserver.Find(&aObserver); + if(err == KErrNotFound) + { + err = iAudioCodecObserver.Append(&aObserver); + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioCodec::UnregisterAudioCodecObserver +// --------------------------------------------------------------------------- +void CLogicalAudioCodec::UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioCodec::UnregisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iAudioCodecObserver.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioCodecObserver.Remove(idxOrErr); + } + DP_OUT(); + } + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocodec/logicalaudiocodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocodec/logicalaudiocodec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef LOGICALAUDIOCODEC_H +#define LOGICALAUDIOCODEC_H + +#include +#include +#include +#include + +#include "componentparameters.h" +#include "audioprocessingunit.h" +#include "mconfigurationhelper.h" + +// Remove when the MMRC server is ready +#include "maudiocodecadaptationobserver.h" + +class MLogicalSettingObserver; +class MAudioProcessingUnitObserver; +class MConfigurationHelper; + +/** + This is the reference implementation of MAudioCodec API. + @lib logicalaudiocodec.lib + */ + +NONSHARABLE_CLASS(CLogicalAudioCodec) : public CAudioProcessingUnit, + public MAudioCodec, + public MAudioCodecAdaptationObserver + { +friend class CAudioContext; +friend class CLogicalAudioStream; +public: + /** + Create a new instance. + */ + static CLogicalAudioCodec* NewL(TAny* aParam); + + /** + Destructor. + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalAudioCodec(); + + // from base class MAudioCodec + TInt SetFormat(TUid aFormat); + TInt SetSampleRate(TInt aSampleRate); + TInt SetMode(TUid aMode); + TInt GetSupportedSamplesRates(RArray& aSupportedRates); + TInt GetSupportedModes(RArray& aSupportedModes); + TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver); + void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver); + + // Override just this + TBool IsTypeOf(TUid aTypeId) const; + TAny* Interface(TUid aType); + + // from MAudioCodecAdaptationObserver + void AllBuffersProcessed(); + void ProcessingUnitError(TInt aError); + void GetSupportedAModesComplete(TInt aError); + void GetSupportedARatesComplete(TInt aError); + +private: + + /** + Second phase constructor + */ + void ConstructL(); + + /** + Constructor + */ + CLogicalAudioCodec(TAny* aParam); + +protected: // data + + // Format uid + + TUid iFormat; + + TInt iSampleRateConfig; + TUid iModeConfig; + RPointerArray iAudioCodecObserver; + + MConfigurationHelper* iAdaptationStream; + + }; + +#endif // LOGICALAUDIOCODEC_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocodec/logicalaudiocodec.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocodec/logicalaudiocodec.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,50 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidLogicalAudioCodecDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioDecoderUid; + version_no = 1; + display_name = "logicalaudiodecoder"; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KAudioEncoderUid; + version_no = 1; + display_name = "logicalaudioencoder"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocontext/audiocontext.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocontext/audiocontext.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,559 @@ +//audiocontext.cpp + +// Copyright (c) 2006-2009 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 +#include +#include +#include + +#include "audiocontext.h" +#include "audioprocessingunit.h" +#include "logicalaudiostream.h" +#include "audiostreammanager.h" + + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CAudioContext::CAudioContext() + { + TRACE_CREATE(); + DP_CONTEXT(CAudioContext::CAudioContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iInCommit = EFalse; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Symbian 2nd phase constructor +// --------------------------------------------------------------------------- +void CAudioContext::ConstructL() + { + DP_CONTEXT(CAudioContext::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + // Setup Multimedia Resource Control + User::LeaveIfError(iMMRC.Open(*this)); + User::LeaveIfError(iCriticalSection.CreateLocal()); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Symbian constructor +// --------------------------------------------------------------------------- +EXPORT_C CAudioContext* CAudioContext::NewL() + { + DP_STATIC_CONTEXT(CAudioContext::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioContext* self = new(ELeave)CAudioContext(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CAudioContext::~CAudioContext() + { + DP_CONTEXT(CAudioContext::~CAudioContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iMMRC.Close(); + iAudioContextObservers.Close(); + iAudioProcessingUnits.Close(); + if (iActualChain) + { + iActualChain->Release(); + }; + iCriticalSection.Close(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::SetClientSettings +// --------------------------------------------------------------------------- +// +TInt CAudioContext::SetClientSettings(const TClientContextSettings& aSettings) + { + DP_CONTEXT(CAudioContext::SetClientSettings *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + iClientSettings = aSettings; + if( iContextId.Id() == 0 ) + { + TUint64 id = iMMRC.LogOn(iClientSettings.iProcessId); + TAudioContextId temp(id); + iContextId = temp; + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err, "%d"); + } + + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::GetContextId +// --------------------------------------------------------------------------- +// +TAudioContextId CAudioContext::ContextId() const + { + DP_CONTEXT(CAudioContext::ContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + return iContextId; + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::Commit +// --------------------------------------------------------------------------- +// +TInt CAudioContext::Commit() + { + DP_CONTEXT(CAudioContext::Commit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + iInCommit = ETrue; + + if (iClientSettings.iProcessId.Id() == 0) + { + DP0_RET(KErrNotReady, "%d"); + } + + err = iMMRC.SendResourceRequest(iActualChain, iDesiredChain, this); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::CreateAudioStream +// --------------------------------------------------------------------------- +// +TInt CAudioContext::CreateAudioStream(MAudioStream *&aStream) + { + DP_CONTEXT(CAudioContext::CreateAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + CAudioStreamManager* manager(NULL); + + // Create desired logical chain + TRAP(err, manager = CAudioStreamManager::NewL(KUidAudioStream)); + if(err == KErrNone) + { + aStream = static_cast(manager); + + // Use this as desired chain (this is the one that the client modify) + CLogicalAudioStream* logicalAudioStream = static_cast(aStream); + iDesiredChain = static_cast(logicalAudioStream); + logicalAudioStream->SetParentContext(*this); + if (iActualChain) + { + iActualChain->Release(); + iActualChain=NULL; + } + TRAP(err, iActualChain = iDesiredChain->CloneL()); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::DeleteAudioStream +// --------------------------------------------------------------------------- +// +void CAudioContext::DeleteAudioStream(MAudioStream *&aStream) + { + DP_CONTEXT(CAudioContext::DeleteAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioStreamManager* manager = static_cast(aStream); + delete manager; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::CreateAudioProcessingUnit +// --------------------------------------------------------------------------- +// +TInt CAudioContext::CreateAudioProcessingUnit(TUid aTypeId, MAudioProcessingUnit *&aProcessingUnit) + { + DP_CONTEXT(CAudioContext::CreateAudioProcessingUnit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + TAudioComponentId unitInstance = GetAndSetInstanceID(); + + CAudioProcessingUnit* pUnit=NULL; + TComponentParameters cParameters; + cParameters.iTypeUid = aTypeId; + cParameters.iInstanceId = unitInstance; + cParameters.iContextId = iContextId; + cParameters.iSettingsObserver = this; + + TRAP(err, pUnit = CAudioProcessingUnit::NewL(cParameters)); + if (err==KErrNone) + { + aProcessingUnit = static_cast(pUnit); + err = iAudioProcessingUnits.Append(aProcessingUnit); + if(err!=KErrNone) + { + delete pUnit; + aProcessingUnit = NULL; + } + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::DeleteAudioProcessingUnit +// --------------------------------------------------------------------------- +// +void CAudioContext::DeleteAudioProcessingUnit( + MAudioProcessingUnit *&aProcessingUnit) + { + DP_CONTEXT(CAudioContext::DeleteAudioProcessingUnit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + CAudioProcessingUnit* cUnit = static_cast(aProcessingUnit); + TAudioComponentId param = aProcessingUnit->InstanceId(); + TUint count= iAudioProcessingUnits.Count(); + + for ( TUint i(0); i < count; i++ ) + { + // find and delete component + if( iAudioProcessingUnits[i]->InstanceId() == param) + { + iAudioProcessingUnits.Remove(i); + delete cUnit; + break; + } + } + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::RegisterAudioContextObserver +// --------------------------------------------------------------------------- +// +TInt CAudioContext::RegisterAudioContextObserver( + MAudioContextObserver& aObserver) + { + DP_CONTEXT(CAudioContext::RegisterAudioContextObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iAudioContextObservers.Find(&aObserver); + if( err != KErrNotFound ) + { + err = KErrAlreadyExists; + } + else + { + err = iAudioContextObservers.Append(&aObserver); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::UnregisterAudioContextObserver +// --------------------------------------------------------------------------- +// +void CAudioContext::UnregisterAudioContextObserver( + MAudioContextObserver& aObserver) + { + DP_CONTEXT(CAudioContext::UnregisterAudioContextObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt idxOrErr = iAudioContextObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioContextObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::Interface +// --------------------------------------------------------------------------- +// +TAny* CAudioContext::Interface(TUid aType) + { + DP_CONTEXT(CAudioContext::Interface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TAny* interface = NULL; + if(aType == KUIdAudioResourceNotification) + { + #ifndef SYMBIAN_DISABLE_ARN + interface = static_cast(this); + #else + interface = NULL; + #endif + } + else + { + interface = NULL; + } + DP_OUT(); + return interface; + } + + +// --------------------------------------------------------------------------- +// From class MAudioContext +// CAudioContext::Reset +// --------------------------------------------------------------------------- +// +TInt CAudioContext::Reset() + { + DP_CONTEXT(CAudioContext::Reset *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if (iInCommit) + { + err = KErrNotReady; + } + iDesiredChain->ResetMessage(); + iDesiredChain->CopySettings(*iActualChain); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MMultimediaResourceControlObserver +// CAudioContext::ReceiveResourceResponse +// --------------------------------------------------------------------------- +// +void CAudioContext::ReceiveResourceResponse(MLogicalChain* aAppliedChain, TInt aError) + { + DP_CONTEXT(CAudioContext::ReceiveResourceResponse *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iCriticalSection.Wait(); + iMsgVersion++; + iMMRC.ResetMessages(); + iCriticalSection.Signal(); + + if ( aError == KErrNone || iPreempted ) + { + if ( iPreempted ) + { + iPreempted = EFalse; + } + // Desired chain was commited succesfully + TInt err; + MLogicalChain* lc = NULL; + TRAP(err, lc = aAppliedChain->CloneL()); + DP1(DLERR,"ECloneLeftWhenReceivingResourceResponse %d", err); + __ASSERT_DEBUG(err == KErrNone, Panic(ECloneLeftWhenReceivingResourceResponse)); + if ( iActualChain ) + { + iActualChain->Release(); + } + iActualChain = lc; + } + else + { + iDesiredChain->CopySettings(*iActualChain); + } + iDesiredChain->ResetMessage(); + ContextEventSignal(KUidA3FContextUpdateComplete, aError); + iInCommit = EFalse; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From class MMultimediaResourceControlObserver +// CAudioContext::ReceiveResourceUpdate +// --------------------------------------------------------------------------- +// +void CAudioContext::ReceiveResourceUpdate(MLogicalChain* /*aMessage*/, TInt aError) + { + DP_CONTEXT(CAudioContext::ReceiveResourceUpdate *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + ContextEventSignal(KUidA3FContextCommitUpdate, aError); + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// From class MMultimediaResourceControlObserver +// CAudioContext::ReceivePreemptionUpdate +// --------------------------------------------------------------------------- +// +void CAudioContext::ReceivePreemptionUpdate(MLogicalChain* /*aMessage*/, TInt aError) + { + DP_CONTEXT(CAudioContext::ReceivePreemptionUpdate *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iPreempted = ETrue; + if(iInCommit) + { + // Send only one callback + ContextEventSignal(KUidA3FContextPreEmptedCommit, aError); + } + else + { + // Send two callbacks + ContextEventSignal(KUidA3FContextPreEmption, aError); + ContextEventSignal(KUidA3FContextPreEmptionUpdate, aError); + } + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// From class MLogicalSettingObserver +// CAudioContext::ReceiveComponentSettingsChange +// --------------------------------------------------------------------------- +void CAudioContext::ReceiveComponentSettingsChange(TUid /*aId*/, TMMRCMessageType aMessageType) + { + iDesiredChain->SetMessageType(aMessageType); + } + +// --------------------------------------------------------------------------- +// Internals +// CAudioContext::GetAndSetInstanceID +// --------------------------------------------------------------------------- +TAudioComponentId CAudioContext::GetAndSetInstanceID() + { + DP_CONTEXT(CAudioContext::GetAndSetInstanceID *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint id(1); // start ID count from 1 + TAudioComponentId idComponent(1); + TUint count = iAudioProcessingUnits.Count(); + if ( count < KMaxTUint ) + { + id = ++count; + } + idComponent = id; + DP_OUT(); + return idComponent; + } + +// --------------------------------------------------------------------------- +// Internals +// CAudioContext::ContextEventSignal +// --------------------------------------------------------------------------- +void CAudioContext::ContextEventSignal(TUid aEvent, TInt aError) + { + DP_CONTEXT(CAudioContext::ContextEventSignal *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioContextObservers.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioContextObservers[idx]->ContextEvent(aEvent, aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioContext::GetLogicalChain +// --------------------------------------------------------------------------- +EXPORT_C MLogicalChain* CAudioContext::GetLogicalChain(TInt aIndex) + { + DP_CONTEXT(CAudioContext::GetLogicalChain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MLogicalChain* logChain = NULL; + if (aIndex == 0) + { + logChain = iDesiredChain; + } + else + { + logChain = iActualChain; + } + DP_OUT(); + return logChain; + } + + +// --------------------------------------------------------------------------- +// CAudioContext::RegisterAsClient +// --------------------------------------------------------------------------- +TInt CAudioContext::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData, MA3FDevSoundAutoPauseResumeObserver* aObserverPtr) + { + DP_CONTEXT(CAudioContext::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + iObserverPtr = aObserverPtr; + err = iMMRC.RegisterAsClient(aEventType, aNotificationRegistrationData); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioContext::CancelRegisterAsClient +// --------------------------------------------------------------------------- +TInt CAudioContext::CancelRegisterAsClient(TUid aEventType) + { + DP_CONTEXT(CAudioContext::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + err = iMMRC.CancelRegisterAsClient(aEventType); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioContext::WillResumePlay +// --------------------------------------------------------------------------- +TInt CAudioContext::WillResumePlay() + { + DP_CONTEXT(CAudioContext::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + err = iMMRC.WillResumePlay(); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From class MMultimediaResourceControlObserver +// CAudioContext::CanResume +// --------------------------------------------------------------------------- +// +void CAudioContext::CanResume() + { + DP_CONTEXT(CAudioContext::CanResume *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if(iObserverPtr) + { + iObserverPtr->NotifyResume(); + } + DP_OUT(); + } + +void CAudioContext::Panic(TAudioContextPanicCodes aCode) + { + User::Panic(KAudioContextPanicCategory, aCode); + } + +EXPORT_C TInt CAudioContext::MsgVersion() + { + return iMsgVersion; + } + +EXPORT_C RCriticalSection& CAudioContext::CriticalSection() + { + return iCriticalSection; + } +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocontext/audiocontext.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocontext/audiocontext.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef AUDIOCONTEXT_H +#define AUDIOCONTEXT_H + +#include +#include +#include +#include + +#include "mmrcclient.h" +#include "multimediaresourcecontrolobserver.h" + +#include +#include + +#include "mlogicalsettingsobserver.h" + + +class CAudioProcessingUnit; +class CLogicalAudioStream; + + +/** +Panic category and codes +*/ +_LIT(KAudioContextPanicCategory, "AudioContext"); + +enum TAudioContextPanicCodes + { + ECloneLeftWhenReceivingResourceResponse = 1, + }; + +//// + // Implementation of the audio context. + // + // @see MAudioContext + // @see MMultimediaResourceControlObserver + // @see MLogicalSettingObserver + // + // @lib AudioComponentFramework.lib + // +NONSHARABLE_CLASS(CAudioContext) : public CBase, + public MAudioContext, + public MMultimediaResourceControlObserver, + public MLogicalSettingObserver, + public MA3FDevSoundAutoPauseResume + { + +public: + + IMPORT_C static CAudioContext* NewL(); + + IMPORT_C virtual ~CAudioContext(); + + // + IMPORT_C MLogicalChain* GetLogicalChain(TInt aIndex); + IMPORT_C TInt MsgVersion(); + IMPORT_C RCriticalSection& CriticalSection(); + // from base class MAudioContext (A3F API) + virtual TInt Commit ( ); + virtual TInt CreateAudioProcessingUnit (TUid aTypeId, MAudioProcessingUnit *& aProcessingUnit ); + virtual TInt CreateAudioStream ( MAudioStream *& aStream ); + virtual void DeleteAudioProcessingUnit ( MAudioProcessingUnit *& aProcessingUnit ); + virtual void DeleteAudioStream ( MAudioStream *& aStream ); + virtual TAudioContextId ContextId ( ) const; + virtual TAny* Interface(TUid aType); + virtual TInt RegisterAudioContextObserver ( MAudioContextObserver & aObserver ); + virtual TInt Reset ( ); + virtual TInt SetClientSettings(const TClientContextSettings &aSettings); + virtual void UnregisterAudioContextObserver ( MAudioContextObserver & aObserver ) ; + + //from base class MMultimediaResourceControlObserver + virtual void ReceiveResourceResponse(MLogicalChain *aMessage, TInt aError); + virtual void ReceiveResourceUpdate(MLogicalChain *aMessage, TInt aError); + virtual void ReceivePreemptionUpdate(MLogicalChain *aMessage, TInt aError); + virtual void CanResume(); + + //from MLogicalSettingObserver + virtual void ReceiveComponentSettingsChange(TUid aId, TMMRCMessageType aMessageType); + + //Internals. + //Resolve and get component context-unique component instance id. + TAudioComponentId GetAndSetInstanceID(); + //Send a the notification about context event to all observers. + void ContextEventSignal(TUid aEvent, TInt aError); + + //from MA3FDevSoundAutoPauseResume + virtual TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData, MA3FDevSoundAutoPauseResumeObserver* aObserverPtr); + virtual TInt CancelRegisterAsClient(TUid aEventType); + virtual TInt WillResumePlay(); + +private: + + CAudioContext(); + + void ConstructL(); + + void Panic(TAudioContextPanicCodes aCode); + +private: + //Context identifier. + + TAudioContextId iContextId; + + //Array of components within this context (stream not included) (array members not own). + + RPointerArray iAudioProcessingUnits; + + + // Array of context observers. + // Members not own. + + RPointerArray iAudioContextObservers; + + + //Multimedia Resource Control API. + + RMMRCClient iMMRC; + + + //Client context identifiers. + + TClientContextSettings iClientSettings; + + //Audio type settings. + + TAudioTypeSettings iAudioTypeSettings; + + // Not owned + MLogicalChain* iDesiredChain; + + // Owned + MLogicalChain* iActualChain; + + TBool iInCommit; + + TBool iPreempted; + + MA3FDevSoundAutoPauseResumeObserver* iObserverPtr; + + TInt iMsgVersion; + + RCriticalSection iCriticalSection; + }; + +#endif // AUDIOCONTEXT_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiocontextfactory/audiocontextfactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiocontextfactory/audiocontextfactory.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,73 @@ +//audiocontextfactory.cpp + +// Copyright (c) 2006-2009 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 + +#include "audiocontext.h" + + +CAudioContextFactory::CAudioContextFactory() + { + } + +EXPORT_C CAudioContextFactory* CAudioContextFactory::NewL() + { + DP_STATIC_CONTEXT(CAudioContextFactory::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioContextFactory* self = new(ELeave) CAudioContextFactory(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +void CAudioContextFactory::ConstructL() + { + DP_CONTEXT(CAudioContextFactory::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +EXPORT_C CAudioContextFactory::~CAudioContextFactory() + { + DP_CONTEXT(CAudioContextFactory::~CAudioContextFactory *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +EXPORT_C TInt CAudioContextFactory::CreateAudioContext(MAudioContext*& aContext) + { + DP_CONTEXT(CAudioContextFactory::CreateAudioContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + TRAPD(err,aContext = CAudioContext::NewL()); + return err; + } + +EXPORT_C void CAudioContextFactory::DeleteAudioContext(MAudioContext*& aContext) + { + DP_CONTEXT(CAudioContextFactory::DeleteAudioContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioContext* contextPtr = static_cast(aContext); + delete contextPtr; + DP_OUT(); + //DP0_RET(KErrNone, "%d"); + } + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +// Copyright (c) 2007-2009 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 "logicalaudiodevicesink.h" +#include + +#include // For making it ECom plugin + +// Map the interface implementation UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioDeviceSinkUid, CLogicalAudioDeviceSink::NewL), + }; + +// Exported proxy for instantiation method resolution. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +CLogicalAudioDeviceSink::CLogicalAudioDeviceSink(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalAudioDeviceSink::CLogicalAudioDeviceSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +CLogicalAudioDeviceSink* CLogicalAudioDeviceSink::NewL(TAny* aParam) + { + DP_STATIC_CONTEXT(CLogicalAudioDeviceSink::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioDeviceSink* self = new(ELeave)CLogicalAudioDeviceSink(aParam); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CLogicalAudioDeviceSink::~CLogicalAudioDeviceSink() + { + DP_CONTEXT(CLogicalAudioDeviceSink::RegisterComponentObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioDeviceSink::IsTypeOf +// --------------------------------------------------------------------------- +TBool CLogicalAudioDeviceSink::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalAudioDeviceSink::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if (iType == aTypeId) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2007-2009 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: +* +*/ + + + +#ifndef CLOGICALAUDIODEVICESINK_H +#define CLOGICALAUDIODEVICESINK_H + +#include +#include +#include +#include "audioprocessingunit.h" + +class MLogicalSettingObserver; + +/** +This is the implementation of CAudioSink API. + +@see CAudioComponent +*/ +NONSHARABLE_CLASS(CLogicalAudioDeviceSink) : public CAudioProcessingUnit + { +friend class CAudioContext; +friend class CLogicalAudioStream; +public: + + /** + * Destructor. + * + * Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalAudioDeviceSink(); + + // from base class CAudioProcessingUnit + virtual TBool IsTypeOf(TUid aTypeId) const; + + /** + * Create a new instance. + * + * @return CAudioDeviceSink* a pointer to the created instance. + */ + static CLogicalAudioDeviceSink* NewL(TAny* aParam); + +private: + + void ConstructL(); + + CLogicalAudioDeviceSink(TAny* aParam); + }; + +#endif // C_LOGICALAUDIODEVICESINK_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesink/logicalaudiodevicesink.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidAudioDeviceSinkDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioDeviceSinkUid; + version_no = 1; + display_name = "logicalaudiodevicesinkfactory"; + } + }; + } + }; + } + + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,99 @@ +// Copyright (c) 2004-2009 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 // For making it ECom plugin +#include + +#include "logicalaudiodevicesource.h" + +#include + + +// ======== LOCAL FUNCTIONS ======== +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioDeviceSourceUid, CLogicalAudioDeviceSource::NewL), //KUidAudioDeviceSource + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +CLogicalAudioDeviceSource::CLogicalAudioDeviceSource(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalAudioDeviceSource::CLogicalAudioDeviceSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +CLogicalAudioDeviceSource* CLogicalAudioDeviceSource::NewL(TAny* aParam) + { + DP_STATIC_CONTEXT(CLogicalAudioDeviceSource::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioDeviceSource* self = new(ELeave)CLogicalAudioDeviceSource(aParam); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +void CLogicalAudioDeviceSource::ConstructL() + { + DP_CONTEXT(CLogicalAudioDeviceSource::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CLogicalAudioDeviceSource::~CLogicalAudioDeviceSource() + { + DP_CONTEXT(CLogicalAudioDeviceSource::~CLogicalAudioDeviceSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +TBool CLogicalAudioDeviceSource::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalAudioDeviceSource::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if (iType == aTypeId) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef CLOGICALAUDIODEVICESOURCE_H +#define CLOGICALAUDIODEVICESOURCE_H + +#include +#include +#include +#include +#include "audioprocessingunit.h" + +class MLogicalSettingObserver; + +/** + +*/ +NONSHARABLE_CLASS(CLogicalAudioDeviceSource) : public CAudioProcessingUnit + { +friend class CAudioContext; +friend class CLogicalAudioStream; +public: + + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalAudioDeviceSource(); + + // from CAudioProcessingUnit + virtual TBool IsTypeOf(TUid aTypeId) const; + + /** + Create a new instance. + + @return CBufferSource* a pointer to the created instance. + */ + static CLogicalAudioDeviceSource* NewL(TAny* aParam); +private: + void ConstructL(); + + CLogicalAudioDeviceSource(TAny* aParam); + }; + +#endif // C_LOGICAL_AUDIOSOURCE_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiodevicesource/logicalaudiodevicesource.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidAudioDeviceSourceDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioDeviceSourceUid; + version_no = 1; + display_name = "logicalAudioDeviceSourcefactory"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,357 @@ +// Copyright (c) 2004-2009 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: +// Name : audiogaincontrol.cpp +// Part of : ACL Logical layer +// + + + +#include "logicalaudiogaincontrol.h" +#include +#include // For making it ECom plugin + +// ======== LOCAL FUNCTIONS ======== +// __________________________________________________________________________ +// Exported proxy for instantiation method resolution +// Define the interface UIDs + +// Moved from header +const TInt KDefaultMaxRampTime = 10; + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioGainControlUid, CLogicalAudioGainControl::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CLogicalAudioGainControl::CLogicalAudioGainControl(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalAudioGainControl::CLogicalAudioGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMaxRampTime = KDefaultMaxRampTime; + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +CLogicalAudioGainControl* CLogicalAudioGainControl::NewL(TAny* aParam) + { + DP_STATIC_CONTEXT(CLogicalAudioGainControl::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioGainControl* self = new(ELeave)CLogicalAudioGainControl(aParam); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CLogicalAudioGainControl::ConstructL() + { + DP_CONTEXT(CLogicalAudioGainControl::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TAudioChannelGain left; + TAudioChannelGain right; + left.iLocation = TAudioChannelGain::ELeft; + right.iLocation = TAudioChannelGain::ERight; + iDesiredChannels.AppendL(left); + iDesiredChannels.AppendL(right); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CLogicalAudioGainControl::~CLogicalAudioGainControl() + { + DP_CONTEXT(CLogicalAudioGainControl::~CLogicalAudioGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iActiveChannels.Close(); + iDesiredChannels.Close(); + iGainObservers.Close(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::GetMaxGain +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::GetMaxGain(TInt& aMaxGain) const + { + DP_CONTEXT(CLogicalAudioGainControl::GetMaxGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // TODO: Fix this when the MMRC server is available + // This adaptationGain pointer will be replaced by the a pointer gotten from + // the "control mechanism" provided by the real MMRC server + TInt err = KErrNotReady; + if(iAdaptationGain) + { + err = iAdaptationGain->GetMaxGain(aMaxGain); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::GetMaxRampTime +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const + { + DP_CONTEXT(CLogicalAudioGainControl::GetMaxRampTime *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + aMaxRampTime = KDefaultMaxRampTime; + if(iAdaptationGain) + { + err = iAdaptationGain->GetMaxRampTime(aMaxRampTime); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::GetGain +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::GetGain(RArray& aChannels) const + { + DP_CONTEXT(CLogicalAudioGainControl::GetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + TInt count = iDesiredChannels.Count(); + aChannels.Reset(); + for (TUint i(0); i < count; i++) + { + TInt err = aChannels.Append(iDesiredChannels[i]); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::SetGain +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::SetGain(RArray& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration) + { + DP_CONTEXT(CLogicalAudioGainControl::SetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + iDesiredRampTime = static_cast(aRampDuration.Int64()); + iDesiredRampOperation = aRampOperation; + + // The gain values are clippped to MaxGain. + TInt a3fMaxGain = 0; + if(iAdaptationGain) + { + err = iAdaptationGain->GetMaxGain(a3fMaxGain); + } + + if(err == KErrNone) + { + iDesiredChannels.Reset(); + TUint count = aChannels.Count(); + TAudioChannelGain gainChannel; + for (TUint i(0); i < count; i++) + { + gainChannel = aChannels[i]; + // + if(gainChannel.iGain > a3fMaxGain) + { + gainChannel.iGain = a3fMaxGain; + } + else if(gainChannel.iGain < 0) + { + err = KErrArgument; + break; + } + + err = iDesiredChannels.Append( gainChannel ); + if(err != KErrNone) + { + break; + } + } + } + + if(err == KErrNone) + { + if(iSettingsObserver) + { + iSettingsObserver->ReceiveComponentSettingsChange(iType, EComponentAlterationGain); + } + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::SetGain +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::SetGain(RArray& aChannels) + { + DP_CONTEXT(CLogicalAudioGainControl::SetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = SetGain(aChannels, KNullUid, 0); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::RegisterAudioGainControlObserver +// --------------------------------------------------------------------------- +// +TInt CLogicalAudioGainControl::RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioGainControl::RegisterAudioGainControlObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iGainObservers.Find(&aObserver); + if( err != KErrNotFound ) + { + err = KErrAlreadyExists; + } + else + { + err = iGainObservers.Append(&aObserver); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CLogicalAudioGainControl::UnregisterAudioGainControlObserver +// --------------------------------------------------------------------------- +// +void CLogicalAudioGainControl::UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioGainControl::UnregisterAudioGainControlObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iGainObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iGainObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioGainControl::IsTypeOf +// --------------------------------------------------------------------------- +TBool CLogicalAudioGainControl::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalAudioGainControl::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if (iType == aTypeId) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioGainControl::Interface +// --------------------------------------------------------------------------- +TAny* CLogicalAudioGainControl::Interface(TUid aType) + { + DP_CONTEXT(CLogicalAudioGainControl::GetInterface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MAudioGainControl* ptr = NULL; + if(aType==KUidAudioGainControl) + { + ptr = this; + } + DP_OUT(); + return ptr; + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControlObserver +// CLogicalAudioGainControl::MaxRampTimeChanged +// --------------------------------------------------------------------------- +void CLogicalAudioGainControl::MaxRampTimeChanged(MAudioGainControl& /*aGain*/) + { + DP_CONTEXT(CLogicalAudioGainControl::MaxRampTimeChanged *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iGainObservers.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iGainObservers[idx]->MaxRampTimeChanged(*this); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControlObserver +// CLogicalAudioGainControl::MaxGainChanged +// --------------------------------------------------------------------------- +void CLogicalAudioGainControl::MaxGainChanged(MAudioGainControl& /*aGain*/) + { + DP_CONTEXT(CLogicalAudioGainControl::MaxGainChanged *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iGainObservers.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iGainObservers[idx]->MaxGainChanged(*this); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControlObserver +// CLogicalAudioGainControl::GainChanged +// --------------------------------------------------------------------------- +void CLogicalAudioGainControl::GainChanged(MAudioGainControl& /*aGain*/, TInt aError) + { + DP_CONTEXT(CLogicalAudioGainControl::GainChanged *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iDesiredChannels.Count(); + iActiveChannels.Reset(); + for(TUint i=0; iGainChanged(*this, aError); + } + DP_OUT(); + } diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,111 @@ +/* +* Copyright (c) 2004-2009 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: +* Name : logicalaudiogaincontrol.h +* Part of : ACL Logical Layer +* +*/ + + + +#ifndef LOGICALAUDIOGAINCONTROL_H +#define LOGICALAUDIOGAINCONTROL_H + +#include +#include +#include +#include +#include + +#include "audioprocessingunit.h" + + +class MLogicalSettingObserver; + +/** +Implementation of audio gain control API. + +@lib audiogaincontrol.lib +*/ + +NONSHARABLE_CLASS(CLogicalAudioGainControl) : public CAudioProcessingUnit, + public MAudioGainControl, + public MAudioGainControlObserver + { +friend class CAudioContext; +friend class CLogicalAudioStream; + +public: + + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalAudioGainControl(); + + // from base class MAudioGainControl + virtual TInt GetMaxGain(TInt& aMaxGain) const; + virtual TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime)const; + virtual TInt SetGain(RArray& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + virtual TInt SetGain(RArray& aChannels); + virtual TInt GetGain(RArray& aChannels) const; + virtual TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + virtual void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + + // from base class CAudioProcessingUnit + virtual TBool IsTypeOf(TUid aTypeId) const; + virtual TAny* Interface(TUid aType); + + // from base class MAudioGainControlObserver + void MaxRampTimeChanged(MAudioGainControl& aGain); + void MaxGainChanged(MAudioGainControl& aGain); + void GainChanged(MAudioGainControl& aGain, TInt aError); + + /** + Create a new instance. + + @param aGaincontrol the gain implementation. Ownership of the pointer + is transferred to the create CAudioGainControl object instance. + @return CAudioGainControl* a pointer to the created instance. + */ + static CLogicalAudioGainControl* NewL(TAny* aParam); + + +private: + + void ConstructL(); + + CLogicalAudioGainControl(TAny* aParam); + +protected: + RArray iActiveChannels; + + RArray iDesiredChannels; + + TTimeIntervalMicroSeconds iDesiredRampTime; + + TUid iDesiredRampOperation; + +private: + // Maximum value for ramp time + TTimeIntervalMicroSeconds iMaxRampTime; + + // The adaptation gain control + MAudioGainControl* iAdaptationGain; + + RPointerArray iGainObservers; + }; + +#endif // LOGICALAUDIOGAINCONTROL_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiogaincontrol/logicalaudiogaincontrol.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidAudioGainControlDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioGainControlUid; + version_no = 1; + display_name = "logicalaudiogaincontrolfactory"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiostream/logicalaudiostream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiostream/logicalaudiostream.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1327 @@ +// Copyright (c) 2004-2009 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 "logicalaudiogaincontrol.h" +#include "logicalaudiocodec.h" +#include "logicalbuffersource.h" +#include "logicalbuffersink.h" +#include "logicalaudiodevicesink.h" +#include "logicalaudiodevicesource.h" +#include "logicalaudiostream.h" + +#include +#include +#include +#include +#include "audiocontext.h" + +// TODO: Remove when the MMRC Extension mechanism is ready +#include "mstreampositioncontrol.h" +#include "mstreampositioncontrol.h" +#include "audioprocessingunit.h" + +#include // For making it ECom plugin + + +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KAudioStreamUid, CLogicalAudioStream::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CLogicalAudioStream::CLogicalAudioStream() + : CAudioStreamManager(), + iCurrentState(EUninitialized), + iMessageType(ERegisterStreamObserver) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalAudioStream::CLogicalAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::NewL +// --------------------------------------------------------------------------- +CLogicalAudioStream* CLogicalAudioStream::NewL(TUid /*aTypeId*/) + { + DP_STATIC_CONTEXT(CLogicalAudioStream::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioStream* self = new(ELeave)CLogicalAudioStream(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +void CLogicalAudioStream::ConstructL() + { + DP_CONTEXT(CLogicalAudioStream::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// + CLogicalAudioStream::~CLogicalAudioStream() + { + DP_CONTEXT(CLogicalAudioStream::~CLogicalAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iAudioProcessingUnits.Close(); + iCISupportObservers.Close(); + DP_OUT(); + } + + +// From MAudioStream +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Uninitialize +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Uninitialize() + { + DP_CONTEXT(CLogicalAudioStream::Uninitialize *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EInitialized) + { + DP0_RET(KErrNotReady, "%d"); + } + + iCurrentState = EUninitialized; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Initialize +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Initialize() + { + DP_CONTEXT(CLogicalAudioStream::Initialize *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EUninitialized) + { + DP0_RET(KErrNotReady, "%d"); + } + + //calling commit?? + iCurrentState = EInitialized; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Load +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Load() + { + DP_CONTEXT(CLogicalAudioStream::Load *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EInitialized) + { + DP0_RET(KErrNotReady, "%d"); + } + + iCurrentState = EIdle; + ResetStreamTime(); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Stop +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Stop() + { + DP_CONTEXT(CLogicalAudioStream::Stop *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EActive && iCurrentState != EPrimed) + { + DP0_RET(KErrNotReady, "%d"); + } + iCurrentState = EIdle; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Unload +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Unload() + { + DP_CONTEXT(CLogicalAudioStream::Unload *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EIdle) + { + DP0_RET(KErrNotReady, "%d"); + } + + iCurrentState = EInitialized; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Prime +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Prime() + { + DP_CONTEXT(CLogicalAudioStream::Prime *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EActive && iCurrentState != EIdle) + { + DP0_RET(KErrNotReady, "%d"); + } + + iCurrentState = EPrimed; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Flush +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Flush() + { + DP_CONTEXT(CLogicalAudioStream::Flush *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EIdle && iCurrentState != EPrimed) + { + DP0_RET(KErrNotReady, "%d"); + } + + if(!iStreamBufferControl) + { + DP0_RET(KErrNotReady, "%d"); + } + //Empty any buffers that have been filled + iStreamBufferControl->FlushBuffers(); + + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Activate +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Activate() + { + DP_CONTEXT(CLogicalAudioStream::Activate *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iCurrentState != EIdle && iCurrentState != EPrimed) + { + DP0_RET(KErrNotReady, "%d"); + } + + //The start-up procedures include requesting permission for audio processing + //from audio policy. If permission to start is denied by audio policy, a state + //change callback to the current state will occur. + iCurrentState = EActive; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AddSource +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::AddSource(MAudioProcessingUnit* aSource) + { + DP_CONTEXT(CLogicalAudioStream::AddSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err; + if (aSource->IsTypeOf(KUidMmfBufferSource) || aSource->IsTypeOf(KUidAudioDeviceSource)) + { + if (iCurrentState == EUninitialized) + { + err = DoAddProcessingUnit(aSource); + } + else + { + err = KErrNotReady; + } + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AddSink +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::AddSink(MAudioProcessingUnit* aSink) + { + DP_CONTEXT(CLogicalAudioStream::AddSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err; + if (aSink->IsTypeOf(KUidMmfBufferSink) || aSink->IsTypeOf(KUidAudioDeviceSink) ) + { + if (iCurrentState == EUninitialized) + { + err = DoAddProcessingUnit(aSink); + } + else + { + err = KErrNotReady; + } + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AddCodec +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::AddAudioCodec(MAudioProcessingUnit* aCodec) + { + DP_CONTEXT(CLogicalAudioStream::AddAudioCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err; + if (iCodec != NULL) + { + DP0_RET(KErrInUse, "%d"); + } + + if (aCodec->IsTypeOf(KUidAudioCodec)) + { + if (iCurrentState == EUninitialized) + { + err = DoAddProcessingUnit(aCodec); + } + else + { + err = KErrNotReady; + } + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AddGainControl +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::AddGainControl(MAudioProcessingUnit* aGainControl) + { + DP_CONTEXT(CLogicalAudioStream::AddGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + if (iGain != NULL) + { + DP0_RET(KErrInUse, "%d"); + } + + if (aGainControl->IsTypeOf(KUidAudioGainControl)) + { + if (iCurrentState == EUninitialized) + { + err = DoAddProcessingUnit(aGainControl); + } + else + { + err = KErrNotReady; + } + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::RemoveProcessigUnit +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::RemoveProcessingUnit(MAudioProcessingUnit* aProcessingUnit) + { + DP_CONTEXT(CLogicalAudioStream::RemoveProcessingUnit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if(iCurrentState != EUninitialized) + { + DP0_RET(KErrNotReady, "%d"); + } + + TInt err(KErrNotFound); + if (aProcessingUnit != NULL) + { + TAudioComponentId param = aProcessingUnit->InstanceId(); + TUint count= iAudioProcessingUnits.Count(); + + if (aProcessingUnit->IsTypeOf(KUidAudioCodec)) + { + iCodec = NULL; + } + else if (aProcessingUnit->IsTypeOf(KUidAudioGainControl)) + { + iGain = NULL; + } + + for ( TUint i(0); i < count; i++ ) + { + // find and remove component + if( iAudioProcessingUnits[i]->InstanceId() == param) + { + iAudioProcessingUnits.Remove(i); + break; + } + } + SetMessageType(EComponentDestruction); + err = KErrNone; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::ResetStreamTime +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::ResetStreamTime() + { + DP_CONTEXT(CLogicalAudioStream::ResetStreamTime *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + if (iCurrentState != EIdle) + { + DP0_RET(KErrNotReady, "%d"); + } + if(iPositionControl) + { + iPositionControl->ResetControlPosition(); + } + iTimeProcessed = 0; + DP0_RET(err, "%d"); + } + + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::GetStreamTime +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::GetStreamTime(TTimeIntervalMicroSeconds& aStreamTime) + { + DP_CONTEXT(CLogicalAudioStream::GetStreamTime *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + if(iPositionControl) + { + err = iPositionControl->GetControlPosition(aStreamTime); + if(err == KErrNone) + { + iTimeProcessed = aStreamTime; + } + } + else + { + aStreamTime = iTimeProcessed; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::Interface +// --------------------------------------------------------------------------- +TAny* CLogicalAudioStream::Interface(TUid aType) + { + DP_CONTEXT(CLogicalAudioStream::Interface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TAny* interface(NULL); + if( aType == KUidAudioStream) + { + interface = static_cast(this); + } + else if( aType == KUidExtensionInferface) + { + interface = static_cast(this); + } + else if (aType == KUidAudioStreamAdaptationObserver) + { + interface = static_cast(this); + DP0_RET(interface, "0x%x"); + } + else if (aType == KUidAudioCodecObserver) + { + interface = static_cast(this); + DP0_RET(interface, "0x%x"); + } + + DP_OUT(); + return interface; + } + +// --------------------------------------------------------------------------- +// From MCustomInterfaceSupport +// CAudioStream::RequestCustomInterface +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::RequestCustomInterface(TUid aUid, TAny*& aPtr) + { + DP_CONTEXT(CLogicalAudioStream::RequestCustomInterface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if (aUid == KA3FBackdoorAccessIfUid) + { + MA3FBackdoorAccessIf* self = this; + aPtr = self; + } + else if(iInterfaceProvider) + { + err = iInterfaceProvider->RequestCustomInterface(aUid, aPtr); + if (err != KErrNone) + { + aPtr = NULL; + } + } + else + { + err = KErrNotReady; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From MCustomInterfaceSupport +// CAudioStream::RegisterObserver +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::RegisterObserver(MCustomInterfaceSupportObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioStream::RegisterObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iCISupportObservers.Find(&aObserver); + if( err != KErrNotFound ) + { + err = KErrAlreadyExists; + } + else + { + err = iCISupportObservers.Append(&aObserver); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// From MCustomInterfaceSupport +// CAudioStream::UnRegisterObserver +// --------------------------------------------------------------------------- +void CLogicalAudioStream::UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver) + { + DP_CONTEXT(CLogicalAudioStream::UnRegisterObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iCISupportObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iCISupportObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MCustomInterfaceSupport +// CAudioStream::CustomInterfaceRemoval +// --------------------------------------------------------------------------- +void CLogicalAudioStream::CustomInterfaceRemoval(TUid aInterfaceUid, TAny* aPtr) + { + DP_CONTEXT(CLogicalAudioStream::CustomInterfaceRemoval *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iCISupportObservers.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iCISupportObservers[idx]->CustomInterfaceRemoval(aInterfaceUid, aPtr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MAudioStreamAdaptationObserver +// CAudioStream::PhysicalAdaptationEvent +// --------------------------------------------------------------------------- +void CLogicalAudioStream::PhysicalAdaptationEvent(TPhysicalEvent /*aEvent*/, TInt /*aError*/) + { + DP_CONTEXT(CLogicalAudioStream::PhysicalAdaptationEvent *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioStream::StateEvent +// --------------------------------------------------------------------------- +void CLogicalAudioStream::StateEvent(TInt aReason, TAudioState aNewState) + { + DP_CONTEXT(CLogicalAudioStream::StateEvent *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); +#ifdef _DEBUG + RDebug::Print(_L("CLogicalAudioStream::StateEvent Error %d Stay %d"), aReason, aNewState); +#endif + TUint count = iAudioStreamObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioStreamObserver[idx]->StateEvent(*this, aReason, aNewState); + } + iCurrentState = aNewState; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AddProcessingUnitComplete +// --------------------------------------------------------------------------- +void CLogicalAudioStream::AddProcessingUnitComplete(TUid aType, TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::AddProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MAudioProcessingUnit* instance = NULL; + MapUidToProcessingUnit(aType, instance); + TUint count = iAudioStreamObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioStreamObserver[idx]->AddProcessingUnitComplete(*this, instance, aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::RemoveProcessingUnitComplete +// --------------------------------------------------------------------------- +void CLogicalAudioStream::RemoveProcessingUnitComplete(TUid aType, TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::RemoveProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MAudioProcessingUnit* instance = NULL; + MapUidToProcessingUnit(aType, instance); + TUint count = iAudioStreamObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioStreamObserver[idx]->RemoveProcessingUnitComplete(*this, instance, aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MAudioStreamAdaptationObserver +// CLogicalAudioStream::ProcessingFinished +// --------------------------------------------------------------------------- +void CLogicalAudioStream::ProcessingFinished() + { + DP_CONTEXT(CLogicalAudioStream::ProcessingFinished *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioStreamObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioStreamObserver[idx]->ProcessingFinished(*this); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::FlushComplete +// --------------------------------------------------------------------------- +void CLogicalAudioStream::FlushComplete(TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::FlushComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioStreamObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + iAudioStreamObserver[idx]->FlushComplete(*this, aError); + } + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// Internal +// CLogicalAudioStream::DoAddProcessingUnit +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::DoAddProcessingUnit(MAudioProcessingUnit* aProcessingUnit) + { + DP_CONTEXT(CLogicalAudioStream::DoAddProcessingUnit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + if (aProcessingUnit->IsTypeOf(KUidAudioCodec) ) + { + // Need for tone handling error + CAudioProcessingUnit* pUnit = static_cast(aProcessingUnit); + iCodec = static_cast(pUnit); + } + else if (aProcessingUnit->IsTypeOf(KUidAudioGainControl) ) + { + CAudioProcessingUnit* pUnit = static_cast(aProcessingUnit); + iGain = static_cast(pUnit); + } + + err = iAudioProcessingUnits.Append(aProcessingUnit); + SetMessageType(EComponentCreation); + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// Internal +// CLogicalAudioStream::MapUidToProcessingUnit +// --------------------------------------------------------------------------- +void CLogicalAudioStream::MapUidToProcessingUnit(TUid aType, MAudioProcessingUnit*& aInstance) + { + DP_CONTEXT(CLogicalAudioStream::MapUidToProcessingUnit *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioProcessingUnits.Count(); + for(TUint i=0; i(iAudioProcessingUnits[i]); + if ( aInstance->IsTypeOf(aType) ) + { + break; + } + aInstance = NULL; + } + DP_OUT(); + } + +// From MLogicalChain +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SetMessageType +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetMessageType(TMMRCMessageType aMessageType) + { + DP_CONTEXT(CLogicalAudioStream::SetMessageType *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iMessageType |= aMessageType; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::ResetMessage +// --------------------------------------------------------------------------- +void CLogicalAudioStream::ResetMessage() + { + DP_CONTEXT(CLogicalAudioStream::SetMessageType *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iMessageType = ENoMessage; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::MessageType +// --------------------------------------------------------------------------- +TUint CLogicalAudioStream::MessageType() + { + DP_CONTEXT(CLogicalAudioStream::MessageType *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(iMessageType, "Message type %d"); + } + + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AudioProcessingUnitUid +// --------------------------------------------------------------------------- +TUid CLogicalAudioStream::AudioProcessingUnitUid(TInt aIndex) + { + DP_CONTEXT(CLogicalAudioStream::AudioProcessingUnitUid *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUid uid = {0}; + MAudioProcessingUnit* pUnit(NULL); + if (aIndex >= 0) + { + pUnit = static_cast(iAudioProcessingUnits[aIndex]); + } + + if (pUnit != NULL) + { + if (pUnit->IsTypeOf(KUidAudioDecoder)) + { + uid = KUidAudioDecoder; + } + else if (pUnit->IsTypeOf(KUidAudioEncoder)) + { + uid = KUidAudioEncoder; + } + else if (pUnit->IsTypeOf(KUidMmfBufferSource)) + { + uid = KUidMmfBufferSource; + } + else if (pUnit->IsTypeOf(KUidAudioGainControl)) + { + uid = KUidAudioGainControl; + } + else if (pUnit->IsTypeOf(KUidAudioDeviceSink)) + { + uid = KUidAudioDeviceSink; + } + else if (pUnit->IsTypeOf(KUidMmfBufferSink)) + { + uid = KUidMmfBufferSink; + } + else if (pUnit->IsTypeOf(KUidAudioDeviceSource)) + { + uid = KUidAudioDeviceSource; + } + else if (pUnit->IsTypeOf(KUidAudioCodec)) + { + uid = KUidAudioCodec; + } + } + DP_OUT(); + return uid; + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::AudioProcessingUnitsCount +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::AudioProcessingUnitsCount() + { + DP_CONTEXT(CLogicalAudioStream::AudioProcessingUnitsCount *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(iAudioProcessingUnits.Count(), "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::StreamState +// --------------------------------------------------------------------------- +TAudioState CLogicalAudioStream::StreamState() + { + DP_CONTEXT(CLogicalAudioStream::StreamState *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(iCurrentState, "Stream state %d"); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::SetStreamState +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetStreamState(TAudioState aAudioState) + { + DP_CONTEXT(CLogicalAudioStream::StreamState *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iCurrentState = aAudioState; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::CodecFormat +// --------------------------------------------------------------------------- +TUid CLogicalAudioStream::CodecFormat() + { + DP_CONTEXT(CLogicalAudioStream::CodecFormat *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + DP_OUT(); + TUid tuidnull = {0}; + if(codec) + { + return codec->iFormat; + } + else + { + return tuidnull; + } + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::GetSampleRate +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::GetSampleRate() + { + DP_CONTEXT(CLogicalAudioStream::GetSampleRate *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + const TUint KDefaultSampleRate = 8000; // Default sample rate + CLogicalAudioCodec* codec = static_cast(iCodec); + DP_OUT(); + TInt sampleRateValue = KDefaultSampleRate; + if(codec) + { + sampleRateValue = codec->iSampleRateConfig; + } + return sampleRateValue; + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::GetMode +// --------------------------------------------------------------------------- +TUid CLogicalAudioStream::GetMode() + { + DP_CONTEXT(CLogicalAudioStream::GetMode *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + TUid tuidnull = {0}; + DP_OUT(); + if(codec) + { + return codec->iModeConfig; + } + else + { + return tuidnull; + } + } + + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::Priority +// --------------------------------------------------------------------------- +TInt CLogicalAudioStream::Priority() + { + DP_CONTEXT(CLogicalAudioStream::Priority*CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(iAudioTypeSettings.iPriority, "Priority %d"); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::GetVolumeRampParameters +// --------------------------------------------------------------------------- +void CLogicalAudioStream::GetVolumeRampParameters(TUid& aRampOperation, TTimeIntervalMicroSeconds& aRampDuration) + { + DP_CONTEXT(CLogicalAudioStream::GetVolumeRampParameters*CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioGainControl* gain = static_cast(iGain); + if(gain) + { + aRampOperation = gain->iDesiredRampOperation; + aRampDuration = gain->iDesiredRampTime; + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::CopySettings +// @param the logical chain from where the parameter will be copied +// --------------------------------------------------------------------------- +void CLogicalAudioStream::CopySettings(const MLogicalChain& aChain) + { + DP_CONTEXT(CLogicalAudioStream::CopySettings *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CopyStreamSettings(aChain); + CopyCodecSettings(aChain); + CopyGainSettings(aChain); + DP_OUT(); + } + +void CLogicalAudioStream::CopyStreamSettings(const MLogicalChain& aChain) + { + DP_CONTEXT(CLogicalAudioStream::CopyStreamSettings *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // LogicalAudioStream settings + CLogicalAudioStream& srcChain = static_cast(const_cast(aChain)); + + iAudioTypeSettings = srcChain.iAudioTypeSettings; + iCurrentState = srcChain.iCurrentState; + iRequestState = srcChain.iRequestState; + iMessageType = srcChain.iMessageType; + iTimeProcessed = srcChain.iTimeProcessed; + DP_OUT(); + } + +void CLogicalAudioStream::CopyCodecSettings(const MLogicalChain& aChain) + { + DP_CONTEXT(CLogicalAudioStream::CopyCodecSettings *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CLogicalAudioStream& srcChain = static_cast(const_cast(aChain)); + // Copy codec settings + CLogicalAudioCodec* srcCodec = static_cast(srcChain.iCodec); + if(iCodec && srcCodec) + { + CLogicalAudioCodec* logicalCodec = static_cast(iCodec); + logicalCodec->iFormat = srcCodec->iFormat; + logicalCodec->iSampleRateConfig = srcCodec->iSampleRateConfig; + logicalCodec->iModeConfig = srcCodec->iModeConfig; + } + DP_OUT(); + } + + +void CLogicalAudioStream::CopyGainSettings(const MLogicalChain& aChain) + { + DP_CONTEXT(CLogicalAudioStream::CopyGainSettings *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CLogicalAudioStream& srcChain = static_cast(const_cast(aChain)); + // Copy gain settings + CLogicalAudioGainControl* srcGain = static_cast(srcChain.iGain); + if (iGain && srcGain ) + { + if(srcGain->iDesiredChannels.Count() > 0) + { + CLogicalAudioGainControl* logicalGain = static_cast(iGain); + TUint count = srcGain->iDesiredChannels.Count(); + for (TUint i(0); i < count; i++) + { + logicalGain->iDesiredChannels[i] = srcGain->iDesiredChannels[i]; + } + logicalGain->iDesiredRampOperation = srcGain->iDesiredRampOperation; + logicalGain->iDesiredRampTime = srcGain->iDesiredRampTime; + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::CloneL +// --------------------------------------------------------------------------- +MLogicalChain* CLogicalAudioStream::CloneL() + { + DP_CONTEXT(CLogicalAudioStream::CloneL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + MLogicalChain* newLogicalChain = NULL; + + // Create another audiostream + CAudioStreamManager *manager = NULL; + manager = CAudioStreamManager::NewL(KUidAudioStream); + // Copy stream settings + CLogicalAudioStream* logicalAudioStream = static_cast(manager); + + MAudioProcessingUnit* pUnit=NULL; + TInt count = iAudioProcessingUnits.Count(); + for(TInt i = 0; i < count ; i++) + { + // Create processing unit + TUid type = AudioProcessingUnitUid(i); + TComponentParameters cParameters; + cParameters.iTypeUid = type; + cParameters.iInstanceId = 0; + cParameters.iContextId = 0; + cParameters.iSettingsObserver = NULL; + pUnit = CAudioProcessingUnit::NewL(cParameters); + + // If no error then add to the stream + if ( (type == KUidAudioDecoder) || (type == KUidAudioEncoder) ) + { + err = logicalAudioStream->AddAudioCodec(pUnit); + } + else if (type == KUidMmfBufferSource || (type == KUidAudioDeviceSource) ) + { + err = logicalAudioStream->AddSource(pUnit); + } + else if (type == KUidAudioGainControl) + { + err = logicalAudioStream->AddGainControl(pUnit); + } + else if (type == KUidAudioDeviceSink || ( type == KUidMmfBufferSink) ) + { + err = logicalAudioStream->AddSink(pUnit); + } + // TODO: + // Check this couldn't be added + if(err != KErrNone) + { + logicalAudioStream->iAudioProcessingUnits.Remove(iAudioProcessingUnits.Count()-1); + delete pUnit; + } + } + // Cast to MLogicalChain + newLogicalChain = static_cast(logicalAudioStream); + newLogicalChain->CopySettings(*this); + + DP0_RET(newLogicalChain, "0x%x"); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::Release +// --------------------------------------------------------------------------- +void CLogicalAudioStream::Release() + { + DP_CONTEXT(CLogicalAudioStream::Release *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // ResetAndDestroy + TInt count = iAudioProcessingUnits.Count(); + TInt i; + for (i=0; i(iAudioProcessingUnits[i]); + delete pUnit; + } + iAudioProcessingUnits.Reset(); + DP_OUT(); + delete this; + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::GetComponent +// --------------------------------------------------------------------------- +TAny* CLogicalAudioStream::GetComponent(TUid aType) + { + DP_CONTEXT(CLogicalAudioStream::GetComponent *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TAny* interface = NULL; + + // go through this or our subcomponents to see if somebody knows about the interface + interface = Interface(aType); + if (interface==NULL) + { + TUint count = iAudioProcessingUnits.Count(); + // go through components looking for valid interface + for ( TInt i=0; i < count; i++ ) + { + interface = iAudioProcessingUnits[i]->Interface(aType); + if (interface!=NULL) + { + break; + }; + } + }; + + + DP0_RET(interface, "0x%x"); + } + + + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::SetAdaptationSource +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetAdaptationSource(MMMFBufferSource& aSource) + { + DP_CONTEXT(CLogicalAudioStream::SetAdaptationSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MapUidToProcessingUnit(KUidMmfBufferSource, iAudioProcessingUnit); + ASSERT(iAudioProcessingUnit); + + CAudioProcessingUnit* cUnit = static_cast(iAudioProcessingUnit); + CLogicalBufferSource* bufferSource = (static_cast(cUnit)); + + bufferSource->iAdaptationBufferSource = &aSource; + aSource.SetDataSupplier(*bufferSource); + + iAudioProcessingUnit = NULL; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::SetAdaptationSink +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetAdaptationSink(MMMFBufferSink& aSink) + { + DP_CONTEXT(CLogicalAudioStream::SetAdaptationSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MapUidToProcessingUnit(KUidMmfBufferSink, iAudioProcessingUnit); + ASSERT(iAudioProcessingUnit); + + CAudioProcessingUnit* cUnit = static_cast(iAudioProcessingUnit); + CLogicalBufferSink* bufferSink = (static_cast(cUnit)); + + bufferSink->iAdaptationBufferSink = &aSink; + aSink.SetDataConsumer(*bufferSink); + + iAudioProcessingUnit = NULL; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::SetAdaptationGainControl +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetAdaptationGainControl(MAudioGainControl& aGain) + { + DP_CONTEXT(CLogicalAudioStream::SetAdaptationGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + ASSERT(iGain); + CLogicalAudioGainControl* gain = static_cast(iGain); + gain->iAdaptationGain = &aGain; + aGain.RegisterAudioGainControlObserver(*gain); + DP_OUT(); + } + + + +// --------------------------------------------------------------------------- +// From MLogicalChain +// CLogicalAudioStream::SetPositionControl +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetStreamPositionControl(MStreamPositionControl& aPositionControl) + { + DP_CONTEXT(CLogicalAudioStream::SetStreamPositionControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iPositionControl = &aPositionControl; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SetAdaptationStream +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetAdaptationStream(MConfigurationHelper& aStream) + { + DP_CONTEXT(CLogicalAudioStream::SetAdaptationStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + if (codec != NULL) + { + if (codec->iAdaptationStream == NULL) + { + codec->iAdaptationStream = &aStream; + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SetStreamBufferControl +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetStreamBufferControl(MStreamBufferControl& aStreamBufferControl) + { + DP_CONTEXT(CLogicalAudioStream::SetAdaptationStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iStreamBufferControl = &aStreamBufferControl; + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SetCustomInterfaceProvider +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetCustomInterfaceProvider(MCustomInterfaceSupport& aInterfaceProvider) + { + DP_CONTEXT(CLogicalAudioStream::SetCustomInterfaceProvider *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iInterfaceProvider = &aInterfaceProvider; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SampleRateSet +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SampleRateSet(TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + if(codec) + { + TUint count = codec->iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + codec->iAudioCodecObserver[idx]->SampleRateSet(aError); + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::ModeSet +// --------------------------------------------------------------------------- +void CLogicalAudioStream::ModeSet(TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + if(codec) + { + TUint count = codec->iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + codec->iAudioCodecObserver[idx]->ModeSet(aError); + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::GetSupportedSampleRatesComplete +// --------------------------------------------------------------------------- +void CLogicalAudioStream::GetSupportedSampleRatesComplete (TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + if(codec) + { + TUint count = codec->iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + codec->iAudioCodecObserver[idx]->GetSupportedSampleRatesComplete(aError); + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::GetSupportedModesComplete +// --------------------------------------------------------------------------- +void CLogicalAudioStream::GetSupportedModesComplete (TInt aError) + { + DP_CONTEXT(CLogicalAudioStream::SampleRateSet *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalAudioCodec* codec = static_cast(iCodec); + if(codec) + { + TUint count = codec->iAudioCodecObserver.Count(); + for ( TUint idx(0); idx < count; idx++ ) + { + codec->iAudioCodecObserver[idx]->GetSupportedModesComplete(aError); + } + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CLogicalAudioStream::SetParentContext +// --------------------------------------------------------------------------- +void CLogicalAudioStream::SetParentContext(const CAudioContext& aContext) + { + iParentContext = const_cast(&aContext); + } + + +// from MA3FBackdoorAccessIf + +MAudioContext* CLogicalAudioStream::AudioContext() + { + return iParentContext; + } + +MAudioStream* CLogicalAudioStream::AudioStream() + { + return this; + } + +MAudioProcessingUnit* CLogicalAudioStream::ProcessingUnit(TUid aType) + { + // look through our processing units for something of the correct type + TInt numProcessingUnits = iAudioProcessingUnits.Count(); + for (TInt index=0; index < numProcessingUnits; index++) + { + MAudioProcessingUnit* ptr = iAudioProcessingUnits[index]; + if (ptr->IsTypeOf(aType)) + { + return ptr; + } + } + return NULL; + } diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiostream/logicalaudiostream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiostream/logicalaudiostream.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,221 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef LOGICALAUDIOSTREAM_H +#define LOGICALAUDIOSTREAM_H + +#include +#include +#include +#include + +#include +#include + +#include "componentparameters.h" +#include "audiostreammanager.h" + +#include +#include "../shared/a3fbackdooraccess.h" +#include "../audiocontext/audiocontext.h" + +// TO BE REMOVED WHEN MMRC SERVER IS READY +#include "mlogicalchain.h" +#include "maudiostreamadaptationobserver.h" +#include "maudiocodecadaptationobserver.h" + +#include + +#include "mstreambuffercontrol.h" + + +class MLogicalSettingObserver; +class CLogicalAudioCodec; +class CLogicalAudioGainControl; +class CLogicalBufferSource; +class CLogicalBufferSink; +class CLogicalAudioDeviceSink; +class CLogicalAudioDeviceSource; + + +/** +This is the implementation of audio stream API. +@see MAudioStream +*/ + +NONSHARABLE_CLASS(CLogicalAudioStream) : public CAudioStreamManager, + public MCustomInterfaceSupport, + public MCustomInterfaceSupportObserver, + public MAudioStreamAdaptationObserver, + public MLogicalChain, + public MAudioCodecObserver, + public MA3FBackdoorAccessIf + { +friend class CAudioContext; + +public: + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalAudioStream(); + + // from MAudioStream + virtual TInt Initialize(); + virtual TInt Load(); + virtual TInt Activate(); + virtual TInt Stop(); + virtual TInt Unload(); + virtual TInt Uninitialize(); + virtual TInt Prime(); + virtual TInt Flush(); + + virtual TInt AddSource(MAudioProcessingUnit* aSource); + virtual TInt AddSink(MAudioProcessingUnit* aSink); + virtual TInt AddAudioCodec(MAudioProcessingUnit* aCodec); + virtual TInt AddGainControl(MAudioProcessingUnit* aGainControl); + virtual TInt RemoveProcessingUnit(MAudioProcessingUnit* aProcessingUnit); + virtual TInt ResetStreamTime(); + virtual TInt GetStreamTime(TTimeIntervalMicroSeconds& aStreamTime); + virtual TAny* Interface(TUid aType); + + // from MCustomInterfaceSupport + virtual TInt RequestCustomInterface(TUid aUid, TAny*& aPtr); + virtual TInt RegisterObserver(MCustomInterfaceSupportObserver& aObserver); + virtual void UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver); + + // from MCustomInterfaceSupportObserver + virtual void CustomInterfaceRemoval(TUid aInterfaceUid, TAny* aPtr); + + // from MAudioStreamAdaptationObserver + void PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError); + void StateEvent(TInt aReason, TAudioState aNewState); + void AddProcessingUnitComplete(TUid aType, TInt aError); + void RemoveProcessingUnitComplete(TUid aType, TInt aError); + void ProcessingFinished (); + void FlushComplete (TInt aError); + + // from MLogicalChain + void SetMessageType(TMMRCMessageType aMessageType); + void ResetMessage(); + TUint MessageType(); + TUid AudioProcessingUnitUid(TInt aIndex); + TInt AudioProcessingUnitsCount(); + TAudioState StreamState(); + void SetStreamState(TAudioState aState); + TUid CodecFormat(); + TInt GetSampleRate(); + TUid GetMode(); + TInt Priority(); + void GetVolumeRampParameters(TUid& aRampOperation, TTimeIntervalMicroSeconds& aRampDuration); + MLogicalChain* CloneL(); + void Release(); + TAny* GetComponent(TUid aType); + + void CopySettings(const MLogicalChain& aChain); + void SetAdaptationSource(MMMFBufferSource& aSource); + void SetAdaptationSink(MMMFBufferSink& aSink); + void SetAdaptationGainControl(MAudioGainControl& aGain); + void SetStreamPositionControl(MStreamPositionControl& aControl ); + void SetCustomInterfaceProvider(MCustomInterfaceSupport& aControl); + void SetCodecConfiguration(RArray aSampleRate, RArray aMode); + void SetAdaptationStream(MConfigurationHelper& aStream); + void SetStreamBufferControl(MStreamBufferControl& aStreamBufferControl); + + // from MAudioCodecObserver + void SampleRateSet(TInt aError); + void ModeSet(TInt aError); + void GetSupportedSampleRatesComplete (TInt aError); + void GetSupportedModesComplete (TInt aError); + + // from MA3FBackdoorAccessIf + MAudioContext* AudioContext(); + MAudioStream* AudioStream(); + MAudioProcessingUnit* ProcessingUnit(TUid aType); + + /** + Create a new instance. + + @param aStream the stream implementation. Ownership of the pointer is transferred to the + create CAudioStream object instance. + @return CAudioStreamComponent* a pointer to the created instance. + */ + static CLogicalAudioStream* NewL(TUid aTypeId); + + //Get functions for configuration + void GetSupportedSampleRates(RArray& aSupportedRates); + void GetSupportedModes(RArray& aSupportedModes); + + virtual void SetParentContext(const CAudioContext& aContext); + +protected: + // Internal method + void MapUidToProcessingUnit(TUid aType, MAudioProcessingUnit*& aInstance); + + void CopyStreamSettings(const MLogicalChain& aChain); + void CopyCodecSettings(const MLogicalChain& aChain); + void CopyGainSettings(const MLogicalChain& aChain); + +private: + + void ConstructL(); + CLogicalAudioStream(); + TInt DoAddProcessingUnit(MAudioProcessingUnit* aUnit); + +private: + // Time processed + TTimeIntervalMicroSeconds iTimeProcessed; + + // Audio processing units at this context + RPointerArray iAudioProcessingUnits; + + // CI observers + RPointerArray iCISupportObservers; + + // Stream state + TAudioState iCurrentState; + + TAudioState iRequestState; + + // MLogical chain variables + MAudioProcessingUnit* iCodec; + + MAudioProcessingUnit* iGain; + + // General pointer, useful to manage all the audioprocessingunit + // never keeps specific information + MAudioProcessingUnit* iAudioProcessingUnit; + + // Adaptation interfaces + MStreamPositionControl* iPositionControl; + MStreamBufferControl* iStreamBufferControl; + + MCustomInterfaceSupport* iInterfaceProvider; + + // Message type + TUint iMessageType; + + TInt iContextPriority; + + // handle back to parent context + CAudioContext* iParentContext; + }; + +#endif // LOGICALAUDIOSTREAM_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/audiostream/logicalaudiostream.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/audiostream/logicalaudiostream.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidLogicalAudioStreamDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10283445; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAudioStreamUid; + version_no = 1; + display_name = "logicalaudiostreamfactory"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersink/logicalbuffersink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersink/logicalbuffersink.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,175 @@ +// Copyright (c) 2006-2009 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 "logicalbuffersink.h" +#include +#include // For making it ECom plugin + +// Exported proxy for instantiation method resolution +// Define the interface UIDs +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfBufferSinkUid, CLogicalBufferSink::NewL) + }; + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CLogicalBufferSink::CLogicalBufferSink(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalBufferSink::CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +CLogicalBufferSink* CLogicalBufferSink::NewL(TAny* aParameters) + { + DP_STATIC_CONTEXT(CLogicalBufferSink::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalBufferSink* self = new(ELeave)CLogicalBufferSink(aParameters); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CLogicalBufferSink::ConstructL() + { + DP_CONTEXT(CLogicalBufferSink::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CLogicalBufferSink::~CLogicalBufferSink() + { + DP_CONTEXT(CLogicalBufferSink::~CLogicalBufferSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// from class MMMFBufferSink +// --------------------------------------------------------------------------- +// CLogicalBufferSink::SetDataConsumer +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSink::SetDataConsumer(MMMFAudioDataConsumer& aConsumer) + { + DP_CONTEXT(CLogicalBufferSink::SetDataConsumer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iConsumer = &aConsumer; + DP0_RET(KErrNone,"%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSink::BufferEmptied +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSink::BufferEmptied(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CLogicalBufferSink::BufferEmptied *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iAdaptationBufferSink->BufferEmptied(aBuffer); + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSink::BuffersDiscarded +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSink::BuffersDiscarded() + { + DP_CONTEXT(CLogicalBufferSink::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iAdaptationBufferSink->BuffersDiscarded(); + DP0_RET(err,"%d"); + } + +// From CAudioProcessingUnit +// --------------------------------------------------------------------------- +// CLogicalBufferSink::IsTypeOf +// --------------------------------------------------------------------------- +// +TBool CLogicalBufferSink::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalBufferSink::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if (iType == aTypeId) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSink::Interface +// --------------------------------------------------------------------------- +// +TAny* CLogicalBufferSink::Interface(TUid aType) + { + DP_CONTEXT(CLogicalBufferSink::Interface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + MMMFBufferSink* ptr = NULL; + if(aType==KUidMmfBufferSink) + { + ptr = static_cast(this); + } + DP_OUT(); + return ptr; + } + +// From MMMFAudioDataConsumer +// --------------------------------------------------------------------------- +// CLogicalBufferSink::BufferToBeFilled +// --------------------------------------------------------------------------- +// +void CLogicalBufferSink::BufferToBeEmptied(MMMFBufferSink* /*aSink*/, CMMFBuffer* aBuffer) + { + iConsumer->BufferToBeEmptied(this, aBuffer); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::DiscardBuffers +// --------------------------------------------------------------------------- +// +void CLogicalBufferSink::DiscardBuffers(MMMFBufferSink* /*aSink*/) + { + iConsumer->DiscardBuffers(this); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersink/logicalbuffersink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersink/logicalbuffersink.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2004-2009 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: +* Name : logicalbuffersink.h +* Part of : ACL Logical Layer +* +*/ + + + +#ifndef LOGICALBUFFERSINK_H +#define LOGICALBUFFERSINK_H + +#include +#include +#include +#include +#include + +#include "audioprocessingunit.h" + +#include + + +class MLogicalSettingObserver; + +/** +This is the implementation of CAudioSink API. + +@see CAudioComponent +*/ +NONSHARABLE_CLASS(CLogicalBufferSink) : public CAudioProcessingUnit, + public MMMFBufferSink, + public MMMFAudioDataConsumer + { +friend class CAudioContext; +friend class CLogicalAudioStream; + +public: + + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalBufferSink(); + + // from class MBufferSink + TInt SetDataConsumer(MMMFAudioDataConsumer& aConsumer); + TInt BufferEmptied(CMMFBuffer* aBuffer); + TInt BuffersDiscarded(); + + // from class CAudioProcessingUnit + virtual TBool IsTypeOf(TUid aTypeId) const; + virtual TAny* Interface(TUid aType); + + // from MMMFAudioDataConsumer + void BufferToBeEmptied(MMMFBufferSink* aSink, CMMFBuffer* aBuffer); + void DiscardBuffers(MMMFBufferSink* aSink); + /** + Create a new instance. + + @return CBufferSink* a pointer to the created instance. + */ + static CLogicalBufferSink* NewL(TAny* aParameters); + +private: + + void ConstructL(); + + CLogicalBufferSink(TAny* aParameters); + +protected: + // The adaptation buffer sink + MMMFBufferSink* iAdaptationBufferSink; + +private: + // The client which requests data + MMMFAudioDataConsumer *iConsumer; + + CMMFBuffer* iBuffer; + }; + +#endif // LOGICALBUFFERSINK_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersink/logicalbuffersink.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersink/logicalbuffersink.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidBufferSinkDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfBufferSinkUid; + version_no = 1; + display_name = "logicalbuffersinkfactory"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersource/logicalbuffersource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersource/logicalbuffersource.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,176 @@ +// Copyright (c) 2004-2009 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: +// Name : logicalbuffersource.cpp +// Part of : ACL Logical Layer +// + + + +#include "logicalbuffersource.h" +#include +#include // For making it ECom plugin + +// Map the interface implementation UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KMmfBufferSourceUid, CLogicalBufferSource::NewL), + }; + +// Exported proxy for instantiation method resolution. +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CLogicalBufferSource::CLogicalBufferSource(TAny* aParam) : CAudioProcessingUnit(aParam) + { + TRACE_CREATE(); + DP_CONTEXT(CLogicalBufferSource::CLogicalBufferSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +CLogicalBufferSource* CLogicalBufferSource::NewL(TAny* aParameters) + { + DP_STATIC_CONTEXT(CLogicalBufferSource::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CLogicalBufferSource* self = new(ELeave)CLogicalBufferSource(aParameters); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CLogicalBufferSource::ConstructL() + { + DP_CONTEXT(CLogicalBufferSource::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CLogicalBufferSource::~CLogicalBufferSource() + { + DP_CONTEXT(CLogicalBufferSource::~CLogicalBufferSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// from MMMFBufferSource +// --------------------------------------------------------------------------- +// CLogicalBufferSource::SetDataSupplier +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSource::SetDataSupplier(MMMFAudioDataSupplier& aSupplier) + { + DP_CONTEXT(CLogicalBufferSource::SetDataSupplier *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + iSupplier = &aSupplier; + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::BufferFilled +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSource::BufferFilled(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CLogicalBufferSource::BufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iAdaptationBufferSource->BufferFilled(aBuffer); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::BuffersDiscarded +// --------------------------------------------------------------------------- +// +TInt CLogicalBufferSource::BuffersDiscarded() + { + DP_CONTEXT(CLogicalBufferSource::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iAdaptationBufferSource->BuffersDiscarded(); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::IsTypeOf +// --------------------------------------------------------------------------- +// +TBool CLogicalBufferSource::IsTypeOf(TUid aTypeId) const + { + DP_CONTEXT(CLogicalBufferSource::IsTypeOf *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool result = EFalse; + if (iType == aTypeId) + { + result = ETrue; + } + DP0_RET(result, "%d"); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::Interface +// --------------------------------------------------------------------------- +// +TAny* CLogicalBufferSource::Interface(TUid aType) + { + DP_CONTEXT(CLogicalBufferSource::Interface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TAny* interface = NULL; + if(aType==KUidMmfBufferSource) + { + interface = static_cast(this); + } + DP0_RET(interface, "%d"); + } + +// From MMMFAudioDataSupplier +// --------------------------------------------------------------------------- +// CLogicalBufferSource::BufferToBeFilled +// --------------------------------------------------------------------------- +// +void CLogicalBufferSource::BufferToBeFilled(MMMFBufferSource* /*aSource*/, CMMFBuffer* aBuffer) + { + iSupplier->BufferToBeFilled(this, aBuffer); + } + +// --------------------------------------------------------------------------- +// CLogicalBufferSource::DiscardBuffers +// --------------------------------------------------------------------------- +// +void CLogicalBufferSource::DiscardBuffers(MMMFBufferSource* /*aSource*/) + { + iSupplier->DiscardBuffers(this); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersource/logicalbuffersource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersource/logicalbuffersource.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,90 @@ +/* +* Copyright (c) 2004-2009 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: +* Name : logicalbuffersource.h +* Part of : ACL Logical Layer +* +*/ + + + +#ifndef LOGICALBUFFERSOURCE_H +#define LOGICALBUFFERSOURCE_H + +#include +#include +#include +#include +#include + +#include "audioprocessingunit.h" + +#include + + +class MLogicalSettingObserver; + +/** + +*/ +NONSHARABLE_CLASS(CLogicalBufferSource) : public CAudioProcessingUnit, + public MMMFBufferSource, + public MMMFAudioDataSupplier + { +friend class CAudioContext; +friend class CLogicalAudioStream; +public: + + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CLogicalBufferSource(); + + // from MMMFBufferSource + virtual TInt SetDataSupplier(MMMFAudioDataSupplier& aSupplier); + virtual TInt BufferFilled(CMMFBuffer* aBuffer); + virtual TInt BuffersDiscarded(); + + // from CAudioProcessingUnit + virtual TBool IsTypeOf(TUid aTypeId) const; + virtual TAny* Interface(TUid aType); + + // from MMMFDataSupplier + virtual void BufferToBeFilled(MMMFBufferSource* aSource, CMMFBuffer* aBuffer); + virtual void DiscardBuffers(MMMFBufferSource* aSource); + + /** + Create a new instance. + + @return CBufferSource* a pointer to the created instance. + */ + static CLogicalBufferSource* NewL(TAny* aParameters); + +private: + void ConstructL(); + + CLogicalBufferSource(TAny* aParameters); + +protected: + // The adaptation buffer source + MMMFBufferSource* iAdaptationBufferSource; + +private: + // The client which provides data + MMMFAudioDataSupplier* iSupplier; + }; + +#endif // LOGICALBUFFERSOURCE_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/buffersource/logicalbuffersource.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/buffersource/logicalbuffersource.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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: +// + + + +//INCLUDES +#include +#include // For implementation Uid +#include "audioprocessingunitdlluids.hrh" // For dll uid + +RESOURCE REGISTRY_INFO theInfo + { + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = KUidBufferSourceDll; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KUidPluginInterfaceAudioProcessinUnit; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KMmfBufferSourceUid; + version_no = 1; + display_name = "logicalbuffersourcefactory"; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/a3fbackdooraccess.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/a3fbackdooraccess.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ + +// Copyright (c) 2009 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: +// + +#ifndef A3FBACKDOORACCESS_H +#define A3FBACKDOORACCESS_H + +/* +This class is to give access to various a3f interfaces from the CustomInterface() +call. It is intended for testing purposes, and is not for general use. +*/ + +const TUid KA3FBackdoorAccessIfUid = {0x10286696}; + +// forward decs +class MAudioContext; +class MAudioStream; +class MAudioProcessingUnit; + +class MA3FBackdoorAccessIf + { +public: + virtual MAudioContext* AudioContext() = 0; + virtual MAudioStream* AudioStream() = 0; + virtual MAudioProcessingUnit* ProcessingUnit(TUid aType) = 0; + }; + +#endif // A3FBACKDOORACCESS_H + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/aacommondatatypes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/aacommondatatypes.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,205 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + + +#ifndef AACOMMONDATATYPES_H +#define AACOMMONDATATYPES_H + +// INCLUDES +#include +#include + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +const TInt KDeviceMaxVolume = 10; +const TInt KDevsoundMaxGain = 1; + +// MACROS +//#define ?macro ?macro_def + +// DATA TYPES +enum TAudioInputPreference + { + ENoPref = 0x00, + EInputDefaultMic = 0x01, + EInputFMRadio = 0x02, + EInputSpeakerOutput = 0x04, + EInputVoiceCall = 0x08, + EInputLineIn = 0x10 + }; + +enum TAudioOutputPreference + { + EOutputNone = 0x00, + EOutputDefault = 0x01, + EOutputPublic = 0x02, + EOutputPrivate = 0x04, + EOutputAll = 0x08 + }; + +struct TAudioFormat + { + TFourCC format; + TUint16 extension; + }; + +enum TBitsInSample + { + E16BitsInSample, + E20BitsInSample, + E24BitsInSample, + E32BitsInSample, + ENotDefined = 0xFF + }; + +enum TAudioType + { + EMedia, // to be removed + ESpeech, // to be removed + EDefaultAudio, + ERingingTone, + ECsCall, + EVoip, + ERadio, + EKeyTone, + ESind, + EPoc, + EStereoBt, + EVisualization, + EVoipNonSignaling, + ENotification, + EVideoCall, + EKodiakPoc + }; + +enum TCodecLocation + { + ECodecLocationMCU, + ECodecLocationADSP, + ECodecLocationCDSP, + ECodecLocationUndefined + }; + +// buffer size parameters +enum TBufferSize + { + EBufferSizeSmall, + EBufferSizeMedium, + EBufferSizeLarge, + EBufferSizeCustom + }; + +#ifndef _DEVSOUND_DATATYPES_DEFINED_ +#define _DEVSOUND_DATATYPES_DEFINED_ + +enum TMMFSampleRate + { + EMMFSampleRate8000Hz = 0x00000001, ///< 8000 Hz Sampling Rate + EMMFSampleRate11025Hz = 0x00000002, ///< 11025 Hz Sampling Rate + EMMFSampleRate16000Hz = 0x00000004, ///< 16000 Hz Sampling Rate + EMMFSampleRate22050Hz = 0x00000008, ///< 22050 Hz Sampling Rate + EMMFSampleRate32000Hz = 0x00000010, ///< 32000 Hz Sampling Rate + EMMFSampleRate44100Hz = 0x00000020, ///< 44100 Hz Sampling Rate + EMMFSampleRate48000Hz = 0x00000040, ///< 48000 Hz Sampling Rate + EMMFSampleRate88200Hz = 0x00000080, ///< 88200 Hz Sampling Rate + EMMFSampleRate96000Hz = 0x00000100, ///< 96000 Hz Sampling Rate + EMMFSampleRate12000Hz = 0x00000200, ///< 12000 Hz Sampling Rate + EMMFSampleRate24000Hz = 0x00000400, ///< 24000 Hz Sampling Rate + EMMFSampleRate64000Hz = 0x00000800 + }; + +enum TMMFMonoStereo + { + EMMFMono = 0x00000001, ///< Mono mode + EMMFStereo = 0x00000002 ///< Stereo mode + }; + +class TMMFCapabilities + { +public: + /** Sampling Rates supported + */ + TUint iRate; + /** Encodings supported + */ + TUint iEncoding; + /** Mono/Stereo support + */ + TUint iChannels; + /** Buffer size supported + */ + TInt iBufferSize; + }; + +#endif // _DEVSOUND_DATATYPES_DEFINED_ + +struct TAudioStreamParams + { + // Sample rate used in data pipe + TMMFSampleRate iSampleRate; + + // Stereo mode used in data pipe + TMMFMonoStereo iStereoMode; + + // Type of stream audio + TAudioType iStreamType; + + // Playback / Record / Tone + TMMFState iStreamState; + + // Stream audio format + TFourCC iFormat; + + TCodecLocation iCodecLocation; + + TBufferSize iBufferSize; + }; + +// allocation info for client +class TAllocationInfo + { + public : // Member data + // Audio type. e.g. ECsCall + TAudioType iAudioType; + + // Unique policy id for each client + TUint32 iPolicyId; + + // buffer size information + TBufferSize iBufferSize; + + // Codec location + TCodecLocation iCodecLocation; + + // Codec Uid + TUid iCodecUid; + }; + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; + +// CLASS DECLARATION + +#endif /* AACOMMONDATATYPES_H */ + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/audioprocessingunit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/audioprocessingunit.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,155 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef AUDIOPROCESSINGUNIT_H +#define AUDIOPROCESSINGUNIT_H + +#include +#include +#include +#include +#include +#include + +#include "componentparameters.h" +#include "mlogicalsettingsobserver.h" + + +/** +A generic AudioComponent base class implementation. +@see MAudioProcessingUnit +*/ +class CAudioProcessingUnit: public CBase, + public MAudioProcessingUnit + { + +public: + + static CAudioProcessingUnit* NewL(TComponentParameters aParameters); + + /** + Destructor. + Releases all resources and deletes all objects owned by this instance. + */ + virtual ~CAudioProcessingUnit(); + + // from base class MAudioProcessingUnit + virtual TAudioComponentId InstanceId() const; + virtual TAudioContextId ContextId() const; + virtual TBool IsTypeOf(TUid aTypeId) const; + virtual TAny* Interface(TUid aType); + virtual TInt RegisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver); + virtual void UnregisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver); + + CAudioProcessingUnit(TAny* aParam); + +protected: // data + // Component type Uid + TUid iType; + + // Audio context Id + TAudioContextId iContextId; + + // Component instance Id + TAudioComponentId iInstanceId; + + // Array of component observers. + RPointerArray iAudioProcessingUnitObservers; + + // Settings observer + MLogicalSettingObserver* iSettingsObserver; + +private: // data + TUid iDtor_ID_Key; + }; + +// Interface's (abstract base class's) destructor +inline CAudioProcessingUnit::~CAudioProcessingUnit() + { + iAudioProcessingUnitObservers.Close(); + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// Interface's (abstract base class's) static factory method implementation. +// Asks ECOM plugin framework to instantiate appropriate concret plugin +// implementation. +inline CAudioProcessingUnit* CAudioProcessingUnit::NewL(TComponentParameters aParameters) + { + TAny* ptr = REComSession::CreateImplementationL( aParameters.iTypeUid , _FOFF(CAudioProcessingUnit, iDtor_ID_Key), static_cast(&aParameters)); + return static_cast(ptr); + } + +inline CAudioProcessingUnit::CAudioProcessingUnit(TAny* aParam) + { + TComponentParameters* param = static_cast(aParam); + iType = param->iTypeUid; + iInstanceId = param->iInstanceId; + iContextId = param->iContextId; + iSettingsObserver = param->iSettingsObserver; + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioCodec::GetContextId +// --------------------------------------------------------------------------- +inline TAudioContextId CAudioProcessingUnit::ContextId() const + { + return iContextId; + } + +inline TAudioComponentId CAudioProcessingUnit::InstanceId() const + { + return iInstanceId; + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioCodec::RegisterComponentObserver +// --------------------------------------------------------------------------- +inline TInt CAudioProcessingUnit::RegisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver) + { + TInt err = iAudioProcessingUnitObservers.Find(&aObserver); + if( err != KErrNotFound ) + { + err = KErrAlreadyExists; + } + else + { + err = iAudioProcessingUnitObservers.Append(&aObserver); + } + return err; + } + +// --------------------------------------------------------------------------- +// from class MAudioProcessingUnit +// CLogicalAudioCodec::UnregisterComponentObserver +// --------------------------------------------------------------------------- +inline void CAudioProcessingUnit::UnregisterProcessingUnitObserver(MAudioProcessingUnitObserver& aObserver) + { + TInt idxOrErr = iAudioProcessingUnitObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioProcessingUnitObservers.Remove(idxOrErr); + } + } + +inline TBool CAudioProcessingUnit::IsTypeOf(TUid) const {return EFalse;} +inline TAny* CAudioProcessingUnit::Interface(TUid) { TAny* any(NULL); return any;} + +#endif // AUDIOPROCESSINGUNIT_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/audioprocessingunitdlluids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/audioprocessingunitdlluids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2007-2009 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: +* +*/ + + + +#ifndef AUDIOPROCESSINGUNITDLLUIDS_HRH +#define AUDIOPROCESSINGUNITDLLUIDS_HRH + +#define KUidLogicalAudioCodecDll 0x1028344F +#define KUidLogicalAudioStreamDll 0x10283453 +#define KUidBufferSourceDll 0x10283455 +#define KUidAudioDeviceSourceDll 0x10283451 +#define KUidBufferSinkDll 0x10283454 +#define KUidAudioDeviceSinkDll 0x10283450 +#define KUidAudioGainControlDll 0x10283452 + +#endif // AUDIOPROCESSINGUNITDLLUIDS_HRH diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/audiostreammanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/audiostreammanager.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef AUDIOSTREAMMANAGER_H +#define AUDIOSTREAMMANAGER_H + +#include +#include +#include +#include +#include + +/** + A generic AudioComponent base class implementation. + @see MAudioProcessingUnit +*/ +NONSHARABLE_CLASS(CAudioStreamManager) : public CBase, + public MAudioStream + { +public: + static CAudioStreamManager* NewL(TUid aImplementationUid); + /** + Destructor. + Releases all resources and deletes all objects owned by this instance. + */ + virtual ~CAudioStreamManager(); + + //From MAudioStream + virtual TInt RegisterAudioStreamObserver(MAudioStreamObserver& aObserver); + virtual void UnregisterAudioStreamObserver(MAudioStreamObserver& aObserver); + virtual TInt SetAudioType(const TAudioTypeSettings& aAudioTypeSettings); + virtual void GetAudioType(TAudioTypeSettings& aAudioTypeSettings) const; + virtual TAudioStreamId InstanceId() const; + CAudioStreamManager(); + +protected: // data + TAudioStreamId iAudioStreamId; + TAudioTypeSettings iAudioTypeSettings; + RPointerArray iAudioStreamObserver; + +private: + TUid iDtor_ID_Key; + + }; + + +// Interface's (abstract base class's) destructor +inline CAudioStreamManager::~CAudioStreamManager() + { + iAudioStreamObserver.Close(); + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// Interface's (abstract base class's) static factory method implementation. +// Asks ECOM plugin framework to instantiate appropriate concret plugin +// implementation. +inline CAudioStreamManager* CAudioStreamManager::NewL(TUid aImplementationUid) + { + TAny* ptr = REComSession::CreateImplementationL( aImplementationUid , _FOFF(CAudioStreamManager, iDtor_ID_Key)); + return static_cast(ptr); + } + +inline CAudioStreamManager::CAudioStreamManager() + { + //iAudioStreamId + } + +// --------------------------------------------------------------------------- +// CAudioStreamManager::RegisterAudioStreamObserver +// --------------------------------------------------------------------------- +inline TInt CAudioStreamManager::RegisterAudioStreamObserver(MAudioStreamObserver& aObserver) + { + TInt err = iAudioStreamObserver.Find(&aObserver); + if(err == KErrNotFound) + { + err = iAudioStreamObserver.Append(&aObserver); + } + else + { + err = KErrAlreadyExists; + } + return err; + } + +// --------------------------------------------------------------------------- +// CAudioStreamManager::UnregisterAudioStreamObserver +// --------------------------------------------------------------------------- +inline void CAudioStreamManager::UnregisterAudioStreamObserver(MAudioStreamObserver& aObserver) + { + TInt idxOrErr = iAudioStreamObserver.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioStreamObserver.Remove(idxOrErr); + } + } + +// --------------------------------------------------------------------------- +// CAudioStreamManager::InstanceId +// --------------------------------------------------------------------------- +inline TAudioStreamId CAudioStreamManager::InstanceId() const + { + return iAudioStreamId; + } + +// --------------------------------------------------------------------------- +// CAudioStreamManager::SetAudioType +// --------------------------------------------------------------------------- +inline TInt CAudioStreamManager::SetAudioType(const TAudioTypeSettings& aAudioTypeSettings) + { + TInt err(KErrNone); + iAudioTypeSettings = aAudioTypeSettings; + return err; + } + +// --------------------------------------------------------------------------- +// CAudioStreamManager::GetAudioType +// --------------------------------------------------------------------------- +inline void CAudioStreamManager::GetAudioType(TAudioTypeSettings& aAudioTypeSettings) const + { + aAudioTypeSettings = iAudioTypeSettings; + } +#endif // CAUDIOSTREAMFACTORY_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/componentparameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/componentparameters.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2004-2009 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: +* audiostreamfactory.h +* Part of : ACL Logical layer +* +*/ + + + +#ifndef COMPONENTPARAMETERS_H +#define COMPONENTPARAMETERS_H + +class MLogicalSettingObserver; + +class TComponentParameters + { +public: + TUid iTypeUid; + TAudioComponentId iInstanceId; + TAudioContextId iContextId; + MLogicalSettingObserver* iSettingsObserver; + }; + +#endif // COMPONENTPARAMETERS_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/mlogicalchain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/mlogicalchain.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef MLOGICALCHAIN_H +#define MLOGICALCHAIN_H + +#include +#include + +// CLASS FORWARD + +class MMMFAudioDataSupplier; +class MMMFAudioDataConsumer; +class MMMFBufferSource; +class MMMFBufferSink; +class MAudioGainControl; +class MAudioCodecAdaptationObserver; +class MStreamPositionControl; +class MCustomInterfaceSupport; +class MConfigurationHelper; +class MStreamBufferControl; + + +enum TMMRCMessageType + { + ENoMessage = 0x0000, + ERegisterStreamObserver = 0x0001, + ERegisterCodecObserver = 0x0002, + ERegisterGainObserver = 0x0004, + + EComponentCreation = 0x0010, + EComponentDestruction = 0x0020, + EComponentAlterationGain = 0x0040, + EComponentAlterationCodec = 0x0080, + EStreamStateChange = 0x0100, + EConfigurationRequest = 0x0200 + }; + + +const TUid KUidAudioCodecObserver = {0x102834BF}; + + +/* +Interface that represent the logical chain +@class MLogicalChain +*/ + +class MLogicalChain + { +public: + /** + Set the type of message to be processed at the adaptation side + @ see TMMRCMessageType + @param the type of message to be processed + */ + virtual void SetMessageType(TMMRCMessageType aMessageType) = 0; + + /** + Set the type of message to be processed at the adaptation side + @ see TMMRCMessageType + @param the type of message to be processed + */ + virtual void ResetMessage() = 0; + + /** + Returns the type of message to be processed at the adaptation side + @ see TMMRCMessageType + @return the type of message to be processed + */ + virtual TUint MessageType() = 0; + + + /** + Returns the number of processing units in the current logical chain + @return the number of processing units in the current logical chain + */ + virtual TInt AudioProcessingUnitsCount() = 0; + + /** + Returns the UID type of the processing unit of the logical chain + This function allows the adaptation side know extra details for logical components + @param aIndex indicates the creation order index + @return the uid type of the processing unit + */ + virtual TUid AudioProcessingUnitUid(TInt aIndex) = 0; + + /** + Returns the logical chain state + @return the logical chain state + */ + virtual TAudioState StreamState() = 0; + + /** + Set the logical chain state + @param the logical chain state + */ + virtual void SetStreamState(TAudioState aState) = 0; + + /** + Returns the logical codec format + @return the logical codec format + */ + virtual TUid CodecFormat() = 0; + + + /** + Returns the logical codec sample rate + @return the logical codec sample rate + */ + virtual TInt GetSampleRate() = 0; + + /** + Gets the mode – e.g. mono/stereo. + @return aMode + */ + virtual TUid GetMode() = 0; + + /** + Returns the priority from the stream + @return the the priority from the stream + */ + virtual TInt Priority() = 0; + + /** + Returns the ramp time parameters + */ + virtual void GetVolumeRampParameters(TUid& aRampOperation, TTimeIntervalMicroSeconds& aRampDuration) = 0; + + /** + Copies the main configuration parameters of the logical chain + @see TLogicalChainConfiguration + @param the logical chain from where the parameter will be copied + */ + virtual void CopySettings(const MLogicalChain& aChain) = 0; + + /** + Creates a copy from the current object + @return a copy from the current logical chain the ownership is transferred + */ + virtual MLogicalChain* CloneL() = 0; + + /** + Deletes the logical chain cloned + */ + virtual void Release() = 0; + + /** + Deletes the logical chain cloned + */ + virtual TAny* GetComponent(TUid aType) = 0; + + // TODO: Remove those temporary workarounds for data connection + // When the MMRC server is fully implemented and + // the Control mechanisms & Observation interface extension mechanisms are available + virtual void SetAdaptationSource(MMMFBufferSource& aSource) = 0; + virtual void SetAdaptationSink(MMMFBufferSink& aSink) = 0; + virtual void SetAdaptationGainControl(MAudioGainControl& aGain) = 0; + virtual void SetStreamPositionControl(MStreamPositionControl& aControl) = 0; + virtual void SetCustomInterfaceProvider(MCustomInterfaceSupport& aControl) = 0; + virtual void SetAdaptationStream(MConfigurationHelper& aCodec) = 0; + virtual void SetStreamBufferControl(MStreamBufferControl& aStreamBufferControl) = 0; + }; + +#endif // MLOGICALCHAIN_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/mlogicalcomponentobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/mlogicalcomponentobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef MLOGICALCOMPONENTOBSERVER_H +#define MLOGICALCOMPONENTOBSERVER_H + + +/** + * An interface to a set of logical audio processing unit callbacks + * + * This serves as the method of communication between the context and the logical audio processing units. + * + * The class is a mixin and is intended to be inherited by the context class that is + * interested in observing the audio processing unit settings changes. + * + */ +class MLogicalComponentObserver + { +public: + virtual void ReceiveComponentSettingsChange(TUid aId) = 0; + }; + +#endif // MLOGICALCOMPONENTOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3facl/src/shared/mlogicalsettingsobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3facl/src/shared/mlogicalsettingsobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef MLOGICALSETTINGOBSERVER_H +#define MLOGICALSETTINGOBSERVER_H + +#include "mlogicalchain.h" + +/** + * An interface to a set of logical audio processing unit callbacks + * + * This serves as the method of communication between the context and the logical audio processing units. + * + * The class is a mixin and is intended to be inherited by the context class that is + * interested in observing the audio processing unit settings changes. + * + */ + class MLogicalSettingObserver + { +public: + virtual void ReceiveComponentSettingsChange(TUid aId, TMMRCMessageType aMessageType) = 0; + }; + +#endif // MLOGICALSETTINGOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/bwins/devsoundadaptationinfoconsts.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/bwins/devsoundadaptationinfoconsts.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + ?MaxGain@DevSoundAdaptationInfoConsts@@SAHXZ @ 1 NONAME ; int DevSoundAdaptationInfoConsts::MaxGain(void) + ?MaxVolume@DevSoundAdaptationInfoConsts@@SAHXZ @ 2 NONAME ; int DevSoundAdaptationInfoConsts::MaxVolume(void) + ?KDevsoundMaxGain@@3HB @ 3 NONAME ; int const KDevsoundMaxGain + ?KDevsoundMaxVolume@@3HB @ 4 NONAME ; int const KDevsoundMaxVolume + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/eabi/devsoundadaptationinfoconsts.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/eabi/devsoundadaptationinfoconsts.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + KDevsoundMaxGain @ 1 NONAME DATA 4 + KDevsoundMaxVolume @ 2 NONAME DATA 4 + _ZN28DevSoundAdaptationInfoConsts7MaxGainEv @ 3 NONAME + _ZN28DevSoundAdaptationInfoConsts9MaxVolumeEv @ 4 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2006-2009 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: +// + + + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +// IBY FILE +./devsoundadaptationinfo.iby /epoc32/rom/include/devsoundadaptationinfo.iby + +PRJ_MMPFILES +../mmpfiles/devsoundadaptationinfo.mmp +../mmpfiles/devsoundadaptationinfoconsts.mmp + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/group/devsoundadaptationinfo.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/group/devsoundadaptationinfo.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,30 @@ +// Copyright (c) 2006-2009 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: +// + + + +#ifndef DEVSOUNDADAPTATIONINFO_IBY +#define DEVSOUNDADAPTATIONINFO_IBY + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// Audio Control fw dll's + +file=ABI_DIR\BUILD_DIR\devsoundadaptationinfo.dll System\Libs\devsoundadaptationinfo.dll +file=ABI_DIR\BUILD_DIR\devsoundadaptationinfoconsts.dll System\Libs\devsoundadaptationinfoconsts.dll + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#endif // DEVSOUNDADAPTATIONINFO_IBY \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/group/multimedia_a3f_devsoundadaptationinfo.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/group/multimedia_a3f_devsoundadaptationinfo.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,16 @@ +#multimedia_a3f_devsound.mrp +# +#Copyright (c) Symbian Software Ltd 2007. All rights reserved. +# + +component multimedia_a3f_devsoundadaptationinfo + +source \sf\os\mm\mmhais\a3fdevsoundcustomisation + +binary \sf\os\mm\mmhais\a3fdevsoundcustomisation\group all + +exports \sf\os\mm\mmhais\a3fdevsoundcustomisation\group + +notes_source \component_defs\release.src + +ipr E diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/mmpfiles/devsoundadaptationinfo.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/mmpfiles/devsoundadaptationinfo.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +// Copyright (c) 2006-2009 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 + +TARGET devsoundadaptationinfo.dll +TARGETTYPE DLL +UID 0x1000008D KA3FDevSoundAdaptationInfoDll + +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI +VENDORID 0x70000001 + +SOURCEPATH ../src/devsoundadaptationinfo +SOURCE devsoundadaptationinfo.cpp +SOURCE devsoundadaptationinfoimplbody.cpp + +USERINCLUDE ../src/devsoundadaptationinfo +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY devsoundadaptationinfoconsts.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY ecom.lib +LIBRARY a3f_trace_heap.lib +LIBRARY a3ffourcclookup.lib + +DEFFILE /epoc32/include/def/~/devsoundadaptationinfo.def + +NOSTRICTDEF +NOEXPORTLIBRARY + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/mmpfiles/devsoundadaptationinfoconsts.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/mmpfiles/devsoundadaptationinfoconsts.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,43 @@ +// Copyright (c) 2006-2009 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 + +TARGET devsoundadaptationinfoconsts.dll +TARGETTYPE DLL +UID 0x1000008D 0x102834B1 + +CAPABILITY ALL -TCB -allfiles -diskadmin -networkcontrol -swevent -trustedui +VENDORID 0x70000001 + +SOURCEPATH ../src/devsoundadaptationinfoconsts +SOURCE devsoundadaptationinfoconsts.cpp +SOURCE devsoundadaptationinfoconstvalues.cpp + +USERINCLUDE ../src/devsoundadaptationinfo +USERINCLUDE ../src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib + +DEFFILE devsoundadaptationinfoconsts.def + +NOSTRICTDEF + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfo.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,114 @@ +// Copyright (c) 2006-2009 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 FILES +// + +#include +#include +#include "devsoundadaptationinfoimpl.h" +#include "devsoundadaptationinfoimplbody.h" + +//------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfo* CA3FDevSoundAdaptationInfo::NewL +// Two-phased constructor. +//------------------------------------------------------------------- +// +EXPORT_C CA3FDevSoundAdaptationInfo* CA3FDevSoundAdaptationInfo::NewL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor) + { + DP_STATIC_CONTEXT(CA3FDevSoundAdaptationInfo::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CA3FDevSoundAdaptationInfoImpl* self = new(ELeave) CA3FDevSoundAdaptationInfoImpl(); + CleanupStack::PushL(self); + self->ConstructL(aAdaptationInfoObserver, aFourCcConvertor); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +//------------------------------------------------------------ +// CA3FDevSoundAdaptationInfo::CA3FDevSoundAdaptationInfo +// C++ default constructor. +//------------------------------------------------------------ +// +CA3FDevSoundAdaptationInfo::CA3FDevSoundAdaptationInfo() + { + } + +//-------------------------------------------------------------- +// CA3FDevSoundAdaptationInfo::~CA3FDevSoundAdaptationInfo +// Destructor +//-------------------------------------------------------------- +// +CA3FDevSoundAdaptationInfo::~CA3FDevSoundAdaptationInfo() + { + } + +//------------------------------------------------------------ +// CA3FDevSoundAdaptationInfoImpl::CA3FDevSoundAdaptationInfo +// C++ default constructor. +//------------------------------------------------------------ +// +CA3FDevSoundAdaptationInfoImpl::CA3FDevSoundAdaptationInfoImpl() + { + } + +//-------------------------------------------------------------- +// CA3FDevSoundAdaptationInfo::~CA3FDevSoundAdaptationInfo +// Destructor +//-------------------------------------------------------------- +// +CA3FDevSoundAdaptationInfoImpl::~CA3FDevSoundAdaptationInfoImpl() + { + DP_CONTEXT(CA3FDevSoundAdaptationInfo::~CA3FDevSoundAdaptationInfo *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + delete iBody; + DP_OUT(); + } + +//-------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::ConstructL +// 2nd phase constructor +//-------------------------------------------------------------- +// +void CA3FDevSoundAdaptationInfoImpl::ConstructL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfo::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iBody = CBody::NewL(aAdaptationInfoObserver, aFourCcConvertor); + DP_OUT(); + } + +TInt CA3FDevSoundAdaptationInfoImpl::RequestMaxGain(TUid aCodecType) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::RequestMaxGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt result = iBody->RequestMaxGain(aCodecType); + DP0_RET(result, "%d"); + } + +TInt CA3FDevSoundAdaptationInfoImpl::RequestSupportedFormats(TUid aCodecType, RArray& aSupportedFormats) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::RequestSupportedFormats *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt result = iBody->RequestSupportedFormats(aCodecType, aSupportedFormats); + DP0_RET(result, "%d"); + } + +TInt CA3FDevSoundAdaptationInfoImpl::Extension_(TUint aExtensionId, TAny*& aExtPtr, TAny*) + { + return iBody->Extension_(aExtensionId, aExtPtr, NULL); + } + +//-------------------------------------------------------------- + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimpl.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef DEVSOUNDADAPTATIONINFOIMPL_H +#define DEVSOUNDADAPTATIONINFOIMPL_H + +#include +#include +#include +#include + +class MA3FDevSoundAdaptationInfoObserver; + +/* +The first level implementation of CA3FDevsoundAdaptationInfo. +*/ +NONSHARABLE_CLASS(CA3FDevSoundAdaptationInfoImpl) : public CA3FDevSoundAdaptationInfo + { + class CBody; + friend class CA3FDevSoundAdaptationInfo; + +public: + + /* + Destructor. + */ + ~CA3FDevSoundAdaptationInfoImpl(); + + // from CA3FDevSoundAdaptationInfo + TInt RequestMaxGain(TUid aCodecType); + TInt RequestSupportedFormats(TUid aCodecType, RArray& aSupportedFormats); + TInt Extension_(TUint aExtensionId, TAny*& aExtPtr, TAny*); + +private: + void ConstructL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor); + CA3FDevSoundAdaptationInfoImpl(); + +private: + + CBody* iBody; + }; + + +#endif // DEVSOUNDADAPTATIONINFOIMPL_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimplbody.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimplbody.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,462 @@ +// Copyright (c) 2006-2009 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: +// devsoundadaptationinfoimpl.cpp +// + +// INCLUDE FILES +#include +#include +#include // for KMmfUidPluginInterfaceHwDevice +#include //needed for CleanupResetAndDestroyPushL() +#include "devsoundadaptationinfoimplbody.h" +#include "devsoundadaptationinfoconsts.h" +#include +#include + +const TInt KHwDeviceDefaultDataLength= 9; + + +//------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CA3FDevSoundAdaptationInfoImpl +// C++ default constructor. +//------------------------------------------------------------------- +// +CA3FDevSoundAdaptationInfoImpl::CBody* CA3FDevSoundAdaptationInfoImpl::CBody::NewL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor) + { + CBody* self = new (ELeave) CBody; + CleanupStack::PushL(self); + self->ConstructL(aAdaptationInfoObserver, aFourCcConvertor); + CleanupStack::Pop(self); + return self; + } + +//------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CA3FDevSoundAdaptationInfoImpl +// C++ default constructor. +//------------------------------------------------------------------- +// +CA3FDevSoundAdaptationInfoImpl::CBody::CBody(): CActive(EPriorityStandard) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody()::CBody() *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CActiveScheduler::Add(this); + DP_OUT(); + } + +//---------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::ConstructL +// Symbian 2nd phase constructor can leave. +//---------------------------------------------------- +// +void CA3FDevSoundAdaptationInfoImpl::CBody::ConstructL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iAdaptationInfoObserver = &aAdaptationInfoObserver; + iFourCcConvertor = &aFourCcConvertor; + DP_OUT(); + } + +//-------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::~CA3FDevSoundAdaptationInfoImpl +// Destructor +//-------------------------------------------------------------- +// +CA3FDevSoundAdaptationInfoImpl::CBody::~CBody() + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::~CBody *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +//--------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::RequestMaxGain +// Retrieves Maximum Valid Gain/Volume +//--------------------------------------------------------- +// +TInt CA3FDevSoundAdaptationInfoImpl::CBody::RequestMaxGain(TUid aCodecType) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::RequestMaxGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iCodecType = aCodecType; + iMaxGainRequested = ETrue; + + // Simulate an asyncronous response + if (!IsActive()) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + + DP0_RET(KErrNone, "%d"); + } + +//----------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::RequestSupportedFormatsL +// Retrieves supported formats (in this version hwDevices). +//----------------------------------------------------- +// +TInt CA3FDevSoundAdaptationInfoImpl::CBody::RequestSupportedFormats(TUid aCodecType, RArray& aSupportedFormats) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::RequestSupportedFormats *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err=KErrNone; + + iCodecType = aCodecType; + + TRAP(err, ReadSupportedFormatsL(aCodecType, aSupportedFormats)); + + if(err==KErrNone) + { + iFormatsRequested = ETrue; + + // Simulate an asyncronous response + if (!IsActive()) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + } + + DP0_RET(err, "%d"); + } + + +TInt CA3FDevSoundAdaptationInfoImpl::CBody::Extension_(TUint aExtensionId, TAny*& aExtPtr, TAny*) + { + if (aExtensionId == KTruePauseCustomInterfaceTypeUid.iUid) + { + aExtPtr = static_cast(this); + return KErrNone; + } + else + { + return CActive::Extension_(aExtensionId, aExtPtr, NULL); + } + } + +// from MTruePauseCustomInterface +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::IsResumeSupported +// --------------------------------------------------------------------------- +TBool CA3FDevSoundAdaptationInfoImpl::CBody::IsResumeSupported(TUid aCodecType, TUid aFormat) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::IsTruePauseSupported *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + + const TUid supportedDecoders [] = + { + KUidFormatPCM16, + KUidFormatPCMU16B, + KUidFormatPCMU16, + KUidFormatPCM16B, + KUidFormatPCM8, + KUidFormatPCMU8, + KUidFormatAlaw, + KUidFormatMulaw, + KUidFormatGSM610, + KUidFormatIMAADPCM, + KUidFormatTone, + KNullUid, // Indicates end of array + }; + + TBool supported = EFalse; + + // PCM16 Encoder + if(aFormat == KUidFormatPCM16 && aCodecType == KUidAudioEncoder) + { + supported = ETrue; + } + // Only certain decoders + else if(aCodecType == KUidAudioDecoder) + { + TInt i = 0; + TUid supportedDecoderUid = supportedDecoders[i]; + do + { + if (supportedDecoderUid == aFormat) + { + supported = ETrue; + break; + } + supportedDecoderUid = supportedDecoders[i++]; + } + while(supportedDecoderUid != KNullUid); + } + DP0_RET(supported, "%d"); + } + +//From CActive +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::RunL +// --------------------------------------------------------------------------- +void CA3FDevSoundAdaptationInfoImpl::CBody::RunL() + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + + if(iMaxGainRequested) + { + + TInt maxgain = 0; + + if (iCodecType == KUidAudioDecoder) + { + maxgain = DevSoundAdaptationInfoConsts::MaxVolume(); + } + else if (iCodecType == KUidAudioEncoder) + { + maxgain = DevSoundAdaptationInfoConsts::MaxGain(); + } + else + { + err = KErrArgument; + } + + iMaxGainRequested = EFalse; + + // Send the callback + iAdaptationInfoObserver->RequestMaxGainComplete(iCodecType, err, maxgain); + + } + + if(iFormatsRequested) + { + err = KErrNone; + + if(iCodecType != KUidAudioDecoder && iCodecType != KUidAudioEncoder) + { + err = KErrArgument; + } + + iFormatsRequested = EFalse; + + // Send the callback + iAdaptationInfoObserver->RequestSupportedFormatsComplete(iCodecType, err); + } + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::RunError +// --------------------------------------------------------------------------- +TInt CA3FDevSoundAdaptationInfoImpl::CBody::RunError(TInt aError) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::RunError *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(aError, "%d"); + } + +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::DoCancel +// --------------------------------------------------------------------------- +void CA3FDevSoundAdaptationInfoImpl::CBody::DoCancel() + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::DoCancel *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::ReadSupportedFormats +// --------------------------------------------------------------------------- +void CA3FDevSoundAdaptationInfoImpl::CBody::ReadSupportedFormatsL(TUid aCodecType, RArray& aSupportedFormats) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::ReadSupportedFormatsL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + RArray supportedDataTypes; + CleanupClosePushL(supportedDataTypes); + + SeekHwDevicePluginsL(supportedDataTypes, aCodecType); + + TInt maxFourCCElements = supportedDataTypes.Count(); + + //clear any existing data in iSupportedFormats array + aSupportedFormats.Reset(); + + for(TInt typeIndex=0; typeIndexFourCCToFormat(supportedDataTypes[typeIndex], format); + if(error == KErrNone) + { + aSupportedFormats.AppendL(format); + } + } + + CleanupStack::PopAndDestroy(&supportedDataTypes); + + DP_OUT(); + } + + +// ----------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::SeekHwDevicePluginsL +// This method looks for hwDevicePlugins that support the codec given in aCodecType +// which must be either EMMFStatePlaying or EMMFStateRecording. +// For each HwDevice plugin found the datatype as indicated by its fourCC code +// from the default_data field in the resource file is added to the array of +// aSupportedDataTypes +// ----------------------------------------------------------------------------- +// +void CA3FDevSoundAdaptationInfoImpl::CBody::SeekHwDevicePluginsL( + RArray& aSupportedDataTypes, + TUid aCodecType) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::SeekHwDevicePluginsL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + ASSERT(aCodecType == KUidAudioDecoder || aCodecType == KUidAudioEncoder); + + //clear any existing data in aSupportedDataTypes array + aSupportedDataTypes.Reset(); + + // Array to return hw device plugin resource info(place on cleanupstack + // _after_ ListImplementationsL() ) + RImplInfoPtrArray plugInArray; + CleanupResetAndDestroyPushL(plugInArray); + + TUid KUidMmfHWPluginInterfaceCodec = {KMmfUidPluginInterfaceHwDevice}; + + REComSession::ListImplementationsL(KUidMmfHWPluginInterfaceCodec, plugInArray); + + TUint numberOfHwDevicePlugins = plugInArray.Count(); + + // if there are hwdevice plugin resource entries then scan entries + // matching on a datatype of pcm16 as the destination datatype for play and + // the source datatype for record. If a match is found and isn't already in + // the list of supported data types, then add it to the list + if (numberOfHwDevicePlugins > 0) + { + CImplementationInformation* hwDeviceResourceEntry = NULL; + _LIT8(KPCM16FourCCString, " P16"); + + // check each resource entry for dst 4CC = P16 for play and + // src 4CC = P16 for record + for (TUint hwDeviceEntry = 0; hwDeviceEntry& aSupportedDataTypes, TFourCC aFourCCEntry) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::FourCCExists *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TBool alreadyExists = EFalse; + + for (TUint fourCCEntryNumber=0; fourCCEntryNumber< aSupportedDataTypes.Count(); fourCCEntryNumber++) + { + if (aSupportedDataTypes[fourCCEntryNumber] == aFourCCEntry) + { + // we already have this 4CC in the supported data types + alreadyExists = ETrue; + break; + } + } + + DP0_RET(alreadyExists, "0x%x"); + } + +// --------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::CBody::ReadFourCC +// --------------------------------------------------------------------------- +void CA3FDevSoundAdaptationInfoImpl::CBody::ReadFourCC(CImplementationInformation* aHwDeviceResourceEntry, TFourCC& aFourCCLeft, TFourCC& aFourCCRight) + { + DP_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::ReadFourCC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TPtrC8 fourCCPtr(0,0); + + // Check for resource entry lenght since for HwDeviceAdaptor it is just "*" + if (aHwDeviceResourceEntry->DataType().Length()>=KHwDeviceDefaultDataLength) + { + // datatype supported 4CC is left 4 chars + fourCCPtr.Set(aHwDeviceResourceEntry->DataType().Left(KFOURCCLENGTH)); + + aFourCCLeft.Set(fourCCPtr); + + // datatype supported 4CC is right 4 chars + fourCCPtr.Set(aHwDeviceResourceEntry->DataType().Right(KFOURCCLENGTH)); + + aFourCCRight.Set(fourCCPtr); + } + + DP_OUT(); + } + +// ----------------------------------------------------------------------------- +// CA3FDevSoundAdaptationInfoImpl::IsDataTypeMatch +// ----------------------------------------------------------------------------- +TBool CA3FDevSoundAdaptationInfoImpl::CBody::IsDataTypeMatch(TFourCC aFourCCPCM16,TFourCC aFourCC) + { + DP_STATIC_CONTEXT(CA3FDevSoundAdaptationInfoImpl::CBody::IsDataTypeMatch *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool match = EFalse; + + if(aFourCCPCM16 == aFourCC) + { + match = ETrue; + } + + DP0_RET(match, "0x%x"); + } + +// End of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimplbody.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfo/devsoundadaptationinfoimplbody.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,92 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef DEVSOUNDADAPTATIONINFOIMPLBODY_H +#define DEVSOUNDADAPTATIONINFOIMPLBODY_H + +#include +#include +#include +#include +#include // For TFourCC +#include "devsoundadaptationinfoimpl.h" + +#define KFOURCCLENGTH 4 + +class MA3FDevSoundAdaptationInfoObserver; + +/* +The real implementation of CA3FDevsoundAdaptationInfo. +*/ +NONSHARABLE_CLASS(CA3FDevSoundAdaptationInfoImpl::CBody) : public CActive, public MTruePauseCustomInterface + { +public: + + /* + Factory + */ + static CBody* NewL(MA3FDevSoundAdaptationInfoObserver& aObserver, CFourCCConvertor& aFourCcConvertor); + + /* + Destructor. + */ + ~CBody(); + + TInt RequestMaxGain(TUid aCodecType); + TInt RequestSupportedFormats(TUid aCodecType, RArray& aSupportedFormats); + + // From CActive + TInt Extension_(TUint aExtensionId, TAny*& aExtPtr, TAny*); + + // from MTruePauseCustomInterface + TBool IsResumeSupported(TUid aCodecType, TUid aFormat); + +private: + + static TBool IsDataTypeMatch(TFourCC aFourCCPCM16,TFourCC aFourCC); + + void SeekHwDevicePluginsL(RArray& aSupportedDataTypes, TUid aCodecType); + + void ReadSupportedFormatsL(TUid aCodecType, RArray& aSupportedFormats); + + TBool FourCCExists(RArray& aSupportedDataTypes,TFourCC aFourCCEntry); + + void ReadFourCC(CImplementationInformation* aHwDeviceResourceEntry, TFourCC& aFourCCLeft, TFourCC& aFourCCRight); + +protected: + void ConstructL(MA3FDevSoundAdaptationInfoObserver& aAdaptationInfoObserver, CFourCCConvertor& aFourCcConvertor); + CBody(); + + // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + + MA3FDevSoundAdaptationInfoObserver* iAdaptationInfoObserver; + + // Pointer to fourcc convertor + // Not owned. + CFourCCConvertor* iFourCcConvertor; + + TBool iMaxGainRequested; + TBool iFormatsRequested; + + TUid iCodecType; + }; + + +#endif // DEVSOUNDADAPTATIONINFOIMPLBODY_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconsts.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconsts.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,32 @@ +// Copyright (c) 2006-2009 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 +#include +#include "devsoundadaptationinfoconsts.h" +#include "devsoundadaptationinfoconstvalues.h" + +EXPORT_C TInt DevSoundAdaptationInfoConsts::MaxGain() + { + return KDevsoundMaxGain; + } + +EXPORT_C TInt DevSoundAdaptationInfoConsts::MaxVolume() + { + return KDevsoundMaxVolume; + } + +//end of file + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconstvalues.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconstvalues.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,23 @@ +// Copyright (c) 2006-2009 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 +#include + +EXPORT_C extern const TInt KDevsoundMaxGain = 64; +EXPORT_C extern const TInt KDevsoundMaxVolume = 100; + +//end of file + diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconstvalues.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/devsoundadaptationinfoconsts/devsoundadaptationinfoconstvalues.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef DEVSOUNDADAPTATIONINFOCONSTVALUES_H +#define DEVSOUNDADAPTATIONINFOCONSTVALUES_H + +#include + +/** +@SYMPatchable +@publishedPartner + +Patchable constant for licencee to set devsound adaptor MaxGain +Licencees should ensure that the devsound adaptor MaxGain is equal to the system adaptor MaxGain. +The constant can be changed at ROM build time using patchdata OBY keyword. + */ +IMPORT_C extern const TInt KDevsoundMaxGain; + +/** +@SYMPatchable +@publishedPartner + +Patchable constant for licencee to set devsound adaptor MaxVolume +Licencees should ensure that the devsound adaptor MaxVolume is equal to the system adaptor MaxVolume. +The constant can be changed at ROM build time using patchdata OBY keyword. + */ +IMPORT_C extern const TInt KDevsoundMaxVolume; + +#endif // DEVSOUNDADAPTATIONINFOCONSTVALUES_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/a3fdevsoundcustomisation/src/shared/devsoundadaptationinfoconsts.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/a3fdevsoundcustomisation/src/shared/devsoundadaptationinfoconsts.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,31 @@ + +// Copyright (c) 2006-2009 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: +// + +#ifndef DEVSOUNDADAPTATIONINFOCONSTS_H +#define DEVSOUNDADAPTATIONINFOCONSTS_H + +/* +Static methods for obtaining the constant values +*/ + +class DevSoundAdaptationInfoConsts + { +public: + IMPORT_C static TInt MaxGain(); + IMPORT_C static TInt MaxVolume(); + }; + +#endif // DEVSOUNDADAPTATIONINFOCONSTS_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/audiocodec.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/audiocodec.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,13 @@ +EXPORTS + ?Initialize@CAudioCodec@@QAEHXZ @ 1 NONAME ; int CAudioCodec::Initialize(void) + ?Load@CAudioCodec@@QAEHHVTUid@@@Z @ 2 NONAME ; int CAudioCodec::Load(int, class TUid) + ?NewL@CAudioCodec@@SAPAV1@VTUid@@ABVCFourCCConvertor@@@Z @ 3 NONAME ; class CAudioCodec * CAudioCodec::NewL(class TUid, class CFourCCConvertor const &) + ?Pause@CAudioCodec@@QAEHXZ @ 4 NONAME ; int CAudioCodec::Pause(void) + ?RegisterAudioCodecObserver@CAudioCodec@@QAEHAAVMAudioCodecAdaptationObserver@@@Z @ 5 NONAME ; int CAudioCodec::RegisterAudioCodecObserver(class MAudioCodecAdaptationObserver &) + ?SetFormat@CAudioCodec@@QAEHVTUid@@@Z @ 6 NONAME ; int CAudioCodec::SetFormat(class TUid) + ?Start@CAudioCodec@@QAEHXZ @ 7 NONAME ; int CAudioCodec::Start(void) + ?Stop@CAudioCodec@@QAEHXZ @ 8 NONAME ; int CAudioCodec::Stop(void) + ?SupportedModes@CAudioCodec@@QAEHAAV?$RArray@VTUid@@@@@Z @ 9 NONAME ; int CAudioCodec::SupportedModes(class RArray &) + ?SupportedRates@CAudioCodec@@QAEHAAV?$RArray@H@@@Z @ 10 NONAME ; int CAudioCodec::SupportedRates(class RArray &) + ?UnregisterAudioCodecObserver@CAudioCodec@@QAEXAAVMAudioCodecAdaptationObserver@@@Z @ 11 NONAME ; void CAudioCodec::UnregisterAudioCodecObserver(class MAudioCodecAdaptationObserver &) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/audiodevicesink.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/audiodevicesink.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CAudioDeviceSink@@SAPAV1@XZ @ 1 NONAME ; class CAudioDeviceSink * CAudioDeviceSink::NewL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/audiodevicesource.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/audiodevicesource.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CAudioDeviceSource@@SAPAV1@XZ @ 1 NONAME ; class CAudioDeviceSource * CAudioDeviceSource::NewL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/audiogaincontrol.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/audiogaincontrol.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + ?NewL@CAudioGainControl@@SAPAV1@XZ @ 1 NONAME ; class CAudioGainControl * CAudioGainControl::NewL(void) + ?SetHelper@CAudioGainControl@@QAEXAAVMGainHelper@@@Z @ 2 NONAME ; void CAudioGainControl::SetHelper(class MGainHelper &) + ?IssueGainChangedCallBack@CAudioGainControl@@QAEXH@Z @ 3 NONAME ; void CAudioGainControl::IssueGainChangedCallBack(int) + ?ConfigureRamp@CAudioGainControl@@QAEHVTUid@@ABVTTimeIntervalMicroSeconds@@@Z @ 4 NONAME ; int CAudioGainControl::ConfigureRamp(class TUid, class TTimeIntervalMicroSeconds const &) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/buffersink.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/buffersink.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CBufferSink@@SAPAV1@XZ @ 1 NONAME ; class CBufferSink * CBufferSink::NewL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/bwins/buffersource.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/bwins/buffersource.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + ?NewL@CBufferSource@@SAPAV1@XZ @ 1 NONAME ; class CBufferSource * CBufferSource::NewL(void) + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F00PCM16Default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F00PCM16Default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F00; // //KMmfUidHwDevicePCM16ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x7f; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 76800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F21PU8Default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F21PU8Default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcmu8_pcm16_dec_resource +{ + uid =0x101F9F21; // //KMmfUidHwDevicePCMU8ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 2048; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F31MuLawDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F31MuLawDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F31; // //KMmfUidHwDeviceMuLawToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F32ALawDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F32ALawDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F32; // //KMmfUidHwDeviceAlawToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F36PCM8Default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F36PCM8Default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F36; // //KMmfUidHwDevicePCM8ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 16384; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101F9F40IMADDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101F9F40IMADDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F40; // //KMmfUidHwDeviceIMAADPCMToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x101FFA06GSM610Default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x101FFA06GSM610Default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101FFA06; // //KMmfUidHwDeviceGSM610ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10205E63iLbcDecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10205E63iLbcDecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// iLBC_DEC_RESOURCE +// The iLBC_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ilbcdec_pcm16_resource +{ + uid = KUidHwCodecIlbcDec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Encode or Record + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10205E66iLbcEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10205E66iLbcEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// iLBC_ENC_RESOURCE +// The iLBC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ilbcenc_pcm16_resource +{ + uid = KUidHwCodecIlbcEnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 0; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10205EE4G711DecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10205EE4G711DecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G711_DEC_RESOURCE +// The G711_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g711dec_pcm16_resource +{ + uid = KUidHwCodecG711Dec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10205EE7G711EncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10205EE7G711EncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,63 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G711_ENC_RESOURCE +// The G711_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g711enc_pcm16_resource +{ + uid = KUidHwCodecG711Enc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; // EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File + + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10205EEAG729DecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10205EEAG729DecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G729_DEC_RESOURCE +// The G729_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g729dec_pcm16_resource +{ + uid = KUidHwCodecG729Dec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Encode or Record + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x1020658FMp3DecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x1020658FMp3DecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// MP3_DEC_RESOURCE +// The MP3_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE mp3dec_resource +{ + uid = KUidHwCodecMP3DecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) }; // End of data[] + }; // End of data[] +} + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10206591AmrWbDecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10206591AmrWbDecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRWB_DEC_RESOURCE +// The AMRWB_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrwbdec_resource +{ + uid = KUidHwCodecAWBDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate16000Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10206596AmrNbDecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10206596AmrNbDecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_DEC_RESOURCE +// The AMRNB_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbdec_resource +{ + uid = KUidHwCodecAMRDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10206598AacDecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10206598AacDecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AAC_DEC_RESOURCE +// The AAC_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE aacdec_resource +{ + uid = KUidHwCodecAACDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x1020659AAacEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x1020659AAacEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AAC_ENC_RESOURCE +// The AAC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE aacenc_resource +{ + uid = KUidHwCodecPCM16ToAACEnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate48000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 28800; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x1020659DRawDecEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x1020659DRawDecEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE raw_pcm16_resource +{ + uid = KUidHwCodecRAWAndPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x1020659EAmrNbEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x1020659EAmrNbEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_ENC_RESOURCE +// The AMRNB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbenc_resource +{ + uid = KUidHwCodecPCM16ToNbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x102065b0AmrNbEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x102065b0AmrNbEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_ENC_RESOURCE +// The AMRNB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbenc_resource +{ + uid = KUidHwCodecPCM16ToNbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x102084BCSbcEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x102084BCSbcEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// SBC_ENC_RESOURCE +// The SBC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE sbc_pcm16_resource +{ + uid = KUidHwCodecSbcEnc; + + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 0; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10208826G729EncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10208826G729EncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G729_ENC_RESOURCE +// The G729_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g729enc_pcm16_resource +{ + uid = KUidHwCodecG729Enc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x102737B2OGGDecDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x102737B2OGGDecDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ogg_pcm16_dec_resource +{ + uid =0x102737B2; // //KVorbisHwDecodeUid;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x102737B4OGGEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x102737B4OGGEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ogg_pcm16_enc_resource +{ + uid =0x102737B4; // //KVorbisHwDecodeUid;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x6ff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0x10283463ToneDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0x10283463ToneDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// TONE_RESOURCE +// The TONE_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE tone_resource +{ +uid = 0x10283463; + data = + { + DAL_RESOURCE_DATA + { + mode = 1; //EMMFStatePlaying + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x01; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0xA0000A34AmrWbEncDefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0xA0000A34AmrWbEncDefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRWB_ENC_RESOURCE +// The AMRWB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrwbenc_resource +{ + uid = KUidHwCodecPCM16ToWbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate16000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/HwDev0xa0000a7aPCM16Default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/HwDev0xa0000a7aPCM16Default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE raw_pcm16_resource +{ + uid = 0xa0000a7a; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f01pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f01pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcmu8_enc_resource +{ + uid =0x101F9F01; // //KMmfUidHwDevicePCM16ToPCMU8;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f33pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f33pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_mulaw_dec_resource +{ + uid =0x101F9F33; // //KMmfUidHwDevicePCM16ToMuLaw;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f34pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f34pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_alaw_dec_resource +{ + uid =0x101F9F34; // //KMmfUidHwDevicePCM16ToALaw;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f35pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f35pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_PCM16B_RESOURCE +// The PCM16_PCM16B_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcm16b_dec_resource +{ + uid =0x101F9F35; // //KMmfUidHwDevicePCM16toPCM16B;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 76800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f37pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f37pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_PCMU16B_RESOURCE +// The PCM16_PCMU16B_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcmu16b_dec_resource +{ + uid =0x101F9F37; // //KMMFUidHwDevicePCM16toPCMU16B;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 2048; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f38s16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f38s16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE s16_pcmu16_resource +{ + uid = 0x101F9F38; //KMmfUidHwDeviceS16ToPCMU16 + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f3cs16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f3cs16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// S16_PCMU8_RESOURCE +// The S16_PCMU8_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE s16_pcmu8_resource +{ + uid = 0x101F9F3c; //KMmfUidHwDeviceS16ToPCMU8 + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f3dpcm16bdefault.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f3dpcm16bdefault.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16B_PCM16_RESOURCE +// The PCM16B_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16b_pcm16_enc_resource +{ + uid =0x101F9F3D; // //KMMFUidHwDevicePCM16BtoPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101f9f41pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101f9f41pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_IMAADPCM_RESOURCE +// The PCM16_IMAADPCM_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_imaadpcm_resource +{ + uid = 0x101F9F41; //KMmfUidHwDevicePCM16ToIMAADPCM + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/hwdev0x101ffa05pcm16default.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/hwdev0x101ffa05pcm16default.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,78 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_GSM610_RESOURCE +// The PCM16_GSM610_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_gsm610_enc_resource +{ + uid =0x101FFA05; // //KMmfUidHwDevicePCM16ToGSM610;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0xff; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f00pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f00pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F00; // //KMmfUidHwDevicePCM16ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 76800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f01pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f01pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcmu8_enc_resource +{ + uid =0x101F9F01; // //KMmfUidHwDevicePCM16ToPCMU8;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f21pu8navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f21pu8navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcmu8_pcm16_dec_resource +{ + uid =0x101F9F21; // //KMmfUidHwDevicePCMU8ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 2048; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f31mulawnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f31mulawnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F31; // //KMmfUidHwDeviceMuLawToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f32alawnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f32alawnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F32; // //KMmfUidHwDeviceAlawToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f33pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f33pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_mulaw_dec_resource +{ + uid =0x101F9F33; // //KMmfUidHwDevicePCM16ToMuLaw;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f34pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f34pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_alaw_dec_resource +{ + uid =0x101F9F34; // //KMmfUidHwDevicePCM16ToALaw;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f35pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f35pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_PCM16B_RESOURCE +// The PCM16_PCM16B_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcm16b_dec_resource +{ + uid =0x101F9F35; // //KMmfUidHwDevicePCM16toPCM16B;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 76800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f36pcm8navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f36pcm8navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F36; // //KMmfUidHwDevicePCM8ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 16384; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f37pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f37pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_PCMU16B_RESOURCE +// The PCM16_PCMU16B_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_pcmu16b_dec_resource +{ + uid =0x101F9F37; // //KMMFUidHwDevicePCM16toPCMU16B;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 2048; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f38s16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f38s16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE s16_pcmu16_resource +{ + uid = 0x101F9F38; //KMmfUidHwDeviceS16ToPCMU16 + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f3cs16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f3cs16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// S16_PCMU8_RESOURCE +// The S16_PCMU8_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE s16_pcmu8_resource +{ + uid = 0x101F9F3c; //KMmfUidHwDeviceS16ToPCMU8 + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f3dpcm16bnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f3dpcm16bnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16B_PCM16_RESOURCE +// The PCM16B_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16b_pcm16_enc_resource +{ + uid =0x101F9F3D; // //KMMFUidHwDevicePCM16BtoPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f40imadnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f40imadnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101F9F40; // //KMmfUidHwDeviceIMAADPCMToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101f9f41pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101f9f41pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_IMAADPCM_RESOURCE +// The PCM16_IMAADPCM_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_imaadpcm_resource +{ + uid = 0x101F9F41; //KMmfUidHwDevicePCM16ToIMAADPCM + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101ffa05pcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101ffa05pcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// PCM16_GSM610_RESOURCE +// The PCM16_GSM610_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE pcm16_gsm610_enc_resource +{ + uid =0x101FFA05; // //KMmfUidHwDevicePCM16ToGSM610;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x101ffa06gsm610navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x101ffa06gsm610navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE gsm610_pcm16_dec_resource +{ + uid =0x101FFA06; // //KMmfUidHwDeviceGSM610ToPCM16;;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10205e63ilbcdecnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10205e63ilbcdecnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// iLBC_DEC_RESOURCE +// The iLBC_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ilbcdec_pcm16_resource +{ + uid = KUidHwCodecIlbcDec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Encode or Record + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10205e66ilbcencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10205e66ilbcencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// iLBC_ENC_RESOURCE +// The iLBC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ilbcenc_pcm16_resource +{ + uid = KUidHwCodecIlbcEnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 0; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10205ee4g711decnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10205ee4g711decnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G711_DEC_RESOURCE +// The G711_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g711dec_pcm16_resource +{ + uid = KUidHwCodecG711Dec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10205ee7g711encnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10205ee7g711encnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,63 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G711_ENC_RESOURCE +// The G711_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g711enc_pcm16_resource +{ + uid = KUidHwCodecG711Enc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; // EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File + + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10205eeag729decnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10205eeag729decnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G729_DEC_RESOURCE +// The G729_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g729dec_pcm16_resource +{ + uid = KUidHwCodecG729Dec; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Encode or Record + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x1020658fmp3decnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x1020658fmp3decnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// MP3_DEC_RESOURCE +// The MP3_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE mp3dec_resource +{ + uid = KUidHwCodecMP3DecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) }; // End of data[] + }; // End of data[] +} + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10206591amrwbdecnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10206591amrwbdecnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRWB_DEC_RESOURCE +// The AMRWB_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrwbdec_resource +{ + uid = KUidHwCodecAWBDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate16000Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10206596amrnbdecnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10206596amrnbdecnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_DEC_RESOURCE +// The AMRNB_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbdec_resource +{ + uid = KUidHwCodecAMRDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10206598aacdecnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10206598aacdecnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AAC_DEC_RESOURCE +// The AAC_DEC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE aacdec_resource +{ + uid = KUidHwCodecAACDecToPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz; + Encoding = 0; + Channels = 3; // Stereo and mono + BufferSize = 28800; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x1020659aaacencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x1020659aaacencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AAC_ENC_RESOURCE +// The AAC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE aacenc_resource +{ + uid = KUidHwCodecPCM16ToAACEnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 28800; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x1020659drawdecencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x1020659drawdecencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE raw_pcm16_resource +{ + uid = KUidHwCodecRAWAndPCM16; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x1020659eamrnbencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x1020659eamrnbencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_ENC_RESOURCE +// The AMRNB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbenc_resource +{ + uid = KUidHwCodecPCM16ToNbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x102065b0amrnbencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x102065b0amrnbencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,61 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRNB_ENC_RESOURCE +// The AMRNB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrnbenc_resource +{ + uid = KUidHwCodecPCM16ToNbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x102084bcsbcencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x102084bcsbcencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// SBC_ENC_RESOURCE +// The SBC_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE sbc_pcm16_resource +{ + uid = KUidHwCodecSbcEnc; + + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 0; + } + }; // End of cap_data + } // End of (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10208826g729encnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10208826g729encnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// G729_ENC_RESOURCE +// The G729_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE g729enc_pcm16_resource +{ + uid = KUidHwCodecG729Enc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate8000Hz; + Encoding = 0xF; // All is supported ??? + Channels = EMMFMono; + BufferSize = 5000; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (encode mode) + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x102737b2oggdecnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x102737b2oggdecnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ogg_pcm16_dec_resource +{ + uid =0x102737B2; // //KVorbisHwDecodeUid;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x102737b4oggencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x102737b4oggencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE ogg_pcm16_enc_resource +{ + uid =0x102737B4; // //KVorbisHwDecodeUid;; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0x10283463tonenavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0x10283463tonenavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,62 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// TONE_RESOURCE +// The TONE_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE tone_resource +{ +uid = 0x10283463; + data = + { + DAL_RESOURCE_DATA + { + mode = 1; //EMMFStatePlaying + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x01; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + + }; // End of data[] +} + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0xa0000a34amrwbencnavi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0xa0000a34amrwbencnavi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "resourceaudioenums.hrh" +#include "hwdeviceimplementationuids.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// AMRWB_ENC_RESOURCE +// The AMRWB_ENC_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE amrwbenc_resource +{ + uid = KUidHwCodecPCM16ToWbAMREnc; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = EMMFSampleRate16000Hz; + Encoding = EMMFSoundEncoding16BitPCM; + Channels = EMMFMono; + BufferSize = 28800; + } + }; // End of cap_data + } // End of DAL_RESOURCE_DATA + }; // End of data[] +} + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/data/naviengine/hwdev0xa0000a7apcm16navi.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/data/naviengine/hwdev0xa0000a7apcm16navi.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,79 @@ +// Copyright (c) 2007-2009 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: +// + + + +// INCLUDES +#include "resourcehwdeviceinitstructs.rh" +#include "hwdeviceimplementationuids.hrh" +#include "resourceaudioenums.hrh" + +// RESOURCE DEFINITIONS + +// ----------------------------------------------------------------------------- +// +// RAW_PCM16_RESOURCE +// The RAW_PCM16_RESOURCE resource provides the client with the following +// initialization information: +// 1. Hardware device UID. This UID is defined by the client. +// 2. The device capabilities parameters consisting of sampling rate, +// type of encoding, channel definition (mono or stereo) and buffer size. +// +// ----------------------------------------------------------------------------- +// + +RESOURCE DAL_RESOURCE_DATA_RESOURCE raw_pcm16_resource +{ + uid = 0xa0000a7a; + data = + { + DAL_RESOURCE_DATA + { + mode = 2; //EMMFStateRecording + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x3F; // NaviEngine Supports: 41000, 32000, 22050, 16000, + // 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; + BufferSize = 4096; + } + }; // End of cap_data + }, // End of DAL_RESOURCE_DATA (encode mode) + + DAL_RESOURCE_DATA + { + mode = EMMFStatePlaying; // Decode or Play + + cap_data = + { + HWDEVICE_CAPABILITIES_DATA + { + Rate = 0x67F; // Binary Rep: 11001111111 = 24000, 12000, 48000, 44100, + // 32000, 22050, 16000, 11025 and 8000 Hz + Encoding = EMMFSoundEncoding16BitPCM; + Channels = 3; // 3 EMMFMono | EMMFStereo + BufferSize = 28800; + } + }; // End of cap_data + } // End of DMS_RESOURCE_DATA (decode mode) + }; // End of data[] + } + + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/audiocodec.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/audiocodec.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,13 @@ +EXPORTS + _ZN11CAudioCodec10InitializeEv @ 1 NONAME + _ZN11CAudioCodec14SupportedModesER6RArrayI4TUidE @ 2 NONAME + _ZN11CAudioCodec14SupportedRatesER6RArrayIiE @ 3 NONAME + _ZN11CAudioCodec26RegisterAudioCodecObserverER29MAudioCodecAdaptationObserver @ 4 NONAME + _ZN11CAudioCodec28UnregisterAudioCodecObserverER29MAudioCodecAdaptationObserver @ 5 NONAME + _ZN11CAudioCodec4LoadEi4TUid @ 6 NONAME + _ZN11CAudioCodec4NewLE4TUidRK16CFourCCConvertor @ 7 NONAME + _ZN11CAudioCodec4StopEv @ 8 NONAME + _ZN11CAudioCodec5PauseEv @ 9 NONAME + _ZN11CAudioCodec5StartEv @ 10 NONAME + _ZN11CAudioCodec9SetFormatE4TUid @ 11 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/audiodevicesink.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/audiodevicesink.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _ZN16CAudioDeviceSink4NewLEv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/audiodevicesource.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/audiodevicesource.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _ZN18CAudioDeviceSource4NewLEv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/audiogaincontrol.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/audiogaincontrol.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + _ZN17CAudioGainControl4NewLEv @ 1 NONAME + _ZN17CAudioGainControl9SetHelperER11MGainHelper @ 2 NONAME + _ZN17CAudioGainControl24IssueGainChangedCallBackEi @ 3 NONAME + _ZN17CAudioGainControl13ConfigureRampE4TUidRK25TTimeIntervalMicroSeconds @ 4 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/buffersink.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/buffersink.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _ZN11CBufferSink4NewLEv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/eabi/buffersource.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/eabi/buffersource.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,3 @@ +EXPORTS + _ZN13CBufferSource4NewLEv @ 1 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2009 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: +// + + + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +PRJ_PLATFORMS +DEFAULT +PRJ_EXPORTS + + ./refacladaptation.iby /epoc32/rom/include/refacladaptation.iby + + +PRJ_MMPFILES +../mmpfiles/audiocodec.mmp +../mmpfiles/buffersink.mmp +../mmpfiles/audiodevicesink.mmp +../mmpfiles/buffersource.mmp +../mmpfiles/audiodevicesource.mmp +../mmpfiles/audiogaincontrol.mmp +../mmpfiles/audiostream.mmp +../mmpfiles/tonehwdevice.mmp + +#endif diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/group/multimedia_a3f_refacladaptation.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/group/multimedia_a3f_refacladaptation.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,16 @@ +#multimedia_a3f_refacladaptation.mrp +# +#Copyright (c) Symbian Software Ltd 2007. All rights reserved. +# + +component multimedia_a3f_refacladaptation + +source \sf\os\mm\mmhais\refacladapt + +binary \sf\os\mm\mmhais\refacladapt\group all + +exports \sf\os\mm\mmhais\refacladapt\group + +notes_source \component_defs\release.src + +ipr T \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/group/refacladaptation.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/group/refacladaptation.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,186 @@ +// Copyright (c) 2006-2009 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: +// + + + +#ifndef REFACLADAPTATION_IBY +#define REFACLADAPTATION_IBY + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +// Audio Control fw dll's + +ECOM_PLUGIN(audiostream.dll, audiostream.rsc) + +ECOM_PLUGIN(tonehwdevice.dll, tonehwdevice.rsc) + +// audiocomponentlibrary plugins +file=ABI_DIR\BUILD_DIR\audiocodec.dll System\Libs\audiocodec.dll +file=ABI_DIR\BUILD_DIR\audiogaincontrol.dll System\Libs\audiogaincontrol.dll +file=ABI_DIR\BUILD_DIR\buffersink.dll System\Libs\buffersink.dll +file=ABI_DIR\BUILD_DIR\audiodevicesink.dll System\Libs\audiodevicesink.dll +file=ABI_DIR\BUILD_DIR\buffersource.dll System\Libs\buffersource.dll +file=ABI_DIR\BUILD_DIR\audiodevicesource.dll System\Libs\audiodevicesource.dll + +/* + * DEFAULT ROM BUILDS [NOT NAVIENGINE] + */ +#ifndef __NE1_TB__ + +data=ZRESOURCE\a3f\HwDev0x101FFA06GSM610Default.RSC resource\a3f\HwDev0x101FFA06.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F21PU8Default.RSC resource\a3f\HwDev0x101F9F21.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F36PCM8Default.RSC resource\a3f\HwDev0x101F9F36.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F00PCM16Default.rsc resource\a3f\HwDev0x101F9F00.rsc +data=ZRESOURCE\a3f\HwDev0x101F9F01PCM16Default.rsc resource\a3f\HwDev0x101F9F01.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F32ALawDefault.RSC resource\a3f\HwDev0x101F9F32.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F34PCM16Default.RSC resource\a3f\HwDev0x101F9F34.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F31MuLawDefault.RSC resource\a3f\HwDev0x101F9F31.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F33PCM16Default.RSC resource\a3f\HwDev0x101F9F33.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F35PCM16Default.RSC resource\a3f\HwDev0x101F9F35.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F37PCM16Default.RSC resource\a3f\HwDev0x101F9F37.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F38S16Default.RSC resource\a3f\HwDev0x101F9F38.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F3cS16Default.RSC resource\a3f\HwDev0x101F9F3c.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F3dpcm16bDefault.RSC resource\a3f\HwDev0x101F9F3d.RSC +data=ZRESOURCE\a3f\HwDev0x101F9F40IMADDefault.RSC resource\a3f\HwDev0x101F9F40.RSC +data=ZRESOURCE\a3f\hwdev0x101f9f41pcm16default.RSC resource\a3f\HwDev0x101F9F41.RSC +data=ZRESOURCE\a3f\hwdev0x101ffa05pcm16default.RSC resource\a3f\hwdev0x101ffa05.rsc +data=ZRESOURCE\a3f\HwDev0xa0000a7aPCM16Default.RSC resource\a3f\HwDev0xa0000a7a.RSC +data=ZRESOURCE\a3f\HwDev0x102737B2OGGDecDefault.RSC resource\a3f\HwDev0x102737B2.RSC +data=ZRESOURCE\a3f\HwDev0x102737B4OGGEncDefault.RSC resource\a3f\HwDev0x102737B4.RSC +data=ZRESOURCE\a3f\HwDev0x10283463ToneDefault.RSC resource\a3f\HwDev0x10283463.RSC + + +// Raw +data=ZRESOURCE\a3f\HwDev0x1020659DRawDecEncDefault.RSC resource\a3f\HwDev0x1020659D.RSC +// MP3 +data=ZRESOURCE\a3f\HwDev0x1020658FMp3DecDefault.RSC resource\a3f\HwDev0x1020658F.RSC +// NB AMR DEC +data=ZRESOURCE\a3f\HwDev0x10206596AmrNbDecDefault.RSC resource\a3f\HwDev0x10206596.RSC +// NB AMR ENC +data=ZRESOURCE\a3f\HwDev0x1020659EAmrNbEncDefault.RSC resource\a3f\HwDev0x1020659E.RSC +// NB AMR ENC (NCP5) +data=ZRESOURCE\a3f\HwDev0x102065b0AmrNbEncDefault.RSC resource\a3f\HwDev0x102065b0.RSC +// WB AMR ENC (NCP5.1) +data=ZRESOURCE\a3f\HwDev0xA0000A34AmrWbEncDefault.RSC resource\a3f\HwDev0xA0000A34.RSC +// WB AMR DEC +data=ZRESOURCE\a3f\HwDev0x10206591AmrWbDecDefault.RSC resource\a3f\HwDev0x10206591.RSC +// SBC +#if (ASW_SBC_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x102084BCSbcEncDefault.rsc resource\a3f\HwDev0x102084BC.rsc +#endif + +#if (ASW_ILBC_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10205E63iLbcDecDefault.RSC resource\a3f\HwDev0x10205E63.RSC +#endif + +#if (ASW_ILBC_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10205E66iLbcEncDefault.RSC resource\a3f\HwDev0x10205E66.RSC +#endif + +#if (ASW_G729_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10208826G729EncDefault.RSC resource\a3f\HwDev0x10208826.RSC +#endif + +#if (ASW_G729_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10205EEAG729DecDefault.RSC resource\a3f\HwDev0x10205EEA.RSC +#endif + +#if (ASW_G711_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10205EE4G711DecDefault.RSC resource\a3f\HwDev0x10205EE4.RSC +#endif + +#if (ASW_G711_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\HwDev0x10205EE7G711EncDefault.RSC resource\a3f\HwDev0x10205EE7.RSC +#endif + +#endif // DEFAULT ROM BUILDS + + +/* + * NAVIENGINE ROM BUILDS + */ +#ifdef __NE1_TB__ + +data=ZRESOURCE\a3f\naviengine\hwdev0x101ffa06gsm610navi.rsc resource\a3f\HwDev0x101FFA06.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f21pu8navi.rsc resource\a3f\HwDev0x101F9F21.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f36pcm8navi.rsc resource\a3f\HwDev0x101F9F36.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f00pcm16navi.rsc resource\a3f\HwDev0x101F9F00.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f01pcm16navi.rsc resource\a3f\HwDev0x101F9F01.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f32alawnavi.rsc resource\a3f\HwDev0x101F9F32.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f34pcm16navi.rsc resource\a3f\HwDev0x101F9F34.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f31mulawnavi.rsc resource\a3f\HwDev0x101F9F31.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f33pcm16navi.rsc resource\a3f\HwDev0x101F9F33.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f35pcm16navi.rsc resource\a3f\HwDev0x101F9F35.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f37pcm16navi.rsc resource\a3f\HwDev0x101F9F37.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f38s16navi.rsc resource\a3f\HwDev0x101F9F38.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f3cs16navi.rsc resource\a3f\HwDev0x101F9F3c.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f3dpcm16bnavi.rsc resource\a3f\HwDev0x101F9F3d.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f40imadnavi.rsc resource\a3f\HwDev0x101F9F40.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101f9f41pcm16navi.rsc resource\a3f\HwDev0x101F9F41.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x101ffa05pcm16navi.rsc resource\a3f\hwdev0x101ffa05.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0xa0000a7apcm16navi.rsc resource\a3f\HwDev0xa0000a7a.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x102737b2oggdecnavi.rsc resource\a3f\HwDev0x102737B2.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x102737b4oggencnavi.rsc resource\a3f\HwDev0x102737B4.RSC +data=ZRESOURCE\a3f\naviengine\hwdev0x10283463tonenavi.rsc resource\a3f\HwDev0x10283463.RSC + +// Raw +data=ZRESOURCE\a3f\naviengine\hwdev0x1020659drawdecencnavi.rsc resource\a3f\HwDev0x1020659D.RSC +// MP3 +data=ZRESOURCE\a3f\naviengine\hwdev0x1020658fmp3decnavi.rsc resource\a3f\HwDev0x1020658F.RSC +// NB AMR DEC +data=ZRESOURCE\a3f\naviengine\hwdev0x10206596amrnbdecnavi.rsc resource\a3f\HwDev0x10206596.RSC +// NB AMR ENC +data=ZRESOURCE\a3f\naviengine\hwdev0x1020659eamrnbencnavi.rsc resource\a3f\HwDev0x1020659E.RSC +// NB AMR ENC (NCP5) +data=ZRESOURCE\a3f\naviengine\hwdev0x102065b0amrnbencnavi.rsc resource\a3f\HwDev0x102065b0.RSC +// WB AMR ENC (NCP5.1) +data=ZRESOURCE\a3f\naviengine\hwdev0xa0000a34amrwbencnavi.rsc resource\a3f\HwDev0xA0000A34.RSC +// WB AMR DEC +data=ZRESOURCE\a3f\naviengine\hwdev0x10206591amrwbdecnavi.rsc resource\a3f\HwDev0x10206591.RSC +// SBC +#if (ASW_SBC_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x102084bcsbcencnavi.rsc resource\a3f\HwDev0x102084BC.RSC +#endif + +#if (ASW_ILBC_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10205e63ilbcdecnavi.rsc resource\a3f\HwDev0x10205E63.RSC +#endif + +#if (ASW_ILBC_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10205e66ilbcencnavi.rsc resource\a3f\HwDev0x10205E66.RSC +#endif + +#if (ASW_G729_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10208826g729encnavi.rsc resource\a3f\HwDev0x10208826.RSC +#endif + +#if (ASW_G729_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10205eeag729decnavi.rsc resource\a3f\HwDev0x10205EEA.RSC +#endif + +#if (ASW_G711_DEC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10205ee4g711decnavi.rsc resource\a3f\HwDev0x10205EE4.RSC +#endif + +#if (ASW_G711_ENC_LOCATION == ASW_LOCATION_AMCU) +data=ZRESOURCE\a3f\naviengine\hwdev0x10205ee7g711encnavi.rsc resource\a3f\HwDev0x10205EE7.RSC +#endif + + +#endif // NAVIENGINE ROM BUILDS + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#endif //REFACLADAPTATION_IBY diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/audiocodec.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/audiocodec.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,565 @@ +// Copyright (c) 2007-2009 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 + +#define RESOURCE_FILES_DIR /resource/a3f +#define RESOURCE_FILES_DIR_NAVIENGINE /resource/a3f/naviengine +#define INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS + + +TARGET audiocodec.dll + +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x10283459 + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiocodec +SOURCE audiocodec.cpp +SOURCE resourcedata.cpp + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiocodec +USERINCLUDE ../../../devsound/a3facf/inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +/* + * Default Resource Files + */ + +SOURCEPATH ../data + +// ogg dec +START RESOURCE HwDev0x102737B2OGGDecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// ogg enc +START RESOURCE HwDev0x102737B4OGGEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// mp3 +START RESOURCE HwDev0x1020658FMp3DecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// raw +START RESOURCE HwDev0x1020659DRawDecEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + + +// nb amr dec +START RESOURCE HwDev0x10206596AmrNbDecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// nb amr enc +START RESOURCE HwDev0x1020659EAmrNbEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// nb amr enc (ncp5) +START RESOURCE HwDev0x102065b0AmrNbEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + + +// wamr dec +START RESOURCE HwDev0x10206591AmrWbDecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// wamr enc +START RESOURCE HwDev0xA0000A34AmrWbEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + + +// sbc +START RESOURCE HwDev0x102084BCSbcEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// tone default +START RESOURCE HwDev0x10283463ToneDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + + +// create resource files for wins (resource files are renamed in iby file) + +// pcm16 default +START RESOURCE HwDev0xa0000a7aPCM16Default.rss +target hwdev0xa0000a7a +TARGETPATH RESOURCE_FILES_DIR +END + +// ogg dec +START RESOURCE HwDev0x102737B2OGGDecDefault.rss +target hwdev0x102737b2 +TARGETPATH RESOURCE_FILES_DIR +END + +// ogg enc +START RESOURCE HwDev0x102737B4OGGEncDefault.rss +target hwdev0x102737b4 +TARGETPATH RESOURCE_FILES_DIR +END + +//gsm 10 +START RESOURCE HwDev0x101FFA06GSM610Default.rss +target hwdev0x101ffa06 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm u8 +START RESOURCE HwDev0x101F9F21PU8Default.rss +target hwdev0x101f9f21 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 8 +START RESOURCE HwDev0x101F9F36PCM8Default.rss +target hwdev0x101f9f36 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f37pcm16default.rss +target hwdev0x101f9f37 +TARGETPATH RESOURCE_FILES_DIR +END + +//s16 +START RESOURCE hwdev0x101f9f38s16default.rss +target hwdev0x101f9f38 +TARGETPATH RESOURCE_FILES_DIR +END + +//s16 +START RESOURCE hwdev0x101f9f3cs16default.rss +target hwdev0x101f9f3c +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm16b +START RESOURCE hwdev0x101f9f3dpcm16bdefault.rss +target hwdev0x101f9f3d +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f01pcm16default.rss +target hwdev0x101f9f01 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE HwDev0x101F9F00PCM16Default.rss +target hwdev0x101f9f00 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f35pcm16default.rss +target hwdev0x101f9f35 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm alaw +START RESOURCE HwDev0x101F9F32ALawDefault.rss +target hwdev0x101f9f32 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f34pcm16default.rss +target hwdev0x101f9f34 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm mulaw +START RESOURCE HwDev0x101F9F31MuLawDefault.rss +target hwdev0x101f9f31 +TARGETPATH RESOURCE_FILES_DIR +END + +//mulaw pcm +START RESOURCE hwdev0x101f9f33pcm16default.rss +target hwdev0x101f9f33 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm imad +START RESOURCE HwDev0x101F9F40IMADDefault.rss +target hwdev0x101f9f40 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm imad +START RESOURCE hwdev0x101f9f41pcm16default.rss +target hwdev0x101f9f41 +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101ffa05pcm16default.rss +target hwdev0x101ffa05 +TARGETPATH RESOURCE_FILES_DIR +END + +// mp3 +START RESOURCE HwDev0x1020658FMp3DecDefault.rss +target hwdev0x1020658f +TARGETPATH RESOURCE_FILES_DIR +END + +// raw +START RESOURCE HwDev0x1020659DRawDecEncDefault.rss +target hwdev0x1020659d +TARGETPATH RESOURCE_FILES_DIR +END + +// nb amr dec +START RESOURCE HwDev0x10206596AmrNbDecDefault.rss +target hwdev0x10206596 +TARGETPATH RESOURCE_FILES_DIR +END + +// nb amr enc +START RESOURCE HwDev0x1020659EAmrNbEncDefault.rss +target hwdev0x1020659e +TARGETPATH RESOURCE_FILES_DIR +END + +// nb amr enc (ncp5) +START RESOURCE HwDev0x102065b0AmrNbEncDefault.rss +target hwdev0x102065b0 +TARGETPATH RESOURCE_FILES_DIR +END + +// wamr enc +START RESOURCE HwDev0xA0000A34AmrWbEncDefault.rss +target hwdev0xa0000a34 +TARGETPATH RESOURCE_FILES_DIR +END + +// wamr dec +START RESOURCE HwDev0x10206591AmrWbDecDefault.rss +target hwdev0x10206591 +TARGETPATH RESOURCE_FILES_DIR +END +// sbc +START RESOURCE HwDev0x102084BCSbcEncDefault.rss +target hwdev0x102084bc +TARGETPATH RESOURCE_FILES_DIR +END + +// tone default +START RESOURCE HwDev0x10283463ToneDefault.rss +target hwdev0x10283463 +TARGETPATH RESOURCE_FILES_DIR +END + +// g711 enc +START RESOURCE HwDev0x10205EE4G711DecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// g711 dec +START RESOURCE HwDev0x10205EE7G711EncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// g729 enc +START RESOURCE HwDev0x10208826G729EncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// g729 dec +START RESOURCE HwDev0x10205EEAG729DecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// ilbc dec +START RESOURCE HwDev0x10205E63iLbcDecDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// ilbc enc +START RESOURCE HwDev0x10205E66iLbcEncDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//gsm 10 +START RESOURCE HwDev0x101FFA06GSM610Default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm u8 +START RESOURCE HwDev0x101F9F21PU8Default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 8 +START RESOURCE HwDev0x101F9F36PCM8Default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f37pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//s16 +START RESOURCE hwdev0x101f9f38s16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//s16 +START RESOURCE hwdev0x101f9f3cs16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm16b +START RESOURCE hwdev0x101f9f3dpcm16bdefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f01pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE HwDev0x101F9F00PCM16Default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f35pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm alaw +START RESOURCE HwDev0x101F9F32ALawDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101f9f34pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm mulaw +START RESOURCE HwDev0x101F9F31MuLawDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//mulaw pcm +START RESOURCE hwdev0x101f9f33pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm imad +START RESOURCE HwDev0x101F9F40IMADDefault.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm imad +START RESOURCE hwdev0x101f9f41pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +//pcm 16 +START RESOURCE hwdev0x101ffa05pcm16default.rss +TARGETPATH RESOURCE_FILES_DIR +END + +// pcm16 default +START RESOURCE HwDev0xa0000a7aPCM16Default.rss +TARGETPATH RESOURCE_FILES_DIR +END + + +/* + * NaviEngine Resource Files + */ + +SOURCEPATH ../data/naviengine + +START RESOURCE hwdev0x101f9f00pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f01pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f3cs16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f3dpcm16bnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f21pu8navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f31mulawnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f32alawnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f33pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f34pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f35pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f36pcm8navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f37pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f38s16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f40imadnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101f9f41pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101ffa05pcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x101ffa06gsm610navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10205e63ilbcdecnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10205e66ilbcencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10205ee4g711decnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10205ee7g711encnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10205eeag729decnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x102065b0amrnbencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x102084bcsbcencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x102737b2oggdecnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x102737b4oggencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x1020658fmp3decnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x1020659drawdecencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x1020659eamrnbencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10206591amrwbdecnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10206596amrnbdecnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10208826g729encnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0x10283463tonenavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0xa0000a7apcm16navi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +START RESOURCE hwdev0xa0000a34amrwbencnavi.rss +TARGETPATH RESOURCE_FILES_DIR_NAVIENGINE +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY a3f_trace_heap.lib + +#ifdef INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS +LIBRARY mmfswcodecwrapper.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY a3ffourcclookup.lib +#endif + +DEFFILE audiocodec.def +nostrictdef + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/audiodevicesink.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/audiodevicesink.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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 + +TARGET audiodevicesink.dll + +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x1028345B + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiosink +SOURCE audiodevicesink.cpp + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiosink +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE audiodevicesink.def +NOSTRICTDEF + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/audiodevicesource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/audiodevicesource.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2004-2009 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 + +TARGET audiodevicesource.dll + +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x10283458 + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiosource +SOURCE audiodevicesource.cpp + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiosource +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE audiodevicesource.def +NOSTRICTDEF + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/audiogaincontrol.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/audiogaincontrol.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,43 @@ +// Copyright (c) 2006-2009 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 + +TARGET audiogaincontrol.dll +TARGETTYPE DLL + +UID KSharedLibraryUidDefine 0x1028345C + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiogaincontrol +SOURCE audiogaincontrol.cpp + + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiogaincontrol + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE audiogaincontrol.def +NOSTRICTDEF + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/audiostream.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/audiostream.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,65 @@ +// Copyright (c) 2004-2009 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 + +TARGET audiostream.dll + +TARGETTYPE PLUGIN +UID 0x10009d8d 0x10283456 + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiostream +SOURCE audiostream.cpp + + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiosink +USERINCLUDE ../src/audiocodec +USERINCLUDE ../src/audiosource +USERINCLUDE ../src/audiogaincontrol +USERINCLUDE ../../../mmresourcemgmt/mmresctrl/inc + +// AS PART OF TEMPORARY +// REMOVE WHEN MMRC MESSAGE SYSTEM IS AVAILABLE +USERINCLUDE ../../a3facl/src/shared // MLogicalChain +USERINCLUDE ../../a3facl/src/audiostream +USERINCLUDE ../../a3facl/src/audiocontext + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + + +SOURCEPATH ../src/audiostream +START RESOURCE audiostream.rss +TARGET audiostream.rsc +END + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib +LIBRARY ecom.lib +LIBRARY audiocodec.lib +LIBRARY buffersource.lib +LIBRARY buffersink.lib +LIBRARY audiogaincontrol.lib +LIBRARY audiodevicesink.lib +LIBRARY audiodevicesource.lib +LIBRARY a3ffourcclookup.lib +LIBRARY audiocomponentframework.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/buffersink.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/buffersink.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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 + +TARGET buffersink.dll +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x1028345A + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiosink +SOURCE buffersink.cpp + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiosink + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE buffersink.def +NOSTRICTDEF + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/buffersource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/buffersource.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2009 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 + +TARGET buffersource.dll + +TARGETTYPE DLL +UID KSharedLibraryUidDefine 0x10283457 + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/audiosource +SOURCE buffersource.cpp + +USERINCLUDE ../src/shared +USERINCLUDE ../src/audiosource + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY a3f_trace_heap.lib + +DEFFILE buffersource.def +NOSTRICTDEF + + + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/mmpfiles/tonehwdevice.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/mmpfiles/tonehwdevice.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,48 @@ +// tonehwdevice.mmp +// Copyright (c) 2006-2009 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: +// + + +TARGET tonehwdevice.dll +TARGETTYPE PLUGIN +UID 0x10009d8d 0x1028345E + +VENDORID 0x70000001 +CAPABILITY ALL -tcb -allfiles -diskadmin -networkcontrol -swevent -trustedui + +SOURCEPATH ../src/tonehwdevice +SOURCE ToneGenerator.cpp +SOURCE tonehwdevice.cpp +SOURCE tonedatapath.cpp + +USERINCLUDE ../src/tonehwdevice +USERINCLUDE ../../../mmdevicefw/mdf/src/audio/mdasoundadapter + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +//Required Resource Files + +START RESOURCE tonehwdevice.rss +TARGET tonehwdevice.rsc +END + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY a3f_trace_heap.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY tonedata.lib +LIBRARY mdasoundadapter.lib + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/audiocodec.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/audiocodec.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1404 @@ +//audiocodec.cpp + +// Copyright (c) 2006-2009 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 +#include +#include +#include "maudiocodecadaptationobserver.h" +#include "audiocodec.h" +#include "resourcedata.h" + +// THIS WILL REMAIN UNTIL THE REQUIREMENT WILL BE DEFINED +// THIS IMPLEMENTATION WILL WORK ONLY FOR HW DEVICES IMPLEMNETED AS SOFTWARE CODEC WRAPPERS +#define INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS + +#ifdef INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS +#include +#endif + +const TInt KMicroSecsInOneSec = 1000000; +const TInt KHwDeviceDefaultDataLength= 9; +const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor + +//Values to find the request ask by the client +const TInt KRequestSampleRate = 0x0001; +const TInt KRequestMode = 0x0002; +const TAudioModeTableEntry KModeTableLookup[] = { + { EMMFMono, {KA3FModeMonoValue} }, + { EMMFStereo, {KA3FModeStereoNonInterleavedValue} }, + }; + + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +CAudioCodec::CAudioCodec(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor) + : CActive(EPriorityStandard), + iLastBuffer(EFalse), + iHwDeviceState(EIdle), + iLastBufferAck(EFalse), + iRampOperation(KNullUid) + { + TRACE_CREATE(); + DP_CONTEXT(CAudioCodec::CAudioCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if(aTypeId==KUidAudioEncoder) + { + iMode = EEncode; + } + else if(aTypeId==KUidAudioDecoder) + { + iMode = EDecode; + } + iFourCCConvertor = static_cast( const_cast(&aFourCCConvertor) ); + + iHwDeviceInitArgs.iEapStreamId = 0; + iHwDeviceInitArgs.iPolicyId = 0; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +EXPORT_C CAudioCodec* CAudioCodec::NewL(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor) + { + DP_STATIC_CONTEXT(CAudioCodec::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioCodec* self = new(ELeave)CAudioCodec(aTypeId, aFourCCConvertor); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +void CAudioCodec::ConstructL() + { + DP_CONTEXT(CAudioCodec::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CActiveScheduler::Add(this); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CAudioCodec::~CAudioCodec() + { + DP_CONTEXT(CAudioCodec::~CAudioCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iAudioCodecObservers.Close(); + if (iHwDevice) + { + if (!iHwDeviceState == EStopped) + { + DP0(DLINFO, "StopAndDeleteCodec"); + iHwDevice->StopAndDeleteCodec(); + } + delete iHwDevice; + iHwDevice = NULL; + } + Cancel(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::SetFormat +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::SetFormat(TUid aFormat) + { + DP_CONTEXT(CAudioCodec::SetFormat *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iFormat = aFormat; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::Initialize +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::Initialize() + { + DP_CONTEXT(CAudioCodec::Initialize *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + TFourCC aFourCC(0); + err = iFourCCConvertor->FormatToFourCC(iFormat,aFourCC); + if(err == KErrNotFound) + { + err = KErrNotSupported; + } + if(err == KErrNone) + { + TRAP(err, FourCCToHwDeviceUidL(aFourCC, iMode, iDeviceUid) ); + } + if (err == KErrNone) + { + err = LoadHwDevice(); + } + +#ifdef INCLUDE_HWDEVICES_AS_SWCODEC_WRAPPERS + if (err == KErrNone) + { + TUid interfaceUid = {0}; + TAny* interface = NULL; + if (iMode == EDecode) + { + interfaceUid.iUid = KMmfPlaySettingsCustomInterface; + } + else if(iMode == EEncode) + { + interfaceUid.iUid = KMmfRecordSettingsCustomInterface; + } + + // This call at the sw codec wrapper creates the custom interfaces for playing and record + if(iHwDevice) + { + interface = iHwDevice->CustomInterface(interfaceUid); + if (iMode == EDecode) + { + iPlayCustomInterface = static_cast(interface); + } + else if(iMode == EEncode) + { + iRecordCustomInterface = static_cast(interface); + } + } + } + +#endif + if(err == KErrNone) + { + err = InitHwDevice(); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::Load +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::Load(TInt aSampleRate, TUid aMode) + { + DP_CONTEXT(CAudioCodec::Load *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iSampleRateConfig = aSampleRate; + iModeConfig = aMode; + TInt err(KErrNone); + err = SetHwDeviceConfig(); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::Start +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::Start() + { + DP_CONTEXT(CAudioCodec::Start *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + iLastBuffer = EFalse; + + // Needed since ToneHwDevice only exchange one buffer with its client + // Resume shouldn't clear the last buffer flag + // since this wont' result on a new buffer request + if(iHwDeviceState == EPaused && iDeviceUid.iUid == KUidToneHwDevice) + { + iLastBuffer = ETrue; + } + + if (iHwDevice) + { + PRF(PRF_ID, PRF_START, PRF_TIME, AA_DS_StartHwDevice, ""); + if (iMode == EDecode) + { + // PLAY + err = iHwDevice->Start(EDevDecode, EDevOutFlow); + DP1(DLINFO,"hwdevice decode start: error %d",err); + iIgnoreUnderflowInterface = reinterpret_cast(iHwDevice->CustomInterface(KIgnoreUnderflowCustomInterfaceTypeUid)); + if(iIgnoreUnderflowInterface) + { + iIgnoreUnderflowInterface->IgnoreUnderflowEvents(); + } + } + else if (iMode == EEncode) + { + // RECORD + err = iHwDevice->Start(EDevEncode, EDevInFlow); + DP1(DLINFO,"hwdevice encode start: error %d",err); + } + else + { + err = KErrNotSupported; + DP1(DLINFO,"CAudioCodec::StartHwDevice - Unknown mode %d", iMode); + } + PRF(PRF_ID, PRF_STOP, PRF_TIME, AA_DS_StartHwDevice, ""); + } + else + { + err = KErrHardwareNotAvailable; + } + + if (err == KErrNone) + { + iHwDeviceState = ERunning; + } + iLastBufferAck = EFalse; + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::Pause +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::Pause() + { + DP_CONTEXT(CAudioCodec::Pause *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + if (iHwDevice) + { + DP0(DLINFO,"Pause hwdevice"); + err = iHwDevice->Pause(); + } + iHwDeviceState = EPaused; + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::Stop +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::Stop() + { + DP_CONTEXT(CAudioCodec::Stop *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + if (iHwDevice && !(iHwDeviceState == EStopped)) + { + DP0(DLINFO,"Stop hwdevice"); + UpdateBytesPlayed(); + err = iHwDevice->Stop(); + iHwDeviceState = EStopped; + } + iLastBufferAck = EFalse; + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::GetSupportedSampleRates +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetSupportedSampleRates(RArray& aSupportedRates) + { + DP_CONTEXT(CAudioCodec::GetSupportedSampleRates *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + aSupportedRates.Reset(); + // Ask for rates from resource files + err = ReadResourceRates(aSupportedRates); + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::GetSupportedModes +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetSupportedModes(RArray& aSupportedModes) + { + DP_CONTEXT(CAudioCodec::GetSupportedModes *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + aSupportedModes.Reset(); + // Ask for modes from resource files + err = ReadResourceModes(aSupportedModes); + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::GetCustomInterface +// --------------------------------------------------------------------------- +TInt CAudioCodec::RequestCustomInterface(TUid aUid, TAny*& aPtr) + { + DP_CONTEXT(CAudioCodec::GetCustomInterface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if(iHwDevice) + { + aPtr = iHwDevice->CustomInterface(aUid); + } + else + { + err = KErrNotReady; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::RegisterObserver +// --------------------------------------------------------------------------- +TInt CAudioCodec::RegisterObserver(MCustomInterfaceSupportObserver& aObserver) + { + DP_CONTEXT(CAudioCodec::RegisterObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + err = iCISupportObservers.Find(&aObserver); + if( err != KErrNotFound ) + { + err = KErrAlreadyExists; + } + else + { + err = iCISupportObservers.Append(&aObserver); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::UnRegisterObserver +// --------------------------------------------------------------------------- +void CAudioCodec::UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver) + { + DP_CONTEXT(CAudioCodec::UnRegisterObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iCISupportObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iCISupportObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::LoadHwDevice +// --------------------------------------------------------------------------- +TInt CAudioCodec::LoadHwDevice() + { + DP_CONTEXT(CAudioCodec::LoadHwDevice *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + if(iDeviceUid==KNullUid) + { + DP0_RET(KErrNotSupported, "%d"); + } + + TRAP(err, iHwDevice = CMMFHwDevice::NewL(iDeviceUid)); + if(err == KErrNotFound) + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::InitHwDevice +// --------------------------------------------------------------------------- +TInt CAudioCodec::InitHwDevice() + { + DP_CONTEXT(CAudioCodec::InitHwDevice *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + DP1(DLINFO, "eapStreamId %d", iHwDeviceInitArgs.iEapStreamId); + DP1(DLINFO, "policyId %d", iHwDeviceInitArgs.iPolicyId); + + iHwDeviceInitParams.iHwDeviceObserver = this; + iHwDeviceInitParams.iHwDeviceInitArgsPtr.Set((TUint8*)&(iHwDeviceInitArgs), + sizeof(THwDeviceInitArgs), + sizeof(THwDeviceInitArgs)); + if (iHwDevice) + { + err = iHwDevice->Init(iHwDeviceInitParams); + } + else + { + err = KErrHardwareNotAvailable; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::SetHwDeviceConfig +// --------------------------------------------------------------------------- +TInt CAudioCodec::SetHwDeviceConfig() + { + DP_CONTEXT(CAudioCodec::SetHwDeviceConfig *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + //TODO Look for another way to set those parameters + TTaskConfig taskconfig; + taskconfig.iUid = KUidRefDevSoundTaskConfig; + taskconfig.iStereoMode = ResolveMode(iModeConfig); + taskconfig.iRate = iSampleRateConfig; + + DP1(DLINFO, "taskconfig.iRate %d", taskconfig.iRate); + DP1(DLINFO, "taskconfig.iStereoMode %d", taskconfig.iStereoMode); + DP1(DLINFO, "taskconfig.iUid %d", taskconfig.iUid); + + if (err == KErrNone && iHwDevice) + { + err = iHwDevice->SetConfig(taskconfig); + } + else + { + err = KErrHardwareNotAvailable; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::ReadResourceRates +// --------------------------------------------------------------------------- +TInt CAudioCodec::ReadResourceRates(RArray& aRates) + { + DP_CONTEXT(CAudioCodec::ReadResourceRates*CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + CResourceData* resource = NULL; + TRAP(err, resource = CResourceData::NewL(iDeviceUid)); + if (err == KErrNone && resource) + { + err = resource->GetSSampleRates(iMode,aRates); + delete resource; + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::ReadResourceModes +// --------------------------------------------------------------------------- +TInt CAudioCodec::ReadResourceModes(RArray& aModes) + { + DP_CONTEXT(CAudioCodec::ReadResourceModes*CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + CResourceData* resource = NULL; + TRAP(err, resource = CResourceData::NewL(iDeviceUid)); + if (err == KErrNone && resource) + { + err = resource->GetSModes(iMode,aModes); + delete resource; + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioComponent +// CAudioCodec::GetOutputPort +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetOutputPort(MOutputPort*& aOutputPort) + { + DP_CONTEXT(CAudioCodec::GetOutputPort *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + aOutputPort = this; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioComponent +// CAudioCodec::GetInputPort +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetInputPort(MInputPort*& aInputPort) + { + DP_CONTEXT(CAudioCodec::GetInputPort *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + aInputPort = this; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioComponent +// CAudioCodec::RegisterAudioComponentObserver +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::RegisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver) + { + DP_CONTEXT(CAudioCodec::RegisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iAudioCodecObservers.Find(&aObserver); + if(err == KErrNotFound) + { + iAudioCodecObservers.Append(&aObserver); + err = KErrNone; + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioComponent +// CAudioCodec::UnregisterAudioComponentObserver +// --------------------------------------------------------------------------- +EXPORT_C void CAudioCodec::UnregisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver) + { + DP_CONTEXT(CAudioCodec::UnregisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iAudioCodecObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioCodecObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MInputPort +// CAudioCodec::EmptyBuffer +// --------------------------------------------------------------------------- +TInt CAudioCodec::EmptyBuffer(CMMFBuffer* /*aBuffer*/, MOutputPort* /*aSupplier*/) + { + DP_CONTEXT(CAudioCodec::EmptyBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotReady, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MInputPort +// CAudioCodec::BufferFilled +// --------------------------------------------------------------------------- +TInt CAudioCodec::BufferFilled(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CAudioCodec::BufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + PRF(PRF_ID, PRF_STOP, PRF_LOAD, AA_DS_Fill, ""); + TInt err(KErrNone); + if(aBuffer->LastBuffer()) + { + iLastBuffer = ETrue; + } + if(iHwDevice) + { + err = iHwDevice->ThisHwBufferFilled(*aBuffer); + } + else + { + err = KErrNotFound; + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class MInputPort +// CAudioCodec::SetOutput +// --------------------------------------------------------------------------- +TInt CAudioCodec::SetOutput(MOutputPort* aOutput) + { + DP_CONTEXT(CAudioCodec::SetOutput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + iOutputPort = aOutput; + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MInputPort +// CAudioCodec::RemoveOutput +// --------------------------------------------------------------------------- +TInt CAudioCodec::RemoveOutput(MOutputPort* /*aOutput*/) + { + DP_CONTEXT(CAudioCodec::RemoveOutput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MOutputPort +// CAudioCodec::FillBuffer +// --------------------------------------------------------------------------- +TInt CAudioCodec::FillBuffer(CMMFBuffer* /*aBuffer*/, MInputPort* /*aConsumer*/) + { + DP_CONTEXT(CAudioCodec::FillBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotReady, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MOutputPort +// CAudioCodec::BufferEmptied +// --------------------------------------------------------------------------- +TInt CAudioCodec::BufferEmptied(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CAudioCodec::BufferEmptied *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + + if (!aBuffer) + { + err = KErrNotFound; + DP0_RET(err, "%d"); + } + + if (iLastBufferAck) //if the hwdevice return a buffer with the lastbuffer flag set, rather than returning a non-empty buffer + { //in this case we generate an empty buffer on behalf of the adaptation + TInt count = iAudioCodecObservers.Count(); + for ( TInt i(0); i < count; i++ ) // causes a ProcessingFinished() to be called on the stream + { + iAudioCodecObservers[i]->AllBuffersProcessed(); + } + iLastBufferAck = EFalse; + } + else + { + if(aBuffer->LastBuffer()) + { + iLastBuffer = ETrue; + } + if(iHwDevice) + { + err = iHwDevice->ThisHwBufferEmptied(*aBuffer); + } + else + { + err = KErrNotFound; + } + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class MOutputPort +// CAudioCodec::SetInput +// --------------------------------------------------------------------------- +TInt CAudioCodec::SetInput(MInputPort* aInput) + { + DP_CONTEXT(CAudioCodec::SetInput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + iInputPort = aInput; + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MOutputPort +// CAudioCodec::RemoveInput +// --------------------------------------------------------------------------- +TInt CAudioCodec::RemoveInput(MInputPort* /*aInput*/) + { + return KErrNone; + } + +// --------------------------------------------------------------------------- +// from class MOutputPort +// CAudioCodec::FlushBuffer +// --------------------------------------------------------------------------- +TInt CAudioCodec::FlushBuffer(MFlushHandlerObserver* aFlushObserver) + { + TInt err = KErrNone; + TAny* ptr = NULL; + + // Flush low layer buffers + if(iHwDevice) + { + ptr = iHwDevice->CustomInterface(TUid::Uid(KMmfUidEmptyBuffersCustomInterface)); + MMMFDevSoundEmptyBuffers* emptybuffers = static_cast(ptr); + if (emptybuffers) + { + // Due to defect DEF127468, this do nothing + err = emptybuffers->EmptyBuffers(); + } + else + { + err = KErrNotSupported; + } + } + else + { + err = KErrNotReady; + } + + // Flush source through an asynchronous request + if(err == KErrNone) + { + err = iOutputPort->FlushBuffer(aFlushObserver); + } + return err; + } + + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CAudioCodec::FillThisHwBuffer +// --------------------------------------------------------------------------- +TInt CAudioCodec::FillThisHwBuffer(CMMFBuffer& aHwBuffer) + { + DP_CONTEXT(CAudioCodec::FillThisHwBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + PRF(PRF_ID, PRF_START, PRF_LOAD, AA_DS_Fill, ""); + + TInt err(KErrNone); + iAdaptationBuffer = static_cast (&aHwBuffer); + + ASSERT(iAdaptationBuffer); + if (iLastBuffer) + { + iAdaptationBuffer->Data().SetLength(0); + BufferFilled(iAdaptationBuffer); + } + else + { + TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().MaxLength() )); + if(err == KErrNone) + { + if(iOutputPort) + { + err = iOutputPort->FillBuffer(&aHwBuffer, this); + } + else + { + err = KErrNotFound; + } + } + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CAudioCodec::EmptyThisHwBuffer +// --------------------------------------------------------------------------- +TInt CAudioCodec::EmptyThisHwBuffer(CMMFBuffer& aHwBuffer) + { + DP_CONTEXT(CAudioCodec::EmptyThisHwBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err(KErrNone); + iAdaptationBuffer = static_cast (&aHwBuffer); + ASSERT(iAdaptationBuffer); + if(iHwDeviceState == EPaused) + { + if (iAdaptationBuffer->Data().Length() == 0) // empty buffer + { + TInt count = iAudioCodecObservers.Count(); + for ( TInt i(0); i < count; i++ ) // causes a ProcessingFinished() to be called on the stream + { + iAudioCodecObservers[i]->AllBuffersProcessed(); + } + } + else + { + if(aHwBuffer.LastBuffer()) + { + aHwBuffer.SetLastBuffer(EFalse); // a buffer coming from hardware device should never have last buffer set... + iLastBufferAck = ETrue; + } + + TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().Length())); + if(err == KErrNone) + { + if(iInputPort) + { + err = iInputPort->EmptyBuffer(&aHwBuffer, this); + } + else + { + err = KErrNotFound; + } + } + } + } + else + { + TRAP(err,iAdaptationBuffer->SetRequestSizeL(iAdaptationBuffer->Data().Length())); + if(err == KErrNone) + { + if(iInputPort) + { + err = iInputPort->EmptyBuffer(&aHwBuffer, this); + } + else + { + err = KErrNotFound; + } + } + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CAudioCodec::MsgFromHwDevice +// --------------------------------------------------------------------------- +TInt CAudioCodec::MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg) + { + DP_CONTEXT(CAudioCodec::MsgFromHwDevice *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBuf<50> formattedNumber; + formattedNumber.Format(_L("MessageType 0x%08x"), aMessageType.iUid); + TBuf<50> buf; + buf.Copy(aMsg); + buf.Append(formattedNumber); + if(aMessageType.iUid == KMmfHwDeviceObserverUpdateBytesPlayed) + { + //This is used by sw codec wrapper to request a bytes played update + //Bytes played won't be updated in Stopped() or Error() on sw codec wrapper + //As the sound device is closed. Non sw codec wrapper Hw device plugins + //Can get the bytes updated on Stopped() and/or Error() + UpdateBytesPlayed(); + } + DP1(DLINFO, "DeviceMessage is %S",&buf); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CAudioCodec::Stopped +// --------------------------------------------------------------------------- +void CAudioCodec::Stopped() + { + DP_CONTEXT(CAudioCodec::Stopped *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + //For sw codec wrappers hw devices bytes played are updated in MsgFromHwDevice + //But non sw codec wrappers hw devices may do it differently + //Also don't know if non sw codec wrappers hw devices will call Stopped or Error first + UpdateBytesPlayed(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CAudioCodec::Error +// --------------------------------------------------------------------------- +// +void CAudioCodec::Error(TInt aError) + { + DP_CONTEXT(CAudioCodec::Error *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TTimeIntervalMicroSeconds currentPosition; + TInt err = KErrNone; + +#ifdef _DEBUG + RDebug::Print(_L("iDeviceUid=0x%x aError=%d iLastBuffer=%d"), iDeviceUid.iUid, aError, iLastBuffer); +#endif + // The most problable receiver is the logicalaudiocodec which should notify to the client through MAudioProcessingUnit + TUint count = iAudioCodecObservers.Count(); + + // Notify only for the + if (aError == KErrUnderflow && iMode == EDecode ) + { + // Notify the observers + if(iLastBuffer) + { + for ( TUint i(0); i < count; i++ ) + { + iAudioCodecObservers[i]->AllBuffersProcessed(); + } + } + else + { + // Re-start decoding + + //For sw codec wrappers hw devices bytes played are updated in MsgFromHwDevice + //But non sw codec wrappers hw devices may do it differently + //Also don't know if non sw codec wrappers hw devices will call Stopped or Error first + UpdateBytesPlayed(); + + err = GetControlPosition(currentPosition); + if(err != KErrNone) + { + // Ignore safely + } + +#ifdef _DEBUG + RDebug::Print(_L("Restart decoding")); +#endif + + Start(); + } + } + else if (aError == KErrOverflow && iMode == EEncode ) + { + if (!iLastBuffer && iHwDeviceState == ERunning) + { + // Re-start encoding + err = GetControlPosition(currentPosition); + if(err != KErrNone) + { + // Ignore safely + } + Start(); + } + else + { + if (iDeviceUid.iUid != KUidToneHwDevice) + { +#ifdef _DEBUG + RDebug::Print(_L("Is this is not needed for other encoders but toneHwDevice")); +#endif + for ( TUint i(0); i < count; i++ ) + { + iAudioCodecObservers[i]->AllBuffersProcessed(); + } + } + } + } + else + { + for ( TUint i(0); i < count; i++ ) + { + iAudioCodecObservers[i]->ProcessingUnitError(aError); + } + } + DP_OUT(); + } + +// HELPER CLASS +// --------------------------------------------------------------------------- +// from class MGainHelper +// CAudioCodec::GetGain +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetGain(TInt& aGain) const + { + DP_CONTEXT(CAudioCodec::GetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if (iMode == EDecode && iPlayCustomInterface) + { + aGain = iPlayCustomInterface->Volume(); + } + else if( iMode == EEncode && iRecordCustomInterface) + { + aGain = iRecordCustomInterface->Gain(); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MGainHelper +// CAudioCodec::SetGain +// --------------------------------------------------------------------------- +TInt CAudioCodec::SetGain(RArray& aChannels) + { + DP_CONTEXT(CAudioCodec::SetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + // Current adaptation doesn't support multichannel + // Use average + TUint count = aChannels.Count(); + TInt gain = 0; + if (count) + { + TInt totalGain = 0; + for (TUint i(0); i < count; i++) + { + totalGain =+ aChannels[i].iGain; + } + gain = totalGain / count; + } + + if (gain > KDefaultMaxGain) + { + gain = KDefaultMaxGain; + } + else if (gain < 0) + { + gain = 0; + } + + if (iMode == EDecode && iPlayCustomInterface) + { + iPlayCustomInterface->SetVolume(gain); + } + else if( iMode == EEncode && iRecordCustomInterface) + { + iRecordCustomInterface->SetGain(gain); + } + + DP0_RET(err, "%d"); + } + + +TInt CAudioCodec::ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration) + { + DP_CONTEXT(CAudioCodec::ConfigureRamp *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + if (aRampOperation == KUidGainSawTooth) + { + if (iMode == EDecode && iPlayCustomInterface) + { + iPlayCustomInterface->SetVolumeRamp(aRampDuration); + } + } + else if (iRampOperation == KNullUid) + { + if (iMode == EDecode && iPlayCustomInterface) + { + iPlayCustomInterface->SetVolumeRamp(0); + } + } + else + { + err = KErrA3fUnsupportedRamp; + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MPositionControl +// CAudioCodec::GetControlPosition +// --------------------------------------------------------------------------- +TInt CAudioCodec::GetControlPosition(TTimeIntervalMicroSeconds& aPosition) + { + DP_CONTEXT(CAudioCodec::GetControlPosition *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + TInt sampleRateValue = iSampleRateConfig; + + // At this adaptation EMMFSoundEncoding16BitPCM encoding is assumed + // Due RMdaDevSound which is always pcm16 each sample is 2 bytes + TInt bytesPerAudioSample = 2; + + // Here is secure to convert to TInt a TAudioMode since the values + // are chossen according to the value they represent. + TInt numberOfChannels = ResolveMode(iModeConfig); + + TInt64 samples = 0; + if (err == KErrNone) + { + if( iMode == EDecode && iPlayCustomInterface) + { + TInt64 bytesPlayed = iPlayCustomInterface->BytesPlayed(); + if (bytesPlayed) + { + iPlayedBytesCount = bytesPlayed; + } + + samples = iPlayedBytesCount; + + if(numberOfChannels > 1) + { + samples /= numberOfChannels; + } + + if(bytesPerAudioSample > 1) + { + samples /= bytesPerAudioSample; + } + } + else if( iMode == EEncode && iRecordCustomInterface) + { + samples = iRecordCustomInterface->BytesRecorded(); + if(numberOfChannels > 1) + { + samples /= numberOfChannels; + } + if(bytesPerAudioSample > 1) + { + samples /= bytesPerAudioSample; + } + } + } + + if(sampleRateValue) + { + iPosition = (TInt64(samples) * KMicroSecsInOneSec / sampleRateValue); + } + aPosition = iPosition; + DP1(DLINFO,"GetControlPosition Samples = %d", samples); +#ifdef _DEBUG + RDebug::Print(_L("GetControlPosition Position=%d"), iPosition); +#endif + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::ResetControlPosition +// --------------------------------------------------------------------------- +void CAudioCodec::ResetControlPosition() + { + DP_CONTEXT(CAudioCodec::ResetControlPosition *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iPosition = 0; + iPlayedBytesCount = 0; + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::FourCCToHwDeviceUid +// --------------------------------------------------------------------------- +void CAudioCodec::FourCCToHwDeviceUidL(TFourCC aFourCC, TMode aMode, TUid &aHWDev) + { + DP_CONTEXT(CAudioCodec::FourCCToHwDeviceUid *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //check argument precondition for aState + if ((aMode != EDecode) && (aMode != EEncode)) + { + User::Leave(KErrArgument); + } + + // Array to return hw device plugin resource info(place on cleanupstack + // _after_ ListImplementationsL() ) + RImplInfoPtrArray plugInArray; + TUid KUidMmfHWPluginInterfaceCodec = {KMmfUidPluginInterfaceHwDevice}; + + // ListImplementationsL leaves if it cannot find anything so trap the error + TRAPD(err, REComSession::ListImplementationsL(KUidMmfHWPluginInterfaceCodec, + plugInArray)); + CleanupResetAndDestroyPushL(plugInArray); + + TUint numberOfHwDevicePlugins = plugInArray.Count(); + + // if no errors and have hwdevice plugin resource entries then scan entries + // matching on a datatype of pcm16 as the destination datatype for play and + // the source datatype for record. If a match is found and isn't already in + // the list of supported data types, then add it to the list + if ((err == KErrNone) && (numberOfHwDevicePlugins)) + { + CImplementationInformation* hwDeviceResourceEntry = NULL; + _LIT8(KPCM16FourCCString, " P16"); + TBufC8 fourCCStringPCM16(KPCM16FourCCString); + TPtr8 fourCCPtrPCM16 = fourCCStringPCM16.Des(); + + // check each resource entry for dst 4CC = P16 for play and + // src 4CC = P16 for record + for (TUint hwDeviceEntry = 0; + hwDeviceEntry < numberOfHwDevicePlugins; + hwDeviceEntry++) + { + hwDeviceResourceEntry = plugInArray[hwDeviceEntry]; + + if (IsDataTypeMatch(hwDeviceResourceEntry, fourCCPtrPCM16, aMode)) + { + // resource entry data field has dest/src datatype ' P16' + // i.e. pcm16 for play/record + TPtrC8 fourCCPtr(0,0); + + if (aMode == EDecode) + { + // datatype supported 4CC is left 4 chars + fourCCPtr.Set( + hwDeviceResourceEntry->DataType().Left(KFOURCCLENGTH)); + } + else if (aMode == EEncode) + { + // datatype supported 4CC is right 4 chars + fourCCPtr.Set( + hwDeviceResourceEntry->DataType().Right(KFOURCCLENGTH)); + } + + TFourCC fourCCEntry(fourCCPtr); + + // New Mapping + if (fourCCEntry == aFourCC) + { + // get the Uid + aHWDev = hwDeviceResourceEntry->ImplementationUid(); + break; + } + } + } + + // Verify there is a HwDeviceUid + if(aHWDev.iUid == 0) + { + User::Leave(KErrNotSupported); + } + } + else + { + // if an error occured and not KErrNotFound then must be a 'real' error + // e.g. KErrNoMemory + if ((err != KErrNotFound) && (err != KErrNone)) + { + User::Leave(err); + } + } + + CleanupStack::PopAndDestroy(&plugInArray); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::IsDataTypeMatch +// --------------------------------------------------------------------------- +TBool CAudioCodec::IsDataTypeMatch(CImplementationInformation* aHwDeviceResourceEntry, + const TDesC8& aHwMatchFourCC, TMode aState) + { + DP_CONTEXT(CAudioCodec::IsDataTypeMatch *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool match = EFalse; + + // Check for resource entry lenght since for HwDeviceAdaptor it is just "*" + if (aHwDeviceResourceEntry->DataType().Length()>=KHwDeviceDefaultDataLength) + { + if (aState == EDecode) + { + //play need to match with the right four characters + match = (!(aHwMatchFourCC.Match( + aHwDeviceResourceEntry->DataType().Right(KFOURCCLENGTH)) == + KErrNotFound)); + } + else if (aState == EEncode) + { + //record need to match with the left four characters + match = + (!(aHwMatchFourCC.Match( + aHwDeviceResourceEntry->DataType().Left(KFOURCCLENGTH)) == + KErrNotFound)); + } + } + else + { +#ifdef _DEBUG + RDebug::Print(_L("HwDeviceEntry %S"), &aHwDeviceResourceEntry->DataType()); +#endif + } + + DP0_RET(match, "0x%x"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::ResolveMode +// --------------------------------------------------------------------------- +TInt CAudioCodec::ResolveMode(TUid aMode) + { + DP_CONTEXT(CAudioCodec::ResolveMode *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt result = 0; + + //Mapping an uid mode to an int channel + for (TUint i=0; i<=KMaxModeIndex; i++) + { + if(KModeTableLookup[i].iAudioMode == aMode) + { + result = KModeTableLookup[i].iAudioModeValue; + break; + } + } + DP0_RET(result, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::SupportedRates +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::SupportedRates(RArray& aSupportedRates) + { + DP_CONTEXT(CAudioCodec::Service *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iRequest |= KRequestSampleRate; + + //Get request capabilities + iErrorRates = GetSupportedSampleRates(aSupportedRates); + + // Simulate an asyncronous response + if (!IsActive()) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + DP0_RET(iErrorRates, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::SupportedModes +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioCodec::SupportedModes(RArray& aSupportedModes) + { + DP_CONTEXT(CAudioCodec::Service *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iRequest |= KRequestMode; + + iErrorModes = GetSupportedModes(aSupportedModes); + + // Simulate an asyncronous response + if (!IsActive()) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + DP0_RET(iErrorModes, "%d"); + } + + +//From CActive +// --------------------------------------------------------------------------- +// CAudioCodec::RunL +// --------------------------------------------------------------------------- +void CAudioCodec::RunL() + { + DP_CONTEXT(CAudioCodec::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + // Send the callback for the request operation + if (iRequest & KRequestMode) + { + TUint count = iAudioCodecObservers.Count(); + for ( TUint i(0); i < count; i++ ) + { + iAudioCodecObservers[i]->GetSupportedAModesComplete(iErrorModes); + } + + // Reset the request flag + iRequest &= ~KRequestMode; + } + + // Send the callback for the request operation + if (iRequest & KRequestSampleRate) + { + TUint count = iAudioCodecObservers.Count(); + for ( TUint i(0); i < count; i++ ) + { + iAudioCodecObservers[i]->GetSupportedARatesComplete(iErrorRates); + } + + // Reset the request flag + iRequest &= ~KRequestSampleRate; + } + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::RunError +// --------------------------------------------------------------------------- +TInt CAudioCodec::RunError(TInt aError) + { + DP_CONTEXT(CAudioCodec::RunError *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(aError, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioCodec::DoCancel +// --------------------------------------------------------------------------- +void CAudioCodec::DoCancel() + { + DP_CONTEXT(CAudioCodec::DoCancel *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iRequest = 0; + DP_OUT(); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/audiocodec.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/audiocodec.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,278 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef AUDIOCODEC_H +#define AUDIOCODEC_H + +#include +#include +#include +#include +#include +#include + +#include "hwdeviceimplementationuids.hrh" + +#include + +#include "moutputport.h" +#include "minputport.h" +#include "mgainhelper.h" +#include "mstreampositioncontrol.h" + +#include +#include + +#define KFOURCCLENGTH 4 + + +enum TMode + { + // Decoder mode + EDecode = 0x01, + // And vice versa + EEncode = 0x02 + }; + +class TSampleRateTableEntry + { +public: + TInt iSampleRateValue; + TMMFSampleRate iSampleRate; + }; + +class TAudioModeTableEntry + { +public: + TMMFMonoStereo iAudioModeValue; + TUid iAudioMode; + }; + +const TInt KMaxModeIndex = 1; + + + +class MAudioCodecAdaptationObserver; +class CFourCCConvertor; + + ///// + //This is the reference implementation of Phyisical AudioCodec + //@lib audiocodec.lib + /// + +// TODO: Check if those interfaces MInputPort, MOutputPort should be replaced by MMMFAudioDataSupplier, MMMFAudioDataConsumer + + +NONSHARABLE_CLASS(CAudioCodec) :public CActive, + public MMMFHwDeviceObserver, + public MInputPort, // Adaptation interface + public MOutputPort, // Adaptation interface + public MGainHelper, // Adaptation interface + public MCustomInterfaceSupport, // A3F interface + public MStreamPositionControl // Adaptation interface + { +friend class CAudioGainControl; +public: + + ///// + // Create a new instance. + // + // @param aTypeId. + // @return CAudioCodec* a pointer to the created instance. + /// + + IMPORT_C static CAudioCodec* NewL(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor); + + // Check if this would be removed + ///// + // Structure to hold hw device init parameters + /// + class THwDeviceInitArgs + { + public: + TUint8 iPolicyId; + TInt iEapStreamId; + }; + + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CAudioCodec(); + + + IMPORT_C TInt SetFormat(TUid aFormat); + IMPORT_C TInt RegisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver); + IMPORT_C void UnregisterAudioCodecObserver(MAudioCodecAdaptationObserver& aObserver); + IMPORT_C TInt Initialize(); + IMPORT_C TInt Load(TInt aSampleRate, TUid aMode); + IMPORT_C TInt Start(); + IMPORT_C TInt Pause(); + IMPORT_C TInt Stop(); + + + + // From MOutputPort + TInt GetOutputPort(MOutputPort*& aOutputPort); + + // From MInputPort + TInt GetInputPort(MInputPort*& aInputPort); + + // From MCustomInterfaceSupport + virtual TInt RequestCustomInterface(TUid aUid, TAny*& aPtr); + virtual TInt RegisterObserver(MCustomInterfaceSupportObserver& aObserver); + virtual void UnRegisterObserver(MCustomInterfaceSupportObserver& aObserver); + + // from base class MInputPort + virtual TInt EmptyBuffer(CMMFBuffer* aBuffer, MOutputPort* aSupplier); + virtual TInt BufferFilled(CMMFBuffer* aBuffer); + virtual TInt SetOutput(MOutputPort* aOutput); + virtual TInt RemoveOutput(MOutputPort* aOutput); + + // from base class MOutputPort + virtual TInt FillBuffer(CMMFBuffer* aBuffer, MInputPort* aConsumer); + virtual TInt BufferEmptied(CMMFBuffer* aBuffer); + virtual TInt SetInput(MInputPort* aInput); + virtual TInt RemoveInput(MInputPort* aInput); + virtual TInt FlushBuffer(MFlushHandlerObserver* aFlushObserver); + + // from base class MMMFHwDeviceObserver + virtual TInt FillThisHwBuffer(CMMFBuffer& aHwBuffer); + virtual TInt EmptyThisHwBuffer(CMMFBuffer& aHwBuffer); + virtual TInt MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg); + virtual void Stopped(); + virtual void Error(TInt aError); + + // from base class MGainHelper + TInt GetGain(TInt& aGain) const; + TInt SetGain(RArray& aChannels); + TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + + // from base class MStreamPositionControl + TInt GetControlPosition(TTimeIntervalMicroSeconds& aPosition); + void ResetControlPosition(); + + + TInt ResolveMode(TUid aMode); + TInt GetSupportedSampleRates(RArray& aSupportedRates); + TInt GetSupportedModes(RArray& aSupportedModes); + + //Return the supported values to the client + IMPORT_C TInt SupportedModes(RArray& aSupportedModes); + IMPORT_C TInt SupportedRates(RArray& aSupportedRates); + +protected: + // from CActive + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + + TInt LoadHwDevice(); + TInt InitHwDevice(); + TInt SetHwDeviceConfig(); + void FourCCToHwDeviceUidL(TFourCC aFourCC, TMode aMode, TUid &aHWDev); + + TBool IsDataTypeMatch(CImplementationInformation* aHwDeviceResourceEntry, + const TDesC8& aHwMatchFourCC, TMode aState); + + // TODO: This will be replaced, when the new mechanism to get the supported configuration + // will be defined + ///// + // Reads hw device parameters from resource files. + // @return error code. + /// + TInt ReadResourceRates(RArray& aRates); + TInt ReadResourceModes(RArray& aModes); + + void UpdateBytesPlayed(); + +private: + void ConstructL(); + + CAudioCodec(TUid aTypeId, const CFourCCConvertor& aFourCCConvertor); + +private: + TUid iType; + // Indicates if this is an encoder or decoder + TMode iMode; + + // The codec format + TUid iFormat; + + // Resolved HwDevice Uid + TUid iDeviceUid; + + // + + MPlayCustomInterface* iPlayCustomInterface; + + MRecordCustomInterface* iRecordCustomInterface; + + // HwDevice init parameters + THwDeviceInitParams iHwDeviceInitParams; + THwDeviceInitArgs iHwDeviceInitArgs; + + // CI observers + RPointerArray iCISupportObservers; + + enum THwDeviceState + { + EIdle, + ERunning, + EPaused, + EStopped + }; + + TBool iLastBuffer; + THwDeviceState iHwDeviceState; + TBool iLastBufferAck; + TInt iRequest; + TInt iErrorRates; + TInt iErrorModes; + TInt iSampleRateConfig; + TUid iModeConfig; + + CMMFHwDevice* iHwDevice; + CMMFDataBuffer* iAdaptationBuffer; + + MOutputPort* iOutputPort; + MInputPort* iInputPort; + TInt64 iPosition; + TInt64 iPlayedBytesCount; + + CFourCCConvertor* iFourCCConvertor; + RPointerArray iAudioCodecObservers; + MIgnoreUnderflowEventsCustomInterface* iIgnoreUnderflowInterface; + TUid iRampOperation; + TTimeIntervalMicroSeconds iRampDuration; + }; + +/* + * Updates the total bytes played. + * + */ +inline void CAudioCodec::UpdateBytesPlayed() + { + if (iPlayCustomInterface) + { + iPlayedBytesCount = iPlayCustomInterface->BytesPlayed(); + } + } + +#endif // AUDIOCODEC_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/hwdeviceimplementationuids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/hwdeviceimplementationuids.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef HWDEVICEIMPLEMENTATIONUIDS_HRH +#define HWDEVICEIMPLEMENTATIONUIDS_HRH + + +#define Mp3ToPcm16CodecDllUid 0x1020658E +#define KUidHwCodecMP3DecToPCM16 0x1020658F +#define AwbToPcm16CodecDllUid 0x10206590 +#define KUidHwCodecAWBDecToPCM16 0x10206591 +#define AmrToPcm16CodecDllUid 0x10206595 +#define KUidHwCodecAMRDecToPCM16 0x10206596 +#define AacToPcm16CodecDllUid 0x10206597 +#define KUidHwCodecAACDecToPCM16 0x10206598 +#define Pcm16ToAacCodecDllUid 0x10206599 +#define KUidHwCodecPCM16ToAACEnc 0x1020659A +#define KUidHwCodecRAWAndPCM16DllUid 0x102065a6 +#define KUidHwCodecRAWAndPCM16 0x1020659D + +// SBC Enc +#define KUidHwCodecSbcEncDllUid 0x102084BB +#define KUidHwCodecSbcEnc 0x102084BC + +// G711 Dec +#define KUidGwcG711DecDllUid 0x10205EE2 +#define KUidHwCodecG711DecDllUid 0x10205EE3 +#define KUidHwCodecG711Dec 0x10205EE4 + +// G711 Enc +#define KUidGwcG711EncDllUid 0x10205EE5 +#define KUidHwCodecG711EncDllUid 0x10205EE6 +#define KUidHwCodecG711Enc 0x10205EE7 + +// iLBC Dec +#define KUidGwcIlbcDecDllUid 0x10205E61 +#define KUidHwCodecIlbcDecDllUid 0x10205E62 +#define KUidHwCodecIlbcDec 0x10205E63 + +// ilBC Enc +#define KUidGwcIlbcEncDllUid 0x10205E64 +#define KUidHwCodecIlbcEncDllUid 0x10205E65 +#define KUidHwCodecIlbcEnc 0x10205E66 + +// G729 Dec +#define KUidGwcG729DecDllUid 0x10205EE8 +#define KUidHwCodecG729DecDllUid 0x10205EE9 +#define KUidHwCodecG729Dec 0x10205EEA + +// G729 Enc +#define KUidGwcG729EncDllUid 0x10208825 +#define KUidHwCodecG729EncDllUid 0x10205EEB +#define KUidHwCodecG729Enc 0x10208826 + +//ASW_LOCATION_AMCU +#define KUidHwCodecPCM16ToNbAMREnc 0x102065b0 +#define KUidHwCodecPCM16ToNbAMREncDllUid 0x102065b1 + +// ASW_LOCATION_CDSP +#define KUidHwCodecPCM16ToNbAMREncCDsp 0x1020659E +#define KUidHwCodecPCM16ToNbAMREncCDspDllUid 0x102065a7 + +// AMR WB Enc MCU +#define KUidHwCodecPCM16ToWbAMREnc 0xA0000A34 +#define KUidHwCodecPCM16ToWbAMREncDllUid 0xA0000A33 + +#define KUidBaseHwDeviceDllUid 0x102065a5 + +#define KUidControlHwDeviceDllUid 0x10206592 +#define KUidControlHwDevice 0x10206593 + +#define KUidHwCodecAUDVIS 0x10205DD9 +#define KUidHwCodecAUDVISDllUid 0x10205DD7 + + +// TONE +#define KUidToneUid 0x1020659f +#define KUidToneHwDevice 0x10283463 +#define KUidToneHwDevicedll 0x1028345E + + +// These are the ECOM Implementation UIDs for the unit test hw devices used to test the +// sw codec wrapper. +// The ECOM Interface UID for CMMFHwDevice is defined in mmfhwdevice.h + +#define KMmfUidTSUSWCDWRAP 0xA0000A7A + +#define KMmfUidHwDevicePCMU8ToPCM16 0x101F9F21 +#define KMmfUidHwDeviceGSM610ToPCM16 0x101FFA06 +#define KMmfUidHwDeviceMulawToPCM16 0x101F9F31 +#define KMmfUidHwDeviceAlawToPCM16 0x101F9F32 +#define KMmfUidHwDevicePCM8ToPCM16 0x101F9F36 +#define KMmfUidHwDeviceIMAADPCMToPCM16 0x101F9F40 +#define KMmfUidHwDevicePCM16ToPCM16 0x101F9F00 +#define KMMFUidHwDevicePCM16toPCMU16B 0x101F9F37 +#define KMmfUidHwDeviceS16ToPCMU16 0x101F9F38 +#define KMmfUidHwDevicePCM16toPCM16B 0x101F9F35 + +#endif //HWDEVICEIMPLEMENTATIONUIDS_HRH diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/resourceaudioenums.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/resourceaudioenums.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +#ifndef RESOURCEAUDIOENUMS_HRH +#define RESOURCEAUDIOENUMS_HRH + +// DATA TYPES + +/** +* Sample rates supported by MMF. +*/ +enum TMMFSampleRate + { + EMMFSampleRate8000Hz = 0x00000001, + EMMFSampleRate11025Hz = 0x00000002, + EMMFSampleRate16000Hz = 0x00000004, + EMMFSampleRate22050Hz = 0x00000008, + EMMFSampleRate32000Hz = 0x00000010, + EMMFSampleRate44100Hz = 0x00000020, + EMMFSampleRate48000Hz = 0x00000040, + EMMFSampleRate88200Hz = 0x00000080, + EMMFSampleRate96000Hz = 0x00000100, + EMMFSampleRate12000Hz = 0x00000200, + EMMFSampleRate24000Hz = 0x00000400 + }; + +/** +* Mono / stereo supported by MMF. +*/ +enum TMMFMonoStereo + { + EMMFMono = 0x00000001, + EMMFStereo = 0x00000002 + }; + +/** +* Sound encodings supported by MMF. +*/ +enum TMMFSoundEncoding + { + EMMFSoundEncoding8BitPCM = 0x00000001, + EMMFSoundEncoding16BitPCM = 0x00000002, + EMMFSoundEncoding8BitALaw = 0x00000004, + EMMFSoundEncoding8BitMuLaw = 0x00000008 + }; + +/** +* Stereo types supported by MMF. +*/ +enum TMMFStereoSupport + { + EMMFNone = 0x00000000, + EMMFInterleavedOnly = 0x00000001, + EMMFNonInterleavedOnly = 0x00000002, + EMMFBothNonAndInterleaved = 0x00000003 + }; + +enum TMMFState + { + /** Idle state. + */ + EMMFStateIdle, + /** The MMF is currently playing. + */ + EMMFStatePlaying, + /** The MMF is playing a tone. + */ + EMMFStateTonePlaying, + /** The MMF is currently playing tone. + */ + EMMFStateRecording, + /** The MMF is playing and recording. + */ + EMMFStatePlayingRecording, + /** The MMF is converting data. + */ + EMMFStateConverting + }; + +// Taken from dspbridge.h. + +enum TDMSConnectionType + { + EDMSConnectionGpp, + EDMSConnectionTask, + EDMSConnectionDevice + }; + +/** +* Stream Transfer type +* This enumeration defines the transfer modes supported: +* 1. Processor copy mode (ETransferCpuCopy) and +* 2. Single copy DSP DMA (ETransferRemoteDma) +* 3. Zero-Copy mode (ETransferZeroCopy) +* +* Taken from dspbridge.h +*/ +enum TDMSTransferType + { + ETransferTypeCpuCopy, + ETransferTypeRemoteDma, + ETransferTypeZeroCopy + }; + +enum EnableTrueOrFalse + { + EEnableFalse, + EEnableTrue + }; + +#endif // RESOURCEAUDIOENUMS_HRH + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/resourcedata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/resourcedata.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,269 @@ +//audiocodec.cpp + +// Copyright (c) 2006-2009 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: +// + + + + +// INCLUDES +#include "resourcedata.h" +#include +#include + +_LIT(KDC_RESOURCE_FILES_DIR, "\\resource\\a3f\\"); +const TInt KAssumedResourceId =1; + +const TSampleRateTableEntry KRateTableLookup[] = { + { 8000, EMMFSampleRate8000Hz }, + { 11025, EMMFSampleRate11025Hz }, + { 12000, EMMFSampleRate12000Hz }, + { 16000, EMMFSampleRate16000Hz }, + { 22050, EMMFSampleRate22050Hz }, + { 24000, EMMFSampleRate24000Hz }, + { 32000, EMMFSampleRate32000Hz }, + { 44100, EMMFSampleRate44100Hz }, + { 48000, EMMFSampleRate48000Hz }, + { 64000, EMMFSampleRate64000Hz }, + { 88200, EMMFSampleRate88200Hz }, + { 96000, EMMFSampleRate96000Hz }, + }; + +const TAudioModeTableEntry KModeTableLookup[] = { + { EMMFMono, {KA3FModeMonoValue} }, + { EMMFStereo, {KA3FModeStereoNonInterleavedValue} }, + }; + +const TInt KMaxSampleRateIndex = 11; + +// ============================ MEMBER FUNCTIONS =============================== + +CResourceData::CResourceData() + { + TRACE_CREATE(); + } + +// ----------------------------------------------------------------------------- +// CResourceData::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CResourceData* CResourceData::NewL(TUid aResourceUid) + { + DP_STATIC_CONTEXT( CResourceData::NewL *CD0*, CtxDevSound, DPAPI); + DP1_IN("aResourceUid = 0x%x", aResourceUid); + + CResourceData* obj = NULL; + obj = new ( ELeave ) CResourceData; + CleanupStack::PushL( obj ); + obj->ConstructL( aResourceUid ); + CleanupStack::Pop(obj); + + DP0_RET(obj, "obj = 0x%x" ); + } + +// ----------------------------------------------------------------------------- +// CResourceData::~CResourceData +// Destructor. +// ----------------------------------------------------------------------------- +// +CResourceData::~CResourceData() + { + DP_CONTEXT(CResourceData::~CResourceData *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + delete iResourceData; + DP_OUT(); + } + + +// ----------------------------------------------------------------------------- +// CResourceData::GetSModes +// Reads the capabilities data. +// ----------------------------------------------------------------------------- +// +TInt CResourceData::GetSModes(TMode aMode, RArray& aModeConfig) + { + DP_CONTEXT( CResourceData::GetSampleModes *CD1*, CtxDevSound, DPLOCAL ); + DP1_IN( "TMode aMode = 0x%x", aMode ); + TInt ret = SeekToMode(aMode); + if (ret != KErrNone) + { + DP0_RET(ret, "%d"); + } + + // capability data size + TInt capDataSize = iResourceReader.ReadInt16(); + + // sanity check for cap data size + if (iResourceReader.Ptr() > iResourceDataEnd-capDataSize) + { + DP0( DLERR, "Pointer mismatch with cap data" ); + DP0_RET(KErrCorrupt, "KErrCorrupt" ); + } + + //Getting new Capabilities so clean the array. + aModeConfig.Reset(); + + TInt tempSampleRate = iResourceReader.ReadInt32(); + TInt tempEnconding = iResourceReader.ReadInt32(); + TInt tempMode = iResourceReader.ReadInt32(); + + TInt err(KErrNone); + + for (TUint i=0; i<=KMaxModeIndex; i++) + { + if((KModeTableLookup[i].iAudioModeValue) & tempMode) + { + err = aModeConfig.Append(KModeTableLookup[i].iAudioMode); + if (err != KErrNone) + { + break; + } + } + } + + DP0_RET(err, ""); + } + + +// ----------------------------------------------------------------------------- +// CResourceData::GetSSampleRates +// Reads the capabilities data. +// ----------------------------------------------------------------------------- +// +TInt CResourceData::GetSSampleRates(TMode aMode, RArray& aSampleRateConfig) + { + DP_CONTEXT( CResourceData::GetSSampleRates *CD1*, CtxDevSound, DPLOCAL ); + DP1_IN( "TMode aMode = 0x%x", aMode ); + //TODO to be change every hwdevice is either decode or encode + //By the moment The same resource file has both modes + TInt ret = SeekToMode(aMode); + if (ret != KErrNone) + { + DP0_RET(ret, "%d"); + } + + // capability data size + TInt capDataSize = iResourceReader.ReadInt16(); + + // sanity check for cap data size + if (iResourceReader.Ptr() > iResourceDataEnd-capDataSize) + { + DP0( DLERR, "Pointer mismatch with cap data" ); + DP0_RET(KErrCorrupt, "KErrCorrupt" ); + } + + //Getting new Capabilities so clean the array. + aSampleRateConfig.Reset(); + + TInt tempSampleRate = iResourceReader.ReadInt32(); + TInt err(KErrNone); + + for (TUint i=0; i<=KMaxSampleRateIndex; i++) + { + if(KRateTableLookup[i].iSampleRate & tempSampleRate) + { + err = aSampleRateConfig.Append(KRateTableLookup[i].iSampleRateValue); + if (err != KErrNone) + { + break; + } + } + } + + DP0_RET(err, ""); + } + +// ----------------------------------------------------------------------------- +// CResourceData::ConstructL +// Symbian 2nd phase constructor can leave. +// Reads the resource file for the correct UID. +// ----------------------------------------------------------------------------- +// +void CResourceData::ConstructL(TUid aResourceUid) + { + DP_CONTEXT( CResourceData::ConstructL *CD1*, CtxDevSound, DPLOCAL ); + DP1_IN( "aResourceUid = 0x%x", aResourceUid ); + // Open a file server session. + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + TBuf16 fileName; + TBuf16 pathAndFileName (KDrive); // Z: + fileName.Format(KFileNameFormat,aResourceUid.iUid); // HwDev0x + pathAndFileName.Append(KDC_RESOURCE_FILES_DIR); /* \\resource\\ */ + pathAndFileName.Append(fileName); // HwDevxxx.rsc + pathAndFileName.ZeroTerminate(); + HBufC16* fileNamePtr = pathAndFileName.AllocL(); + CleanupStack::PushL( fileNamePtr ); + RResourceFile rscFile; + rscFile.OpenL(fs, fileNamePtr->Des()); + CleanupClosePushL(rscFile); + // read the resource data + iResourceData = rscFile.AllocReadL(KAssumedResourceId); + // initialize the reader + iResourceReader.SetBuffer( iResourceData ); + iResourceUid = aResourceUid; + CleanupStack::PopAndDestroy( 3, &fs ); // fs, fileNamePtr,rscFile + DP_OUT(); + } + +// ----------------------------------------------------------------------------- +// CResourceData::SeekToMode +// Utility method for seeking resource to the correct mode. Leaves with +// KErrNotFound if mode is not found in the opened resource. +// ----------------------------------------------------------------------------- +// +TInt CResourceData::SeekToMode(TMode aMode) + { + DP_CONTEXT( CResourceData::SeekToMode *CD1*, CtxDevSound, DPLOCAL ); + DP1_IN( "aMode = 0x%x", aMode ); + // set buffer position to beginning + iResourceReader.SetBuffer(iResourceData); + // read the resource uid + TUid resourceUid = {iResourceReader.ReadInt32()}; + if (resourceUid != iResourceUid) + { + DP2( DLERR, "Mismatching resource uids resourceUid = %x iResourceUid = %x",resourceUid.iUid,iResourceUid.iUid ); + DP0_RET(KErrCorrupt, "KErrCorrupt" ); + } + // read the number of mode-entries in the resource + TInt modeCount = iResourceReader.ReadInt16(); + for (TInt modeIndex = 0; modeIndex < modeCount; modeIndex++) + { + // read the mode number + TMode mode = (TMode) iResourceReader.ReadInt32(); + if (mode == aMode) + { + DP0_RET(KErrNone, "" ); + } + // capability data size + TInt capDataSize = iResourceReader.ReadInt16(); + + // skip capability data + if (iResourceReader.Ptr() > iResourceDataEnd-capDataSize) + { + DP0( DLERR, "Pointer mismatch with cap data" ); + DP0_RET(KErrCorrupt, "KErrCorrupt" ); + } + iResourceReader.Advance( capDataSize ); + } + // not found + DP1( DLERR, "Mode 0x%x not found?", aMode ); + DP0_RET(KErrNotFound, "KErrNotFound" ); + } + + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/resourcedata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/resourcedata.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,105 @@ +/* +* Copyright (c) 2007 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: +* +*/ + + +#ifndef RESOURCEDATA_H +#define RESOURCEDATA_H + +// INCLUDES +#include +#include +#include +#include "audiocodec.h" + +_LIT16(KDrive,"z:"); +_LIT16(KFileNameFormat,"HwDev0x%x.rsc"); +const TInt8 KResFileNameLength = 20; +const TInt8 KResFileNameAndPathLength = 50; +// CLASS DECLARATION + +///// +// Class is used to read capabilities and initilaization data from codec +// resource data files. +/// +NONSHARABLE_CLASS (CResourceData) : public CBase + { +public: // Constructors and destructor + + ///// + // Two-phased constructor. + // + // @param aResourceUid UID of the resource whose data to read. + // @return CResourceData* Pointer to a newly constructed object. + /// + static CResourceData* NewL(TUid aResourceUid); + + ///// + // Destructor. + /// + ~CResourceData(); + +public: + + ///// + // Reads the capabilities data. + // + // @param aMode Mode of the resource. + // @param aConf On return from a succesful call, contains the capabilities data. + // @return error code + /// + TInt GetSSampleRates(TMode aMode, RArray& aSampleRate); + TInt GetSModes(TMode aMode, RArray& aModeConfig); + +private: + + + //Constructor. + + CResourceData(); + + + //2nd phase constructor is private. + //The param is the UID of the resource whose data to read. + + void ConstructL(TUid aResourceUid); + + + //Utility method for seeking resource to the correct mode. Leaves with + //KErrNotFound if mode is not found in the opened resource. + + //aMode is the codec mode. + + TInt SeekToMode(TMode aMode); + +private: // Data + + // Resource UID. + TUid iResourceUid; + + // Resource file data. + HBufC8* iResourceData; + + // Resource file reader. + TResourceReader iResourceReader; + + // Resource data end pointer (for safety checks). + const TUint8* iResourceDataEnd; + }; + +#endif // RESOURCEDATA_H + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiocodec/resourcehwdeviceinitstructs.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiocodec/resourcehwdeviceinitstructs.rh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2007-2009 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: +// + + + +#ifndef __RESOURCEHWDEVICEINITSTRUCTS_RH__ +#define __RESOURCEHWDEVICEINITSTRUCTS_RH__ + +// STRUCTURE DEFINITIONS + +STRUCT DAL_RESOURCE_DATA + { + LONG mode; // resource mode for which the data is + STRUCT cap_data; // --> client-specific capability data STRUCT + } + +// ----------------------------------------------------------------------------- +// DAL_RESOURCE_DATA_RESOURCE +// Structure for hardware device management resource +// ----------------------------------------------------------------------------- +// +STRUCT DAL_RESOURCE_DATA_RESOURCE + { + LONG uid; // resource type UID + STRUCT data[]; // array of DMS_RESOURCE_DATA + } + +// ----------------------------------------------------------------------------- +// HWDEVICE_CAPABILITIES_DATA +// Structure for hardware device capabilities data +// ----------------------------------------------------------------------------- +// +STRUCT HWDEVICE_CAPABILITIES_DATA WORD + { + LONG Rate; // Sample Rates supported + LONG Encoding; // Encodings supported + LONG Channels; // Mono/Stereo support + LONG BufferSize; // Buffer size sup + } + +#endif // __RESOURCEHWDEVICEINITSTRUCTS_RH__ + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,272 @@ +// Copyright (c) 2006-2009 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 "audiogaincontrol.h" +#include + +// ======== LOCAL FUNCTIONS ======== +void Panic(TInt aPanicCode) + { + _LIT(KAudioGainControlPanicCategory, "audiogaincontrol"); + User::Panic(KAudioGainControlPanicCategory, aPanicCode); + } + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +CAudioGainControl::CAudioGainControl() + { + TRACE_CREATE(); + DP_CONTEXT(CAudioGainControl::CAudioGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +EXPORT_C CAudioGainControl* CAudioGainControl::NewL() + { + DP_STATIC_CONTEXT(CAudioGainControl::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioGainControl* self = new(ELeave)CAudioGainControl(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +void CAudioGainControl::ConstructL() + { + DP_CONTEXT(CAudioGainControl::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +CAudioGainControl::~CAudioGainControl() + { + DP_CONTEXT(CAudioGainControl::~CAudioGainControl *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iGainObservers.Close(); + DP_OUT(); + } + +EXPORT_C void CAudioGainControl::SetHelper(MGainHelper &aHelper) + { + iHelper = &aHelper; + } +// --------------------------------------------------------------------------- +// CAudioGainControl::IssueGainChangedCallBack +// --------------------------------------------------------------------------- +EXPORT_C void CAudioGainControl::IssueGainChangedCallBack(TInt aError) + { + DP_CONTEXT(CAudioGainControl::IssueGainChangedCallBack *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iGainObservers.Count(); + for(TUint i(0); iGainChanged(*this, aError); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioGainControl::IssueMaxGainChangedCallBack +// --------------------------------------------------------------------------- +void CAudioGainControl::IssueMaxGainChangedCallBack() + { + DP_CONTEXT(CAudioGainControl::IssueMaxGainChangedCallBack *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iGainObservers.Count(); + for(TUint i(0); iMaxGainChanged(*this); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioGainControl::IssueMaxRampTimeGainChangedCallBack +// --------------------------------------------------------------------------- +void CAudioGainControl::IssueMaxRampTimeChangedCallBack() + { + DP_CONTEXT(CAudioGainControl::IssueMaxRampTimeChangedCallBack *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iGainObservers.Count(); + for(TUint i(0); iMaxRampTimeChanged(*this); + } + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioGainControl::ConfigureRamp +// --------------------------------------------------------------------------- +EXPORT_C TInt CAudioGainControl::ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration) + { + DP_CONTEXT(CAudioGainControl::ConfigureRamp *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + // Apply ramp + if(iHelper) + { + err = iHelper->ConfigureRamp(aRampOperation, aRampDuration); + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::GetMaxGain +// --------------------------------------------------------------------------- +TInt CAudioGainControl::GetMaxGain(TInt& aMaxGain) const + { + DP_CONTEXT(CAudioGainControl::GetMaxGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + aMaxGain = KDefaultMaxGain; + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::GetMaxRampTime +// --------------------------------------------------------------------------- +TInt CAudioGainControl::GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const + { + DP_CONTEXT(CAudioGainControl::GetMaxRampTime *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + aMaxRampTime = KDefaultMaxRampTime; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::GetGain +// --------------------------------------------------------------------------- +TInt CAudioGainControl::GetGain(RArray& aChannels) const + { + DP_CONTEXT(CAudioGainControl::GetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + aChannels.Reset(); + TInt count = iGains.Count(); + + for (TUint i(0); i < count; i++) + { + err = aChannels.Append(iGains[i]); + if(err != KErrNone) + { + break; + } + } + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::SetGain +// --------------------------------------------------------------------------- +TInt CAudioGainControl::SetGain( RArray& /*aChannels*/, TUid /*aRampOperation*/, + const TTimeIntervalMicroSeconds& /*aRampDuration*/) + { + DP_CONTEXT(CAudioGainControl::SetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + __ASSERT_DEBUG(EFalse, Panic(EAdaptationOldSetGainCalledPanic)); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::SetGain +// --------------------------------------------------------------------------- +TInt CAudioGainControl::SetGain(RArray& aChannels) + { + DP_CONTEXT(CAudioGainControl::SetGain *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + // Keep array cache + iGains.Reset(); + TUint count = aChannels.Count(); + for (TUint i(0); i < count; i++) + { + err = iGains.Append(aChannels[i]); + if(err != KErrNone) + { + break; + } + } + + // Apply gain + if(iHelper && err == KErrNone) + { + err = iHelper->SetGain(aChannels); + } + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::RegisterAudioGainControlObserver +// --------------------------------------------------------------------------- +TInt CAudioGainControl::RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver) + { + DP_CONTEXT(CAudioGainControl::RegisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iGainObservers.Find(&aObserver); + if(err == KErrNotFound) + { + err = iGainObservers.Append(&aObserver); + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MAudioGainControl +// CAudioGainControl::UnregisterAudioGainControlObserver +// --------------------------------------------------------------------------- +void CAudioGainControl::UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver) + { + DP_CONTEXT(CAudioGainControl::UnregisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iGainObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iGainObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiogaincontrol/audiogaincontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2007-2009 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: +* +*/ + + + +#ifndef AUDIOGAINCONTROL_H +#define AUDIOGAINCONTROL_H + +#include +#include +#include +#include + +#include "mgainhelper.h" + +#include + + +const TUint KDefaultGain = 5; +const TUint KDefaultMaxGain = 255; // TODO should discover at run time but this is value of current Symbian sound driver adaptor +const TUint KDefaultNumChannels = 2; +const TUint KDefaultMaxRampTime = 5; + +enum TGainControlPanicCode + { + EAdaptationOldSetGainCalledPanic, + }; + +/** + * Implementation of audio gain control API. + * ?more_complete_description + * @lib audiogaincontrol.lib + */ +NONSHARABLE_CLASS(CAudioGainControl) : public CBase, public MAudioGainControl + { +public: + + IMPORT_C static CAudioGainControl* NewL(); + /** + * Destructor. + * + * Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CAudioGainControl(); + + IMPORT_C void SetHelper(MGainHelper& aHelper); + + IMPORT_C void IssueGainChangedCallBack(TInt aError); + + IMPORT_C TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + + void IssueMaxGainChangedCallBack(); + void IssueMaxRampTimeChangedCallBack(); + + // from base class MAudioGainControl + TInt GetMaxGain(TInt& aMaxGain) const; + TInt GetMaxRampTime(TTimeIntervalMicroSeconds& aMaxRampTime) const; + TInt SetGain(RArray& aChannels, TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration); + TInt SetGain(RArray& aChannels); + TInt GetGain(RArray& aChannels) const; + TInt RegisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + void UnregisterAudioGainControlObserver(MAudioGainControlObserver& aObserver); + +private: + void ConstructL(); + + CAudioGainControl(); + +private: //data + RArray iGains; + /** + * Reference to observer instance + */ + RPointerArray iGainObservers; + + // The gain cannot talk directly with the sound device driver so it needs a helper to request + MGainHelper* iHelper; + }; + +#endif // AUDIOGAINCONTROL_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosink/audiodevicesink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosink/audiodevicesink.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,68 @@ +//audiodevicesink.cpp + +// Copyright (c) 2006-2009 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 "audiodevicesink.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CAudioDeviceSink::CAudioDeviceSink() + { + TRACE_CREATE(); + DP_CONTEXT(CAudioDeviceSink::CAudioDeviceSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +EXPORT_C CAudioDeviceSink* CAudioDeviceSink::NewL() + { + DP_STATIC_CONTEXT(CAudioDeviceSink::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioDeviceSink* self = new(ELeave)CAudioDeviceSink(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CAudioDeviceSink::ConstructL() + { + DP_CONTEXT(CAudioDeviceSink::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CAudioDeviceSink::~CAudioDeviceSink() + { + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosink/audiodevicesink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosink/audiodevicesink.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef AUDIODEVICESINK_H +#define AUDIODEVICESINK_H + +#include +#include +#include + +#include "mmrcclient.h" + + +///// + // This is the implementation of CAudioSink API. + // + // @see CAudioComponent + /// +NONSHARABLE_CLASS(CAudioDeviceSink) : public CBase + { +public: + ///// + // Create a new instance. + // + // @return CAudioDeviceSink* a pointer to the created instance. + /// + IMPORT_C static CAudioDeviceSink* NewL(); + + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CAudioDeviceSink(); + +private: + + void ConstructL(); + CAudioDeviceSink(); + }; + +#endif // AUDIODEVICESINK_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosink/buffersink.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosink/buffersink.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,183 @@ +//buffersink.cpp + +// Copyright (c) 2006-2009 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 "buffersink.h" +#include "moutputport.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CBufferSink::CBufferSink() + { + TRACE_CREATE(); + DP_CONTEXT(CBufferSink::CBufferSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +EXPORT_C CBufferSink* CBufferSink::NewL() + { + DP_STATIC_CONTEXT(CBufferSink::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CBufferSink* self = new(ELeave)CBufferSink(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CBufferSink::ConstructL() + { + DP_CONTEXT(CBufferSink::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBufferSink::~CBufferSink() + { + DP_CONTEXT(CBufferSink::~CBufferSink *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// from class MInputPort +// --------------------------------------------------------------------------- +// CBufferSink::GetInputPort +// --------------------------------------------------------------------------- +// +TInt CBufferSink::GetInputPort(MInputPort*& aInput) + { + DP_CONTEXT(CBufferSource::GetInputPort *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + aInput = this; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSink::EmptyBuffer +// --------------------------------------------------------------------------- +// +TInt CBufferSink::EmptyBuffer(CMMFBuffer* aBuffer, MOutputPort* aSupplier) + { + DP_CONTEXT(CBufferSink::EmptyBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if (aSupplier == iOutput) + { + iConsumer->BufferToBeEmptied(static_cast(this), aBuffer); + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSink::BufferFilled +// --------------------------------------------------------------------------- +// +TInt CBufferSink::BufferFilled(CMMFBuffer* /*aBuffer*/) + { + DP_CONTEXT(CBufferSink::BufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSink::SetOutput +// --------------------------------------------------------------------------- +// +TInt CBufferSink::SetOutput(MOutputPort* aOutput) + { + DP_CONTEXT(CBufferSink::SetOutput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iOutput = aOutput; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSink::RemoveOutput +// --------------------------------------------------------------------------- +// +TInt CBufferSink::RemoveOutput(MOutputPort* /*aOutput*/) + { + DP_CONTEXT(CBufferSink::RemoveOutput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iOutput=NULL; + DP0_RET(KErrNone, "%d"); + } + +// from MMMFBufferSink +// --------------------------------------------------------------------------- +// CBufferSink::SetDataConsumer +// --------------------------------------------------------------------------- +// +TInt CBufferSink::SetDataConsumer(MMMFAudioDataConsumer& aConsumer) + { + DP_CONTEXT(CBufferSink::SetDataConsumer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iConsumer = &aConsumer; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSink::BufferEmptied +// --------------------------------------------------------------------------- +// +TInt CBufferSink::BufferEmptied(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CBufferSink::BufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // Check if need a switch + iBuffer = aBuffer; + DP_OUT(); + return(iOutput->BufferEmptied(aBuffer)); + } + +// --------------------------------------------------------------------------- +// CBufferSink::BuffersDiscarded +// --------------------------------------------------------------------------- +// +TInt CBufferSink::BuffersDiscarded() + { + DP_CONTEXT(CBufferSink::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // Check what we are suppose to do + if(iBuffer) + { + iBuffer = NULL; + } + DP0_RET(KErrNone, "%d"); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosink/buffersink.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosink/buffersink.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef BUFFERSINK_H +#define BUFFERSINK_H + +#include +#include + +#include "minputport.h" + +#include +#include + + +///// +// This is the implementation of CAudioSink API. +// +// @see CAudioComponent +/// +NONSHARABLE_CLASS(CBufferSink) : public CBase, + public MInputPort, + public MMMFBufferSink + { +public: + + ///// + // Create a new instance. + // + // @return CBufferSink* a pointer to the created instance. + /// + IMPORT_C static CBufferSink* NewL(); + + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CBufferSink(); + + // from class MInputPort + TInt GetInputPort(MInputPort*& aInputPort); + virtual TInt EmptyBuffer(CMMFBuffer* aBuffer, MOutputPort* aSupplier); + virtual TInt BufferFilled(CMMFBuffer* aBuffer); + virtual TInt SetOutput(MOutputPort* aOutput); + virtual TInt RemoveOutput(MOutputPort* aOutput); + + // from class MMFBufferSink + virtual TInt SetDataConsumer(MMMFAudioDataConsumer& aConsumer); + virtual TInt BufferEmptied(CMMFBuffer* aBuffer); + virtual TInt BuffersDiscarded(); + +private: + + void ConstructL(); + + CBufferSink(); + + MMMFAudioDataConsumer* iConsumer; + + MOutputPort* iOutput; + + CMMFBuffer* iBuffer; + }; + +#endif // BUFFERSINK_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosource/audiodevicesource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosource/audiodevicesource.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,72 @@ +//audiodevicesource.cpp + +// Copyright (c) 2006-2009 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 "audiodevicesource.h" +#include + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CAudioDeviceSource::CAudioDeviceSource() + { + TRACE_CREATE(); + DP_CONTEXT(CAudioDeviceSource::CAudioDeviceSource, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +EXPORT_C CAudioDeviceSource* CAudioDeviceSource::NewL() + { + DP_STATIC_CONTEXT(CAudioDeviceSource::NewL, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioDeviceSource* self = new(ELeave)CAudioDeviceSource(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CAudioDeviceSource::ConstructL() + { + DP_CONTEXT(CAudioDeviceSource::ConstructL, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CAudioDeviceSource::~CAudioDeviceSource() + { + DP_CONTEXT(CAudioDeviceSource::~CAudioDeviceSource, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosource/audiodevicesource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosource/audiodevicesource.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef AUDIODEVICESOURCE_H +#define AUDIODEVICESOURCE_H + +#include +#include +#include + +#include "mmrcclient.h" + +///// + //This is the implementation of CAudioSource API. + //@see CAudioComponent +/// +NONSHARABLE_CLASS(CAudioDeviceSource) : public CBase + { +public: + + ///// + // Create a new instance. + // + // @return CAudioDeviceSource* a pointer to the created instance. + /// + IMPORT_C static CAudioDeviceSource* NewL(); + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CAudioDeviceSource(); + +private: + + void ConstructL(); + + CAudioDeviceSource(); + }; + +#endif // AUDIODEVICESOURCE_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosource/buffersource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosource/buffersource.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,232 @@ +//buffersource.cpp + +// Copyright (c) 2006-2009 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 "buffersource.h" +#include "minputport.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CBufferSource::CBufferSource() + : CActive(EPriorityStandard) + { + TRACE_CREATE(); + DP_CONTEXT(CBufferSource::CBufferSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +EXPORT_C CBufferSource* CBufferSource::NewL() + { + DP_STATIC_CONTEXT(CBufferSource::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CBufferSource* self = new(ELeave)CBufferSource(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CBufferSource::ConstructL() + { + DP_CONTEXT(CBufferSource::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CActiveScheduler::Add(this); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CBufferSource::~CBufferSource() + { + DP_CONTEXT(CBufferSource::~CBufferSource *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + + +// from MMMFBufferSource +// --------------------------------------------------------------------------- +// CBufferSource::SetDataSupplier +// --------------------------------------------------------------------------- +TInt CBufferSource::SetDataSupplier(MMMFAudioDataSupplier& aSupplier) + { + DP_CONTEXT(CBufferSource::SetDataSupplier *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iSupplier = &aSupplier; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::BufferFilled +// --------------------------------------------------------------------------- +TInt CBufferSource::BufferFilled(CMMFBuffer* aBuffer) + { + DP_CONTEXT(CBufferSource::BufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iBuffer = aBuffer; + DP_OUT(); + return iInput->BufferFilled(aBuffer); + } + +// --------------------------------------------------------------------------- +// CBufferSource::BuffersDiscarded +// --------------------------------------------------------------------------- +TInt CBufferSource::BuffersDiscarded() + { + DP_CONTEXT(CBufferSource::BuffersDiscarded *CD1*, CtxDevSound, DPLOCAL); + // Check what we are suppose to do + DP_IN(); + if(iBuffer) + { + iBuffer = NULL; + } + DP0_RET(KErrNone, "%d"); + } + + +//From MOutputPort +// --------------------------------------------------------------------------- +// CBufferSource::FillBuffer +// --------------------------------------------------------------------------- +// +TInt CBufferSource::FillBuffer(CMMFBuffer* aBuffer, MInputPort* aConsumer) + { + DP_CONTEXT(CBufferSource::FillBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + if (aConsumer == iInput) + { + iSupplier->BufferToBeFilled(static_cast(this), aBuffer); + } + else + { + err = KErrNotSupported; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::BufferEmptied +// --------------------------------------------------------------------------- +// +TInt CBufferSource::BufferEmptied(CMMFBuffer* /*aBuffer*/) + { + DP_CONTEXT(CBufferSource::BufferEmptied *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::SetInput +// --------------------------------------------------------------------------- +// +TInt CBufferSource::SetInput(MInputPort* aInput) + { + DP_CONTEXT(CBufferSource::SetInput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iInput = aInput; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::RemoveInput +// --------------------------------------------------------------------------- +// +TInt CBufferSource::RemoveInput(MInputPort* /*aInput*/) + { + DP_CONTEXT(CBufferSource::RemoveInput *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iInput = NULL; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::GetOutputPort +// --------------------------------------------------------------------------- +// +TInt CBufferSource::GetOutputPort(MOutputPort*& aOutputPort) + { + DP_CONTEXT(CBufferSource::GetOutputPort *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + aOutputPort = this; + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CBufferSource::FlushBuffer +// --------------------------------------------------------------------------- +// +TInt CBufferSource::FlushBuffer(MFlushHandlerObserver* aFlushObserver) + { + DP_CONTEXT(CBufferSource::FlushBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iObserver = aFlushObserver; + if (!IsActive()) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrNone); + SetActive(); + } + DP0_RET(KErrNone, "%d"); + } + +// From CActive +// --------------------------------------------------------------------------- +// CBufferSource::DoCancel +// --------------------------------------------------------------------------- +// +void CBufferSource::DoCancel() + { + DP_CONTEXT(CBufferSource::FlushBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + // Nothing to do + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CBufferSource::RunL +// --------------------------------------------------------------------------- +// +void CBufferSource::RunL() + { + DP_CONTEXT(CBufferSource::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iSupplier->DiscardBuffers(this); + iObserver->FlushComplete(KErrNone); + + DP_OUT(); + } + + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiosource/buffersource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiosource/buffersource.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007-2008 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: +* +*/ + + +#ifndef BUFFERSOURCE_H +#define BUFFERSOURCE_H + +#include +#include +#include + +#include "moutputport.h" +#include "mstreambuffercontrol.h" + +#include + + +///// + // This is the implementation of CAudioSource API. + // + // @see CAudioComponent. + /// +NONSHARABLE_CLASS(CBufferSource) : public CActive, + public MMMFBufferSource, // A3F interface + public MOutputPort // Adaptation interface + + { +public: + + IMPORT_C static CBufferSource* NewL(); + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CBufferSource(); + + // from MMMFBufferSource + TInt SetDataSupplier(MMMFAudioDataSupplier& aSupplier); + TInt BufferFilled(CMMFBuffer* aBuffer); + TInt BuffersDiscarded(); + + // from class MOutputPort + TInt GetOutputPort(MOutputPort*& aOutputPort); + TInt FillBuffer(CMMFBuffer* aBuffer, MInputPort* aConsumer); + TInt BufferEmptied(CMMFBuffer* aBuffer); + TInt SetInput(MInputPort* aInput); + TInt RemoveInput(MInputPort* aInput); + TInt FlushBuffer(MFlushHandlerObserver* aFlushObserver); +private: + + void ConstructL(); + + CBufferSource(); + + void DoCancel(); + + void RunL(); + +private: + MFlushHandlerObserver* iObserver; + + MMMFAudioDataSupplier* iSupplier; + + MInputPort* iInput; + + CMMFBuffer* iBuffer; + }; + +#endif // BUFFERSOURCE_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiostream/audiostream.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiostream/audiostream.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,903 @@ +//audiostream.cpp + +// Copyright (c) 2006-2009 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 +#include +#include + +#include "audiostream.h" + +// PHYSICAL COMPONENTS +#include "audiocodec.h" +#include "audiostream.h" +#include "buffersource.h" +#include "buffersink.h" +#include "audiodevicesource.h" +#include "audiodevicesink.h" +#include "audiogaincontrol.h" +#include "maudiostreamadaptationobserver.h" + +#include +#include + +#include "minputport.h" +#include "moutputport.h" +#include "audiocontext.h" + +#include + + + +const TInt KSampleRate8000Hz = 8000; + +// Map the interface implementation UIDs to implementation factory functions +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(0x10283461, CAudioStream::NewL), + }; + + +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +CAudioStream::CAudioStream() + : iCurrentStreamState(EUninitialized), + iDesiredStreamState(EUninitialized) + { + TRACE_CREATE(); + DP_CONTEXT(CAudioStream::CAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + // Some init config values + iSampleRateConfig = KSampleRate8000Hz; + iModeConfig = KA3FModeMono; + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Factory method +// --------------------------------------------------------------------------- +// +CAudioStream* CAudioStream::NewL() + { + DP_STATIC_CONTEXT(CAudioStream::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CAudioStream* self = new(ELeave)CAudioStream(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Second phase constructor +// --------------------------------------------------------------------------- +// +void CAudioStream::ConstructL() + { + DP_CONTEXT(CAudioStream::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CAudioStream::~CAudioStream() + { + DP_CONTEXT(CAudioStream::~CAudioStream *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iAudioStreamObservers.Close(); + iAudioCodecObservers.Close(); + // Just for now + DeletePhysicalComponents(); + REComSession::FinalClose(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioStream::RegisterAudioStreamObserver +// --------------------------------------------------------------------------- +// +TInt CAudioStream::RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver) + { + DP_CONTEXT(CAudioStream::RegisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iAudioStreamObservers.Find(&aObserver); + if(err == KErrNotFound) + { + err = iAudioStreamObservers.Append(&aObserver); + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::UnregisterAudioStreamObserver +// --------------------------------------------------------------------------- +// +void CAudioStream::UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver) + { + DP_CONTEXT(CAudioStream::UnregisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iAudioStreamObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioStreamObservers.Remove(idxOrErr); + } + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// CAudioStream::SetFourCC +// --------------------------------------------------------------------------- +// +void CAudioStream::SetFourCC(const CFourCCConvertor& aFourCCConvertor) + { + DP_CONTEXT(CAudioStream::SetFourCC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + CFourCCConvertor& ref = const_cast(aFourCCConvertor); + iFourCCConvertor = static_cast(static_cast(&ref)); + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// CAudioStream::UnregisterAudioStreamObserver +// --------------------------------------------------------------------------- +// +void CAudioStream::UnregisterAllAudioStreamObserver() + { + DP_CONTEXT(CAudioStream::UnregisterAudioStreamObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iAudioStreamObservers.Reset(); + + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// MMRC extension mechanism +// --------------------------------------------------------------------------- +TAny* CAudioStream::GetComponent(TUid aType) + { + TAny* ptr = NULL; + MLogicalChain* clientDesiredChain = NULL; + CAudioContext* context = static_cast(iAudioContext); + if(context) + { + clientDesiredChain = context->GetLogicalChain(0); + } + if (clientDesiredChain) + { + ptr = clientDesiredChain->GetComponent(aType); + } + return ptr; + } + +// --------------------------------------------------------------------------- +// CAudioStream::Message +// --------------------------------------------------------------------------- +TInt CAudioStream::Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags) + { + DP_CONTEXT(CAudioStream::Message *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + iCurrentChain = &aCurrentChain; + iDesiredChain = &aDesiredChain; + + TUint messageType = aDesiredChain.MessageType(); + + iAudioContext = &aContext; + + CAudioContext* audioContext = static_cast (iAudioContext); + // TO NOTIFY DIRECTLY CONTEXT + MMultimediaResourceControlObserver* mmrcObserver = static_cast(audioContext); + + // Register stream observer + if (messageType & ERegisterStreamObserver != 0) + { + // Use MMRC extension mechanism + TAny* ptr = GetComponent(KUidAudioStreamAdaptationObserver); + MAudioStreamAdaptationObserver* observer = static_cast(ptr); + if(observer) + { + err = RegisterAudioStreamObserver(*observer); + } + } + + // Register codec observer + if (messageType & ERegisterCodecObserver != 0) + { + // Use MMRC extension mechanism + TAny* ptr = GetComponent(KUidAudioCodecObserver); + MAudioCodecObserver* observer = static_cast(ptr); + if (observer) + { + err = RegisterAudioCodecObserver(*observer); + } + } + + // Component creation + TUint bit = messageType & EComponentCreation; + if( (err == KErrNone) && (bit != 0) ) + { + CAudioContext* context = static_cast(iAudioContext); + MLogicalChain* clientDesiredChain = context->GetLogicalChain(0); + err = CreatePhysicalComponents(*clientDesiredChain); + + // For Configuration + if (err==KErrNone) + { + clientDesiredChain->SetAdaptationStream(*this); + clientDesiredChain->SetStreamBufferControl(*this); + } + } + + // Component alteration + // Changes that must be applied before stream state transition + TBool configCodec = EFalse; + bit = messageType & EComponentAlterationCodec; + if( (err == KErrNone) && (bit != 0) ) + { + // Set Format + if(iCodec) + { + TUid desiredCodecFormat = iDesiredChain->CodecFormat(); + err = iCodec->SetFormat( desiredCodecFormat ); + } + + if(err == KErrNone) + { + //if samplerate or mode has changed, update value and trigger callbacks at appropriate point + if ((iDesiredChain->GetSampleRate() > 0) && (iDesiredChain->GetSampleRate() != iSampleRateConfig)) + { + iSampleRateConfig = iDesiredChain->GetSampleRate(); + configCodec = ETrue; + } + if ((iDesiredChain->GetMode() != KNullUid) && (iDesiredChain->GetMode() != iModeConfig)) + { + iModeConfig = iDesiredChain->GetMode(); + configCodec = ETrue; + } + } + } + + + bit = messageType & EComponentAlterationGain; + if( (err == KErrNone) && (bit != 0) ) + { + // Apply volume ramp + // Note that ramp operation and gain now are applied separately because current tone arquitecture + // need the volume ramp to be set before start the tonehwdevice + TTimeIntervalMicroSeconds currentRampTimeValue = 0; + TUid currentRampTimeOperation(KNullUid); + TTimeIntervalMicroSeconds desiredRampTimeValue = 0; + TUid desiredRampTimeOperation(KNullUid); + iCurrentChain->GetVolumeRampParameters(currentRampTimeOperation, currentRampTimeValue); + iDesiredChain->GetVolumeRampParameters(desiredRampTimeOperation, desiredRampTimeValue); + + if(currentRampTimeOperation != desiredRampTimeOperation || + currentRampTimeValue.Int64() != desiredRampTimeValue.Int64() ) + { + if (iGainControl) + { + err = iGainControl->ConfigureRamp(desiredRampTimeOperation, desiredRampTimeValue); + } + } + } + + //Configuration request + // Stream state + TBool invokeStateEventCallback = EFalse; + iDesiredStreamState = iDesiredChain->StreamState(); + if( (err == KErrNone) && (iCurrentStreamState != iDesiredStreamState) ) + { + err = ChangeState(iCurrentStreamState, iDesiredStreamState); + if (err == KErrNone) + { + iCurrentStreamState = iDesiredStreamState; + } + invokeStateEventCallback = ETrue; + } + + // Component alteration + // Changes that must be applied after stream state transition + TBool gainUpdated = EFalse; + bit = messageType & EComponentAlterationGain; + if( (err == KErrNone) && (bit != 0) ) + { + TAny* ptr = GetComponent(KUidAudioGainControl); + MAudioGainControl* gaincontrol = static_cast(ptr); + if (iGainControl && gaincontrol) + { + RArray channels; + TInt err = gaincontrol->GetGain(channels); + if (channels.Count() != 0 ) + { + err = iGainControl->SetGain(channels); + gainUpdated = ETrue; + } + channels.Close(); + } + } + + TBool invokeCodecCallbacks = EFalse; + bit = messageType & EComponentAlterationCodec; + if ( (err == KErrNone) && (bit != 0) && configCodec && (iCurrentStreamState == EInitialized) ) + { + //codec loading actually configures sample rate and mode + ASSERT(iCodec); + err = iCodec->Load(iSampleRateConfig, iModeConfig); + iIsCodecConfig = (err == KErrNone); + invokeCodecCallbacks = ETrue; + if ( err != KErrNone ) + { + //get back to previous values in case of error + iSampleRateConfig = iCurrentChain->GetSampleRate(); + iModeConfig = iCurrentChain->GetMode(); + } + } + + // Component destruction + bit = messageType & EComponentDestruction; + if( (err == KErrNone) && (bit != 0) ) + { + DeletePhysicalComponents(); + } + + TUint isStopping = aFlags & KServerStopping; + TUint preemptionRequest = aFlags & KPreemptionRequest; + + // HERE WE CAN GUARANTEE THAT THE REQUEST IS SUCCESFUL + // Notify context + // 1ST CALLBACK + if(!preemptionRequest) + { + mmrcObserver->ReceiveResourceUpdate(&aDesiredChain, KErrNone); + } + else + { + mmrcObserver->ReceivePreemptionUpdate(&aDesiredChain, err); + } + + // Processing unit callbacks + // Gain control + // Note that due to error checking before applying any change + // this callback always returned the error obtained by calling SetGain + // or KErrNone + if(gainUpdated) + { + if (iGainControl) + { + iGainControl->IssueGainChangedCallBack(err); + } + } + + // Stream + if(invokeStateEventCallback) + { + invokeStateEventCallback = EFalse; + for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ ) + { + if ( !isStopping ) + { + iAudioStreamObservers[idx]->StateEvent(err, iCurrentStreamState); + } + } + } + if( invokeCodecCallbacks && (iCurrentStreamState == EInitialized) ) + { + TInt count = iAudioCodecObservers.Count(); + for ( TInt idx = 0; idx < count; idx++ ) + { + //TODO replace this functionality with the new mmrc + iAudioCodecObservers[idx]->SampleRateSet(err); + iAudioCodecObservers[idx]->ModeSet(err); + } + } + + // Now has no effect on context + // But it's needed to let the MMRC know about the operation being completed + // and in such way let it to know that + for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ ) + { + if ( !isStopping ) + { + iAudioStreamObservers[idx]->PhysicalAdaptationEvent(EOperationComplete, err); + } + } + + // Don't need to send last callback sync + // Let MMRC do it + + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::DeletePhysicalComponents +// --------------------------------------------------------------------------- +void CAudioStream::DeletePhysicalComponents() + { + DP_CONTEXT(CAudioStream::DeletePhysicalComponents *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + if(iBufferSource) + { + delete iBufferSource; + iBufferSource = NULL; + } + if(iBufferSink) + { + delete iBufferSink; + iBufferSink = NULL; + } + if(iCodec) + { + delete iCodec; + iCodec = NULL; + iIsCodecConfig = EFalse; + } + if(iGainControl) + { + delete iGainControl; + iGainControl = NULL; + } + if(iDeviceSource) + { + delete iDeviceSource; + iDeviceSource = NULL; + } + if(iDeviceSink) + { + delete iDeviceSink; + iDeviceSink= NULL; + } + DP_OUT(); + } + + +// --------------------------------------------------------------------------- +// CAudioStream::CreatePhysicalComponents +// --------------------------------------------------------------------------- +TInt CAudioStream::CreatePhysicalComponents(MLogicalChain& aDesiredChain) + { + DP_CONTEXT(CAudioStream::CreatePhysicalComponents *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + TInt units = aDesiredChain.AudioProcessingUnitsCount(); + TInt index=0; + TUid typeId; + + for (index=0; index < units ; index++) + { + typeId = aDesiredChain.AudioProcessingUnitUid(index); + + // By the moment all components + if (err == KErrNone) + { + if (typeId == KUidAudioDecoder || typeId == KUidAudioEncoder ) + { + if(!iCodec) + { + TRAP(err, iCodec = CAudioCodec::NewL(typeId, *iFourCCConvertor )); + iIsCodecConfig = EFalse; + iCodec->RegisterAudioCodecObserver(*this); + TAny* ptr = GetComponent(KUidAudioCodecAdaptationObserver); + MAudioCodecAdaptationObserver* observer = static_cast(ptr); + if(observer) + { + iCodec->RegisterAudioCodecObserver(*observer); + } + // For HW custom interface + aDesiredChain.SetCustomInterfaceProvider(*iCodec); + } + if(iGainControl) + { + iGainControl->SetHelper(*iCodec); + } + // This mechanism is temporary and must be replaced + // with the Extension mechanism when the MMRC server + aDesiredChain.SetStreamPositionControl(*iCodec); + } + else if (typeId == KUidMmfBufferSource) + { + if(!iBufferSource) + { + TRAP(err,iBufferSource = CBufferSource::NewL()); + // This mechanism is temporary and must be replaced + // with the Extension mechanism when the MMRC server + aDesiredChain.SetAdaptationSource(*iBufferSource); + /* + TAny* ptr = aDesiredChain.GetComponent(KUidMmfBufferSource); + MMMFAudioDataSupplier* supplier = static_cast(ptr); + if(supplier) + { + iBufferSource->SetDataSupplier(*supplier); + } + */ + } + } + else if (typeId == KUidMmfBufferSink) + { + if(!iBufferSink) + { + TRAP(err, iBufferSink = CBufferSink::NewL()); + // This mechanism is temporary and must be replaced + // with the Extension mechanism when the MMRC server + aDesiredChain.SetAdaptationSink(*iBufferSink); + } + } + else if (typeId == KUidAudioGainControl) + { + if(!iGainControl) + { + // This mechanism is temporary and must be replaced + // with the Extension mechanism when the MMRC server + TRAP(err, iGainControl = CAudioGainControl::NewL()); + aDesiredChain.SetAdaptationGainControl(*iGainControl); + } + } + else if (typeId == KUidAudioDeviceSink) + { + if(!iDeviceSink) + { + TRAP(err, iDeviceSink = CAudioDeviceSink::NewL()); + } + } + else if (typeId == KUidAudioDeviceSource) + { + if(!iDeviceSource) + { + TRAP(err, iDeviceSource = CAudioDeviceSource::NewL()); + } + } + else + { + err = KErrNotSupported; + } + } + + // Notify the observers + for ( TUint idx(0); idx < iAudioStreamObservers.Count(); idx++ ) + { + iAudioStreamObservers[idx]->AddProcessingUnitComplete(typeId, err); + } + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::CreateDataPath +// --------------------------------------------------------------------------- +TInt CAudioStream::CreateDataPath() + { + DP_CONTEXT(CAudioStream::CreateDataPath *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNotReady); + + if(iBufferSource && iCodec) // && iSink && iGain) + { + // TMode == Decode + if(KErrNone == iBufferSource->GetOutputPort(iOutputport) && KErrNone == iCodec->GetInputPort(iInputport)) + { + iOutputport->SetInput(iInputport); + iInputport->SetOutput(iOutputport); + err = KErrNone; + } + } + else if(iBufferSink && iCodec) // && iSink && iGain) + { + //TMode == Encode + if(KErrNone == iCodec->GetOutputPort(iOutputport) && KErrNone == iBufferSink->GetInputPort(iInputport)) + { + iOutputport->SetInput(iInputport); + iInputport->SetOutput(iOutputport); + err = KErrNone; + } + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::DemolishDataPath +// --------------------------------------------------------------------------- +// +TInt CAudioStream::DemolishDataPath() + { + DP_CONTEXT(CAudioStream::DemolishDataPath *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iOutputport->RemoveInput(iInputport); + iInputport->RemoveOutput(iOutputport); + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::ChangeState +// --------------------------------------------------------------------------- +TInt CAudioStream::ChangeState(TAudioState aPreviousState, TAudioState aDesiredState) + { + DP_CONTEXT(CAudioStream::ChangeState *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + iCurrentStreamState = aPreviousState; + iDesiredStreamState = aDesiredState; + + // Ensure that there is no dereference of a NULL pointer + ASSERT(iDesiredStreamState < EInitialized || iDesiredStreamState > EActive || iCodec); + + switch (iDesiredStreamState) + { + case EInitialized: + { + if (iCurrentStreamState == EUninitialized) //Initialize + { + err = CreateDataPath(); + if(err == KErrNone) + { + err = iCodec->Initialize(); + } + } + else if( iCurrentStreamState == EIdle ) //codec unload (actually, unconfig) + { + iIsCodecConfig = EFalse; + err = KErrNone; + } + // Preemption + // This A3F adaptation allows going from Active/Primed directly to initialised + // otherwise reference MMRC would need to handle those transitions separately + else if(iCurrentStreamState == EActive || iCurrentStreamState == EPrimed) + { + // To Idle + err = iCodec->Stop(); + // To Initilised + iIsCodecConfig = EFalse; + } + + if(err == KErrNone) + { + iCurrentStreamState = EInitialized; + } + break; + } + case EIdle: + { + if ( (iCurrentStreamState == EInitialized) && !iIsCodecConfig ) + { + //codec loading actually configures sample rate and mode + err = iCodec->Load(iSampleRateConfig, iModeConfig); + iIsCodecConfig = (err == KErrNone); + } + else if (iCurrentStreamState == EActive) + { + err = iCodec->Stop(); + } + else if (iCurrentStreamState == EPrimed) + { + err = iCodec->Stop(); + } + + if(err == KErrNone) + { + iTimeProcessed = 0; + iCurrentStreamState = EIdle; + } + break; + } + case EPrimed: + { + if (iCurrentStreamState == EIdle) + { + DP0(DLINFO,"============== Stream is going from EIdle -> PRIMED"); + DP0(DLINFO,"Nothing to be done"); + } + else if (iCurrentStreamState == EActive) + { + DP0(DLINFO,"============== Stream is going from EActive -> PRIMED"); + err = iCodec->Pause(); + } + if(err == KErrNone) + { + iCurrentStreamState = EPrimed; + } + break; + } + case EActive: + { + if (iCurrentStreamState == EPrimed) //Activate from Primed + { + // Reusing AudioCodec::Start for resuming + DP0(DLINFO,"============== Stream is going from EPrimed -> ACTIVE"); + err = iCodec->Start(); + } + else if(iCurrentStreamState == EIdle) //Activate from Idle + { + DP0(DLINFO,"============== Stream is going from EIdle -> ACTIVATE"); + err = iCodec->Start(); + } + + if(err == KErrNone) + { + iCurrentStreamState = EActive; + } + break; + } + case EUninitialized: + { + err = DemolishDataPath(); + if(err == KErrNone) + { + iCurrentStreamState = EUninitialized; + } + break; + } + case EDead: + { + err = DemolishDataPath(); + if(err == KErrNone) + { + iCurrentStreamState = EDead; + } + break; + } + default: + err = KErrNotSupported; + DP1(DLINFO,"CAudioStream::ChangeState Unknown state! %d", iDesiredStreamState); + break; + } + DP0_RET(err, "%d"); + } + +TInt CAudioStream::FlushBuffers() + { + DP_CONTEXT(CAudioStream::FlushBuffers *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + + MOutputPort* outPort= static_cast(iCodec); + if(outPort) + { + outPort->FlushBuffer(this); + } + else + { + err = KErrNotReady; + } + err = KErrNone; + DP0_RET(err, "%d"); + } + + +void CAudioStream::FlushComplete(TInt aError) + { + DP_CONTEXT(CAudioStream::FlushComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioStreamObservers.Count(); + for ( TUint i(0); i < count; i++ ) + { + iAudioStreamObservers[i]->FlushComplete(aError); + } + DP_OUT(); + } + +void CAudioStream::AllBuffersProcessed() + { + DP_CONTEXT(CAudioStream::AllBuffersProcessed *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TUint count = iAudioStreamObservers.Count(); + for ( TUint i(0); i < count; i++ ) + { + iAudioStreamObservers[i]->ProcessingFinished(); + } + DP_OUT(); + } + +void CAudioStream::ProcessingUnitError(TInt /*aError*/) + { + DP_CONTEXT(CAudioStream::ProcessingUnitError *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioStream::RegisterAudioCodecObserver +// --------------------------------------------------------------------------- +TInt CAudioStream::RegisterAudioCodecObserver(MAudioCodecObserver& aObserver) + { + DP_CONTEXT(CAudioStream::RegisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = iAudioCodecObservers.Find(&aObserver); + if(err == KErrNotFound) + { + err = iAudioCodecObservers.Append(&aObserver); + } + else + { + err = KErrAlreadyExists; + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// CAudioStream::UnregisterAudioCodecObserver +// --------------------------------------------------------------------------- +void CAudioStream::UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver) + { + DP_CONTEXT(CAudioStream::UnregisterAudioCodecObserver *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt idxOrErr = iAudioCodecObservers.Find(&aObserver); + if( idxOrErr != KErrNotFound ) + { + iAudioCodecObservers.Remove(idxOrErr); + } + DP_OUT(); + } + +void CAudioStream::GetSupportedAModesComplete(TInt /*aError*/) + { + DP_CONTEXT(CAudioStream::GetSupportedAModesComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +void CAudioStream::GetSupportedARatesComplete(TInt /*aError*/) + { + DP_CONTEXT(CAudioStream::GetSupportedARatesComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CAudioStream::GetSupportedSampleRates +// --------------------------------------------------------------------------- +TInt CAudioStream::GetSupportedSampleRates(RArray& aSupportedRates) + { + TInt err = (KErrNotReady); + err = iCodec->SupportedRates(aSupportedRates); + return err; + } + +// --------------------------------------------------------------------------- +// CAudioStream::GetSupportedModes +// --------------------------------------------------------------------------- +TInt CAudioStream::GetSupportedModes(RArray& aSupportedModes) + { + TInt err = (KErrNotReady); + err = iCodec->SupportedModes(aSupportedModes); + return err; + } + +// end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiostream/audiostream.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiostream/audiostream.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2007 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: +* +*/ + + +#ifndef AUDIOSTREAM_H +#define AUDIOSTREAM_H + +#include +#include +#include +#include +#include "audiostreamadaptation.h" +#include "maudiocodecadaptationobserver.h" +#include "mconfigurationhelper.h" +#include "mstreambuffercontrol.h" + +class CAudioCodec; +class CAudioStream; +class CAudioDeviceSource; +class CAudioDeviceSink; +class CBufferSink; +class CBufferSource; +class CAudioGainControl; +class CFourCCConvertor; +class MAudioStreamAdaptationObserver; +class MInputPort; +class MOutputPort; +class MAudioCodecObserver; + + +#include "mlogicalchain.h" + +class CLogicalAudioStream; + +///// + // This is the implementation of audio stream adaptation. + /// + +class CAudioStream : public CAudioStreamAdaptation, + public MAudioCodecAdaptationObserver, + public MConfigurationHelper, + public MStreamBufferControl, + public MFlushHandlerObserver + { +public: + + ///// + // Create a new instance. + // + // @param aStream the stream implementation. Ownership of the pointer is transferred to the create CAudioStream object instance. + // @return CAudioStreamComponent* a pointer to the created instance. + /// + static CAudioStream* NewL(); + + ///// + // Destructor. + // + // Deletes all objects and releases all resource owned by this instance. + /// + virtual ~CAudioStream(); + + // From CAudioStreamAdaptation + TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver); + void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver); + void UnregisterAllAudioStreamObserver(); + void SetFourCC(const CFourCCConvertor& aFourCCConvertor); + + TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags); + + // from class MAudioCodecAdaptationObserver + void AllBuffersProcessed(); + void ProcessingUnitError(TInt aError); + TInt RegisterAudioCodecObserver(MAudioCodecObserver& aObserver); + void UnregisterAudioCodecObserver(MAudioCodecObserver& aObserver); + void GetSupportedAModesComplete(TInt aError); + void GetSupportedARatesComplete(TInt aError); + + // from base clase MStreamBufferControl + TInt FlushBuffers(); + + // from class MFlushHandlerObserver + void FlushComplete(TInt aError); +protected: + // from base clase MConfigurationhelper + TInt GetSupportedModes(RArray& aSupportedModes); + TInt GetSupportedSampleRates(RArray& aSupportedRates); + +private: + TInt CreateDataPath(); + + TInt DemolishDataPath(); + + TInt ChangeState(TAudioState aPreviousState, TAudioState aTargetState); + + TAny* GetComponent(TUid aType); + + TInt CreatePhysicalComponents(MLogicalChain& aDesiredChain); + + void DeletePhysicalComponents(); + + void ConstructL(); + + CAudioStream(); + +private: + // Flags + TBool iIsCodecConfig; + + // Components + MLogicalChain* iDesiredChain; + + MLogicalChain* iCurrentChain; + + MAudioContext* iAudioContext; + + CAudioCodec* iCodec; + + CBufferSource* iBufferSource; + + CBufferSink* iBufferSink; + + CAudioDeviceSource* iDeviceSource; + + CAudioDeviceSink* iDeviceSink; + + CAudioGainControl* iGainControl; + + // Not owned + CFourCCConvertor* iFourCCConvertor; + + TInt iSampleRateConfig; + + TUid iModeConfig; + + TAudioState iCurrentStreamState; + + TAudioState iDesiredStreamState; + + // Observers + RPointerArray iAudioStreamObservers; + + RPointerArray iAudioCodecObservers; + + MOutputPort* iOutputport; // remove ports when changing to Uninitialized + + MInputPort* iInputport; + + TTimeIntervalMicroSeconds iTimeProcessed; + }; + +#endif // AUDIOSTREAM_H__ diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/audiostream/audiostream.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/audiostream/audiostream.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +// Copyright (c) 2004-2009 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 + +// Declares info for two implementations +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x10283456; + // Declare array of interface info. This dll contains implementations + interfaces = + { + INTERFACE_INFO + { + interface_uid = 0x10283461; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10283461; + version_no = 1; + display_name = "AudioStreamAdaptation"; + default_data = ""; + opaque_data = ""; + } + }; + } + }; + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/audiostreamadaptation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/audiostreamadaptation.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,142 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef AUDIOSTREAMADAPTATION_H +#define AUDIOSTREAMADAPTATION_H + +#include +#include +#include +#include + +/** +@publishedAll +@released + +Implementation of the Audio Component Version + +*/ + +class TAudioComponentInfo + { + TInt iVersion; + }; + +/** +@publishedAll +@released + +Implementation of the Stream Adaptation + +*/ + +class MAudioStreamAdaptationObserver; +class CFourCCConvertor; +class MLogicalChain; +class MAudioContext; + +const TUid KAudioComponentManagerUid = {0x10283462}; + +// Messages flags +const TInt KServerStopping = 0x01; +const TInt KPreemptionRequest = 0x02; + +/** +@publishedAll +@released + +This is the interface to AudioStreamAdaptation. +This is represent the stream loaded when the MMRC server +selects the adaptation. + +This functionality includes audio playback and recording using different formats +CAudioStreamAdaptation provides the access point for clients to Adaptation Layer. +It is responsible for initializing connections to various subsystems +in audio adaptation. These include setting up and managing connection +to the low level audio adaptation API implementations. The connections are then made +available . +*/ +class CAudioStreamAdaptation : public CBase + { + +public: + + /** + Constructs, and returns a pointer to, a new CAudioComponentManager object. + + @return A pointer to the CAudioComponentManager instance. + */ + static CAudioStreamAdaptation* NewL(TUid aType); + + /** + Destructor. + + Deletes all objects and releases all resource owned by this instance. + */ + virtual ~CAudioStreamAdaptation(); + + + /** + Returns if a message was passed through the adaptation. + + @param MLogicalChain + Logical Current Chain + @param MLogicalChain + Desired Chain after message + @return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. + */ + + virtual TInt Message(MLogicalChain& aCurrentChain, MLogicalChain& aDesiredChain, MAudioContext& aContext, TInt aFlags) = 0; + + /** + Returns if a Audio Stream Observer was Registered. + + @param MAudioStreamAdaptationObserver + Observer object witch will be registered + @return An error code indicating if the function call was successful. KErrNone on success, otherwise + another of the system-wide error codes. + */ + + virtual TInt RegisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver) = 0 ; + + /** + Returns if a Audio Stream Observer was UnRegistered. + + @param MAudioStreamAdaptationObserver + Observer object witch will be unregistered + */ + + virtual void UnregisterAudioStreamObserver(MAudioStreamAdaptationObserver& aObserver) = 0; + + virtual void UnregisterAllAudioStreamObserver() = 0; + + virtual void SetFourCC(const CFourCCConvertor& aFourCCConvertor) = 0; + + +private: + + /** iDtor_ID_Key Instance identifier key. When instance of an + * implementation is created by ECOM framework, the + * framework will assign UID for it. The UID is used in + * destructor to notify framework that this instance is + * being destroyed and resources can be released. + */ + TUid iDtor_ID_Key; + }; + +#include "audiostreamadaptation.inl" + +#endif // C_AUDIOCOMPONENTMANAGER_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/audiostreamadaptation.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/audiostreamadaptation.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2004-2009 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: +* +*/ + + + +// Interface's (abstract base class's) destructor +inline CAudioStreamAdaptation::~CAudioStreamAdaptation() + { + REComSession::DestroyedImplementation(iDtor_ID_Key); + } + +// Interface's (abstract base class's) static factory method implementation. +// Asks ECOM plugin framework to instantiate appropriate concret plugin +// implementation. + +inline CAudioStreamAdaptation* CAudioStreamAdaptation::NewL(TUid aType) + { + TAny* ptr = REComSession::CreateImplementationL( aType, _FOFF(CAudioStreamAdaptation,iDtor_ID_Key) ) ; + + // The type of TAny* ptr should be CAudioStreamAdaptation + return REINTERPRET_CAST(CAudioStreamAdaptation*, ptr); + } + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/maudiocodecadaptationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/maudiocodecadaptationobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MAUDIOCODECADAPTATIONOBSERVER_H +#define MAUDIOCODECADAPTATIONOBSERVER_H + +#include + +class CMMFBuffer; + +// TO DO Use real Uid +const TUid KUidAudioCodecAdaptationObserver = {0x102834D1}; + +/** +Interface to get notifications from AudioCodecObserver +MAudioCodecObserver +*/ +class MAudioCodecAdaptationObserver + { +public: + /** + */ + virtual void AllBuffersProcessed() = 0; + + /** + */ + virtual void ProcessingUnitError(TInt aError) = 0; + + /** + */ + virtual void GetSupportedAModesComplete(TInt aError) = 0; + virtual void GetSupportedARatesComplete(TInt aError) = 0; + }; + +#endif // M_DATAPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/maudiostreamadaptationobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/maudiostreamadaptationobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef MAUDIOSTREAMADAPTATIONOBSERVER_H +#define MAUDIOSTREAMADAPTATIONOBSERVER_H + + +enum TPhysicalEvent + { + EOperationComplete, + EOperationIncomplete, + }; + +// TO DO Use real Uid +const TUid KUidAudioStreamAdaptationObserver = {0x102834D2}; + +class MAudioStreamAdaptationObserver + { +public: + virtual void PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError) = 0; + virtual void StateEvent(TInt aReason, TAudioState aNewState) = 0; + virtual void AddProcessingUnitComplete(TUid aType, TInt aError) = 0; + virtual void RemoveProcessingUnitComplete(TUid aType, TInt aError) = 0; + virtual void ProcessingFinished() = 0; + virtual void FlushComplete(TInt aError) = 0; + }; + +#endif // MAUDIOSTREAMADAPTATIONOBSERVER_H \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/mconfigurationhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/mconfigurationhelper.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2007-2009 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: +* Save as expressly licensed to you by Symbian Software Ltd, all rights reserved. +* +* +*/ + + + +#ifndef MCONFIGURATIONHELPER_H +#define MCONFIGURATIONHELPER_H + +#include + +/** + This class allow interaction with the physical layer in order to get + */ +class MConfigurationHelper + { +public: + + /** + This returns a list of supported sample rates. The list need just include those of the “standard list” + that are supported. Includes rates supported by sample rate conversion. + GetSupportedConfigurationComplete() callback shows result. + @param aSupportedRates + @return an error code + */ + virtual TInt GetSupportedModes(RArray& aSupportedModes) = 0; + virtual TInt GetSupportedSampleRates(RArray& aSupportedRates) = 0; + }; + +#endif // MCONFIGURATIONHELPER_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/mgainhelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/mgainhelper.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MGAINHELPER_H +#define MGAINHELPER_H + +#include + +/** + */ +class MGainHelper + { +public: + + // Allows retrieve the gain applied to low level adaptation + virtual TInt GetGain(TInt& aGain) const = 0; + + // Set the gain to the low level adaptation + virtual TInt SetGain(RArray& aChannels) = 0; + + //Select the ramp operation and the volump ramp duration. + virtual TInt ConfigureRamp(TUid aRampOperation, const TTimeIntervalMicroSeconds& aRampDuration) = 0; + }; + +#endif // MGAINHELPER_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/minputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/minputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MINPUTPORT_H +#define MINPUTPORT_H + +#include + +class CMMFBuffer; +class MOutputPort; + +/** + */ +class MInputPort + { + public: + /** + * @param + */ + virtual TInt GetInputPort(MInputPort*& aInputPort) = 0; + /** + * @param + */ + virtual TInt EmptyBuffer(CMMFBuffer* aBuffer, MOutputPort* aSupplier)=0; + + /** + * @param + */ + virtual TInt BufferFilled(CMMFBuffer* aBuffer)=0; + + /** + */ + virtual TInt SetOutput(MOutputPort* aOutput)=0; + + /** + * @param + */ + virtual TInt RemoveOutput(MOutputPort* aOutput)=0; + + }; + +#endif // MINPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/minterfaceprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/minterfaceprovider.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MINTERFACEPROVIDER_H +#define MINTERFACEPROVIDER_H + +#include + +class CMMFBuffer; +class MOutputPort; + +/** + */ +class MInterfaceProvider + { +public: + /** + * @param aInterfaceUid the uid of the custom interface + */ + virtual TAny* GetCustomInterface(TUid aInterfaceId) = 0; + }; + +#endif // MINTERFACEPROVIDER_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/moutputport.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/moutputport.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MOUTPUTPORT_H +#define MOUTPUTPORT_H + +#include + +class CMMFBuffer; +class MInputPort; +class MFlushHandlerObserver; +/** + */ +class MOutputPort + { +public: + + virtual TInt GetOutputPort(MOutputPort*& aInputPort) = 0; + /** + * @param + */ + virtual TInt FillBuffer(CMMFBuffer* aBuffer, MInputPort* aConsumer)=0; + + /** + * @param + */ + virtual TInt BufferEmptied(CMMFBuffer* aBuffer)=0; + + /** + */ + virtual TInt SetInput(MInputPort* aInput)=0; + + /** + * @param + */ + virtual TInt RemoveInput(MInputPort* aInput)=0; + + /** + * @param + */ + virtual TInt FlushBuffer(MFlushHandlerObserver* aFlushObserver)=0; + }; + +#endif // MOUTPUTPORT_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/mstreambuffercontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/mstreambuffercontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2008-2009 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: +* Save as expressly licensed to you by Symbian Software Ltd, all rights reserved. +* +* +*/ + + + +#ifndef MBUFFERCONTROL_H +#define MBUFFERCONTROL_H + +#include + +/* +A CBufferFlushHandler's client must implement this interface +to be notified when when the flush process has finished +*/ +class MFlushHandlerObserver + { +public: + virtual void FlushComplete(TInt aError) = 0; + }; + +/** + This class allow interaction with the physical layer allowing flush physical buffers + */ +class MStreamBufferControl + { +public: + /** + @return KErrNone error if flush operation is successful + */ + virtual TInt FlushBuffers() = 0; + }; + +#endif // MBUFFERCONTROL_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/shared/mstreampositioncontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/shared/mstreampositioncontrol.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef MSTREAMPOSITIONCONTROL_H +#define MSTREAMPOSITIONCONTROL_H + +#include + +/** + This class allow interaction with the physical layer in order to get + */ +class MStreamPositionControl + { +public: + /** + Get the position of the control based on samples played or recorded + @return the position of the control + */ + virtual TInt GetControlPosition(TTimeIntervalMicroSeconds& aPosition) = 0; + + virtual void ResetControlPosition() = 0; + }; + +#endif // MSTREAMPOSITIONCONTROL_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/ToneGenerator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/ToneGenerator.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,916 @@ +// Copyright (c) 1997-2009 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: +// This file contains an implementation of the ToneGenerator interface +// that converts all tone generation requests in to sampled audio +// data to be played through the normal local sampled audio interface +// +// + +#include "ToneGenerator.h" +#include +#include + +/****************************************************************************** +* Tone Generators +* +* The following classes are used to generate simple frequency/duration tones, +* DTMF, and SymbianOS tone sequences in a WINS environment. The below code +* should only be considered for WINS. +******************************************************************************/ + +// this defines the maximum possible amplitude allowed for TSineGen::SetFrequency() +const TInt KMaxAmplitude = 0x8000; + +// default number of samples for trailing silence following a Tone +const TInt KDefaultTrailingSilenceSamples = 20; + +// +// Sine tone generator +// + +const TInt16 TSineGen::SineTable[KMaxSineTable] = + { + 0, 804, 1607, 2410, 3211, 4011, 4807, 5601, + 6392, 7179, 7961, 8739, 9511, 10278, 11038, 11792, + 12539, 13278, 14009, 14732, 15446, 16150, 16845, 17530, + 18204, 18867, 19519, 20159, 20787, 21402, 22004, 22594, + 23169, 23731, 24278, 24811, 25329, 25831, 26318, 26789, + 27244, 27683, 28105, 28510, 28897, 29268, 29621, 29955, + 30272, 30571, 30851, 31113, 31356, 31580, 31785, 31970, + 32137, 32284, 32412, 32520, 32609, 32678, 32727, 32757, + 32767, 32757, 32727, 32678, 32609, 32520, 32412, 32284, + 32137, 31970, 31785, 31580, 31356, 31113, 30851, 30571, + 30272, 29955, 29621, 29268, 28897, 28510, 28105, 27683, + 27244, 26789, 26318, 25831, 25329, 24811, 24278, 23731, + 23169, 22594, 22004, 21402, 20787, 20159, 19519, 18867, + 18204, 17530, 16845, 16150, 15446, 14732, 14009, 13278, + 12539, 11792, 11038, 10278, 9511, 8739, 7961, 7179, + 6392, 5601, 4807, 4011, 3211, 2410, 1607, 804, + 0, -804, -1607, -2410, -3211, -4011, -4807, -5601, + -6392, -7179, -7961, -8739, -9511,-10278,-11038,-11792, + -12539,-13278,-14009,-14732,-15446,-16150,-16845,-17530, + -18204,-18867,-19519,-20159,-20787,-21402,-22004,-22594, + -23169,-23731,-24278,-24811,-25329,-25831,-26318,-26789, + -27244,-27683,-28105,-28510,-28897,-29268,-29621,-29955, + -30272,-30571,-30851,-31113,-31356,-31580,-31785,-31970, + -32137,-32284,-32412,-32520,-32609,-32678,-32727,-32757, + -32767,-32757,-32727,-32678,-32609,-32520,-32412,-32284, + -32137,-31970,-31785,-31580,-31356,-31113,-30851,-30571, + -30272,-29955,-29621,-29268,-28897,-28510,-28105,-27683, + -27244,-26789,-26318,-25831,-25329,-24811,-24278,-23731, + -23169,-22594,-22004,-21402,-20787,-20159,-19519,-18867, + -18204,-17530,-16845,-16150,-15446,-14732,-14009,-13278, + -12539,-11792,-11038,-10278, -9511, -8739, -7961, -7179, + -6392, -5601, -4807, -4011, -3211, -2410, -1607, -804, + }; + +const TInt16 TSineGen::IncTable[KMaxSineTable] = + { + 804, 803, 803, 801, 800, 796, 794, + 791, 787, 782, 778, 772, 767, 760, 754, + 747, 739, 731, 723, 714, 704, 695, 685, + 674, 663, 652, 640, 628, 615, 602, 590, + 575, 562, 547, 533, 518, 502, 487, 471, + 455, 439, 422, 405, 387, 371, 353, 334, + 317, 299, 280, 262, 243, 224, 205, 185, + 167, 147, 128, 108, 89, 69, 49, 30, + 10, -10, -30, -49, -69, -89, -108, -128, + -147, -167, -185, -205, -224, -243, -262, -280, + -299, -317, -334, -353, -371, -387, -405, -422, + -439, -455, -471, -487, -502, -518, -533, -547, + -562, -575, -590, -602, -615, -628, -640, -652, + -663, -674, -685, -695, -704, -714, -723, -731, + -739, -747, -754, -760, -767, -772, -778, -782, + -787, -791, -794, -796, -800, -801, -803, -803, + -804, -804, -803, -803, -801, -800, -796, -794, + -791, -787, -782, -778, -772, -767, -760, -754, + -747, -739, -731, -723, -714, -704, -695, -685, + -674, -663, -652, -640, -628, -615, -602, -590, + -575, -562, -547, -533, -518, -502, -487, -471, + -455, -439, -422, -405, -387, -371, -353, -334, + -317, -299, -280, -262, -243, -224, -205, -185, + -167, -147, -128, -108, -89, -69, -49, -30, + -10, 10, 30, 49, 69, 89, 108, 128, + 147, 167, 185, 205, 224, 243, 262, 280, + 299, 317, 334, 353, 371, 387, 405, 422, + 439, 455, 471, 487, 502, 518, 533, 547, + 562, 575, 590, 602, 615, 628, 640, 652, + 663, 674, 685, 695, 704, 714, 723, 731, + 739, 747, 754, 760, 767, 772, 778, 782, + 787, 791, 794, 796, 800, 801, 803, 803, + 804 + }; + +void TSineGen::SetFrequency(TInt aFrequency,TInt aAmplitude) +// +// Given the frequency set iStep. +// Reset iPosition to the equivalent of 0 degrees. +// In the special case of aFrequency==4KHz set iPosition to 90 degrees. +// + { + + if (aAmplitude>(1<<15)) + iAmplitude=(1<<15); + else if (aAmplitude<-(1<<15)) + iAmplitude=-(1<<15); + else + iAmplitude=aAmplitude; +// +// There are 256 entries in the sine table to traverse 360 degrees. +// The codec requires samples at a rate of 8000 per second. +// Thus for a 1Hz tone the step will be 256/8000 or 4/125. +// Now we need need the integer part of the result to end up in +// the MSB so we need to multiply by 2^24. This gives the formula +// step = (f*4*2^24)/125 or (f*2^26)/125. +// Our highest frequency is 4KHz so that the term (f*2^26) exceeds +// a 32 bit result by 4000/2^6 (2^6 is the number of significant bits +// left after a multiply by 2^26). i.e. 6 bits. We overcome this by +// having 6 bits less in the fraction, so the new formula becomes +// ((f*2^20)/125)*2^6. This still gives us 20 significant bits in the +// fraction. +// + + iStep=(((TUint)aFrequency<<20)/125)<<6; + iPosition=(aFrequency==4000 ? 0x40000000 : 0); + } + +TInt TSineGen::NextSample() +// +// Generate the next sample using linear interpolation +// + { + TUint pos=iPosition>>24; + TInt amp=((IncTable[pos]*((iPosition&0x00ffffff)>>20))); + amp>>=4; + amp+=SineTable[pos]; + amp=(amp*iAmplitude)>>15; + iPosition+=iStep; + return(amp); + } + +void TSineWave::Generate(TInt16* aDest,TInt aCount) +// +// Called when more samples need to be generated. +// + { + while (aCount--) + { + *aDest++=STATIC_CAST(TInt16,iGen1.NextSample()+iGen2.NextSample()); + } + } + +void TSineWave::SetFrequency(TInt aFrequency,TInt aAmplitude) +// +// Set to generate a single frequency +// + { + SetFrequency(aFrequency,aAmplitude,0,0); + } + +void TSineWave::SetFrequency(TInt aFrequency1,TInt aAmplitude1,TInt aFrequency2,TInt aAmplitude2) +// +// Set to generate two frequencies +// + { + iGen1.SetFrequency(aFrequency1,aAmplitude1); + iGen2.SetFrequency(aFrequency2,aAmplitude2); + } + +// +// TMdaToneGenerator +// + +void TMdaToneGenerator::Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp) +// +// Set up this tone generator to generate data at the desired sample rate +// and number of channels (typically mono/stereo) +// + { + iRate = aRate; + iChannels = aChannels; + iSamplesLeft = 0; + iIncompleteVolume = 0; + iRampUpRemainder = 0; + iRampUp = ETrue; // Default ramping to on as it is normally useful + iRampDown = ETrue; + iIncompleteRampDown = EFalse; + iIncompleteRampUp = EFalse; + iRepeats = aRepeats; + iSilenceBetweenRepeats = aSilence; + iRampUpCount = aRampUp; + iRampUpLeft = aRampUp; + iAfterRepeatSilence = EFalse; + } + +LOCAL_C void RampVolume(TInt16* aData,TInt aCount,TInt aStartVol,TInt aEndVol) +// +// Simple function to ramp down the volume of some samples +// Typically used to prevent "clicking" artifacts at the beginning/end of tones +// + { + TInt step = (aEndVol - aStartVol)/aCount; + while (aCount--) + { + TInt data = TInt(*aData) * aStartVol; + *aData++ = TInt16(data>>15); + aStartVol += step; + } + } + +TInt TMdaToneGenerator::FillBuffer(TDes8& aBuffer) +// +// Fill the supplied buffer with tone data +// Sets the buffer length to zero if there is no more data to play +// The buffer must have a max length of at least one sample * channels +// e.g. 2 bytes mono, 4 bytes stereo +// + { + const TInt KRampUpSamples = 50; + const TInt KRampDownSamples = 50; + + ASSERT(aBuffer.MaxLength()>= (iChannels<<1)); + aBuffer.SetMax(); + + TBool silence; + TInt samples = 0; // + TInt used = 0; // Data used + TInt avail = aBuffer.Length(); // Data filled + TInt count = 0; // Data to be converted + TBool rampUp = EFalse; + + TMdaPtr8 fill; + fill.Set(aBuffer); // Pointer to data left to be filled + + // + // The rest of this function will loop around continually until the buffer + // is filled or there is no more data to play + // + +Restart: + silence = EFalse; // Reset + if (iSamplesLeft == 0) + { + if (iTrailingSilence == 0) + { + TInt error = GetNextTone(); + if (error) + return error; + + rampUp = ETrue; + if ((iSamplesLeft==0)&&(iTrailingSilence==0)) + { + if ((iSilenceBetweenRepeats)&&(!iAfterRepeatSilence)) + { + iTrailingSilence = iSilenceBetweenRepeats; + iAfterRepeatSilence = ETrue; + goto Restart; + } + else + { + if ((iRepeats>0)||(iRepeats==KMdaRepeatForever)) + { + iAfterRepeatSilence = EFalse; + if (iRepeats>0) + iRepeats--; + + Reset(); + goto Restart; + } + } + // No more to play + goto Finished; + } + goto Restart; + } + else + { + silence = ETrue; + samples = iTrailingSilence; + } + } + else + samples = iSamplesLeft; + + count = Min(samples,avail>>1); + fill.SetLength(count<<1); + + if (!silence) + { // Generate wave + iSineWave.Generate(REINTERPRET_CAST(TInt16*,&fill[0]),count); + + if (iRampUp) + { + // Ramp up volume at beginning of tone + if (rampUp) + { // Fade in first few samples + if(count < KRampUpSamples) + { + // Partial rampup due to being at the end of the buffer + TInt fadeInLength = Min(KRampUpSamples,(fill.Length()>>1)); + iIncompleteVolume = (count*((1<<15)/KRampUpSamples)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,0,iIncompleteVolume); + iRampUpRemainder = fadeInLength; + iIncompleteRampUp = ETrue; + } + else + { + // Normal rampup + TInt fadeInLength = Min(Min(KRampUpSamples,iSamplesLeft),(fill.Length()>>1)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,0,1<<15); + iIncompleteRampUp = EFalse; + } + } + else if (iIncompleteRampUp) + { + // Completing partial rampup at the start of a new buffer + TInt fadeInLength = Min(Min((KRampUpSamples-iRampUpRemainder),iSamplesLeft),(fill.Length()>>1)); + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&fill[0]))),fadeInLength,iIncompleteVolume,1<<15); + iIncompleteRampUp = EFalse; + } + } + if (iRampDown) + { // Ramp down volume at end of tone + if ((iSamplesLeft-count) < KRampDownSamples) + { + if(iSamplesLeft-count == 0) + { + // Fade out last few samples + TInt startVolume = 1<<15;; + TInt fadeOutLength = Min(Min(KRampDownSamples,iSamplesLeft),(fill.Length()>>1)); + + if(iIncompleteRampDown) + { + // Completing partial rampdown at the start of a new buffer + startVolume -= iIncompleteVolume; + iIncompleteRampDown = EFalse; + } + + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&(fill.Right(fadeOutLength<<1))[0]))),fadeOutLength,startVolume,0); + } + else if(iSamplesLeft-count > 0) + { + // Partial rampdown due to being at the end of the buffer + TInt rampDifference = (KRampDownSamples-(iSamplesLeft-count)); + TInt fadeOutLength = Min(Min(rampDifference,iSamplesLeft),(fill.Length()>>1)); + iIncompleteVolume = ((rampDifference*(1<<15))/KRampDownSamples); + + RampVolume(CONST_CAST(TInt16*,REINTERPRET_CAST(const TInt16*,(&(fill.Right(fadeOutLength<<1))[0]))),fadeOutLength,1<<15,(1<<15)-iIncompleteVolume); + + iIncompleteRampDown = ETrue; + } + } + } + iSamplesLeft -= count; + } + else + { // Generate silence + fill.FillZ(count<<1); + iTrailingSilence -= count; + } + + used += count<<1; + avail -= count<<1; + fill.Shift(count<<1); + + if (avail>(iChannels<<1)) + goto Restart; + +Finished: + + aBuffer.SetLength(used); + + // Do any ramp up that is required + if (iRampUpLeft>0) + { + TInt words = iRampUpLeft * iChannels; + words = Min(words,used>>1); + if (words>0) // In case buffer has zero length... + { + TInt left = iRampUpLeft * iChannels; + TInt rampup = iRampUpCount * iChannels; + iRampUpLeft -= words/iChannels; + TInt16* sample = REINTERPRET_CAST(TInt16*,&aBuffer[0]); + while (words--) + { + *sample++ = STATIC_CAST(TInt16,(TInt32(*sample)*(rampup-(left--)))/rampup); + } + } + } + + return KErrNone; + } + +TInt TMdaToneGenerator::DurationToSamples(const TTimeIntervalMicroSeconds& aDuration) +// +// Convert the given duration to a sample count using the current settings +// + { + const TInt64 KTInt64OneMilion = 1000000; + + // Calculate duration as samples + TInt64 microSeconds(aDuration.Int64()); // MSVC doesn't like "aDuration.Int64()" in line below + TInt64 dur = ((TInt64(iRate) * TInt64(iChannels) * microSeconds) / KTInt64OneMilion); + if (I64HIGH(dur)>0) + return KMaxTInt; // Ridiculous! + else + return I64LOW(dur); + } + +// +// TMdaSimpleToneGenerator +// + +void TMdaSimpleToneGenerator::Reset() + { + iPlayed = EFalse; + } + +void TMdaSimpleToneGenerator::SetFrequencyAndDuration(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration) +// +// Store the frequency and duration of the specified sine tone +// + { + iFrequency = aFrequency; + iDuration = aDuration; + iPlayed = EFalse; + } + +TInt TMdaSimpleToneGenerator::GetNextTone() +// +// Simple implementation - just sets the supplied frequency and duration +// + { + // This class only plays one tone for the specified duration + if (!iPlayed) + { + iSamplesLeft = I64LOW((iDuration.Int64() * TInt64(iRate))/1000000); + iSineWave.SetFrequency(iFrequency,1<<14); + iPlayed = ETrue; + iTrailingSilence = 20; // Just to stop clicking + } + return KErrNone; + } + +// +// TMdaDualToneGenerator +// + +void TMdaDualToneGenerator::Reset() + { + iPlayed = EFalse; + } + +void TMdaDualToneGenerator::SetFrequencyAndDuration(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration) + { + // Store the frequencies and duration of the specified dual tone + iFrequencyOne = aFrequencyOne; + iFrequencyTwo = aFrequencyTwo; + iDuration = aDuration; + iPlayed = EFalse; + } + +// +// This is called by TMdaToneGenerator::FillBuffer() +// to calculate the number of samples (iSamplesLeft) that will be needed +// for the tone to be played and to initialize the sine wave generator. +// If the tone has already been played, then leaves iSamplesLeft +// unmodified (should be zero) to indicate that it has finished. +// +TInt TMdaDualToneGenerator::GetNextTone() + { + // This class only plays one tone for the specified duration + if (!iPlayed) + { + iSamplesLeft = I64LOW((iDuration.Int64() * TInt64(iRate))/KOneMillionMicroSeconds); + iSineWave.SetFrequency(iFrequencyOne, KMaxAmplitude/2, iFrequencyTwo, KMaxAmplitude/2); + iPlayed = ETrue; + iTrailingSilence = KDefaultTrailingSilenceSamples; // Just to stop clicking + } + return KErrNone; + } +// +// TMdaDTMFGenerator +// + +const TInt KRecalculateToneLengths = KMinTInt; + +void TMdaDTMFGenerator::Reset() + { + iChar = 0; + } + +void TMdaDTMFGenerator::SetToneDurations(const TTimeIntervalMicroSeconds32 aOn, + const TTimeIntervalMicroSeconds32 aOff, + const TTimeIntervalMicroSeconds32 aPause) +// +// Setup the DTMF tone durations +// aOn can be == -1 indicating should play first tone indefinately +// + { + ASSERT(aOn.Int() >=-1); + ASSERT(aOff.Int()>=0); + ASSERT(aPause.Int()>=0); + + iOn = aOn; + iOff = aOff; + iPause = aPause; + + iOnSamples = KRecalculateToneLengths; // Must recalculate these later + } + +void TMdaDTMFGenerator::SetString(const TDesC& aDTMFString) +// +// Store the DTMF string to be played +// No need to validate it as it will already have been checked +// + { + iChar = 0; + iDTMFString = &aDTMFString; + } + +const TUint8 KDtmfVolumeTable[4][4]= +// +// Relative strengths to assign to different DTMF tones +// +// This is only important if DTMFs are being played through a speaker +// and need to be machine-recognisable. This table compensates for frequency +// drop-off in the speaker and can boost the relative volume of some +// frequencies so they are still within tolerance. +// +// The values normally need to be determined using a frequency analyser on +// the hardware +// +// Each column == same low frequency (697, 770, 852, 941 Hz) +// Each row == same high frequency (1209, 1336, 1477, 1633 Hz) +// +// The value are interpreted as ratios: +// 0 == 100% low +// 7f == 50% low, 50% high +// ff == 100% high +// + { + {38,27,29,37}, + {46,36,36,46}, + {62,47,49,58}, + {70,56,60,68} + }; + +const TUint8 KDtmfTone697=0x0; +const TUint8 KDtmfTone770=0x1; +const TUint8 KDtmfTone852=0x2; +const TUint8 KDtmfTone941=0x3; + +const TUint8 KDtmfTone1209=0x00; +const TUint8 KDtmfTone1336=0x10; +const TUint8 KDtmfTone1477=0x20; +const TUint8 KDtmfTone1633=0x30; + +const TUint8 KDtmfToneTable[16]= + { + KDtmfTone941|KDtmfTone1336,//0 + KDtmfTone697|KDtmfTone1209,//1 + KDtmfTone697|KDtmfTone1336,//2 + KDtmfTone697|KDtmfTone1477,//3 + KDtmfTone770|KDtmfTone1209,//4 + KDtmfTone770|KDtmfTone1336,//5 + KDtmfTone770|KDtmfTone1477,//6 + KDtmfTone852|KDtmfTone1209,//7 + KDtmfTone852|KDtmfTone1336,//8 + KDtmfTone852|KDtmfTone1477,//9 + + KDtmfTone697|KDtmfTone1633,//A + KDtmfTone770|KDtmfTone1633,//B + KDtmfTone852|KDtmfTone1633,//C + KDtmfTone941|KDtmfTone1633,//D + KDtmfTone941|KDtmfTone1209,//E or * + KDtmfTone941|KDtmfTone1477,//F or # + }; + +TInt TMdaDTMFGenerator::GetNextTone() +// +// Setup frequency/duration/silence settings for next DTMF tone +// Supported characters are 0-9 A-F * # , and any kind of white space +// + { + TBool onlyPlayFirstTone = EFalse; + + if (iOnSamples == KRecalculateToneLengths) + { + // Must recalculate tone durations as samples + + // Handle special case where tone on duration negative + // - meaning play first character indefinately + if (iOn.Int()>=0) + iOnSamples = DurationToSamples(TInt64(iOn.Int())); + else + { + onlyPlayFirstTone = ETrue; + iOnSamples = -1; + } + + iOffSamples = DurationToSamples(TInt64(iOff.Int())); + iPauseSamples = DurationToSamples(TInt64(iPause.Int())); + } + + ASSERT(iDTMFString); + + if (iChar==iDTMFString->Length()) + return KErrNone; // Finished. Nothing to do + + TInt highFrequency = 0; + TInt highVolume = 0; + TInt lowFrequency = 0; + TInt lowVolume =0; + +Retry: + TChar c((*iDTMFString)[iChar++]); + if ((TUint)c=='#' || (TUint)c=='*' || c.IsHexDigit()) + { + TInt tableIndex; + switch ((TUint)c) + { + case '*': + tableIndex=14; + break; + case '#': + tableIndex=15; + break; + default: + if (c.IsDigit()) + tableIndex=(TUint)c-'0'; + else //letter + { + c.UpperCase(); + tableIndex=(TUint)c-'A'+10; + } + } + TInt high=KDtmfToneTable[tableIndex]&0xf0; + TInt low=KDtmfToneTable[tableIndex]&0x0f; + switch(high) + { + case KDtmfTone1209: + highFrequency=1209; + break; + case KDtmfTone1336: + highFrequency=1336; + break; + case KDtmfTone1477: + highFrequency=1477; + break; + default://KDtmfTone1633: + highFrequency=1633; + break; + } + switch(low) + { + case KDtmfTone697: + lowFrequency=697; + break; + case KDtmfTone770: + lowFrequency=770; + break; + case KDtmfTone852: + lowFrequency=852; + break; + default://KDtmfTone941: + lowFrequency=941; + break; + } + high>>=4; + const TUint8* dtmfVolumes=&KDtmfVolumeTable[0][0]; + TInt volume=dtmfVolumes[((low)<<2)+(high)]<<7; + highVolume = volume; + lowVolume = (1<<15)-volume; + + iTrailingSilence = iOffSamples; + iSamplesLeft = iOnSamples; + } + else if ((TUint)c==',') + { + iTrailingSilence = iPauseSamples; + iSamplesLeft = 0; + } + else if (c.IsSpace()) + { + if (iChar < iDTMFString->Length()) + goto Retry; + } + else + return KErrCorrupt; + + if (iOnSamples < 0) // Play only first character for ever + { + iTrailingSilence = 0; + iSamplesLeft = iRate * iChannels; // One second of samples + iChar = 0; // Reset so this character is played again next time + iRampDown = EFalse; + if (!onlyPlayFirstTone) + { + iRampUp = EFalse; + // This is not the first time around so we should not + // reset the tone generator - it will already have the + // correct settings and setting them again would cause + // an audible discontinuity + return KErrNone; + } + } + + iSineWave.SetFrequency(highFrequency,highVolume,lowFrequency,lowVolume); + return KErrNone; + } + +// +// TMdaSequenceGenerator +// + +// +// Sequence constants +// + +//const TInt KMaxFixedSequenceStack=KMaxSequenceStack;//Max nesting level of FixedSequences * 2 +#ifdef _DEBUG +const TInt16 KFixedSequenceSignatureOne='S'+('Q'<<8); +const TInt16 KFixedSequenceSignatureTwo='N'+('C'<<8); +#endif // _DEBUG + +const TInt KFixedSequenceFunctionReturn=-1; +const TInt KFixedSequenceFunctionStartLoop=-2; +const TInt KFixedSequenceFunctionEndLoop=-3; + +void TMdaSequenceGenerator::Reset() + { + iInstructionPtr = REINTERPRET_CAST(const TInt16*,&((*iSequenceData)[0])); + iInstructionPtr += 2; // Skip signature + iStackIndex = 0; + } + +void TMdaSequenceGenerator::SetSequenceData(const TDesC8& aSequenceData) +// +// Store the sequence data to be played +// No need to validate it as it will already have been checked +// + { + iSequenceData = &aSequenceData; + iInstructionPtr = REINTERPRET_CAST(const TInt16*,&aSequenceData[0]); + iLastInstruction = iInstructionPtr + (iSequenceData->Length()>>1) - 1; + + // These are asserts because this should not be called if signature not present + ASSERT(*iInstructionPtr == KFixedSequenceSignatureOne); + ASSERT(*(iInstructionPtr+1) == KFixedSequenceSignatureTwo); + + iInstructionPtr += 2; // Skip signature + + iStackIndex = 0; + } + +TInt TMdaSequenceGenerator::GetNextTone() +// +// + { + ASSERT(iInstructionPtr); // Sanity check + + TInt ret = KRequestPending; + while (ret == KRequestPending) + { + if (iInstructionPtr > iLastInstruction) + ret = KErrCorrupt; + else if (*iInstructionPtr<=0) + { + switch (*iInstructionPtr) + { + case KFixedSequenceFunctionReturn: // End of sequence + ret = KErrNone; + break; + + case KFixedSequenceFunctionStartLoop: + if (iStackIndex>2) // Validate - can only nest twice + ret = KErrCorrupt; + else if ((iInstructionPtr+2) > iLastInstruction) + ret = KErrCorrupt; // Don't run off end of sequence + else + { + iStack[iStackIndex++]=(TInt)(iInstructionPtr+2); + iStack[iStackIndex++]=(TInt)*(iInstructionPtr+1); + iInstructionPtr+=2; + } + break; + + case KFixedSequenceFunctionEndLoop: + if (iStackIndex==0) // Validate - must already be nested + ret = KErrCorrupt; + else + { + if ((--iStack[iStackIndex-1])!=0) + iInstructionPtr=(TInt16*)iStack[iStackIndex-2]; + else + { + iStackIndex-=2; + iInstructionPtr++; + } + } + break; + + default: // Bad sequence + ret = KErrCorrupt; + } + } + else + { + if ((iInstructionPtr+5) > iLastInstruction) + ret = KErrCorrupt; // Don't run off end of sequence + else + { + iSamplesLeft = *iInstructionPtr++; + TInt freqOne = *iInstructionPtr++; + TInt volOne = *iInstructionPtr++; + TInt freqTwo = *iInstructionPtr++; + TInt volTwo = *iInstructionPtr++; + + if ((volOne> 1<<15)||(volTwo > 1<<15)) + ret = KErrCorrupt; + else + { + iSineWave.SetFrequency(freqOne,volOne,freqTwo,volTwo); + ret = KErrNone; + } + } + } + } + return ret; + } + +// --------------------------------- +// Code to generate sine table files used by tone generator +// Optionally called from InitL() +// #define GENERATE_SINE_TABLES 1 +#ifdef GENERATE_SINE_TABLES +LOCAL_C GenerateSineTableL() + { + _LIT(KSineFile,"sine.txt"); + _LIT(KSineIncFile,"sineinc.txt"); + + RFile file; + file.Replace(MdaManager::Fs(),KSineFile,EFileWrite); + CleanupClosePushL(file); + + RFile file2; + file2.Replace(MdaManager::Fs(),KSineIncFile,EFileWrite); + CleanupClosePushL(file2); + + const TReal pi=3.141592653589; + const TReal twopi=pi*2; + const TReal samples = 256.0; + const TReal step = twopi/samples; + + TBuf8<128> sinebuffer; + TBuf8<128> incbuffer; + TReal res; + TInt first=0; + TInt last=KMaxTInt; + TInt current; + _LIT8(KFormat,"%6d,"); + _LIT8(KNewLine,"\n"); + + for(TReal angle=0.0;angle<=(twopi-step);) // Copes with rounding errors + { + sinebuffer.Zero(); + incbuffer.Zero(); + for (int i=0;i<8;i++) + { + User::LeaveIfError(Math::Sin(res,angle)); + current = TInt(KMaxTInt16*res); + sinebuffer.AppendFormat(KFormat,current); + if (last != KMaxTInt) + incbuffer.AppendFormat(KFormat,current-last); + else + first = current; + last = current; + angle += step; + } + sinebuffer.Append(KNewLine); + incbuffer.Append(KNewLine); + file.Write(sinebuffer); + file2.Write(incbuffer); + } + + // Write fine difference to incbuffer - differnece between first and last + incbuffer.Zero(); + incbuffer.AppendFormat(KFormat,first-last); + incbuffer.Append(KNewLine); + file2.Write(incbuffer); + + CleanupStack::PopAndDestroy(2); + } +#endif +//------------------------------- diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/ToneGenerator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/ToneGenerator.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,226 @@ +// Copyright (c) 1997-2009 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: +// + +#ifndef __TONEGENERATOR_H__ +#define __TONEGENERATOR_H__ + +#include + +// +// Sine tone generator +// + +const TInt KMaxSineTable = 256; +const TUint KToneBufferSize = 8192; + +// one second in microseconds +const TInt KOneMillionMicroSeconds = 1000000; + + +class TSineGen +/** +*@internalTechnology +*/ + { +public: + void SetFrequency(TInt aFrequency,TInt aAmplitude); + TInt NextSample(); +private: + TUint iPosition; + TUint iStep; + TInt iAmplitude; + static const TInt16 SineTable[KMaxSineTable]; + static const TInt16 IncTable[KMaxSineTable]; + }; + +class TSineWave +/** +*@internalTechnology +*/ + { +public: + void Generate(TInt16* aDest,TInt aCount); + void SetFrequency(TInt aFrequency,TInt aAmplitude); + void SetFrequency(TInt aFrequency1,TInt aAmplitude1,TInt aFrequency2,TInt aAmplitude2); +private: + TSineGen iGen1; + TSineGen iGen2; + }; + +// +// Tone synthesis interface +// Defines the abstract interface for tone synthesis +// Capable of filling buffers with audio data +// + +class MMdaToneSynthesis +/** +*@internalTechnology +*/ + { +public: + // Allocate necessary resources for this kind of synthesis + virtual void Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp)=0; + // Begin generating data from start again + virtual void Reset()=0; + // Fill supplied buffer with next block of 16bit PCM audio data + virtual TInt FillBuffer(TDes8& aBuffer)=0; + }; + +// +// Tone generator base class +// + +class TMdaToneGenerator : public MMdaToneSynthesis + { +public: + virtual void Configure(TInt aRate, TInt aChannels, TInt aRepeats, TInt aSilence, TInt aRampUp); + virtual TInt FillBuffer(TDes8& aBuffer); +protected: + virtual TInt GetNextTone()=0; + // + TInt DurationToSamples(const TTimeIntervalMicroSeconds& aDuration); +protected: + TSineWave iSineWave; + TInt iRate; + TInt iChannels; + TInt iSamplesLeft; + TInt iTrailingSilence; + TBool iRampUp; + TBool iRampDown; + TBool iIncompleteRampDown; + TBool iIncompleteRampUp; + TInt iIncompleteVolume; + TInt iRampUpRemainder; + TInt iRepeats; + TInt iSilenceBetweenRepeats; + TBool iAfterRepeatSilence; + TInt iRampUpCount; + TInt iRampUpLeft; + }; + +// +// Simple tone synthesis +// + +class TMdaSimpleToneGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + void SetFrequencyAndDuration(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration); + virtual void Reset(); + virtual TInt GetNextTone(); +private: + TTimeIntervalMicroSeconds iDuration; + TInt iFrequency; + TBool iPlayed; + }; + + +/** + * Dual tone synthesis + * Generates a tone consisting of two sine waves of different + * frequencies summed together. + * + * @internalTechnology + */ +class TMdaDualToneGenerator : public TMdaToneGenerator + { +public: + void SetFrequencyAndDuration(TInt aFrequencyOne, TInt aFrequencyTwo, const TTimeIntervalMicroSeconds& aDuration); + virtual void Reset(); + virtual TInt GetNextTone(); +private: + TTimeIntervalMicroSeconds iDuration; + TInt iFrequencyOne; + TInt iFrequencyTwo; + TBool iPlayed; + }; + +// +// DTMF tone synthesis +// + +class TMdaDTMFGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + virtual void Reset(); + void SetToneDurations( const TTimeIntervalMicroSeconds32 aOn, + const TTimeIntervalMicroSeconds32 aOff, + const TTimeIntervalMicroSeconds32 aPause); + void SetString(const TDesC& aDTMFString); +private: + virtual TInt GetNextTone(); +private: + const TDesC* iDTMFString; + TTimeIntervalMicroSeconds32 iOn; + TTimeIntervalMicroSeconds32 iOff; + TTimeIntervalMicroSeconds32 iPause; + TInt iOnSamples; + TInt iOffSamples; + TInt iPauseSamples; + TInt iChar; + TBool iPlayToneOff; + }; + +// +// Tone sequence synthesis +// + +const TInt KMaxSequenceStack = 6; +class TMdaSequenceGenerator : public TMdaToneGenerator +/** +*@internalTechnology +*/ + { +public: + virtual void Reset(); + void SetSequenceData(const TDesC8& aSequenceData); +private: + virtual TInt GetNextTone(); +private: + const TDesC8* iSequenceData; + const TInt16* iInstructionPtr; + const TInt16* iLastInstruction; + TInt iStack[KMaxSequenceStack]; + TInt iStackIndex; + }; + +const TInt KBufferLength = 0x1000; + +// Public Media Server includes + +class TMdaPtr8 : public TPtr8 //needed for this WINS Impl of Tone Gen + { +public: + TMdaPtr8() + : TPtr8(0,0,0) {}; + inline void Set(const TDes8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.MaxLength()); }; + inline void SetLengthOnly(const TDes8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); }; + inline void Set(const TPtrC8& aDes) + { TPtr8::Set((TUint8*)(aDes.Ptr()),aDes.Length(),aDes.Length()); }; + inline void Shift(TInt aOffset) + { SetLength(Length()-aOffset); iMaxLength-=aOffset; iPtr+=aOffset; }; + }; + + +#endif diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonedatapath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonedatapath.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,704 @@ +// Copyright (c) 2003-2009 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 "tonedatapath.h" + + +CToneDataPath* CToneDataPath::NewL() + { + CToneDataPath* self = new(ELeave) CToneDataPath; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +void CToneDataPath::ConstructL() + { + iAudioPlayer = new (ELeave) CToneDataPathPlayer(*this,CActive::EPriorityUserInput); + iSoundDeviceErrorReceiver = new (ELeave) CToneSoundDevPlayErrorReceiver(*this, CActive::EPriorityUserInput); + } + + +CToneDataPath::~CToneDataPath() + { + delete iAudioPlayer; + delete iSoundDeviceErrorReceiver; + + iSoundDevice.Close(); + + if (iCodec) + { + delete iSourceBuffer; + if (!iCodec->IsNullCodec()) + { + delete iSoundDeviceBuffer; + } + } + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + delete iTransferWindow; + + if(iTransferBuffer) + { + iTransferBuffer->Close(); + delete iTransferBuffer; + } +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + delete iPtrBufferMemoryBlock; +#endif + } + + +TInt CToneDataPath::SetObserver(MMMFHwDeviceObserver& aObserver) + { + TInt error; + if (iHwDeviceObserver) + { + error = KErrAlreadyExists; + } + else + { + iHwDeviceObserver = &aObserver; + error = KErrNone; + } + return error; + } + + +TInt CToneDataPath::AddCodec(CToneCodec& aCodec) + { + if (iCodec) + { + return KErrNotSupported; //doesn't support multiple codecs + } + + TInt err = KErrNone; + + iCodec = &aCodec; + + // Allocate data buffer + iSourceBufferSize = iCodec->SourceBufferSize(); + iSoundDevBufferSize = iCodec->SinkBufferSize(); + + if ((!iSourceBufferSize)||(!iSoundDevBufferSize)) + { + err = KErrArgument; //codec plugin has not specified buffer size + } + + if (err == KErrNone) + { +#ifdef __USE_MMF_TRANSFERBUFFERS__ + TRAP(err,iSourceBuffer = CreateTransferBufferL(iSourceBufferSize, static_cast(iSourceBuffer))); +#endif +#ifdef __USE_MMF_PTRBUFFERS__ + TRAP(err,iSourceBuffer = CreatePtrBufferL(iSourceBufferSize)); +#else + TRAP(err,iSourceBuffer = CMMFDataBuffer::NewL(iSourceBufferSize)); +#endif + } + + if (err == KErrNone) + { + if (iCodec->IsNullCodec()) + {//use source buffer for sound device buffer + iSoundDeviceBuffer = NULL; + } + else + {//codec needs separate source and sound device buffers + TRAP(err,iSoundDeviceBuffer = CMMFDataBuffer::NewL(iSoundDevBufferSize)); + } + } + return err; + } + +TInt CToneDataPath::Start() + { + TInt startError = KErrNone; + + if (!iCodec) + {//check that a codec has been added + startError = KErrNotReady; + } + if ((!iSoundDevice.Handle())&&(!startError)) + {//check that the sound drivers can be opened + startError = iSoundDevice.Open(); + } + + if (iState == EPaused) + {//we are paused so need to resume play + if (!startError) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPath::Start-Resume")); +#endif + iAudioPlayer->ResumePlaying(); + iState = EPlaying; + } + } + else if (!startError) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPath::Start-Normal")); +#endif + // get sample rate and channels from RMdaDevSound + RMdaDevSound::TCurrentSoundFormatBuf format; + iSoundDevice.GetPlayFormat(format); + iSampleRate = format().iRate; + iChannels = format().iChannels; + + iNoMoreSourceData = EFalse; + iSourceBuffer->SetLastBuffer(EFalse); + iState = EPlaying; + iSoundDeviceErrorReceiver->Start(); + TRAP(startError,FillSourceBufferL()); //get initial buffer of audio data + if (startError == KErrNone) + { + // Start the player objects + iAudioPlayer->Start(); + } + else + {//failed to start up correctly go back to stopped state + iState = EStopped; + iSoundDeviceErrorReceiver->Stop(); + } + } + return startError; + } + + +// *** Main Play Loop *** + +void CToneDataPath::FillSourceBufferL() + {//asks observer to fill the source buffer + // Ask immediately for data from the observer +#ifdef __CYCLE_MMF_DATABUFFERS__ + // Create a new buffer to replicate INC021405 Play-EOF-Play on HwAccelerated solution Panics + // If the creation fails, we carry on regardless as the original buffer will not have been + // destroyed. Must do this as alloc fail tests will not run. + if(iSourceBuffer) + { + iSourceBuffer = CycleAudioBuffer(iSourceBuffer); + } +#endif // __CYCLE_MMF_DATABUFFERS__ + User::LeaveIfError(iHwDeviceObserver->FillThisHwBuffer(*iSourceBuffer)); + + } + + +void CToneDataPath::BufferFilledL(CMMFDataBuffer& aBuffer) + {//call back from observer to indicate buffer has been filled + + if (iState == EStopped) + { + User::Leave(KErrNotReady);//ok if paused? + } + + iSourceBuffer = &aBuffer; + iSourceBuffer->SetStatus(EFull); +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPath::BufferFilledL")); +#endif + + //need to check that the buffer size is not 0 - if so assume we've reached the end of the data + iBuffSize = iSourceBuffer->BufferSize(); + if (!iBuffSize) + {//no buffer - could be end of source or could be that the source has no data?? + iNoMoreSourceData = ETrue; +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPath::BufferFilledL-NoMoreSourceData")); +#endif + } + //even if the buffer size is 0 we still + //need to perform the following to get the sound device callback + FillSoundDeviceBufferL(); //get buffer in pcm16 format for sound device + + iAudioPlayer->PlayData(*iSoundDeviceBuffer); //play data to sound drivers + } + + +void CToneDataPath::FillSoundDeviceBufferL() + {//use CToneCodec to fill the sound device buffer + + CToneCodec::TCodecProcessResult codecProcessResult; + + if (iCodec->IsNullCodec()) + {//no codec so data can be sent direct to sink + iSoundDeviceBuffer = iSourceBuffer; + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + else + { + //pass buffer to codec for processing + codecProcessResult = iCodec->ProcessL(*iSourceBuffer, *iSoundDeviceBuffer); + + if (iSourceBuffer->LastBuffer()) //if source is last buffer so is sound dev + { + iSoundDeviceBuffer->SetLastBuffer(ETrue); + } + if ((!iSoundDeviceBuffer->BufferSize())&&(codecProcessResult.iDstBytesAdded)) + {//the codec has added data but not set the buffer length + iSoundDeviceBuffer->Data().SetLength(codecProcessResult.iDstBytesAdded); + } + //only supports EProcessComplete + switch (codecProcessResult.iCodecProcessStatus) + { + case CToneCodec::TCodecProcessResult::EProcessComplete: + //finished procesing source data - all data in sink buffer + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; +#ifdef SYMBIAN_VARIABLE_BITRATE_CODEC + case CToneCodec::TCodecProcessResult::EProcessIncomplete: + //finished procesing source data - all data in sink buffer + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; +#endif + case CToneCodec::TCodecProcessResult::EDstNotFilled: + //could be the last buffer in which case dst might not get filled + { + iSoundDeviceBuffer->SetStatus(EFull); //sink buffer is full + } + break; + case CToneCodec::TCodecProcessResult::EEndOfData: + //no more data - send what we've got to the sink + //note we can't always rely on this - in many cases the codec will not know when + //it has reached the end of data. + { + iSoundDeviceBuffer->SetStatus(EFull);//sink buffer may not really be 'full' but its as full as it going to get + iNoMoreSourceData = ETrue; + //doesn't matter if sink buffer is not full + } + break; + default: + //Panic(EMMFSwCodecWrapperBadCodec); //should never get here - bad codec + break; + } + } + } + + +void CToneDataPath::BufferEmptiedL(const CMMFDataBuffer& aBuffer) + {//call back from CToneDataPathPlayer when the sound device buffer has been emptied + if (&aBuffer != iSoundDeviceBuffer) + { + Panic(EToneBadBuffer); + } + + if (!iNoMoreSourceData) + { + FillSourceBufferL(); + } + } + +//*** End of Main Play Loop *** + + +void CToneDataPath::Stop() + { + iAudioPlayer->Cancel(); + iSoundDeviceErrorReceiver->Cancel(); + iSoundDevice.Close(); + +#ifdef __CYCLE_MMF_DATABUFFERS__ + // Create a new buffer to replicate INC021405 Play-EOF-Play on HwAccelerated solution Panics + // If the creation fails, we carry on regardless as the original buffer will not have been + // destroyed. Must do this as alloc fail tests will not run. + if(iSourceBuffer) + { + iSourceBuffer = CycleAudioBuffer(iSourceBuffer); + } +#endif // __CYCLE_MMF_DATABUFFERS__ + + iState = EStopped; + } + + +void CToneDataPath::Pause() + { + //since a pause can happen anyway in the datatransfer -need to set to a known + //state so that when play is resumed the behaviour is predictable + if (iSoundDevice.Handle()) + { + iSoundDevice.PausePlayBuffer(); //needs new LDD + iState = EPaused; +#ifdef _SCW_DEBUG + RDebug::Print(_L("Pause")); +#endif + } + else + {//an error must have occured + iState = EStopped; + } + } + + +TInt CToneDataPath::EmptyBuffers() + { + TInt error = KErrNone; + if (iSoundDevice.Handle() == 0) + { + error = KErrNotReady; + } + else + { + iSoundDevice.FlushPlayBuffer(); + } + return error; + } + + +RMdaDevSound& CToneDataPath::Device() + { + return iSoundDevice; + } + + +void CToneDataPath::SoundDeviceException(TInt aError) + { + if(iIgnoreUnderflow) + { + if((aError == KErrUnderflow) && (!iNoMoreSourceData)) + { + //ignore underflow + return; + } + } + + //this sends a request to the hw device observer + //to update the bytes played + //it is done here so that the sound driver can be closed prior to + //updating the policy and sending the error back + TUid uidUpdateBytesPlayed; + uidUpdateBytesPlayed.iUid = KToneHwDeviceObserverUpdateBytesPlayed; + TPtrC8 dummy(0,0); + + ASSERT(iHwDeviceObserver); + iHwDeviceObserver->MsgFromHwDevice(uidUpdateBytesPlayed,dummy); + + //this closes RMdaDevSound. + Stop(); + + //inform devsound so it can update policy + iHwDeviceObserver->Stopped(); + + // Inform the observer of the exception condition + // We inform the hw device observer after the policy has been + // updated incase the observer relied on the error to assume + // the policy has been updated + iHwDeviceObserver->Error(aError); + + RDebug::Print(_L("CToneDataPath::iHwDeviceObserver->Error(%d)"),aError); + } + +/** +Retrieves a custom interface to the device. +The reference CToneDataPath supports three custom interfaces, +MEmptyBuffersCustomInterface, MSetVbrFlagCustomInterface and MIgnoreUnderflowEventsCustomInterface + +@param aInterface + Interface UID, defined with the custom interface. + aInterface = KMmfUidEmptyBuffersCustomInterface for MEmptyBuffersCustomInterface, + KSetVbrFlagCustomInterfaceTypeUid for MSetVbrFlagCustomInterface + +@return A pointer to the interface implementation, or NULL if the device can not + implement the interface requested. The return value must be cast to the + correct type by the user. +*/ +TAny* CToneDataPath::CustomInterface(TUid aInterface) + { + TAny* ret = NULL; + + if (aInterface == KIgnoreUnderflowCustomInterfaceTypeUid) + { + MIgnoreUnderflowEventsCustomInterface* result = static_cast (this); + ret = static_cast(result); + } + return ret; + } + + +void CToneDataPath::IgnoreUnderflowEvents() + { + iIgnoreUnderflow = ETrue; + } + + + +/************************************************************************ + * CDataPathPlayer * + ************************************************************************/ + +CToneDataPathPlayer::CToneDataPathPlayer(CToneDataPath& aParent, TInt aPriority) +: CActive(aPriority), iParent(aParent) + { + CActiveScheduler::Add(this); + } + + +CToneDataPathPlayer::~CToneDataPathPlayer() + { + Cancel(); + } + + +void CToneDataPathPlayer::Start() + { + // No implementation + } + + +void CToneDataPathPlayer::ResumePlaying() + { + if (iParent.Device().Handle()) + { + //should be ok to call this even if we are active + iParent.Device().ResumePlaying(); + iResumePlaying = ETrue; + } +#ifdef _SCW_DEBUG + RDebug::Print(_L("Playing Resumed")); +#endif + } + + +void CToneDataPathPlayer::PlayData(const CMMFDataBuffer& aData) + { + iDataFromSource = &aData; + if (!IsActive()) + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPathPlayer::PlayData")); +#endif + iParent.Device().PlayData(iStatus,(static_cast (iDataFromSource))->Data()); + SetActive(); + } + } + + +void CToneDataPathPlayer::Stop() + { + if (!IsActive()) + { + iParent.Device().FlushPlayBuffer(); // Otherwise won't be flushed + } + Cancel(); + iParent.SoundDeviceException(KErrCancel); + } + + +void CToneDataPathPlayer::RunL() + { +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneDataPathPlayer::RunL error[%d]"), iStatus.Int()); +#endif + if (iStatus.Int()!=KErrNone) + { + iParent.SoundDeviceException(iStatus.Int()); + } + else + { + iParent.BufferEmptiedL(static_cast(*iDataFromSource)); + iResumePlaying = EFalse; + } + } + + +TInt CToneDataPathPlayer::RunError(TInt aError) + { + Error(aError); + return KErrNone; + } + + +void CToneDataPathPlayer::DoCancel() + { + if (iParent.Device().Handle()) + { + iParent.Device().CancelPlayData(); + iParent.Device().FlushPlayBuffer(); + } + } + + +void CToneDataPathPlayer::Error(TInt aError) + { + iParent.SoundDeviceException(aError); + } + + + +/************************************************************************ + * CToneSoundDevPlayErrorReceiver * + ************************************************************************/ + +CToneSoundDevPlayErrorReceiver::CToneSoundDevPlayErrorReceiver(CToneDataPath& aParent, TInt aPriority) +: CActive(aPriority), iParent(aParent) + { + CActiveScheduler::Add(this); + } + +CToneSoundDevPlayErrorReceiver::~CToneSoundDevPlayErrorReceiver() + { + Cancel(); + } + +void CToneSoundDevPlayErrorReceiver::Start() + { + iParent.Device().NotifyPlayError(iStatus); + SetActive(); + } + +void CToneSoundDevPlayErrorReceiver::Stop() + { + Cancel(); + } + +void CToneSoundDevPlayErrorReceiver::RunL() + { + TInt reason = iStatus.Int(); + Start(); + + // An error has been returned +#ifdef _SCW_DEBUG + RDebug::Print(_L("CToneSoundDevPlayErrorReceiver::RunL[%d]"), reason); +#endif + iParent.SoundDeviceException(reason); + } + +void CToneSoundDevPlayErrorReceiver::DoCancel() + { + iParent.Device().CancelNotifyPlayError(); + } + + + +/* + * CycleAudioBufferL + * + * Sets up a usable buffer for passing to MMF + * + * This method has been written such that it must allocate a new buffer before + * replacing the existing one. The purpose of this is to force creation of a + * new buffer. Simply deleting and then re-allocing may result in the same + * address being used. + * + * Only cycles if there is enough memory + * + */ +#ifdef __CYCLE_MMF_DATABUFFERS__ +CMMFDataBuffer* CToneDataPath::CycleAudioBuffer(CMMFDataBuffer* aBuffer) + { + CMMFDataBuffer* buffer = NULL; + TUint bufferSize = aBuffer->Data().MaxLength(); + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + TRAPD(err, buffer = CreateTransferBufferL(bufferSize, static_cast(aBuffer))); +#else + TRAPD(err,buffer = CMMFDataBuffer::NewL(bufferSize)); + + if (err == KErrNone) + { + delete aBuffer; + } +#endif + if (err != KErrNone) + {//there was a problem creating buffer eg OOM so use same buffer + buffer = aBuffer; + } + + return buffer; + + } +#endif + +/* + * DoCleanupRHandleBase + * + * This method will initially Close the handle and then delete it. + * + */ +#ifdef __USE_MMF_TRANSFERBUFFERS__ +inline static void DoCleanupRHandleBase(TAny* aRHandleBase) + { + ASSERT(aRHandleBase); + RHandleBase* rHandleBase = static_cast (aRHandleBase); + TRAPD(error, rHandleBase->Close()); + delete aRHandleBase; + } + +CMMFTransferBuffer* CToneDataPath::CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer) + { + CMMFTransferBuffer* buffer = NULL; + + RTransferBuffer* transBuffer = new (ELeave) RTransferBuffer; + + TCleanupItem bufferCleanupItem(DoCleanupRHandleBase, transBuffer); //closes and deletes. + CleanupStack::PushL(bufferCleanupItem); + + RTransferWindow* transWindow = new (ELeave) RTransferWindow; + + TCleanupItem windowCleanupItem(DoCleanupRHandleBase, transWindow); //closes and deletes. + CleanupStack::PushL(windowCleanupItem); + + User::LeaveIfError(transBuffer->Create(aBufferSize)); + User::LeaveIfError(transWindow->Create(aBufferSize)); + User::LeaveIfError(transWindow->MapInBuffer(*transBuffer)); + + buffer = CMMFTransferBuffer::NewL(*transWindow); + + delete aOldBuffer; //closes RTransferWindow + delete iTransferWindow; + + if(iTransferBuffer) + { + iTransferBuffer->Close(); + } + delete iTransferBuffer; + + iTransferBuffer = transBuffer; + iTransferWindow = transWindow; + + CleanupStack::Pop(transWindow); + CleanupStack::Pop(transBuffer); + + return buffer; + } +#endif + + +#ifdef __USE_MMF_PTRBUFFERS__ +CMMFPtrBuffer* CToneDataPath::CreatePtrBufferL(TUint aBufferSize) + { + CMMFPtrBuffer* buffer = NULL; + if (iPtrBufferMemoryBlock) + { + delete iPtrBufferMemoryBlock;//incase already exisits + } + iPtrBufferMemoryBlock = HBufC8::NewL(aBufferSize); + TPtr8 ptrMemoryBlock(iPtrBufferMemoryBlock->Des()); + buffer = CMMFPtrBuffer::NewL(ptrMemoryBlock); + return buffer; + } +#endif // __USE_MMF_PTRBUFFERS__ + + + diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonedatapath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonedatapath.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,199 @@ +// Copyright (c) 2003-2009 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: +// + +#ifndef TONEDATAPATH_H +#define TONEDATAPATH_H + +#include +#include "mdasoundadapter.h" +#include +#include "tonehwdevice.h" + +//message from tonedatapath to hw device observer +//to tell it to update the bytes played +#define KToneHwDeviceObserverUpdateBytesPlayed 0x101FE2A4 + +class MMMFHwDeviceObserver; +class CToneDataPath; +class CToneCodec; + + +/** +@internalTechnology +Panic codes for the Tone Data Path +*/ +enum TToneDataPathPanicCode + { + /** Codec wrapper did not create an internal datapath + */ + EToneNoDataPath, + + /** Codec wrapper does not have a device handle + */ + EToneNoDevice, + + /** Codec wrapper codec returns non existant process result + */ + EToneBadCodec, + + /** Sound driver returns unexpected buffer + */ + EToneBadBuffer + }; + + +/** + * Active object used by the CToneDataPath to send data to the sound + * driver This particular active object encapsulates the asynchronous play + * function, where a buffer of data is sent to the WINS audio device, and the + * active object's RunL is called when the buffer has been consumed by the + * WINS audio device. + * @internalComponent + */ +class CToneDataPathPlayer : public CActive + { +public: + CToneDataPathPlayer(CToneDataPath& aParent, TInt aPriority); + ~CToneDataPathPlayer(); + void Start(); + void ResumePlaying(); + void PlayData(const CMMFDataBuffer& aData); + void Stop(); + virtual void RunL(); + virtual TInt RunError(TInt aError); + virtual void DoCancel(); + virtual void Error(TInt aError); +private: + CToneDataPath& iParent; + const CMMFDataBuffer* iDataFromSource; + TBool iResumePlaying; + }; + +/* +* Active object used by CToneDataPath to listening for error messages +* from the WINS audio device. If this object's RunL is called, playback has +* been terminated for some reason. The active object then +* notifies its parent the datapath, so that proper cleanup and client +* notification can occur. +* @internalComponent +*/ +class CToneSoundDevPlayErrorReceiver : public CActive + { +public: + CToneSoundDevPlayErrorReceiver(CToneDataPath& aParent, TInt aPriority); + ~CToneSoundDevPlayErrorReceiver(); + void Start(); + void Stop(); + virtual void RunL(); + virtual void DoCancel(); +private: + CToneDataPath& iParent; + }; + + +class CToneDataPath : public CBase, + public MIgnoreUnderflowEventsCustomInterface + + { +public: + enum TToneDataPathState + { + EStopped, + EPlaying, + EPaused + }; +public: + static CToneDataPath* NewL(); + ~CToneDataPath(); + TInt SetObserver(MMMFHwDeviceObserver& aHwObserver); + TInt AddCodec(CToneCodec& aCodec); + TInt Start(); + void Stop(); + void Pause(); + RMdaDevSound& Device(); + void BufferFilledL(CMMFDataBuffer& aBuffer); + void BufferEmptiedL(const CMMFDataBuffer& aBuffer); + void SoundDeviceException(TInt aError); + TToneDataPathState State() {return iState;}; + TInt EmptyBuffers(); + virtual void IgnoreUnderflowEvents(); + virtual TAny* CustomInterface(TUid aInterface); + + +protected: + CToneDataPath() {}; + inline void Panic(TInt aPanicCode); + void ConstructL(); + void FillSourceBufferL(); + void FillSoundDeviceBufferL(); + +#ifdef __CYCLE_MMF_DATABUFFERS__ + CMMFDataBuffer* CycleAudioBuffer(CMMFDataBuffer* aBuffer); +#endif + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + CMMFTransferBuffer* CreateTransferBufferL(TUint aBufferSize, CMMFTransferBuffer* aOldBuffer); +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + CMMFPtrBuffer* CreatePtrBufferL(TUint aBufferSize); +#endif + +protected: + TToneDataPathState iState; + MMMFHwDeviceObserver* iHwDeviceObserver; + CToneCodec* iCodec; + CToneDataPathPlayer* iAudioPlayer; + CToneSoundDevPlayErrorReceiver* iSoundDeviceErrorReceiver; + RMdaDevSound iSoundDevice; + CMMFDataBuffer* iSourceBuffer; + CMMFDataBuffer* iSoundDeviceBuffer; + TBool iNoMoreSourceData; + TBool iSinkCanReceive; + TUint iSourceBufferSize; + TUint iSoundDevBufferSize; + TBool iRampAudioSample; + + TTimeIntervalMicroSeconds iVolumeRamp; + // DEF048512 + TInt iSampleRate; + TInt iChannels; + + TInt iBuffSize; + + TBool iIgnoreUnderflow; + +#ifdef __USE_MMF_TRANSFERBUFFERS__ + RTransferBuffer* iTransferBuffer; + RTransferWindow* iTransferWindow; +#endif + +#ifdef __USE_MMF_PTRBUFFERS__ + HBufC8* iPtrBufferMemoryBlock; +#endif + + }; + +/** + * Internal panic + * @internalComponent + */ +inline void CToneDataPath::Panic(TInt aPanicCode) + { + _LIT(KTonePanicCategory, "ToneDataPath"); + User::Panic(KTonePanicCategory, aPanicCode); + } + +#endif //TONEDATAPATH_H diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonehwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonehwdevice.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1031 @@ +// tonehwdevice.cpp +// Copyright (c) 2006-2009 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 FILES +#include +#include "tonehwdevice.hrh" //for KUidToneHwDevice +#include // For making it ECom plugin +#include "tonehwdevice.h" + + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY(KUidToneHwDevice, CToneHwDevice::NewL), + }; +//current supported sample rate +const TInt KSupportedSampleRate = 8000; + +// --------------------------------------------------------------------------- +// Default constructor +// --------------------------------------------------------------------------- +// +CToneHwDevice::CToneHwDevice() + { + DP_CONTEXT(CToneHwDevice::CToneHwDevice *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +// ----------------------------------------------------------------------------- +// Symbian 2nd phase constructor +// ----------------------------------------------------------------------------- +// +void CToneHwDevice::ConstructL() + { + DP_CONTEXT(CToneHwDevice::ConstructL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + + iHwDataBufferFill = CMMFDataBuffer::NewL(sizeof(TToneData)); + iHwDataBufferFill->SetLastBuffer(EFalse); + iHwDataBufferFill->Data().SetLength(sizeof(TToneData)); + iHwDataBufferFill->SetRequestSizeL(sizeof(TToneData)); + + iCodec = new(ELeave)CToneCodec(); + + DP_OUT(); + } + +// ----------------------------------------------------------------------------- +// Symbian constructor +// ----------------------------------------------------------------------------- +// +CToneHwDevice* CToneHwDevice::NewL() + { + DP_STATIC_CONTEXT(CToneHwDevice::NewL *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + CToneHwDevice* self = new (ELeave) CToneHwDevice(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +CToneHwDevice::~CToneHwDevice() + { + DP_CONTEXT(CToneHwDevice::~CToneHwDevice *CD0*, CtxDevSound, DPLOCAL); + DP_IN(); + delete iHwDataBufferFill; + delete iCodec; + delete iPlayCustomInterface; + + if(iDataPath) + { + delete iDataPath; + } + + if(iToneBuffer1) + { + delete iToneBuffer1; + } + if(iToneBuffer2) + { + delete iToneBuffer2; + } + DP_OUT(); + } + +/** +* +* Codec +* +*/ +CToneCodec& CToneHwDevice::Codec() + { + return *iCodec; + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::Init +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::Init(THwDeviceInitParams& aDevInfo) + { + DP_CONTEXT(CToneHwDevice::Init *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if (!iToneInitialized) // Check if tones is not initialized yet. + { + iToneInitialized = ETrue; + } + + // [ precondition that aDevInfo has a valid observer ] + if (!aDevInfo.iHwDeviceObserver) + { + DP0_RET(KErrArgument, "%d"); + } + + iHwDeviceObserver = aDevInfo.iHwDeviceObserver; + + //[ assert the post condition ] + if (!iCodec) + { + DP0_RET(KErrNotSupported, "%d"); + } + + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::Start +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) + { + DP_CONTEXT(CToneHwDevice::Start *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt error = KErrNone; + + // Start for first time OR resuming + if (!iTonePlaying || iDataPath->State() == CToneDataPath::EPaused) + { + iLastBuffer = EFalse; + //[ assert precondition that play custom interface is present] + //if there is no tone play custom interface then the user of the CToneHwDevice + //cannot have set any of the custom settings such as sample rate. + if (!iPlayCustomInterface) + { + DP0_RET(KErrNotReady, "%d"); + } + + //play + if (!iDataPath) + { + //create a datapath + TRAP(error,iDataPath = CToneDataPath::NewL()); + if ((iDataPath)&&(error == KErrNone)) + { + ASSERT(iHwDeviceObserver); + iDataPath->SetObserver(*this); + error = iDataPath->AddCodec(*iCodec); + if (error == KErrNone) + { + iDeviceBufferSize = (iCodec->SinkBufferSize()); + } + } + } + if ((error == KErrNone) && (iDataPath->State() != CToneDataPath::EPlaying)) + { + //datapath was created ok and we are not playing + if (iDataPath->State() == CToneDataPath::EStopped) + { + // starting from 'fresh so set sound device settings + if (!iDataPath->Device().Handle()) + { + //if Device() is called then we need a valid sound device handle + error = iDataPath->Device().Open(); + if (error != KErrNone) + { + DP0_RET(error, "%d"); + } + + } + static_cast(iPlayCustomInterface)->SetDevice(&(iDataPath->Device())); + + TUint iVol = iPlayCustomInterface->Volume(); + iDataPath->Device().SetPlayVolume(iVol); + + soundDeviceSettings().iRate = iSampleRate; + + //this would normally be pcm16 + soundDeviceSettings().iEncoding = RMdaDevSound::EMdaSoundEncoding16BitPCM; + + //1 = mono 2 = stereo + soundDeviceSettings().iChannels = iChannels; + + //tell sound driver what buffer size to expect + //it is up the the implementor to make use the device can support + //the required buffer size + soundDeviceSettings().iBufferSize = iDeviceBufferSize; + error = iDataPath->Device().SetPlayFormat(soundDeviceSettings); + + } // End of iDataPath->State() == CToneDataPath::EStopped + + //else resuming from pause + if ((error == KErrNone)||(error == KErrInUse)) + { + // Hw device hasn't played anything yet so don't change + // active buffer. This is checked in FillThisHwBuffer. + if(iDataPath->State() != CToneDataPath::EPaused) + { + iFirstCallFromHwDevice = ETrue; + } + iTonePlaying = ETrue; + error = iDataPath->Start(); + } + }//status == KErrNone + } + else // if tone playback is already ongoing do nothing + { + DP0(DLINFO,"Previous tone call is not completed yet"); + } + DP0_RET(error, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::Stop +// --------------------------------------------------------------------------- +TInt CToneHwDevice::Stop() + { + DP_CONTEXT(CToneHwDevice::Stop *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if (iTonePlaying) + { + iTonePlaying = EFalse; + } + + if (!iDataPath) + { + DP0_RET(KErrNotReady, "%d"); + } + + delete iDataPath; + iDataPath = NULL; + + //Setting device to NULL since after stop it doesn't exists any more + if(iPlayCustomInterface) + { + static_cast(iPlayCustomInterface)->SetDevice(NULL); + } + + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::Pause +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::Pause() + { + DP_CONTEXT(CToneHwDevice::Pause *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if (!iDataPath) + { + DP0_RET(KErrNotReady, "%d"); + } + iDataPath->Pause(); + + DP0_RET(KErrNone, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::StopAndDeleteCodec +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::StopAndDeleteCodec() + { + DP_CONTEXT(CToneHwDevice::StopAndDeleteCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotSupported, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::DeleteCodec +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::DeleteCodec() + { + DP_CONTEXT(CToneHwDevice::DeleteCodec *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotSupported, "%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::SetConfig +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::SetConfig(TTaskConfig& aConfig) + { + DP_CONTEXT(CToneHwDevice::SetConfig *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if (aConfig.iUid != KUidRefDevSoundTaskConfig) + { + DP0_RET(KErrArgument, "%d"); + } + + if (aConfig.iRate != KSupportedSampleRate ) + { + DP0_RET(KErrNotSupported, "%d"); + } + + iSampleRate = aConfig.iRate; + + if (aConfig.iStereoMode == ETaskMono) + { + iChannels = 1; + } + else if (aConfig.iStereoMode == ETaskInterleaved || aConfig.iStereoMode == ETaskNonInterleaved) + { + iChannels = 2; + } + else + { + DP0_RET(KErrArgument, "%d"); + } + + DP0_RET(KErrNone, "%d"); + } + +// CToneHwDevice::FillThisHwBuffer +// --------------------------------------------------------------------------- +TInt CToneHwDevice::FillThisHwBuffer(CMMFBuffer& aHwBuffer) + { + DP_CONTEXT(CToneHwDevice::FillThisHwBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err(KErrNone); + + if(iFirstCallFromHwDevice) + { + err = iHwDeviceObserver->FillThisHwBuffer(aHwBuffer); + } + else + { + err = ThisHwBufferFilled(aHwBuffer); + } + DP0_RET(err,"%d"); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::ThisHwBufferFilled +// --------------------------------------------------------------------------- +// +TInt CToneHwDevice::ThisHwBufferFilled(CMMFBuffer& aMmfBuffer) + { + DP_CONTEXT(CToneHwDevice::ThisHwBufferFilled *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + CMMFDataBuffer* myBuffer = static_cast (&aMmfBuffer); + // Set the request length, From HwDevice this comes with buffer + // length. + TInt len = myBuffer->Data().MaxLength(); + // Ignore error. since buffer size = Buffer Length + TRAP(err, myBuffer->SetRequestSizeL(len)); + + if(iFirstCallFromHwDevice) + { + myBuffer->SetLastBuffer(EFalse); + + Mem::Copy((TAny*)(&myToneData), (TAny*)(myBuffer->Data().Ptr()), sizeof(TToneData)); + + err = ReadToneData(); + if(err==KErrNone) + { + err= GenerateBufferData(); + } + } + else + { + // Hw device will call this method right after its Start was called. + // When it calls this for the first time it hasn't played one single + // buffer yet so check that. + // In this case there's no need to set the active buffer as it's already + // waiting to be played. + SetActiveToneBuffer(); + } + + if (err == KErrNone) + { + // If there is no data in the active buffer, tone play is finished. + // DevSound just have to wait for completion event from audio device. + if (iActiveToneBuffer->Data().Length() == 0) + { + iActiveToneBuffer->SetLastBuffer(ETrue); + myBuffer->SetLastBuffer(ETrue); + iLastBuffer=ETrue; + } + + TInt tonelen = iActiveToneBuffer->Data().Length(); + + // don't enter more data than can be handled by the receiving buffer + if (len >= tonelen) + { + len = tonelen; + } + + // Copy data from tone buffer to hw device buffer + Mem::Copy((TAny*)(myBuffer->Data().Ptr()), (TAny*)(iActiveToneBuffer->Data().Ptr()), len); + + myBuffer->Data().SetLength(len); + + //Play data and try to generate next data block + TRAP(err,iDataPath->BufferFilledL(static_cast (*myBuffer))); + if(err == KErrNone) + { + if(iLastBuffer) + { + // coverity[check_after_deref] + if(myBuffer) + { + myBuffer = NULL; + } + FreeBuffers(); + iFirstCallFromHwDevice = EFalse; + } + else + { + // Check again whether this is the first call from Hw device. + // FillFreeToneBuffer assumes the iActiveToneBuffer has already + // been played. + if (!iFirstCallFromHwDevice) + { + err = FillFreeToneBuffer(); + } + else + { + iFirstCallFromHwDevice = EFalse; // Reset flag + } + } + } + } + if ( err != KErrNone ) + { + myBuffer->SetLastBuffer(ETrue); + myBuffer->Data().SetLength(0); + //Use error additional variable for sending last buffer so can still send Error(err) + TRAPD(datapathErr, iDataPath->BufferFilledL(static_cast (*myBuffer))); + // coverity[check_after_deref] + if(myBuffer) + { + myBuffer = NULL; + } + FreeBuffers(); + iFirstCallFromHwDevice = EFalse; + if ( datapathErr != KErrNone ) + { + iHwDeviceObserver->Error(datapathErr); + DP0_RET(datapathErr, "%d"); + } + iHwDeviceObserver->Error(err); + } + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CToneHwDevice::ThisHwBufferEmptied +// --------------------------------------------------------------------------- +TInt CToneHwDevice::ThisHwBufferEmptied(CMMFBuffer& /*aMmfBuffer*/) + { + DP_CONTEXT(CToneHwDevice::ThisHwBufferEmptied *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotSupported, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CToneHwDevice::EmptyThisHwBuffer +// --------------------------------------------------------------------------- +TInt CToneHwDevice::EmptyThisHwBuffer(CMMFBuffer& /*aMmfBuffer*/) + { + DP_CONTEXT(CToneHwDevice::EmptyThisHwBuffer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP0_RET(KErrNotSupported, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CToneHwDevice::MsgFromHwDevice +// --------------------------------------------------------------------------- +TInt CToneHwDevice::MsgFromHwDevice(TUid aMessageType, const TDesC8& aMsg) + { + DP_CONTEXT(CToneHwDevice::MsgFromHwDevice *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err(KErrNone); + err = iHwDeviceObserver->MsgFromHwDevice(aMessageType, aMsg); + DP0_RET(err, "%d"); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CToneHwDevice::Stopped +// --------------------------------------------------------------------------- +void CToneHwDevice::Stopped() + { + DP_CONTEXT(CToneHwDevice::Stopped *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iHwDeviceObserver->Stopped(); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class MMMFHwDeviceObserver +// CToneHwDevice::Error +// --------------------------------------------------------------------------- +void CToneHwDevice::Error(TInt aError) + { + DP_CONTEXT(CToneHwDevice::Error *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iHwDeviceObserver->Error(aError); + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// from class CMMFHwDevice +// CToneHwDevice::CustomInterface +// --------------------------------------------------------------------------- +// +TAny* CToneHwDevice::CustomInterface(TUid aInterfaceUid) + { + DP_CONTEXT(CToneHwDevice::CustomInterface *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TAny* ret = NULL; + TInt err = KErrNone; + + if (aInterfaceUid.iUid == KMmfPlaySettingsCustomInterface) + { + if (!iPlayCustomInterface) + { + TRAP(err,iPlayCustomInterface = new(ELeave)TToneCustomInterface()); + } + if (err) + { + ret = NULL; + } + else + { + ret = static_cast(iPlayCustomInterface); + } + } + else if (aInterfaceUid == KIgnoreUnderflowCustomInterfaceTypeUid) + { + if (!iDataPath) + { + ret = NULL; + } + else + { + ret = static_cast(iDataPath)->CustomInterface(aInterfaceUid); + } + } + + DP_OUT(); + return ret; + } + +TInt CToneHwDevice::ReadToneData() + { + DP_CONTEXT(CToneHwDevice::ReadToneData *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TUint vol; + myToneData.GetType(iToneType); + TInt64 zeroInt64(0); + iFrequency1 = myToneData.GetFrequencyOne(); + iFrequency2 = myToneData.GetFrequencyTwo(); + myToneData.GetDuration(iDuration); + + myToneData.GetRepeatTrailingSilence(iRepeatTrailingSilence); + iRepeatCount = myToneData.GetRepeatCount(); + iRampDuration = iPlayCustomInterface->VolumeRamp(); + vol = iPlayCustomInterface->Volume(); + iDataPath->Device().SetPlayVolume(vol); + switch (iToneType) + { + case TToneData::ESimple: + DP0(DLINFO, "Playing simple tone"); + iDataPath->Device().GetPlayFormat(soundDeviceSettings); + if((iFrequency1<0) || (iDuration.Int64() < zeroInt64)) + { + iHwDeviceObserver->Error(KErrArgument); + DP0_RET(KErrArgument, "%d"); + } + iToneGen.SetFrequencyAndDuration(iFrequency1,iDuration); + // Configure tone generator + iToneGen.Configure( + soundDeviceSettings().iRate, + soundDeviceSettings().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*soundDeviceSettings().iRate)/1000000), + I64LOW((iRampDuration.Int64()*soundDeviceSettings().iRate)/1000000) + ); + iCurrentGenerator = &iToneGen; + break; + case TToneData::EDual: + DP0(DLINFO, "Playing dual tone"); + iDataPath->Device().GetPlayFormat(soundDeviceSettings); + if((iFrequency1<0) || (iFrequency2<0) || (iDuration.Int64() < zeroInt64)) + { + iHwDeviceObserver->Error(KErrArgument); + DP0_RET(KErrArgument, "%d"); + } + iDualToneGen.SetFrequencyAndDuration(iFrequency1, iFrequency2, iDuration); + // Configure dual tone generator + iDualToneGen.Configure( + soundDeviceSettings().iRate, + soundDeviceSettings().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*soundDeviceSettings().iRate)/KOneMillionMicroSeconds), + I64LOW((iRampDuration.Int64()*soundDeviceSettings().iRate)/KOneMillionMicroSeconds) + ); + iCurrentGenerator = &iDualToneGen; + break; + case TToneData::EDtmfString: + DP0(DLINFO, "Playing DTMF string"); + myToneData.GetDtmfLenghts(myToneOnLength, myToneOffLength, myPauseLength); + iDTMFGen.SetToneDurations(myToneOnLength, myToneOffLength, myPauseLength); + iDTMFString = myToneData.GetDTMFString(); + if(!ValidDTMFString(const_cast(*iDTMFString))) + { + DP0(DLINFO, "Invalid DTMF String"); + iHwDeviceObserver->Error(KErrCorrupt); + DP0_RET(KErrCorrupt, "%d"); + } + iDTMFGen.SetString(const_cast(*iDTMFString)); + iDataPath->Device().GetPlayFormat(soundDeviceSettings); + iDTMFGen.Configure( + soundDeviceSettings().iRate, + soundDeviceSettings().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*soundDeviceSettings().iRate)/1000000), + I64LOW((iRampDuration.Int64()*soundDeviceSettings().iRate)/1000000) + ); + iCurrentGenerator = &iDTMFGen; + break; + case TToneData::ESequence: + DP0(DLINFO, "Playing tone sequence"); + iSequenceData = myToneData.GetSequenceData(); + // Check whether the sequence is signed or not + if (!RecognizeSequence(*iSequenceData)) + { + DP0(DLINFO, "Invalid Sequence Sign"); + iHwDeviceObserver->Error(KErrCorrupt); + DP0_RET(KErrCorrupt, "%d"); + } + iSequenceGen.SetSequenceData(*iSequenceData); + iDataPath->Device().GetPlayFormat(soundDeviceSettings); + iSequenceGen.Configure( + soundDeviceSettings().iRate, + soundDeviceSettings().iChannels, + iRepeatCount, + I64LOW((iRepeatTrailingSilence.Int64()*soundDeviceSettings().iRate)/1000000), + I64LOW((iRampDuration.Int64()*soundDeviceSettings().iRate)/1000000) + ); + iCurrentGenerator = &iSequenceGen; + break; + case TToneData::EFixedSequence: + DP0(DLINFO, "Playing FixedSequnce"); + iHwDeviceObserver->Error(KErrNotSupported); + DP0_RET(KErrNotSupported, "%d"); + default: + DP0_RET(KErrNotSupported, "%d"); + } + DP0_RET(KErrNone, "%d"); + } + +/* + * + * Creates buffer and begin playback using the specified tone generator. + * + */ +TInt CToneHwDevice::GenerateBufferData() + { + DP_CONTEXT(CToneHwDevice::GenerateBufferData *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err; + err = KErrNone; + + // Delete any buffer from previous call and try to create maximum buffer + // size. Double Buffer the Tone data. + if (iToneBuffer1) + { + delete iToneBuffer1; + iToneBuffer1 = NULL; + } + //note the tone buffer needs to be the same as the pcm16->pcm16 'null' + //hw device plugin + // Buffer size = (SampleRate * BytesPerSample * Channels) / 4 + TInt useBufferOfSize = ((SamplingFrequency() * 2 * NumberOfChannels())/KDevSoundFramesPerSecond + (KDevSoundDeltaFrameSize-1)) &~ (KDevSoundDeltaFrameSize-1); + //clamp buffer to desired limits + if(useBufferOfSize < KDevSoundMinFrameSize) + { + useBufferOfSize = KDevSoundMinFrameSize; + } + else if(useBufferOfSize > KDevSoundMaxFrameSize) + { + useBufferOfSize = KDevSoundMaxFrameSize; + } + + TRAP(err, iToneBuffer1 = CMMFDataBuffer::NewL(useBufferOfSize)); + if ( err != KErrNone ) + { + DP0_RET(err, "%d"); + } + + err = iCurrentGenerator->FillBuffer(iToneBuffer1->Data()); + if(err!=KErrNone) + { + DP0_RET(err, "%d"); + } + + if (iToneBuffer2) + { + delete iToneBuffer2; + iToneBuffer2 = NULL; + } + + TRAP(err, iToneBuffer2 = CMMFDataBuffer::NewL(useBufferOfSize)); + if ( err != KErrNone ) + { + DP0_RET(err, "%d"); + } + + err = iCurrentGenerator->FillBuffer(iToneBuffer2->Data()); + if(err!=KErrNone) + { + DP0_RET(err, "%d"); + } + + // Assign active buffer + iActiveToneBuffer = iToneBuffer1; + DP0_RET(KErrNone, "%d"); + } + +/* + * + * This method assigns the other buffer as active buffer. The tone audio + * generator should fill data in the other buffer by now. + * + */ +void CToneHwDevice::SetActiveToneBuffer() + { + if (iActiveToneBuffer == iToneBuffer1) + iActiveToneBuffer = iToneBuffer2; + else if (iActiveToneBuffer == iToneBuffer2) + iActiveToneBuffer = iToneBuffer1; + } + + +void CToneHwDevice::FreeBuffers() + { + if(iToneBuffer1) + { + delete iToneBuffer1; + iToneBuffer1 = NULL; + } + if(iToneBuffer2) + { + delete iToneBuffer2; + iToneBuffer2 = NULL; + } + } + + /* + * + * Returns an integer representing Sampling Frequency the device is currently + * configured to. + * + * @return "TInt" + * Sampling Frequency. + * + */ +TInt CToneHwDevice::SamplingFrequency() + { + return iSampleRate; + } + +/* + * + * Returns an integer representing number of channels the device is currently + * configured to. + * + * @return "TInt" + * Number of audio channels 1 if mono, 2 if stereo. + * + */ +TInt CToneHwDevice::NumberOfChannels() + { + if(iChannels == EMMFMono) + return 1; + else + return 2; + } + + /* + * + * This method fills data into the free buffer. + * + * @return "TInt" + * Error code. KErrNone if success. + * + */ +TInt CToneHwDevice::FillFreeToneBuffer() + { + TInt err(KErrNone); + if (iActiveToneBuffer == iToneBuffer1) + { + err = iCurrentGenerator->FillBuffer(iToneBuffer2->Data()); + } + else if (iActiveToneBuffer == iToneBuffer2) + { + err = iCurrentGenerator->FillBuffer(iToneBuffer1->Data()); + } + return err; + } + +TBool CToneHwDevice::RecognizeSequence(const TDesC8& aData) + { + // Reference plug-in only supports its own sequence format + _LIT8(KSequenceSignature,"SQNC"); + if (aData.Length() > 4) + { + if (aData.Left(4) == KSequenceSignature) + { + return ETrue; + } + } + // Didn't recognise + return EFalse; + } + +TBool CToneHwDevice::ValidDTMFString(const TDesC& aDTMFString) + { + const TDesC* stringDTMF = &aDTMFString;; + TInt stringPos = 0; + if (stringPos == stringDTMF->Length()) + { + return EFalse; // Finished. Nothing to do + } + do + { + TChar c((*stringDTMF)[stringPos++]); + if (static_cast (c)=='#' || static_cast (c)=='*' || static_cast (c)==',' || c.IsHexDigit() || c.IsSpace()) + { + //Do nothing, valid character + } + else + { + return EFalse; + } + + } + while(stringPos < stringDTMF->Length()); + return ETrue; + } + + +/************************************************************************ + * TToneCustomInterface * + ************************************************************************/ +/** + * This method is not be exported as it is only + * intended to be called within this DLL. + * It's purpose is to assign an RMdaDevSound to the play + * custom interface + * @internalComponent + */ +void TToneCustomInterface::SetDevice(RMdaDevSound* aDevice) + { + iDevice = aDevice; + } + +void TToneCustomInterface::SetVolume(TUint aVolume) + { + iVolume = aVolume; + if (iDevice && iDevice->Handle()!=0) + { + iDevice->SetPlayVolume(aVolume); + } + } + +/** + * Procedure to get the number of bytes played by the device driver + * If there is no handle available to the device driver then the + * procedure returns the last known value + * @released + * @return number of bytes played + */ +TUint TToneCustomInterface::BytesPlayed() + { + if(iDevice) + { + if (iDevice->Handle()) + { + iBytesPlayed = iDevice->BytesPlayed(); + } + } + return iBytesPlayed; + } + + +// +// class CToneCodec // +// + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::CToneCodec +// --------------------------------------------------------------------------- +// +CToneCodec::CToneCodec() + { + } + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::~CToneCodec +// --------------------------------------------------------------------------- +// +CToneCodec::~CToneCodec() + { + } + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::ConstructL +// --------------------------------------------------------------------------- +// +void CToneCodec::ConstructL() + { + } + + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::ProcessL +// --------------------------------------------------------------------------- +// +CToneCodec::TCodecProcessResult CToneCodec::ProcessL(const CMMFBuffer& /*aSource*/, CMMFBuffer& /*aDest*/) + { + //no processing required for null codec + User::Leave(KErrNotSupported); + //to keep compiler happy + TCodecProcessResult result; + result.iCodecProcessStatus = TCodecProcessResult::EEndOfData; + result.iSrcBytesProcessed = 0; + result.iDstBytesAdded = 0; + return result; + } + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::SourceBufferSize +// --------------------------------------------------------------------------- +// +TUint CToneCodec::SourceBufferSize() + { + return KPCM16ToPCM16BufferSize; + } + +// --------------------------------------------------------------------------- +// from class CToneCodec +// CToneCodec::SinkBufferSize +// --------------------------------------------------------------------------- +// +TUint CToneCodec::SinkBufferSize() + { + return KPCM16ToPCM16BufferSize; + } + + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +/** +* ImplementationGroupProxy +* is called to get a pointer to the plugin's implementation table, or table +* of functions used to instantiate the plugin. +* @since +* @param aTableCount returns the number of functions in the table. +* @return retuns a pointer to the table. +*/ +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonehwdevice.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonehwdevice.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,378 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef C_TONEHWDEVICE_H +#define C_TONEHWDEVICE_H + +// INCLUDES +#include +#include +#include +#include +#include +#include "mdasoundadapter.h" +#include "ToneGenerator.h" +#include "tonedatapath.h" +#include + + +//note we need to keep this buffer at 8K as the tone utility expects 8K +const TInt KPCM16ToPCM16BufferSize = 0x2000; + +//controlls buffer sizes +const TInt KDevSoundDefaultFrameSize = 0x1000; +const TInt KDevSoundMinFrameSize = 0x800; //2K +const TInt KDevSoundMaxFrameSize = 0x4000; //16K +const TInt KDevSoundDeltaFrameSize = 0x800; //2K +const TInt KDevSoundFramesPerSecond = 4; + +// FORWARD DECLARATIONS +class CToneDataPath; + +// CLASS DECLARATION + +/** + * Implementation of custom interface class for tone play functionality created by the + * CToneCodec::CustomInterface() method. It provides + * access to miscellaneous functionality such as volume settings + */ +class TToneCustomInterface : public MPlayCustomInterface + { +public: + TToneCustomInterface() : iVolume(0),iBytesPlayed(0),iDevice(NULL),iRampDuration(0) {} + void SetVolume(TUint aVolume); + TUint Volume(); + TUint BytesPlayed(); + void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); + TTimeIntervalMicroSeconds& VolumeRamp(); + void SetDevice(RMdaDevSound* iDevice); +private: + TUint iVolume; + TUint iBytesPlayed; + RMdaDevSound* iDevice; + TTimeIntervalMicroSeconds iRampDuration; + }; + + + +/* +* Codec Implementation +*/ + +class CToneCodec : public CBase + { +public: + /** + Indicates the result of processing data from the source buffer to a destination buffer + and provides functions to compare the result code. + The CToneCodec buffer sizes should be set to return EProcessComplete + The other return codes are to keep the ProcessL method compatible with + the 7.0s CMMFCodec API. + */ + class TCodecProcessResult + { + public: + /** + Flag to track the codec's processing status. + */ + enum TCodecProcessResultStatus + { + /** The codec has successfully completed its processing. */ + EProcessComplete, + /** Could not empty the source buffer because the destination buffer became full. */ + EProcessIncomplete, + /** Codec came across an end of data. */ + EEndOfData, + /** Could not fill the destination buffer because the source buffer has been emptied. */ + EDstNotFilled, + /** An error occured. */ + EProcessError + }; + + /** Overloaded operator to test equality. */ + TBool operator==(const TCodecProcessResultStatus aStatus) const {return (iCodecProcessStatus == aStatus);} + /** Overloaded operator to test inequality. */ + TBool operator!=(const TCodecProcessResultStatus aStatus) const {return (iCodecProcessStatus != aStatus);} + + /** + Default constructor. + */ + TCodecProcessResult() + :iCodecProcessStatus(EProcessError), iSrcBytesProcessed(0), iDstBytesAdded(0) {}; + + public: + /** + The codec's processing status + + @see enum TCodecProcessResultStatus + */ + TCodecProcessResultStatus iCodecProcessStatus; + + /** The number of source bytes processed */ + TUint iSrcBytesProcessed; + + /** The number of bytes added to the destination buffer */ + TUint iDstBytesAdded; + }; +public: + + CToneCodec(); + ~CToneCodec(); + + void ConstructL(); + + + /** + Processes the data in the specified source buffer and writes the processed data to + the specified destination buffer. + + This function is synchronous, when the function returns the data has been processed. + + @param aSource + The source buffer containing data to encode or decode. + @param aDest + The destination buffer to hold the data after encoding or decoding. + + @return The result of the processing. + + @see TCodecProcessResult + */ + TCodecProcessResult ProcessL(const CMMFBuffer& aSource, CMMFBuffer& aDest); + + /** + Gets the max size of the source buffer passed into the + CToneCodec::ProcessL function. + + Note that this means that this is the Max size of each buffer passed to the codec. The actual + size of the data could be less than the max size. + + @return The max size of the source buffer in bytes. + */ + TUint SourceBufferSize(); + + /** + Gets the max size of the sink (destination) buffer passed into the + CToneCodec::ProcessL method. + + Note that this means that this is the Max size of each buffer passed to the codec. The actual + size of the data written to this buffer could be less than the max size. + + @return The max size of the sink buffer in bytes. + */ + TUint SinkBufferSize(); + + TBool IsNullCodec() {return ETrue;}; + + + private: + + TUint iBufferSize; + + }; + + +class CToneHwDevice : public CMMFHwDevice, + public MMMFHwDeviceObserver + + { + public: // Constructors and destructor + + static CToneHwDevice* NewL(); + ~CToneHwDevice(); + + public: // New functions + + public: // Functions from base classes + + + TInt Init(THwDeviceInitParams& aDevInfo); + TInt Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/); + TInt Stop(); + + /* This function is not used in tone playback*/ + TInt Pause(); + + TAny* CustomInterface(TUid aInterfaceUid); + + TInt FillThisHwBuffer(CMMFBuffer& aHwBuffer); + + TInt ThisHwBufferFilled(CMMFBuffer& aMmfBuffer); + + /*From MMMFHwDeviceObserver*/ + /* This function is not used in tone playback*/ + TInt ThisHwBufferEmptied(CMMFBuffer& aMmfBuffer); + + /*From MMMFHwDeviceObserver*/ + /* This function is not used in tone playback*/ + TInt EmptyThisHwBuffer(CMMFBuffer& aMmfBuffer); + + /*From MMMFHwDeviceObserver*/ + TInt MsgFromHwDevice(TUid aMessageType, const TDesC8 &aMsg); + + /*From MMMFHwDeviceObserver*/ + void Stopped(); + + /*From MMMFHwDeviceObserver*/ + void Error(TInt aError); + + TInt SetConfig(TTaskConfig& aConfig); + + /* This function is not used in tone playback*/ + TInt StopAndDeleteCodec(); + + /* This function is not used in tone playback*/ + TInt DeleteCodec(); + + CToneCodec& Codec(); + + TInt GenerateBufferData(); + + void SetActiveToneBuffer(); + + TInt SamplingFrequency(); + + TInt NumberOfChannels(); + + TInt FillFreeToneBuffer(); + + TInt ReadToneData(); + + void FreeBuffers(); + + TBool ValidDTMFString(const TDesC& aDTMFString); + + TBool RecognizeSequence(const TDesC8& aData); + + protected: // New functions + protected: // Functions from base classes + + private: + + CToneHwDevice(); + void ConstructL(); + + public: // Data + protected: // Data + private: // Data + + /** + * Pointer to the buffer that was last sent to the observer to be filled. + * Own pointer. + */ + CMMFDataBuffer* iHwDataBufferFill; + + /** + * Hwdevice observer. Information is send to upper level by using this pointer. + */ + MMMFHwDeviceObserver* iHwDeviceObserver; + + /** + The datapath used to transfer the data + */ + CToneDataPath* iDataPath; + + MPlayCustomInterface* iPlayCustomInterface; + + /** + * Initialize status of the tone + */ + TBool iToneInitialized; + + /** + * Playback status of the tone + */ + TBool iTonePlaying; + + /** + * Pointer to information about hwdevice initializing parameters. + */ + //TSizeHwDeviceInitArgs* iSizeHwDeviceInitArgs; + + /** + * Type of the tone + */ + TToneData::TToneType iToneType; + + /** + * Tone Data + */ + TToneData myToneData; + + /** + * Tone Codec + */ + CToneCodec *iCodec; + + /** + The buffer size of the sound device + */ + TUint iDeviceBufferSize; + + /** + The sample rate of the sound device + */ + TInt iSampleRate; + + /** + The number of channels of the sound device + */ + TInt iChannels; + + TBool iLastBuffer; + + TTimeIntervalMicroSeconds iRampDuration; + + //WINS Sound Device Structures + RMdaDevSound::TCurrentSoundFormatBuf soundDeviceSettings; + + // Double buffer tone playing + CMMFDataBuffer* iToneBuffer1; + CMMFDataBuffer* iToneBuffer2; + // Reference to current tone buffer playing + CMMFDataBuffer* iActiveToneBuffer; + + TBool iFirstCallFromHwDevice; + + //Tone Stuff: + + MMdaToneSynthesis* iCurrentGenerator; + TMdaSimpleToneGenerator iToneGen; + TMdaDualToneGenerator iDualToneGen; + TMdaDTMFGenerator iDTMFGen; + TMdaSequenceGenerator iSequenceGen; // Not Supported + TInt iRepeatCount; + TInt iFrequency1; + TInt iFrequency2; + TTimeIntervalMicroSeconds iRepeatTrailingSilence; + TTimeIntervalMicroSeconds iDuration; + + TTimeIntervalMicroSeconds32 myToneOnLength; + TTimeIntervalMicroSeconds32 myToneOffLength; + TTimeIntervalMicroSeconds32 myPauseLength; + + TDesC *iDTMFString; + + TDesC8 *iSequenceData; + }; + + #include "tonehwdevice.inl" + +#endif + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonehwdevice.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonehwdevice.hrh Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,28 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef TONEHWDEVICE_HRH +#define TONEHWDEVICE_HRH + +// TONE +#define KUidToneUid 0x1020659f +#define KUidToneHwDevice 0x10283463 +#define KUidToneHwDevicedll 0x1028345E + +#endif //TONEHWDEVICE_HRH diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonehwdevice.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonehwdevice.inl Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2006-2009 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: +* +*/ + + + +#ifndef TONEHWDEVICE_INL +#define TONEHWDEVICE_INL + +#include "tonehwdevice.h" + +inline TUint TToneCustomInterface::Volume() + { + return iVolume; + }; + +inline void TToneCustomInterface::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) + { + iRampDuration = aRampDuration; + }; + +inline TTimeIntervalMicroSeconds& TToneCustomInterface::VolumeRamp() + { + return iRampDuration; + }; + +#endif + +// End of File diff -r 000000000000 -r 79dd3e2336a0 mmhais/refacladapt/src/tonehwdevice/tonehwdevice.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmhais/refacladapt/src/tonehwdevice/tonehwdevice.rss Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,59 @@ +// Copyright (c) 2006-2009 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: +// RESOURCE IDENTIFIER +// + + + +// INCLUDES +#include +#include "mmfplugininterfaceuids.hrh" // for KMmfUidPluginInterfaceHwDevice + +// CONSTANTS +// MACROS + + +// RESOURCE DEFINITIONS +// ----------------------------------------------------------------------------- +// +// Identifies adapters for ECOM. +// +// ----------------------------------------------------------------------------- +// +RESOURCE REGISTRY_INFO theInfo + { + dll_uid = 0x1028345E; + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMmfUidPluginInterfaceHwDevice; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = 0x10283463; + version_no = 1; + display_name = "PCM16->PCM16 Codec||Copyright © 1997-2001 Symbian Ltd. All Rights Reserved.||"; + default_data = "TONE, P16" ; + opaque_data = ""; + } + }; + } + }; + } + +// End of File + + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/bwins/mmrcclient.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/bwins/mmrcclient.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,15 @@ +EXPORTS + ??0RMMRCClient@@QAE@XZ @ 1 NONAME ; RMMRCClient::RMMRCClient(void) + ??1RMMRCClient@@UAE@XZ @ 2 NONAME ; RMMRCClient::~RMMRCClient(void) + ?Close@RMMRCClient@@QAEXXZ @ 3 NONAME ; void RMMRCClient::Close(void) + ?LogOn@RMMRCClient@@QAE_KVTProcessId@@@Z @ 4 NONAME ; unsigned long long RMMRCClient::LogOn(class TProcessId) + ?Open@RMMRCClient@@QAEHAAVMMultimediaResourceControlObserver@@@Z @ 5 NONAME ; int RMMRCClient::Open(class MMultimediaResourceControlObserver &) + ?SendResourceConfirmation@RMMRCClient@@QAEHXZ @ 6 NONAME ; int RMMRCClient::SendResourceConfirmation(void) + ?SendResourceErrorNotification@RMMRCClient@@QAEHXZ @ 7 NONAME ; int RMMRCClient::SendResourceErrorNotification(void) + ?SendResourceRequest@RMMRCClient@@QAEHPAVMLogicalChain@@0PAVCAudioContext@@@Z @ 8 NONAME ; int RMMRCClient::SendResourceRequest(class MLogicalChain *, class MLogicalChain *, class MAudioContext *) + ?SendResourceUpdateResult@RMMRCClient@@QAEHXZ @ 9 NONAME ; int RMMRCClient::SendResourceUpdateResult(void) + ?CancelRegisterAsClient@RMMRCClient@@QAEHVTUid@@@Z @ 10 NONAME ; int RMMRCClient::CancelRegisterAsClient(class TUid) + ?RegisterAsClient@RMMRCClient@@QAEHVTUid@@ABVTDesC8@@@Z @ 11 NONAME ; int RMMRCClient::RegisterAsClient(class TUid, class TDesC8 const &) + ?WillResumePlay@RMMRCClient@@QAEHXZ @ 12 NONAME ; int RMMRCClient::WillResumePlay(void) + ?ResetMessages@RMMRCClient@@QAEXXZ @ 13 NONAME ; void RMMRCClient::ResetMessages(void) + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/bwins/mmrcserver.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/bwins/mmrcserver.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,4 @@ +EXPORTS + ?NewL@CMMRCClientSideServerRequestToAdaptationAO@@SAPAV1@XZ @ 1 NONAME ; class CMMRCClientSideServerRequestToAdaptationAO * CMMRCClientSideServerRequestToAdaptationAO::NewL(void) + ?StartMMRCServer@@YAHAAVRThread@@@Z @ 2 NONAME ; int StartMMRCServer(class RThread &) + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/eabi/mmrcclient.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/eabi/mmrcclient.DEF Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,20 @@ +EXPORTS + _ZN11RMMRCClient19SendResourceRequestEP13MLogicalChainS1_P13CAudioContext @ 1 NONAME + _ZN11RMMRCClient24SendResourceConfirmationEv @ 2 NONAME + _ZN11RMMRCClient24SendResourceUpdateResultEv @ 3 NONAME + _ZN11RMMRCClient29SendResourceErrorNotificationEv @ 4 NONAME + _ZN11RMMRCClient4OpenER34MMultimediaResourceControlObserver @ 5 NONAME + _ZN11RMMRCClient5CloseEv @ 6 NONAME + _ZN11RMMRCClient5LogOnE10TProcessId @ 7 NONAME + _ZN11RMMRCClientC1Ev @ 8 NONAME + _ZN11RMMRCClientC2Ev @ 9 NONAME + _ZN11RMMRCClientD0Ev @ 10 NONAME + _ZN11RMMRCClientD1Ev @ 11 NONAME + _ZN11RMMRCClientD2Ev @ 12 NONAME + _ZTI11RMMRCClient @ 13 NONAME + _ZTV11RMMRCClient @ 14 NONAME + _ZN11RMMRCClient22CancelRegisterAsClientE4TUid @ 15 NONAME + _ZN11RMMRCClient16RegisterAsClientE4TUidRK6TDesC8 @ 16 NONAME + _ZN11RMMRCClient14WillResumePlayEv @ 17 NONAME + _ZN11RMMRCClient13ResetMessagesEv @ 18 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/eabi/mmrcserver.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/eabi/mmrcserver.def Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,6 @@ +EXPORTS + _Z15StartMMRCServerR7RThread @ 1 NONAME + _ZN42CMMRCClientSideServerRequestToAdaptationAO4NewLEv @ 2 NONAME + _ZTI22CARNNotificationObject @ 3 NONAME + _ZTV22CARNNotificationObject @ 4 NONAME + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/group/bld.inf Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2004-2009 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: +// Name bld.inf +// autor Symbian +// + + + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND +PRJ_PLATFORMS +DEFAULT + + + +PRJ_EXPORTS +./refmmrc.iby /epoc32/rom/include/refmmrc.iby + +PRJ_MMPFILES +../mmpfiles/mmrcserver.mmp +../mmpfiles/mmrcclient.mmp + + +#endif diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/group/multimedia_a3f_refmmrc.mrp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/group/multimedia_a3f_refmmrc.mrp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,16 @@ +#multimedia_a3f_refmmrc.mrp +# +#Copyright (c) Symbian Software Ltd 2007. All rights reserved. +# + +component multimedia_a3f_refmmrc + +source \sf\os\mm\mmresourcemgmt\mmresctrl + +binary \sf\os\mm\mmresourcemgmt\mmresctrl\group all + +exports \sf\os\mm\mmresourcemgmt\mmresctrl\group + +notes_source \component_defs\release.src + +ipr T \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/group/refmmrc.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/group/refmmrc.iby Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,32 @@ +// Copyright (c) 2006-2009 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: +// + + + + +#ifndef AUDIOPOLICY_IBY +#define AUDIOPOLICY_IBY + +#ifdef SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +//AudioPolicy + +file=ABI_DIR\BUILD_DIR\mmrcclient.dll System\Libs\mmrcclient.dll +file=ABI_DIR\BUILD_DIR\mmrcserver.dll System\Libs\mmrcserver.dll +// End of File + +#endif // SYMBIAN_MULTIMEDIA_A3FDEVSOUND + +#endif // AUDIOPOLICY_IBY \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcadaptationproxy.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcadaptationproxy.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,147 @@ +// Copyright (c) 2007-2009 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: +// mmrcserverphysicaladaptation.h +// +// + +#ifndef MMRCPHYSICALADAPTATION_H_ +#define MMRCPHYSICALADAPTATION_H_ + +#include +#include +#include +#include +#include "mmrcclientserver.h" +#include "maudiostreamadaptationobserver.h" + +class MLogicalChain; +class MAudioContext; +class CFourCCConvertor; +class CMMRCServerSideAdaptationResponseAO; +class CAudioStreamAdaptation; +class CMMRCServerSession; + +//------------------------------------------------------------------------------------ +// CMMRCClientSideServerRequestToAdaptationAO +//------------------------------------------------------------------------------------ + +/** +@internalComponent + +This class implements the proxy to the Physical adaptation. +The main purpose of this class is to communicate with the physical resource manager. +*/ +NONSHARABLE_CLASS( CMMRCClientSideServerRequestToAdaptationAO ): public CActive, public MAudioStreamAdaptationObserver + { +public: + /** + * Constructs, and returns a pointer to, a new CMMRCClientSideServerRequestToAdaptationAO object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCClientSideServerRequestToAdaptationAO* A pointer to newly created utlitly object. + */ + IMPORT_C static CMMRCClientSideServerRequestToAdaptationAO* NewL( ); + + /** + * Destructor. + */ + ~CMMRCClientSideServerRequestToAdaptationAO( ); + +public: + void Initialize(CMMRCServerSession* aServerSession, + CMMRCServerSideAdaptationResponseAO* aCallback, + RThread* aClientThread, + const CFourCCConvertor& aFourCCConvertor); + + void Service(TUint aRequestType); + + /** + * Callback in case of timeout + */ + void ResourceRequestAcknowledgmentTimeout( ); + + // from MAudioStreamAdaptationObserver + void PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError); + void StateEvent(TInt aReason, TAudioState aNewState); + void AddProcessingUnitComplete(TUid aType, TInt aError); + void RemoveProcessingUnitComplete(TUid aType, TInt aError); + void ProcessingFinished(); + void FlushComplete(TInt aError); + + //From CActive + virtual void RunL(); + virtual void DoCancel(); + +private: + /** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ + CMMRCClientSideServerRequestToAdaptationAO( ); + + void TidyUp(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL( ); + +private: + //owned + CAudioStreamAdaptation* iStreamAdaptation; + + //not owned + RThread* iClientThread; + CMMRCServerSession* iServerSession; + CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO; + + MLogicalChain* iLogicalChainRequested; + MLogicalChain* iLogicalChainLastCommited; + MAudioContext* iAudioContext; + TInt iRequestsProcessed; + TUint iRequestType; + }; + +//------------------------------------------------------------------------------------ +// CMMRCServerSideAdaptationResponseAO +//------------------------------------------------------------------------------------ + +/** +@internalComponent + +*/ +NONSHARABLE_CLASS( CMMRCServerSideAdaptationResponseAO ) : public CActive + { +public: + ~CMMRCServerSideAdaptationResponseAO(); + static CMMRCServerSideAdaptationResponseAO* NewL(); + void Initialize(CMMRCServerSession* aServerSession, RThread* iServerThread ); + void Service(TMMRCAdaptationToServerRequestResults aEvent, TInt aError); + void StartAdaptationListening(); +private: + CMMRCServerSideAdaptationResponseAO(); + void ConstructL( ); + void RunL( ); + void DoCancel( ); + +private: + //not owned + CMMRCServerSession* iMMRCServerSession; + RThread* iServerThread; + + TMMRCAdaptationToServerRequestResults iEvent; + TInt iError; + }; + +#endif /*MMRCPHYSICALADAPTATION_H_*/ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcclient.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,124 @@ +//mmrcclient.h + +// Copyright (c) 2007-2009 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: +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef RMMRCCLIENT_H +#define RMMRCCLIENT_H + +// INCLUDES +#include +#include +#include +#include "maudiostreamadaptationobserver.h" + +class MAudioContext; +class MLogicalChain; +class MMultimediaResourceControlObserver; +class CMMRCServer; +class CMMRCServerSession; +class CMMRCClientImplementation; +class CAudioContext; + +// CLASS DECLARATION +// +// This class opens connection and provides functions to MMRC server. +// +// @lib mmrcclient.lib +// +class RMMRCClient + { +public: + IMPORT_C RMMRCClient(); + + IMPORT_C virtual ~RMMRCClient(); + + // + // Open connection to server. + // + // @param aConnection Interface to server, must not be connected. + // @param aCallback Callback interface. + // @return an error code. KErrNone if successful, otherwise one of the system wide error codes. + // + IMPORT_C TInt Open(MMultimediaResourceControlObserver& aCallback); + + // + // Zero is invalid Context id and indicates error. + // @param aProcessId Process Id. + // @return TUint32 Context Id. + // + IMPORT_C TUint64 LogOn(TProcessId aProcessId); + + // + // Asynchronous return to ReceiveResourceResponse. + // + // @param aMessage Message to be sent. + // @return an error code. KErrNone if successful, otherwise one of the system wide error codes. + // + IMPORT_C TInt SendResourceRequest(MLogicalChain* aCurrent, MLogicalChain* aDesired, CAudioContext* aContext); + + // + // Synchronous. + // + // @return an error code. KErrNone if successful, otherwise one of the system wide error codes. + // + IMPORT_C TInt SendResourceConfirmation(); + + // + // Synchronous. + // + // @return an error code. KErrNone if successful, otherwise one of the system wide error codes. + // + IMPORT_C TInt SendResourceUpdateResult(); + + // + // Synchronous. + // + // @return an error code. KErrNone if successful, otherwise one of the system wide error codes. + // + IMPORT_C TInt SendResourceErrorNotification(); + + // + // Close connection to server. + // + IMPORT_C void Close(); + // + // Register a client for notification. + // + IMPORT_C TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData); + + // + // Cancel the register of a client for notification. + // + IMPORT_C TInt CancelRegisterAsClient(TUid aEventType); + // + // + // + IMPORT_C TInt WillResumePlay(); + + IMPORT_C void ResetMessages(); + +private: + CMMRCClientImplementation* iImplementation; + }; + +#endif // RMMRCCLIENT_H diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcclientimplementation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcclientimplementation.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,64 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef R_MMRCCLIENTIMPLEMENTATION_H +#define R_MMRCCLIENTIMPLEMENTATION_H + +#include +#include +#include +#include + + +#include "mmrcclient.h" +#include "mmrcclientserver.h" +#include "mmrcclientsession.h" +#include "mmrcmsgqueuehandlerobserver.h" + +class MMultimediaResourceControlObserver; +class CMMRCClientMsgQueueHandler; + +NONSHARABLE_CLASS(CMMRCClientImplementation) : public CBase, public MMMRCMsgQueueHandlerObserver + { +public: + static CMMRCClientImplementation* NewL(MMultimediaResourceControlObserver& aCallback); + ~CMMRCClientImplementation(); + + TUint64 LogOn(TProcessId aProcessId); + void Close(); + + TInt SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext); + + //for notification + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData); + TInt CancelRegisterAsClient(TUid aEventType); + TInt WillResumePlay(); + + //from MMMRCMsgQueueHandlerObserver + void HandleMessage(TMMRCQueueItem& aMessage); + + void ResetMessages(); +private: + void ConstructL(); + CMMRCClientImplementation(MMultimediaResourceControlObserver& aCallback); + +private: + MMultimediaResourceControlObserver& iObserver; + RMMRCClientSession iMMRCClientSession; + RMsgQueue iMsgQueue; + CMMRCClientMsgQueueHandler* iMsgClientQueueHandler; + }; + +#endif /* R_MMRCCLIENTIMPLEMENTATION_H */ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcclientmsgqueuehandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcclientmsgqueuehandler.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,52 @@ +// Copyright (c) 2006-2009 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: +// + + +#ifndef MMRCCLIENTMSGQUEUEHANDLER_H +#define MMRCCLIENTMSGQUEUEHANDLER_H + +#include +#include +#include +#include +#include "mmrcclientserver.h" + +class MMMRCMsgQueueHandlerObserver; + +NONSHARABLE_CLASS(CMMRCClientMsgQueueHandler) : public CActive + { +public: + static CMMRCClientMsgQueueHandler* NewL( + RMsgQueue& aMsgQueue, + MMMRCMsgQueueHandlerObserver& aObserver); + + ~CMMRCClientMsgQueueHandler(); + void ReceiveEvents(); + void RunL(); + TInt RunError(TInt aError); + void DoCancel(); + +private: + CMMRCClientMsgQueueHandler( + RMsgQueue& aMsgQueue, + MMMRCMsgQueueHandlerObserver& aObserver); + void ConstructL(); + +private: + RMsgQueue& iMsgQueue; + MMMRCMsgQueueHandlerObserver& iObserver; + }; + +#endif //__MMRCCLIENTMSGQUEUEHANDLER_H diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcclientserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcclientserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,117 @@ +// Copyright (c) 2006-2009 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: +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef MMRCCLIENTSERVER_H +#define MMRCCLIENTSERVER_H + +#include + +enum TReason + { + EUninitialize, + EInitialize, + EUnload, + ELoad, + EStop, + EPrimeReason, + EActivate, + EReasonError + }; + +// Function opcodes for client to server messaging +enum TMMRCClientToServerMessages + { + EMMRCClientToServerSetClientThreadId = 0, + EMMRCClientToServerSetMsgQueueHandle, + EMMRCClientToServerSetAdaptationProxy, + EMMRCClientToServerSetCallback, + EMMRCClientToServerRequestContextId, + EMMRCClientToServerCloseSession, + EMMRCClientToServerRequestResource, + EMMRCClientToServerRegisterAsClient, + EMMRCClientToServerCancelRegisterAsClient, + EMMRCClientToServerWillResumePlay + }; + +// Function opcodes for server to client messaging +enum TMMRCServerToClientMessageCallTypes + { + }; + +// Function opcodes for server to client messaging +enum TMMRCServerToClientMessageResults + { + EMMRCServerToClientResourceAgreed = 0, + EMMRCServerToClientResourcePreempt, + EMMRCServerToClientResourceDenied, + EMMRCServerToClientCommitUpdate, + EMMRCServerToClientRequestError + }; + +// Function opcodes for server to client messaging +enum TMMRCAdaptationToServerRequestResults + { + EMMRCAdaptationToServerResourceComplete = 0, + EMMRCAdaptationToServerResourceIncomplete, + EMMRCAdaptationToServerResourceTimeout, + EMMRCAdaptationToServerShutdown + }; + +enum TMMRCServerState + { + EMMRCServerStateIdle = 0, + EMMRCServerStateWaitResourceResponseFromAdaptation, + EMMRCServerStateWaitPreemptionResponse + }; + +enum TMMRCRule + { + EAlwaysProcess = 0, + EProcessOnIdle + }; + + + +enum TMMRCRequestType + { + EMMRCRequestCommitUpdate = 0, + EMMRCRequestCommitResponse, + EMMRCRequestResourceUnallocated + }; + + +class MLogicalChain; + +class TMMRCQueueItem + { +public: + MLogicalChain* iData; + TMMRCRequestType iRequestType; + TMMRCServerToClientMessageResults iResult; + TInt iErrorCode; + TUint iMessageSize; + }; + + IMPORT_C TInt StartMMRCServer(RThread& aServerThread); + +#endif //__MMRCCLIENTSERVER_H + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcclientsession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcclientsession.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,71 @@ +// Copyright (c) 2006-2009 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: +// + +#ifndef MMRCCLIENTSESSION_H__ +#define MMRCCLIENTSESSION_H__ + +#include "mmrcclientserver.h" + +#include +#include +#include +#include "mmrcclientserver.h" + +class MLogicalChain; +class MAudioContext; +class MMultimediaResourceControlObserver; +class CMMRCClientSideServerRequestToAdaptationAO; +class CAudioContext; + +NONSHARABLE_CLASS(RMMRCClientSession) : public RSessionBase + { +public: + RMMRCClientSession(); + RMMRCClientSession::~RMMRCClientSession(); + + TInt StartServer(); + TInt Open(MMultimediaResourceControlObserver& aCallback); + TUint64 LogOn(TProcessId aProcessId); + void Close(); + + void InitializeServerL(RHandleBase& aMsgQueueHandle); + TInt SendResourceRequest(MLogicalChain* aCurrent, MLogicalChain* aDesired, CAudioContext* aContext); + void ResourceRequestResponse(MLogicalChain* aChainResponse, TMMRCServerToClientMessageResults aResult, TInt aError); + + //for notification + TInt RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData); + TInt CancelRegisterAsClient(TUid aEventType); + TInt WillResumePlay(); + + void ResetMessages(); +private: + //void SendRequestResourceDataL(); + +private: + RThread iServerThread; + TRequestStatus *iCallingStatus; + + //owned + MLogicalChain* iLogicalChainLastCommited; + MLogicalChain* iLogicalChainRequested; + CMMRCClientSideServerRequestToAdaptationAO* iMMRCClientSideServerRequestToAdaptationAO; + + //not owned + MMultimediaResourceControlObserver* iObserver; + + TInt iCurrentRequestId; + }; + +#endif //__MMRCCLIENTSESSION_H__ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcerrorcodes.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcerrorcodes.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,34 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCERROR_H_ +#define MMRCERROR_H_ + + +#define KMMRCErrorNaneNotImplemented _L("Not implemented") +#define KMMRCErrorNameUnkwnonAudioState _L("Unknown audio state") +#define KMMRCErrorNameLogicalChainNull _L("Logical chain should not be null") +#define KMMRCErrorNamesessionLost _L("Session should not be null") + +enum TMMRCError +{ + KMMRCErrorNotImplemented, + EMMRCErrorUnkwnonAudioState, + EMMRCErrorLogicalChainNull, + EMMRCErrorSessionLost +}; + + +#endif /*MMRCERROR_H_*/ \ No newline at end of file diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcmsgqueuehandlerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcmsgqueuehandlerobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,26 @@ +// Copyright (c) 2007-2009 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: +// + + +#ifndef MMRCMSGQUEUEHANDLEROBSERVER_H +#define MMRCMSGQUEUEHANDLEROBSERVER_H + +class MMMRCMsgQueueHandlerObserver + { +public: + virtual void HandleMessage(TMMRCQueueItem& aMessage) = 0; + }; + +#endif //__MMRCMSGQUEUEHANDLEROBSERVER_H diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,106 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCSERVER_H__ +#define MMRCSERVER_H__ + +#include +#include +#include +#include +#include "mmrcclientserver.h" + +/** +* @file +* @internalTechnology +*/ + +class TServerStart; +class CMMRCServerSession; +class CMMRCServerController; +class MMultimediaResourceControlObserver; +class CFourCCConvertor; + +// reasons for server panic +enum TCountServPanic + { + EBadRequest = 1, + EBadDescriptor + }; + +/** +@internalComponent + +This class implements the MMRC Server. +The main purpose of this class is to implement the MMRC Server +*/ +NONSHARABLE_CLASS( CMMRCServer ): public CServer2 + { +public: + /** + * Constructs, and returns a pointer to, a new CMMRCServer object. + * Leaves on failure. + * @return CMMRCServer* A pointer to newly created utlitly object. + */ + static CMMRCServer* NewL(); + + /** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServer object. + * Leaves on failure. + * @return CMMRCServer* A pointer to newly created utlitly object. + */ + static CMMRCServer* NewLC(); + + /** + * Destructor. + */ + ~CMMRCServer(); + +public: + // The thread function executed by the server + static TInt ThreadFunction(TAny* aStarted); + + // Creates a new session with the server; the function + // implements the pure virtutal function + // defined in class CServer2 + CSession2* NewSessionL(const TVersion& aVersion,const RMessage2& aMessage) const; +private : + // The thread function executed by the server + static TInt ThreadFunctionL(TAny* aStarted); + + // Function to panic the server + static void PanicServer(TInt aPanic); + + /** + * By default Symbian 2nd phase constructor is private. + */ + CMMRCServer(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + // owned + CMMRCServerController* iMMRCServerController; //MMRC Server controller + + //Not ownwed. + CFourCCConvertor* iFourCCConvertor; + + }; + +#endif //__MMRCSERVER_H__ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcservercontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcservercontroller.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,193 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCSERVERCONTROLLER_H__ +#define MMRCSERVERCONTROLLER_H__ + +#include +#include +#include +#include "mmrcclientserver.h" + +class CMMRCServerInfo; +class MMMRCServerInfoState; +class CMMRCServerSession; +class CMMRCServerRuleManager; +class CARNNotificationObject; + + +/** +Panic category and codes that MMRCServerController raises on the client +*/ +_LIT(KMMRCServerControllerPanicCategory, "MMRCServerController"); + +enum TMMRCServerControllerPanicCodes + { + EProcessNextRequestLeft = 1, + EPushPauseContextLeft, + EPushAllocatedResourceContextFailed + }; + + +/** +@internalComponent + +This class implements the MMRC Server Controller. +The main purpose of this class is to control the different transactions +*/ +NONSHARABLE_CLASS( CMMRCServerController ): public CBase + { +public: + /** + * Constructs, and returns a pointer to, a new CMMRCServerController object. + * Leaves on failure. + * @return CMMRCServerController* A pointer to newly created utlitly object. + */ + static CMMRCServerController* NewL(); + + /** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerController object. + * Leaves on failure. + * @return CMMRCServerController* A pointer to newly created utlitly object. + */ + static CMMRCServerController* NewLC(); + + /** + * Destructor. + */ + ~CMMRCServerController(); + +public: + + /** + * Process the request pointer by a specific session + * @param CMMRCServerSession& aServerSession + * @return KerrNone in case of success of the process + */ + TInt EnqueueRequestL(CMMRCServerSession& aServerSession ); + + /** + * Callback from the adaptation + * @param MLogicalChain* aOldChain + * @param MLogicalChain* aNewChain + * @param TMMRCAdaptationToServerRequestResults aResult + */ + void AdaptationRequestAcknowledgment(CMMRCServerSession& aServerSessionAllocatedResource, TMMRCAdaptationToServerRequestResults aResult, TInt aError); + + /* + * + */ + void CloseSessionByContextId(TInt32 aContextId); + + /* + * + */ + void ClientAcknowledgment(CMMRCServerSession& aServerSession); + + /* + * + */ + void ServerState(TMMRCServerState& aServerState, TUint64& aContextId) const; + + /** + * + * @param CMMRCServerSession& aServerSession + * @return KerrNone in case of success of the process + */ + TInt EnqueueRequestForAPRL(CMMRCServerSession& aServerSession ); + + /** + * + * @param CMMRCServerSession& aServerSession + * @return KerrNone in case of success of the process + */ + TInt RemoveRequestForAPR(CMMRCServerSession& aServerSession ); + + /** + * + * @return KerrNone in case of success of the process + */ + TInt WillResumePlay(); + + +private: + /** + * Process the first request with the highest priority from the FIFO queue + * @return KerrNone in case of success of the process + */ + TInt ProcessNextRequestL(); + + /** + * Send a resource request to the adaptation + * @param CMMRCServerSession& aServerSession + * @return KerrNone in case of success of the process + */ + TInt SendResourceRequest( CMMRCServerSession& aServerSession ); + + /** + * Send a preemption request to the adaptation + * @param CMMRCServerSession& aServerSession + * @return KerrNone in case of success of the process + */ + TInt SendPreemptionRequest( CMMRCServerSession& aServerSession ); + + /** + * Pop the decision rule on the base of the current in-process request and a new committed request + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule + */ + TMMRCRule DecisionRule(TAudioState aAudioStateAllocatedResource, TAudioState aAudioStateRequiringProcess); + + /** + * Pop the action reason on the base of the last committed request and the current one + * @param TAudioState aAudioStateLastCommitted + * @param TAudioState aAudioStateRequested + * @return TReason + */ + TReason ActionReason(TAudioState aAudioStateLastCommitted, TAudioState aAudioStateRequested); + + /** + * Notify all the paused client that a resource has been unallocated + */ + void NotifyPausedClientsResourceUnallocated(); + + + /* + * + */ + void Panic(TMMRCServerControllerPanicCodes aCode); + +private: + + /** + * By default Symbian 2nd phase constructor is private. + */ + CMMRCServerController(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + //owned + CMMRCServerInfo* iMMRCServerInfo; + CMMRCServerRuleManager* iMMRCServerRuleManager; + CARNNotificationObject* iARNNotificationObject; + }; + +#endif //__MMRCSERVERCONTROLLER_H__ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcserverinfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcserverinfo.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,275 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCSERVERINFO_H__ +#define MMRCSERVERINFO_H__ + +#include +#include +#include "mmrcutil.h" +#include "mmrcclientserver.h" +#include "mmrcserversession.h" + +class CMMRCServerController; + +/** +@internalComponent + +This class implements the MMRC Server Info. +The main purpose of this class is to contain the different information + about the MMRC Server. + The server state + The queue of resource Context + The queue of resource in process +*/ +NONSHARABLE_CLASS( CMMRCServerInfo ): public CBase + { + typedef RMMRCFifoQueue RMMRCContextsQueueTD; + typedef RMMRCFifoOrderQueue RMMRCContextsQueueOrderTD; + +public: + /** + * Constructs, and returns a pointer to, a new CMMRCServerInfo object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerInfo* A pointer to newly created utlitly object. + */ + static CMMRCServerInfo* NewL(CMMRCServerController& aServerController); + + /** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerInfo object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerInfo* A pointer to newly created utlitly object. + */ + static CMMRCServerInfo* NewLC(CMMRCServerController& aServerController); + + /** + * Destructor. + */ + ~CMMRCServerInfo(); + +public: + + TInt AllocatedPausedContextsCount(); + TInt RequestsCount(); + TInt AllocatedResourceContextsCount(); + TInt AllocatedAPRContextsCount(); + + + /** + * Change the state of the server + * @param TMMRCServerState aNewState + * @param TUint64 aContextId + */ + void SwitchServerState(TMMRCServerState aNewState, TUint64 aContextId); + + + /** + * get the state of the server + * @param TMMRCServerState the state of the server + * @param TUint64 aContextId + */ + void ServerState(TMMRCServerState& aServerState, TUint64& aContextId) const; + + /** + * Push a Context on the Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ + void PushRequestL(const CMMRCServerSession& aServerSession); + + /** + * Pop and remove the first Context from the Context queue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstRequest(); + + /** + * Pop and remove the first Context from the Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstRequestByContextId( const TAudioContextId& aContextId ); + + /** + * Pop and remove the first Context of the highest priority from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveRequestFirstHighestPriority( ); + + /** + * Pop and remove the first Context of the highest priority and more than aPriority + * from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveRequestFirstHighestPriority( TInt aPriority ); + + /** + * Pop the first Context from the Context queue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopFirstRequest( ) const; + + /** + * Pop the first Context of the highest priority from the Context queue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopRequestFirstHighestPriority( ) const; + + /** + * Pop the first Context of the highest priority and more than aPriority + * from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopRequestFirstHighestPriority( TInt aPriority ) const; + + /** + * Push an Context on the in-process Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ + void PushAllocatedResourceContextL(const CMMRCServerSession& aServerSession); + + /** + * Pop and remove the first Context of the highest priority from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstAllocatedResourceContext(); + + /** + * Pop and remove the first Context from the in-process Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstAllocatedResourceContextByContextId( const TAudioContextId& aContextId ); + + + /** + * Pop the first Context from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopFirstAllocatedResourceContext( ) const; + + void PushPausedContextL(const CMMRCServerSession& aServerSession ); + CMMRCServerSession* PopAndRemoveFirstPausedContext(); + CMMRCServerSession* PopAndRemovePausedContext(const TAudioContextId& aContextId ); + CMMRCServerSession* PausedContextByIndex(TInt aIndex); + + void PushAPRContextL(const CMMRCServerSession& aServerSession ); + CMMRCServerSession* PopAndRemoveFirstAPRContext(); + CMMRCServerSession* PopAndRemoveFirstAPRContextByContextId(const TAudioContextId& aContextId ); + CMMRCServerSession* PopFirstAPRContext() const; + + TBool IsOnAPRList(TAudioContextId aId); + TBool IsOnPauseList(TAudioContextId aId); + + +private: + /** + * Push an Context on the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ + void PushContextL(RMMRCContextsQueueTD& aContextsQueue, const CMMRCServerSession& aServerSession); + + /** + * Pop and remove the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstContext(RMMRCContextsQueueTD& aContextsQueue); + + /** + * Pop and remove the first Context from the Context queue in parameter by contextId + * @param RMMRCContextsQueueTD& aContextsQueue + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveFirstContextByContextId(RMMRCContextsQueueTD& aContextsQueue, const TAudioContextId& aContextId ); + + /** + * Pop and remove the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue); + + /** + * Pop and remove the first Context of the highest priority and more than aPriority + * from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue, TInt aPriority ); + + /** + * Pop the first Context from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopFirstContext(const RMMRCContextsQueueTD& aContextsQueue) const; + + /** + * Pop the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue) const; + + /** + * Pop the first Context of the highest priority and more than aPriority + * from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ + CMMRCServerSession* PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue, TInt aPriority ) const; + + void PushContextInOrderL(RMMRCContextsQueueOrderTD& aContextsQueue, const CMMRCServerSession& aServerSession); + CMMRCServerSession* PopAndRemoveFirstContextForPause(RMMRCContextsQueueOrderTD& aContextsQueue); + CMMRCServerSession* PopAndRemoveContextIdForPause(RMMRCContextsQueueOrderTD& aContextsQueue, const TAudioContextId& aContextId ); + CMMRCServerSession* PausedContextByIndexForPause(RMMRCContextsQueueOrderTD& aContextsQueue, TInt aIndex); + + +private: + /** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ + CMMRCServerInfo(CMMRCServerController& aServerController); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + CMMRCServerController& iMMRCServerController; + TMMRCServerState iMMRCServerInfoState; + RMMRCContextsQueueTD iMMRCContextsQueue; //0 or more context(s) + RMMRCContextsQueueTD iMMRCAllocatedResourceContextsQueue; + RMMRCContextsQueueOrderTD iMMRCPausedContextsQueue; + RMMRCContextsQueueTD iMMRCAPRContextsQueue; + TUint64 iLastTransactionContextId; + }; + +#endif //__MMRCSERVERINFO_H__ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcserverrulemanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcserverrulemanager.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,98 @@ +// Copyright (c) 2007-2009 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: +// mmrcserverpolicaymanager.h +// +// + +#ifndef MMRCSERVERPOLICYMANAGER_H__ +#define MMRCSERVERPOLICYMANAGER_H__ + +#include +#include +#include +#include "mmrcclientserver.h" + +class CMMRCServerSession; +class CMMRCServerController; +class MMMRCServerInfoState; + +/** +@internalComponent + +This class implements the MMRC Server Rule Manager. +The main purpose of this class is to +*/ +NONSHARABLE_CLASS( CMMRCServerRuleManager ): public CBase + { +public: + /** + * Constructs, and returns a pointer to, a new CMMRCServerRuleManager object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerRuleManager* A pointer to newly created utlitly object. + */ + static CMMRCServerRuleManager* NewL(CMMRCServerController& aServerController); + + /** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerRuleManager object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerRuleManager* A pointer to newly created utlitly object. + */ + static CMMRCServerRuleManager* NewLC(CMMRCServerController& aServerController); + + /** + * Destructor. + */ + ~CMMRCServerRuleManager(); + +public: + /** + * Deduce the rule on the message according to the previous and current state + * Return KErrNotFound if no rule has been found. + * Leaves on failure. + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule rule + */ + TMMRCRule DecisionRule( TAudioState aAudioStateAllocatedResource, TAudioState aAudioStateRequiringProcess ); + + /** + * Deduce the rule on the message according to the previous and current state + * Return KErrNotFound if no rule has been found. + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule rule + */ + TReason ActionReason( TAudioState aAudioStateLastCommited, TAudioState aAudioStateRequested ); + +private: + /** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ + CMMRCServerRuleManager(CMMRCServerController& aServerController); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + CMMRCServerController& iMMRCServerController; + }; + +#endif //__MMRCSERVERPOLICYMANAGER_H__ + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcserversession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcserversession.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,301 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCSERVERSESSION_H__ +#define MMRCSERVERSESSION_H__ + +#include +#include +#include +#include +#include "mmrcclientserver.h" + +/** +* @file +* @internalTechnology +*/ + +class MMultimediaResourceControlObserver; +class MLogicalChain; +class CFourCCConvertor; +class MAudioContext; +class CMMRCServerController; +class CMMRCServerSession; +class CMMRCClientSideServerRequestToAdaptationAO; +class CMMRCServerSideAdaptationResponseAO; +class CAudioContext; + +enum TMMRCServerSessionRequestType + { + ENormalRequest, + EPreemptionRequest, + }; + +/** +Panic category and codes that MMRCServerSession raises on the client +*/ +_LIT(KMMRCServerSessionPanicCategory, "MMRCServerSession"); + +enum TMMRCServerSessionPanicCodes + { + ECloneLeftWhenSendingResponseToClient =1, + EMsgQueueFailedToSendMsg + }; + +/** +@internalComponent +This class implements the MMRC Server Session. +*/ +NONSHARABLE_CLASS(CMMRCServerSession) : public CSession2 + { + //friend class CTimeoutClientAcknowledment; +public: + /** + * Constructs, and returns a pointer to, a new CMMRCServerSession object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @param CFourCCConvertor& A reference to the Fourcc to format converter + * @return CMMRCServerSession* A pointer to newly created utlitly object. + */ + static CMMRCServerSession* NewL(CMMRCServerController& aMMRCServerController, + const CFourCCConvertor& aFourCCConvertor); + + /** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerSession object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @param CFourCCConvertor& A reference to the Fourcc to format converter + * @return CMMRCServerSession* A pointer to newly created utlitly object. + */ + static CMMRCServerSession* NewLC(CMMRCServerController& aMMRCServerController, + const CFourCCConvertor& aFourCCConvertor); + + /** + * Destructor. + */ + ~CMMRCServerSession(); + + + /** + * from CSession2 + * @param aMessage - Function and data for the session + */ + void ServiceL(const RMessage2& aMessage); + + /* + * + */ + void StartProcessL(); + + /* + * + */ + void StartPreemptionL(); + + /** + * Callback on a resource request + * @param TMMRCServerToClientMessageResults aResult the result on the request + * @leave + */ + void AdaptationRequestAcknowledgment(TMMRCAdaptationToServerRequestResults aResult, TInt aError); + + /** + * Notify all the paused client that a resource has been unallocated + */ + void NotifyClientResourceUnallocated(); + + /** + * return the current committed chain (const) + * @return the current committed chain + */ + const MLogicalChain* LogicalChainRequested() const; + + /** + * return the current committed chain (const) + * @return the current committed chain + */ + const MLogicalChain* LogicalChainRequestedStack() const; + + /** + * return the last committed chain (const) + * @return the last committed chain + */ + const MLogicalChain* LogicalChainLastCommited() const; + + /* + * + */ + const MAudioContext* AudioContext() const; + + /** + * return the current committed chain + * @return the current committed chain + */ + MLogicalChain* LogicalChainRequested(); + + /** + * return the current committed chain + * @return the current committed chain + */ + MLogicalChain* LogicalChainRequestedStack(); + + /** + * return the last committed chain + * @return the last committed chain + */ + MLogicalChain* LogicalChainLastCommited(); + + /** + * + */ + CMMRCClientSideServerRequestToAdaptationAO* AdaptationProxy(); + + + CMMRCServerSideAdaptationResponseAO* ServerProxy(); + /** + * + */ + TUint64 ContextId(); + + /** + * + */ + TBool HasMultimediaCapability() const; + + /** + * + */ + void Clean(); + + /** + * + */ + TBool IsServerShuttingDown(); + + TInt RequestsSent(); + + TInt SendRequestToAdaptation(TMMRCServerSessionRequestType aRequestType); + + TInt GetPriority() const; + + /** + * + */ + TBool HasUserEnvironmentCapability(); + + /* + * + */ + TInt NotifyClientOfError(TInt aError); + +protected: + + void IncrementRequestsSent(); + + /* + * + */ + void Disconnect(const RMessage2& aMessage); + +private: + + //Constructor + /** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @param CFourCCConvertor& A reference to the Fourcc to format converter + */ + CMMRCServerSession(CMMRCServerController& aMMRCServerController, + const CFourCCConvertor& aFourCCConvertor); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Dispatch the message received from ServeL + * EMMRCClientToServerSetMsgQueueHandle - Initialise the queue handler + * EMMRCClientToServerMessage - Process a message from the client + * EMMRCClientToServerMessageUpdate - Process a message update from the client + * EMMRCClientToServerMessageAcknowledgement - Process the acknowldgement from the client + * @param aMessage - Function and data for the session + * @return error code + * @leave in case of writeL leave or request leave + */ + TInt DispatchMessageL(const RMessage2& aMessage); + + /* + * + */ + TInt EnqueueRequestL(const RMessage2& aMessage); + + /* + * + */ + void PreProcessRequestL(const RMessage2& aMessage); + + + /* + * + */ + void ProcessResourceDataRequestL(const RMessage2& aMessage); + + /* + * + */ + void SendRequestResponseToClient(TMMRCQueueItem& messageItem); + + /* + * + */ + void SendPreemptionNotificationToClient(TMMRCQueueItem& messageItem); + + + /* + * + */ + void Panic(TMMRCServerSessionPanicCodes aCode); + +private: + RMsgQueue iMsgQueue; // + CMMRCServerController& iMMRCServerController; // a reference on the MMRC Server controller + //RThread iClientThread; + RThread iServerThread; + RThread iClientThread; + TBool iShutdown; + //owned + CMMRCServerSideAdaptationResponseAO* iMMRCServerSideAdaptationResponseAO; + MLogicalChain* iLogicalChainRequestedStack; // the new committed chain + MLogicalChain* iLogicalChainLastCommitedStack; // the last committed + MLogicalChain* iLogicalChainRequested; // the new committed chain + MLogicalChain* iLogicalChainLastCommited; // the last committed + MLogicalChain* iLogicalChainRequestResponse; // A copy of the chain for client response + MLogicalChain* iLogicalChainPreemptionNotification; // A copy of the chain for preemption notification to the client + + //not owned (can be null pointers) + CAudioContext* iAudioContext; + const CFourCCConvertor* iFourCCConvertor; + CMMRCClientSideServerRequestToAdaptationAO* iMMRCClientSideServerRequestToAdaptationAO; + + //not own + TInt32 iContextId; + TInt32 iRequestsSent; + TBool iClientHasMMCapability; + TBool iClientHasUECapability; + }; + +#endif //__MMRCSERVERSESSION_H__ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcserverstart.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcserverstart.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,65 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef MMRCSERVERSTART_H +#define MMRCSERVERSTART_H + +_LIT(KMMRCServerName,"MMRCServer"); +_LIT(KMMRCServerFileName,"mmrcserver"); + +const TUid KMMRCServerUID3 = {0x102021d5}; + +const TInt KMMRCServerStackSize=0x2000; // 8KB +const TInt KMMRCServerInitHeapSize=0x1000; // 4KB +const TInt KMMRCServerMaxHeapSize=0x1000000; // 16MB + +const TUint KMMRCServerVersion=1; +const TUint KMMRCServerMinorVersionNumber=0; +const TUint KMMRCServerBuildVersionNumber=0; + +class TServerStart + { + public: + TServerStart() {}; + TServerStart(TRequestStatus& aStatus); + TPtrC AsCommand() const; + TInt GetCommand(); + void SignalL(); + private: + TThreadId iId; + TRequestStatus* iStatus; + }; + +inline TServerStart::TServerStart(TRequestStatus& aStatus) +:iId(RThread().Id()),iStatus(&aStatus) + { + aStatus = KRequestPending; + } + +// Descriptorizes ’this’ to pass it from client to server +inline TPtrC TServerStart::AsCommand() const + { + return TPtrC(reinterpret_cast(this),sizeof(TServerStart)/sizeof(TText)); + } + +void TServerStart::SignalL() + { + RThread client; + User::LeaveIfError(client.Open(iId)); + client.RequestComplete(iStatus, KErrNone); + client.Close(); + } +#endif //__MMRCSERVERSTART_H + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/mmrcutil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/mmrcutil.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,378 @@ +// Copyright (c) 2007-2009 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: +// + +#ifndef _MMRCUTIL_H_ +#define _MMRCUTIL_H_ + +#include + +template +class RMMRCFifoQueue + { +public: + RMMRCFifoQueue( ); + ~RMMRCFifoQueue( ); + + void Reset( ); + void ResetAndDestroy(); + TBool IsEmpty( ) const; + TInt Count() const; + T* PopAndRemove( ); + T* PopAndRemove( TInt aIndex ); + void PushL( T const* const aElement ); + T* Pop( ) const; + T* Pop( TInt aIndex ) const; + T* operator[] ( TInt aIndex ) const; + +private: + RMMRCFifoQueue( const RMMRCFifoQueue & aMMRCFifoQueue ); //not implemented + const RMMRCFifoQueue & operator= ( const RMMRCFifoQueue & aMMRCFifoQueue ); //not implemented + +private: + struct TListNode + { + T const* iElement; + TListNode *iNext; + + TListNode( T const* const aElement ) + : iElement( aElement ), iNext(NULL) { } + }; + + TListNode *iFirst; + TListNode *iLast; + TInt iCount; + }; + +/** + Construct the queue. +*/ +template +RMMRCFifoQueue::RMMRCFifoQueue( ) + { + iFirst = iLast = NULL; + iCount = 0; + } + +/** + Destructor. +*/ +template +RMMRCFifoQueue::~RMMRCFifoQueue( ) + { + Reset( ); + } + + +/** + Delete each node without deleting the elements. +*/ +template +void RMMRCFifoQueue::Reset( ) + { + while( !IsEmpty( ) ) + { + PopAndRemove( ); + } + } + +/** + Delete each node and each element. +*/ +template +void RMMRCFifoQueue::ResetAndDestroy( ) + { + while( !IsEmpty( ) ) + { + T* element = PopAndRemove( ); + delete element; + } + } + +/** + Return the number of elements. +*/ +template +TInt RMMRCFifoQueue::Count( ) const + { + return iCount; + } + + +/** + Test if the queue is logically empty. + Return TTrue if empty, TFalse, otherwise. +*/ +template +TBool RMMRCFifoQueue::IsEmpty( ) const + { + return iFirst == NULL; + } + + +/** + Return and remove the least recently inserted item from the queue. +*/ +template +T* RMMRCFifoQueue::PopAndRemove( ) + { + T* element = NULL; + if( !IsEmpty( ) ) + { + TListNode* front = iFirst; + element = const_cast(iFirst->iElement); + iFirst = iFirst->iNext; + if( NULL == iFirst ) + { + iLast = NULL; + } + iCount--; + delete front; + front = NULL; + } + return element; + } + +/** + Return and remove the least recently inserted item from the queue. +*/ +template +T* RMMRCFifoQueue::PopAndRemove( TInt aIndex ) + { + T* element = NULL; + TListNode* PreviousNode = NULL; + TListNode* node = iFirst; + TInt i = 0; + for( ; iiNext ; i++) + { + PreviousNode = node; + node = node->iNext; + } + + if(node && i < iCount) + { + if(PreviousNode) + { + PreviousNode->iNext = node->iNext; + if( NULL == node->iNext ) + { + iLast = PreviousNode; + } + } + else + { + iFirst = node->iNext; + if( NULL == iFirst ) + { + iLast = NULL; + } + } + element = const_cast(node->iElement); + iCount--; + delete node; + } + return element; + } + +/** + Insert aElement into the queue. +*/ +template +void RMMRCFifoQueue::PushL( T const* const aElement ) + { + if( IsEmpty( ) ) + { + iLast = iFirst = new(ELeave) TListNode( aElement ); + } + else + { + iLast = iLast->iNext = new(ELeave) TListNode( aElement ); + } + iCount++; + } + +/** + Pop a pointer of the aIndex elements. +*/ +template +T* RMMRCFifoQueue::Pop ( ) const + { + T* element = NULL; + TListNode* node = iFirst; + + if( node ) + { + element = const_cast(node->iElement); + } + + return element; + } + +/** + Pop a pointer of the aIndex elements. +*/ +template +T* RMMRCFifoQueue::Pop ( TInt aIndex ) const + { + T* element = NULL; + TListNode* node = iFirst; + + TInt i = 0; + for( ; (i < aIndex) && (i < iCount) && (node->iNext != NULL) ; i++) + { + node = node->iNext; + } + + if( ( NULL != node ) + && ( i < iCount ) ) + { + element = const_cast(node->iElement); + } + + return element; + } + +/** + Pop a pointer of the aIndex elements. +*/ +template +T* RMMRCFifoQueue::operator[] ( TInt aIndex ) const + { + return Pop(aIndex); + } + + +/** + Class for manage the list of the sessions requesting pause. +*/ +template +class RMMRCFifoOrderQueue : private RMMRCFifoQueue + { + +public: + RMMRCFifoOrderQueue( ); + ~RMMRCFifoOrderQueue( ); + void ResetAndDestroy( ); + TInt Count() const; + void PushL( T const* const aElement ); + T* PopAndRemoveForPause( TInt aIndex ); + T* operator[] ( TInt aIndex ) const; + + +private: + RPointerArray< T > iQueue; + }; + + +/** + Construct the queue. +*/ +template +RMMRCFifoOrderQueue::RMMRCFifoOrderQueue( ) + { + } + +/** + Destructor. +*/ +template +RMMRCFifoOrderQueue::~RMMRCFifoOrderQueue( ) + { + iQueue.Reset(); + iQueue.Close(); + } + +/** + Return the number of elements. +*/ +template +TInt RMMRCFifoOrderQueue::Count( ) const + { + + TInt iNum = iQueue.Count(); + return iNum; + } + +/** + Delete each node and each element. +*/ +template +void RMMRCFifoOrderQueue::ResetAndDestroy( ) + { + iQueue.ResetAndDestroy(); + } + +/** + Insert aElement into the queue and ordered. +*/ +template +void RMMRCFifoOrderQueue::PushL( T const* const aElement ) + { + TInt numElements = iQueue.Count(); + + if( numElements == 0 ) + { + iQueue.Append(aElement); //iQueue: We need to check the error here + return; + } + + for(TInt i(0); iHasMultimediaCapability() && !(iQueue[i]->HasMultimediaCapability())) + { + iQueue.Insert(aElement, i); + return; + } + else if(aElement->HasMultimediaCapability() == iQueue[i]->HasMultimediaCapability()) + { + if (aElement->GetPriority() > iQueue[i]->GetPriority()) + { + iQueue.Insert(aElement,i); + return; + } + } + } + iQueue.Insert(aElement,numElements); + } + +/** + Return and remove the inserted item from the queue. +*/ +template +T* RMMRCFifoOrderQueue::PopAndRemoveForPause( TInt aIndex ) + { + T* aux = NULL; + aux = iQueue[aIndex]; + iQueue.Remove(aIndex); + return aux; + } + + +/** + Pop a pointer of the aIndex elements. +*/ +template +T* RMMRCFifoOrderQueue::operator[] ( TInt aIndex ) const + { + if(iQueue.Count() != 0) + { + return iQueue[aIndex]; + } + else + { + return NULL; + } + } + +#endif /*_MMRCUTIL_H_*/ diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/inc/multimediaresourcecontrolobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/inc/multimediaresourcecontrolobserver.h Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,44 @@ +//multimediaresourcecontrolobserver.h + +// Copyright (c) 2007-2009 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: +// + + + +/** + @file + @internalTechnology +*/ + +#ifndef M_MULTIMEDIARESOURCECONTROLOBSERVER_H +#define M_MULTIMEDIARESOURCECONTROLOBSERVER_H + +class MLogicalChain; + +class MMultimediaResourceControlObserver + { + +public: + + virtual void ReceiveResourceUpdate(MLogicalChain *aMessage, TInt aError) = 0; + + virtual void ReceiveResourceResponse(MLogicalChain *aMessage, TInt aError) = 0; + + virtual void ReceivePreemptionUpdate(MLogicalChain *aMessage, TInt aError) = 0; + + virtual void CanResume() = 0; + }; + +#endif // M_MULTIMEDIARESOURCECONTROLOBSERVER_H diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/mmpfiles/mmrcclient.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/mmpfiles/mmrcclient.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,52 @@ +// Copyright (c) 2007-2009 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: +// + + + +TARGET mmrcclient.dll +TARGETTYPE dll +UID 0x1000008d 0x1028345F + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +SOURCEPATH ../src/mmrcclient +SOURCE mmrcclient.cpp +SOURCE mmrcclientimplementation.cpp +SOURCE mmrcclientsession.cpp +SOURCE mmrcclientmsgqueuehandler.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../mmhais/a3facl/src/shared +USERINCLUDE ../../../mmhais/a3facl/src/audiocontext + +// EO Jin +USERINCLUDE ../../../mmhais/refacladapt/src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY audiocomponentframework.lib +LIBRARY mmrcserver.lib +LIBRARY a3f_trace_heap.lib + + +DEFFILE mmrcclient.DEF +NOSTRICTDEF + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/mmpfiles/mmrcserver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/mmpfiles/mmrcserver.mmp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,54 @@ +// Copyright (c) 2006-2009 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: +// + + + +TARGET mmrcserver.dll +TARGETTYPE dll +UID 0x1000009e 0x102021d5 + +VENDORID 0x70000001 +CAPABILITY All -TCB -AllFiles -DiskAdmin -NetworkControl -SwEvent -TrustedUI + +// Uncomment the next line to enable debug logging in this project +//MACRO SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + +SOURCEPATH ../src/mmrcserver +SOURCE mmrcserver.cpp +SOURCE mmrcservercontroller.cpp +SOURCE mmrcserverinfo.cpp +SOURCE mmrcserversession.cpp +SOURCE mmrcserverrulemanager.cpp +SOURCE mmrcadaptationproxy.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../mmhais/a3facl/src/audiocontext +USERINCLUDE ../../../mmhais/a3facl/src/audiostream +USERINCLUDE ../../../mmhais/a3facl/src/shared +USERINCLUDE ../../../mmhais/refacladapt/src/shared + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY estor.lib +LIBRARY mmfserverbaseclasses.lib +LIBRARY a3ffourcclookup.lib +LIBRARY a3f_trace_heap.lib +LIBRARY audiocomponentframework.lib +DEFFILE mmrcserver.def +NOSTRICTDEF + +SMPSAFE diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclient.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclient.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,248 @@ +//mmrcclient.cpp + +// Copyright (c) 2006-2009 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 "mmrcclient.h" +#include "mmrcclientimplementation.h" +#include "audiocontext.h" +#include + +/** + * + */ +EXPORT_C RMMRCClient::RMMRCClient(): + iImplementation(NULL) + { + TRACE_CREATE(); + DP_CONTEXT(----> RMMRCClient::RMMRCClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + * + */ +EXPORT_C RMMRCClient::~RMMRCClient() + { + DP_CONTEXT(----> RMMRCClient::~RMMRCClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + delete iImplementation; + iImplementation = NULL; + DP_OUT(); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::Open(MMultimediaResourceControlObserver& aCallback) + { + DP_CONTEXT(----> RMMRCClient::Open *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNone; + + if(iImplementation) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!RMMRCClient::Open - iImplementation already created")); + #endif + DP0_RET(KErrCompletion, "error = %d"); + } + + TRAP( err, iImplementation = CMMRCClientImplementation::NewL(aCallback) ); + if(err) + { + Close(); + } + DP0_RET(err, "error = %d"); + } + +/** + * + */ +EXPORT_C void RMMRCClient::Close() + { + DP_CONTEXT(----> RMMRCClient::Close *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + #ifdef _DEBUG + if( NULL == iImplementation ) + { + RDebug::Print(_L("!!!!RMMRCClient::Close - iImplementation NULL")); + } + #endif + + if(iImplementation) + { + iImplementation->Close(); + delete iImplementation; + iImplementation = NULL; + } + + DP_OUT(); + } + +/** + * + */ +EXPORT_C TUint64 RMMRCClient::LogOn(TProcessId aProcessId) + { + DP_CONTEXT(----> RMMRCClient::LogOn *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + #ifdef _DEBUG + if( NULL == iImplementation ) + { + RDebug::Print(_L("!!!!RMMRCClient::LogOn - iImplementation NULL")); + } + #endif + + TUint64 contextId = 0; + if(iImplementation) + { + contextId = iImplementation->LogOn(aProcessId); + } + + DP0_RET(contextId, "contextId = %d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext) + { + DP_CONTEXT(----> RMMRCClient::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if( NULL == iImplementation ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!RMMRCClient::SendResourceRequest - iImplementation NULL")); + #endif + DP0_RET(KErrCompletion, "error = %d"); + } + + TInt error = iImplementation->SendResourceRequest(aLogicalChainLastCommited, aLogicalChainRequested, aContext); + + DP0_RET(error, "error = %d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::SendResourceConfirmation() + { + DP_CONTEXT(----> RMMRCClient::SendResourceConfirmation *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNotSupported; + DP0_RET(err, "%d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::SendResourceUpdateResult() + { + DP_CONTEXT(----> RMMRCClient::SendResourceUpdateResult *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt err = KErrNotSupported; + DP0_RET(err, "%d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::SendResourceErrorNotification() + { + DP_CONTEXT(----> RMMRCClient::SendResourceErrorNotification *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_IN(); + TInt err = KErrNotSupported; + DP0_RET(err, "%d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + DP_CONTEXT(RMMRCClient::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if( NULL == iImplementation ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!RMMRCClient::RegisterAsClient - iImplementation NULL")); + #endif + DP0_RET(KErrCompletion, "error = %d"); + } + + TInt err = iImplementation->RegisterAsClient(aEventType, aNotificationRegistrationData); + + DP0_RET(err, "%d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::CancelRegisterAsClient(TUid aEventType) + { + DP_CONTEXT(RMMRCClient::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if( NULL == iImplementation ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!RMMRCClient::CancelRegisterAsClient - iImplementation NULL")); + #endif + DP0_RET(KErrCompletion, "error = %d"); + } + + TInt err = iImplementation->CancelRegisterAsClient(aEventType); + + DP0_RET(err, "%d"); + } + +/** + * + */ +EXPORT_C TInt RMMRCClient::WillResumePlay() + { + DP_CONTEXT(RMMRCClient::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if( NULL == iImplementation ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!RMMRCClient::WillResumePlay - iImplementation NULL")); + #endif + DP0_RET(KErrCompletion, "error = %d"); + } + + TInt err = iImplementation->WillResumePlay(); + + DP0_RET(err, "%d"); + } + +EXPORT_C void RMMRCClient::ResetMessages() + { + DP_CONTEXT(RMMRCClient::ResetMessages *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iImplementation->ResetMessages(); + + DP_OUT(); + } +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientimplementation.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientimplementation.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,246 @@ +// Copyright (c) 2006-2009 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 "mmrcclientimplementation.h" +#include "mmrcclientmsgqueuehandler.h" +#include "multimediaresourcecontrolobserver.h" +#include "audiocontext.h" + +#include + + +const TInt KMsgQueueSlots = 8; + + +/** + */ +CMMRCClientImplementation::CMMRCClientImplementation(MMultimediaResourceControlObserver& aCallback) +: iObserver(aCallback) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCClientImplementation::CMMRCClientImplementation *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + */ +CMMRCClientImplementation::~CMMRCClientImplementation() + { + DP_CONTEXT(----> CMMRCClientImplementation::~CMMRCClientImplementation *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if(iMsgClientQueueHandler) + { + delete iMsgClientQueueHandler; + } + iMsgQueue.Close(); + + DP_OUT(); + } + +/** + */ +CMMRCClientImplementation* CMMRCClientImplementation::NewL(MMultimediaResourceControlObserver& aCallback) + { + DP_STATIC_CONTEXT(----> CMMRCClientImplementation::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCClientImplementation* self = new (ELeave) CMMRCClientImplementation(aCallback); + CleanupStack::PushL (self); + self->ConstructL (); + CleanupStack::Pop (self); + + DP0_RET(self, "0x%x"); + } + +/** + */ +void CMMRCClientImplementation::ConstructL() + { + DP_CONTEXT(----> CMMRCClientImplementation::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt error = iMMRCClientSession.Open (iObserver); + if ( KErrNotFound == error) + { + //The server is not found, create it + error = iMMRCClientSession.StartServer (); + User::LeaveIfError (error); + + //Try again to create a connection to it + error = iMMRCClientSession.Open (iObserver); + #ifdef _DEBUG + if(error != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCClientImplementation::ConstructL - Open session 2 - error = %d"), error); + } + #endif + User::LeaveIfError (error); + } + #ifdef _DEBUG + if(error != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCClientImplementation::ConstructL - Open session 1 - error = %d"), error); + } + #endif + User::LeaveIfError (error); + + //Create an un-named msg queue, a handle is needed to connect to it. + error = iMsgQueue.CreateGlobal (KNullDesC, KMsgQueueSlots, EOwnerProcess); + #ifdef _DEBUG + if(error != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCClientImplementation::ConstructL - CreateGlobal - error = %d"), error); + } + #endif + User::LeaveIfError (error); + iMsgClientQueueHandler = CMMRCClientMsgQueueHandler::NewL (iMsgQueue, *this); + + //Forward the message queue handle to the server, which will connect to it. + iMMRCClientSession.InitializeServerL(iMsgQueue); + + DP_OUT(); + } +/** + */ +TUint64 CMMRCClientImplementation::LogOn(TProcessId aProcessId) + { + DP_CONTEXT(----> CMMRCClientImplementation::LogOn *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TUint64 contextId = iMMRCClientSession.LogOn(aProcessId); + + DP0_RET(contextId, "contextId = %d"); + } + +/** + */ +void CMMRCClientImplementation::Close() + { + DP_CONTEXT(----> CMMRCClientImplementation::Close *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCClientSession.Close (); + + DP_OUT(); + } + +/** + */ +TInt CMMRCClientImplementation::SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext) + { + DP_CONTEXT(----> CMMRCClientImplementation::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = iMMRCClientSession.SendResourceRequest(aLogicalChainLastCommited, aLogicalChainRequested, aContext); + + DP0_RET(err, "err = %d"); + } + +/**y + */ +void CMMRCClientImplementation::HandleMessage(TMMRCQueueItem& aMessage) + { + DP_CONTEXT(----> CMMRCClientImplementation::HandleMessage *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + #ifdef _DEBUG + RDebug::Print(_L("RMMRCClientSession::ResourceRequestResponseL aMessage.iRequestType = %d, aMessage.iResult = %d, aMessage.iErrorCode = %d"), aMessage.iRequestType, aMessage.iResult, aMessage.iErrorCode); + #endif + + switch(aMessage.iRequestType) + { + + case EMMRCRequestCommitUpdate: + { + // Ignore this, now this will come directly from adaptation + // iObserver.ReceiveResourceUpdate(aMessage.iData, aMessage.iErrorCode); + } + break; + + case EMMRCRequestCommitResponse: + { + // This would remain coming throug MMRC to update client side + iMMRCClientSession.ResourceRequestResponse(aMessage.iData, aMessage.iResult, aMessage.iErrorCode); + } + break; + + case EMMRCRequestResourceUnallocated: + { + // Notification used for APR. + iObserver.CanResume(); + } + break; + + default: //unknown message + #ifdef _DEBUG + ASSERT(0); + RDebug::Print(_L("!!!!CMMRCClientImplementation::HandleMessage - Unknown message")); + #endif + break; + } + + DP_OUT(); + } + +/** + */ +TInt CMMRCClientImplementation::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + DP_CONTEXT(----> CMMRCClientImplementation::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = iMMRCClientSession.RegisterAsClient(aEventType, aNotificationRegistrationData); + + DP0_RET(err, "err = %d"); + } + + +/** + */ +TInt CMMRCClientImplementation::CancelRegisterAsClient(TUid aEventType) + { + DP_CONTEXT(----> CMMRCClientImplementation::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = iMMRCClientSession.CancelRegisterAsClient(aEventType); + + DP0_RET(err, "err = %d"); + } + + +/** + */ +TInt CMMRCClientImplementation::WillResumePlay() + { + DP_CONTEXT(----> CMMRCClientImplementation::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = iMMRCClientSession.WillResumePlay(); + + DP0_RET(err, "err = %d"); + } + +void CMMRCClientImplementation::ResetMessages() + { + DP_CONTEXT(----> CMMRCClientImplementation::ResetMessages *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCClientSession.ResetMessages(); + + DP_OUT(); + } +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientmsgqueuehandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientmsgqueuehandler.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,94 @@ +// Copyright (c) 2006-2009 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 "mmrcclientmsgqueuehandler.h" +#include "mmrcmsgqueuehandlerobserver.h" + +/** +*/ +CMMRCClientMsgQueueHandler* CMMRCClientMsgQueueHandler::NewL( + RMsgQueue& aMsgQueue, + MMMRCMsgQueueHandlerObserver& aObserver) + { + CMMRCClientMsgQueueHandler* self = new(ELeave) CMMRCClientMsgQueueHandler(aMsgQueue,aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +/** +*/ +CMMRCClientMsgQueueHandler::CMMRCClientMsgQueueHandler( + RMsgQueue& aMsgQueue, + MMMRCMsgQueueHandlerObserver& aObserver) + :CActive(EPriorityStandard), + iMsgQueue(aMsgQueue), + iObserver(aObserver) + { + CActiveScheduler::Add(this); + } + +/** +*/ +void CMMRCClientMsgQueueHandler::ConstructL() + { + ReceiveEvents(); + } + +/** +*/ +CMMRCClientMsgQueueHandler::~CMMRCClientMsgQueueHandler() + { + Cancel(); + iMsgQueue.Close(); + } + +/** +*/ +void CMMRCClientMsgQueueHandler::ReceiveEvents() + { + if(!IsActive()) + { + iMsgQueue.NotifyDataAvailable(iStatus); + SetActive(); + } + } + +/** +*/ +void CMMRCClientMsgQueueHandler::RunL() + { + TMMRCQueueItem message; + TInt error = iMsgQueue.Receive(message); + iObserver.HandleMessage(message); + ReceiveEvents(); + } + +/** +*/ +TInt CMMRCClientMsgQueueHandler::RunError(TInt /*aError*/) + { + return KErrNone; + } + +/** +*/ +void CMMRCClientMsgQueueHandler::DoCancel() + { + iMsgQueue.CancelDataAvailable(); + } + +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientsession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcclient/mmrcclientsession.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,272 @@ +// Copyright (c) 2006-2009 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 "mmrcclientsession.h" +#include "mmrcserverstart.h" +#include "multimediaresourcecontrolobserver.h" +#include "mmrcadaptationproxy.h" +#include "mlogicalchain.h" +#include "audiocontext.h" +/** + * + */ +RMMRCClientSession::RMMRCClientSession() +: iLogicalChainLastCommited(NULL), + iLogicalChainRequested(NULL) + { + TRACE_CREATE(); + DP_CONTEXT(----> RMMRCClientSession::RMMRCClientSession *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + * + */ +RMMRCClientSession::~RMMRCClientSession() + { + DP_CONTEXT(----> RMMRCClientSession::~RMMRCClientSession *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if(iMMRCClientSideServerRequestToAdaptationAO) + { + delete iMMRCClientSideServerRequestToAdaptationAO; + iMMRCClientSideServerRequestToAdaptationAO=0; + } + + DP_OUT(); + } + + +/** +// Runs client-side and starts the separate server process +*/ +TInt RMMRCClientSession::StartServer() + { + DP_CONTEXT(----> RMMRCClientSession::StartServer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + err = StartMMRCServer(iServerThread); + + DP0_RET(err, "err = %d"); + } + +/** +*/ +TInt RMMRCClientSession::Open(MMultimediaResourceControlObserver& aCallback) + { + DP_CONTEXT(----> RMMRCClientSession::Open *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + iObserver = &aCallback; + + err = CreateSession(KMMRCServerName, TVersion(1,0,0)); + + DP0_RET(err, "err = %d"); + } + +/** +*/ +TUint64 RMMRCClientSession::LogOn(TProcessId aProcessId) + { + DP_CONTEXT(----> RMMRCClientSession::LogOn *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iCurrentRequestId = 0; + TUint64 contextId; + TPckg contextIdPckg(contextId); + TPckg processIdPckg(aProcessId); + TIpcArgs args(&processIdPckg, &contextIdPckg); + + SendReceive(EMMRCClientToServerRequestContextId,args); + + DP0_RET(contextId, "contextId = %d"); + } + + +/** + */ +void RMMRCClientSession::Close() + { + DP_CONTEXT(----> RMMRCClientSession::Close *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TRequestStatus RequestStatus; + SendReceive(EMMRCClientToServerCloseSession, TIpcArgs(0), RequestStatus); + User::WaitForRequest(RequestStatus); + if(iMMRCClientSideServerRequestToAdaptationAO) + { + delete iMMRCClientSideServerRequestToAdaptationAO; + iMMRCClientSideServerRequestToAdaptationAO=0; + } + + RHandleBase::Close(); + iServerThread.Close(); + + DP_OUT(); + } + +/** +*/ +void RMMRCClientSession::InitializeServerL(RHandleBase& aMsgQueueHandle) + { + DP_CONTEXT(----> RMMRCClientSession::InitializeServerL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //Send the Client ThreadId + RThread me; + const TThreadId& id = me.Id(); + SendReceive(EMMRCClientToServerSetClientThreadId, TIpcArgs(&id)); + + //Create a client side adaptation proxy on the client schudeler + iMMRCClientSideServerRequestToAdaptationAO = CMMRCClientSideServerRequestToAdaptationAO::NewL(); + // send synchronously the pointer to the server + SendReceive(EMMRCClientToServerSetAdaptationProxy, TIpcArgs(iMMRCClientSideServerRequestToAdaptationAO)); + + //Send synchronously the Message Queue pointer to the server + SendReceive(EMMRCClientToServerSetMsgQueueHandle, TIpcArgs(aMsgQueueHandle)); + + DP_OUT(); + } + +/** +*/ +TInt RMMRCClientSession::SendResourceRequest(MLogicalChain* aLogicalChainLastCommited, MLogicalChain* aLogicalChainRequested, CAudioContext* aContext) + { + DP_CONTEXT(----SSSS> RMMRCClientSession::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + //Only one request at a time!!! + if(iLogicalChainLastCommited || iLogicalChainRequested) + { + err = KErrServerBusy; + #ifdef _DEBUG + RDebug::Print(_L("!!RMMRCClientSession::SendResourceRequest - Second request but server busy")); + #endif + DP0_RET(err, "err = %d"); + } + + //Clone the chains; they are realesed on response + if( err == KErrNone ) + { + TRAP(err, iLogicalChainLastCommited = aLogicalChainLastCommited->CloneL()); + if( err == KErrNone ) + { + TRAP(err, iLogicalChainRequested = aLogicalChainRequested->CloneL()); + } + } + + //Send the request + if ( err == KErrNone ) + { + // AM To determine when we reached the limit of messages + err = Send(EMMRCClientToServerRequestResource, TIpcArgs(iLogicalChainLastCommited, iLogicalChainRequested, aContext, aContext->MsgVersion())); + } + #ifdef _DEBUG + else + { + RDebug::Print(_L("!!!!RMMRCClientSession::SendResourceRequest - Error = %d"), err); + } + #endif + + DP0_RET(err, "err = %d"); + } + +/** + */ + void RMMRCClientSession::ResourceRequestResponse(MLogicalChain* aChainResponse, TMMRCServerToClientMessageResults /*aResult*/, TInt aError) + { + DP_CONTEXT(--------> RMMRCClientSession::ResourceRequestResponseL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //Check if the response is not null... Should never happen + if( aChainResponse == NULL && aError == KErrNone) + //coverity[var_compare_op] + { + RDebug::Print(_L("!!!!RMMRCClientSession::ResourceRequestResponseL - Chain in input NULL - KErrArgument")); + __ASSERT_ALWAYS(0, User::Panic(_L("MMRCClientSessionNullResponse"), 1)); + } + + iObserver->ReceiveResourceResponse(aChainResponse, aError); + //coverity[var_deref_model] + // Coverity incorrectly assumes that aChainResponse is always NULL + DP_OUT(); + } + +/** +*/ +TInt RMMRCClientSession::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData) + { + DP_CONTEXT(----> RMMRCClientSession::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err (KErrNone); + err = SendReceive(EMMRCClientToServerRegisterAsClient, TIpcArgs(&aEventType, &aNotificationRegistrationData)); + + + DP0_RET(err, "err = %d"); + } + +/** +*/ +TInt RMMRCClientSession::CancelRegisterAsClient(TUid aEventType) + { + DP_CONTEXT(----> RMMRCClientSession::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err (KErrNone); + err = SendReceive(EMMRCClientToServerCancelRegisterAsClient, TIpcArgs(&aEventType)); + + + DP0_RET(err, "err = %d"); + } + +/** +*/ +TInt RMMRCClientSession::WillResumePlay() + { + DP_CONTEXT(----> RMMRCClientSession::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err (KErrNone); + err = SendReceive(EMMRCClientToServerWillResumePlay, TIpcArgs(0)); + + + DP0_RET(err, "err = %d"); + } + +void RMMRCClientSession::ResetMessages() + { + DP_CONTEXT(----> RMMRCClientSession::ResetMessages *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //Clean the logical chains + if(iLogicalChainLastCommited) + { + iLogicalChainLastCommited->Release(); + iLogicalChainLastCommited = NULL; + } + if(iLogicalChainRequested) + { + iLogicalChainRequested->Release(); + iLogicalChainRequested = NULL; + } + + DP_OUT(); + } +//EOF + diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcadaptationproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcadaptationproxy.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,507 @@ +// Copyright (c) 2007-2009 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: +// mmrcserverphysicaladaptation.cpp +// +// + + +#include "mmrcadaptationproxy.h" +#include "mmrcservercontroller.h" +#include "mmrcserversession.h" +#include "mlogicalchain.h" +#include "audiostreamadaptation.h" + +#include + + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ +CMMRCClientSideServerRequestToAdaptationAO::CMMRCClientSideServerRequestToAdaptationAO() +: CActive(EPriorityHigh) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::CMMRCClientSideServerRequestToAdaptationAO *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + * Destructor + */ +CMMRCClientSideServerRequestToAdaptationAO::~CMMRCClientSideServerRequestToAdaptationAO() + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::~CMMRCClientSideServerRequestToAdaptationAO *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + Cancel(); + TidyUp(); + + DP_OUT(); + } + +/** + * Constructs, and returns a pointer to, a new CMMRCClientSideServerRequestToAdaptationAO object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCClientSideServerRequestToAdaptationAO* A pointer to newly created utlitly object. + */ +EXPORT_C CMMRCClientSideServerRequestToAdaptationAO* CMMRCClientSideServerRequestToAdaptationAO::NewL() + { + DP_STATIC_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCClientSideServerRequestToAdaptationAO* self = new(ELeave) CMMRCClientSideServerRequestToAdaptationAO(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + + DP0_RET(self, "self = 0x%x"); + } + +void CMMRCClientSideServerRequestToAdaptationAO::Initialize(CMMRCServerSession* aServerSession, CMMRCServerSideAdaptationResponseAO* aCallback, + RThread* aClientThread, const CFourCCConvertor& aFourCCConvertor) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::SetCallback *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerSideAdaptationResponseAO = aCallback; + iServerSession = aServerSession; + iClientThread = aClientThread; + + iStreamAdaptation->SetFourCC(aFourCCConvertor); + + DP_OUT(); + } + +/** +CMMRCClientSideServerRequestToAdaptationAO::ConstructL +Symbian 2nd phase constructor can leave. + */ +void CMMRCClientSideServerRequestToAdaptationAO::ConstructL() + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CActiveScheduler::Add(this); + iStreamAdaptation = CAudioStreamAdaptation::NewL(TUid::Uid(0x10283461)) ; + iStreamAdaptation->RegisterAudioStreamObserver(*this); + + iStatus = KRequestPending; + SetActive(); + + DP_OUT(); + } + +/** + * Send a request to the resource manager + * @param MLogicalChain* aOldChain the last committed chain + * @param MLogicalChain* aNewChain the current committed chain + * @param TRequestStatus& aStatus + * @return KErrNone in case of success of the send + */ +void CMMRCClientSideServerRequestToAdaptationAO::Service(TUint aRequestType) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::Service *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iRequestType = aRequestType; + iAudioContext = const_cast(iServerSession->AudioContext()); + iLogicalChainLastCommited = iServerSession->LogicalChainLastCommited(); + iLogicalChainRequested = iServerSession->LogicalChainRequested(); + + // Simulate an asyncronous response +/* +unsafe as checking a client-thread object from server thread. +if (IsActive()) + +Rely on serversession making this call safe. +*/ + + { + TRequestStatus* status = &iStatus; +DP1(2,"clientsideAO event",status); + iClientThread->RequestComplete(status, KErrNone); + } +/* else + { + DP0(2,"shouldneverhappen!!"); + ASSERT(0); + } +*/ + DP_OUT(); + } + +/** + * Callback in case of timeout + */ +void CMMRCClientSideServerRequestToAdaptationAO::ResourceRequestAcknowledgmentTimeout( ) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::ResourceRequestAcknowledgmentTimeout *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +void CMMRCClientSideServerRequestToAdaptationAO::TidyUp() + { +/* +This is a place to put synchronous tidyup code. +See below first attempt. +*/ + +/* if(iStreamAdaptation) + { + iStreamAdaptation->UnregisterAllAudioStreamObserver(); + + if (iLogicalChainLastCommited) + { +// never got past uninitialised. delete. + CLogicalAudioStream* audiostream = static_cast(iLogicalChainLastCommited); + TAudioState state = audiostream->StreamState(); + if (state != EUninitialized) && (iLogicalChainLastCommited)) + { + CLogicalAudioStream* audiostream = static_cast(iLogicalChainRequested); + TAudioState state = audiostream->StreamState(); + audiostream->ResetMessage(); + audiostream->SetMessageType(EComponentDestruction); + switch(state) + { + case EActive: + case EPrimed: + { + audiostream->Stop(); + } // deliberate fallthru'. + case EIdle: + { + audiostream->Unload(); + } // deliberate fallthru'. + case EInitialized: + { + audiostream->Uninitialize(); + iStreamAdaptation->Message(*iLogicalChainLastCommited, *iLogicalChainRequested, *iAudioContext, ETrue); + waitForAdaptationResponse=EFalse; + } + break; + default: + { + // No need to wait until adaptation responds... just kill. + waitForAdaptationResponse=EFalse; + } + break; + } + } + } +*/ delete iStreamAdaptation; + }; + + +/** + * CMMRCClientSideServerRequestToAdaptationAO::RunL + */ + +void CMMRCClientSideServerRequestToAdaptationAO::RunL() + { + DP_CONTEXT(--------> CMMRCClientSideServerRequestToAdaptationAO::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + +/* +flag is safe to read in A.O as it is set synchronously by an A.O running +in the same Active scheduler. +*/ + // no shut down... regular call. + iStatus = KRequestPending; + SetActive(); + iRequestsProcessed++; + + TUint flags = 0; + if(iRequestType == EPreemptionRequest) + { + flags |= KPreemptionRequest; + } + + iStreamAdaptation->Message(*iLogicalChainLastCommited, *iLogicalChainRequested, *iAudioContext, flags); + DP_OUT(); + } + +/** + CMMFDevSoundServer::CDelayDevSoundShutDown::DoCancel + Called by Active object framework when user cancels active object. + (other items were commented in a header). + */ +void CMMRCClientSideServerRequestToAdaptationAO::DoCancel() + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::DoCancel *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); +/* This is "rather complicated" :-) + +This AO always sets itself active, and hence this method will be called +under all deletion conditions. + +As AO and signaller are in different threads, and in Symbian there is +no official manner by which to ascertain if you have been signalled, +we have a synchronous call (across client and server threads) which +simply sets a flag and completes. The flag prevents any further +requests being sent to the adaptation. + +By this mechanism, it is possible to read the number of requests +sent in the server thread as the number does not change after the +sync call. This is necessary as if there was no outstanding request +this A.O needs to self-signal. +*/ + +/* +This assert ensures that the synchronous client->server call occurred +and therefore it is safe to do the next comparison. Necessary in +case someone re-orders the MMRC client deletion later. +*/ + ASSERT(iServerSession->IsServerShuttingDown()); + +/* check to see if we have processed all of the requests that +have been sent by the server - i.e. are there any pending requests + +if (no outstanding requests) + we need to self-signal or this would hang. +otherwise + we need to signal the server-side A.O to terminate that. +*/ + if (iServerSession->RequestsSent() != iRequestsProcessed) + { +// should throw an error, rather than KErrNone +// iMMRCServerSideAdaptationResponseAO->ServiceL( EMMRCAdaptationToServerShutdown, KErrServerTerminated); + iMMRCServerSideAdaptationResponseAO->Service( EMMRCAdaptationToServerShutdown, KErrNone); + } + else + { +/* no more requests will ever come... self signal. +Don't notify MMRC server A.O. - it won't be expecting one +*/ + TRequestStatus* status(&iStatus); + User::RequestComplete(status, KErrNone); + } + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::PhysicalAdaptationEvent(TPhysicalEvent aEvent, TInt aError) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::PhysicalAdaptationEvent *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + switch (aEvent) + { + case EOperationComplete: + if(iMMRCServerSideAdaptationResponseAO) + { + iMMRCServerSideAdaptationResponseAO->Service( EMMRCAdaptationToServerResourceComplete, aError); + } + break; + + case EOperationIncomplete: + if(iMMRCServerSideAdaptationResponseAO) + { + iMMRCServerSideAdaptationResponseAO->Service( EMMRCAdaptationToServerResourceIncomplete, aError); + } + break; + + default: + break; + } + + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::StateEvent(TInt /*aReason*/, TAudioState /*aNewState*/) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::StateEvent *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::AddProcessingUnitComplete(TUid /*aType*/, TInt /*aError*/) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::AddProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::RemoveProcessingUnitComplete(TUid /*aType*/, TInt /*aError*/) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::RemoveProcessingUnitComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::ProcessingFinished() + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::ProcessingFinished *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * + */ +void CMMRCClientSideServerRequestToAdaptationAO::FlushComplete(TInt /*aError*/) + { + DP_CONTEXT(----> CMMRCClientSideServerRequestToAdaptationAO::FlushComplete *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + */ +CMMRCServerSideAdaptationResponseAO::CMMRCServerSideAdaptationResponseAO() +: CActive(EPriorityHigh) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::CMMRCServerSideAdaptationResponseAO *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + */ +CMMRCServerSideAdaptationResponseAO::~CMMRCServerSideAdaptationResponseAO() + { + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::~CMMRCServerSideAdaptationResponseAO *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + Cancel(); + + DP_OUT(); + } + +/** + */ +CMMRCServerSideAdaptationResponseAO* CMMRCServerSideAdaptationResponseAO::NewL() + { + DP_STATIC_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSideAdaptationResponseAO* self = new(ELeave) CMMRCServerSideAdaptationResponseAO(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(self); + + DP0_RET(self, "self = 0x%x"); + } + +/** + */ +void CMMRCServerSideAdaptationResponseAO::ConstructL() + { + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CActiveScheduler::Add (this ); + + DP_OUT(); + } + +/** + */ +void CMMRCServerSideAdaptationResponseAO::Initialize(CMMRCServerSession* aServerSession, RThread* aServerThread ) + { + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::SetServerSession *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerSession = aServerSession; + ASSERT(iMMRCServerSession!=0); + iServerThread = aServerThread; + ASSERT(iServerThread!=0); + DP_OUT(); + } + +/** +These are rather misleading convenience functions which are called +from the context of the caller (i.e. a different thread context) + +Be very cautious with what you rely on. + */ +void CMMRCServerSideAdaptationResponseAO::Service(TMMRCAdaptationToServerRequestResults aEvent, TInt aError) + { + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::Service *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iEvent = aEvent; + iError = aError; + + // Simulate an asynchronous response on correct thread. + TRequestStatus* status = &iStatus; + iServerThread->RequestComplete(status, KErrNone); + DP_OUT(); + } +/** + */ +void CMMRCServerSideAdaptationResponseAO::DoCancel( ) + { + DP_CONTEXT(----> CMMRCServerSideAdaptationResponseAO::DoCancel *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); +/* this should only happen if there is a pending request. + client-side will send a response before closing. + + See DoCancel in CMMRCClientSideServerRequestToAdaptationAO for details. + */ + DP_OUT(); + } + +/** +server-side A.O. used to observe the outcome. + +Calls back AdaptationRequestAcknowledgment on MMRC server session + from server thread context. + */ +void CMMRCServerSideAdaptationResponseAO::RunL() + { + DP_CONTEXT(--------> CMMRCServerSideAdaptationResponseAO::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iMMRCServerSession->AdaptationRequestAcknowledgment( iEvent, iError ); + DP_OUT(); + } + +void CMMRCServerSideAdaptationResponseAO::StartAdaptationListening() + { +/* wrapper functio to set up the A.O */ + iStatus = KRequestPending; + SetActive(); + } +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserver.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,257 @@ +// Copyright (c) 2007-2009 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 "mmrcserver.h" +#include "mmrcserversession.h" +#include "mmrcservercontroller.h" +#include "mmrcserverstart.h" +#include +#include + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * Constructor + */ +CMMRCServer::CMMRCServer() +: CServer2(EPriorityStandard) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServer::CMMRCServer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + Cancel(); + + DP_OUT(); + } + +/** + * Destructor. + */ +CMMRCServer::~CMMRCServer() + { + DP_CONTEXT(----> CMMRCServer::~CMMRCServer *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if(iMMRCServerController) + { + delete iMMRCServerController; + } + delete iFourCCConvertor; + DP_OUT(); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * Constructs, and returns a pointer to, a new CMMRCServer object. + * Leaves on failure. + * @return CMMRCServer* A pointer to newly created utlitly object. + */ +CMMRCServer* CMMRCServer::NewL() + { + DP_STATIC_CONTEXT(----> CMMRCServer::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServer* self = NewLC(); + CleanupStack::Pop(self); + + DP0_RET(self, "0x%x"); + } + +/** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServer object. + * Leaves on failure. + * @return CMMRCServer* A pointer to newly created utlitly object. + */ +CMMRCServer* CMMRCServer::NewLC() + { + DP_STATIC_CONTEXT(----> CMMRCServer::Open *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServer* self = new(ELeave) CMMRCServer; + CleanupStack::PushL(self); + self->ConstructL(); + + DP0_RET(self, "self = 0x%x"); + } + +/** + CMMRCServer::ConstructL + Symbian 2nd phase constructor can leave. + */ +void CMMRCServer::ConstructL() + { + DP_CONTEXT(----> CMMRCServer::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerController = CMMRCServerController::NewL(); + + iFourCCConvertor = CFourCCConvertor::NewL(); + DP_OUT(); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * From CServer2. Creates a server-side client session object. + * Creates a new session. Only one session may be created with the ControllerProxyServer. + * This function may leave with one of the system-wide error codes. + * @param const TVersion& aVersion The version number of the session. + * @param const RMessage2& aMessage + * @return A pointer to the new session. + */ +CSession2* CMMRCServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const + { + DP_CONTEXT(----> CMMRCServer::NewSessionL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TVersion version(KMMRCServerVersion,KMMRCServerMinorVersionNumber,KMMRCServerBuildVersionNumber); + if(!User::QueryVersionSupported(version, aVersion)) + { + User::Leave(KErrNotSupported); + } + CMMRCServerSession* mmrcSession = CMMRCServerSession::NewL(*iMMRCServerController, *iFourCCConvertor); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** +A utility function to panic the server. +*/ +void CMMRCServer::PanicServer(TInt aPanic) + { + _LIT(KMMRCServerPanic,"MMRC Server panic"); + User::Panic(KMMRCServerPanic, aPanic); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +TInt CMMRCServer::ThreadFunctionL(TAny* /**aStarted*/) + { + DP_STATIC_CONTEXT(----> CMMRCServer::ThreadFunctionL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + // create an active scheduler and server + CActiveScheduler* sched = new (ELeave) CActiveScheduler; + CleanupStack::PushL(sched); + + //Install the active scheduler + CActiveScheduler::Install(sched); + + CMMRCServer *server = CMMRCServer::NewLC(); + + + // Start the server + TInt err = server->Start(KMMRCServerName); + if (err != KErrNone) + { + CMMRCServer::PanicServer(KErrNoMemory); + } + + // Let everyone know that we are ready to + // deal with requests. + RThread::Rendezvous(KErrNone); + + // And start fielding requests from client(s). + CActiveScheduler::Start(); + + // Tidy up... + CleanupStack::PopAndDestroy(2, sched); + + DP0_RET(KErrNone, "error = %d"); + } + +/** +Create the thread that will act as the server. +This function is exported from the DLL and called by the client. + +Note that a server can also be implemented as a separate +executable (i.e. as a separate process). +*/ +TInt CMMRCServer::ThreadFunction(TAny* aStarted) + { + DP_STATIC_CONTEXT(----> CMMRCServer::ThreadFunction *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + // get clean-up stack + CTrapCleanup* cleanup=CTrapCleanup::New(); + if (cleanup == NULL) + { + CMMRCServer::PanicServer(KErrNoMemory); + } + + TRAPD( err, ThreadFunctionL(aStarted) ); + + delete cleanup; + + DP0_RET(err, "error = %d"); + } + +/** +Create the thread that will act as the server. +This function is exported from the DLL and called by the client. + +Note that a server can also be implemented as a separate +executable (i.e. as a separate process). +*/ +EXPORT_C TInt StartMMRCServer(RThread& aServerThread) + { + TInt res = KErrNone; + + // Create the server, if one with this name does not already exist. + TFindServer findCountServer(KMMRCServerName); + TFullName name; + + // Need to check that the server exists. + if ( findCountServer.Next(name) != KErrNone ) + { + // Create the thread for the server. + res = aServerThread.Create(KMMRCServerName, + CMMRCServer::ThreadFunction, + KMMRCServerStackSize, + KMMRCServerInitHeapSize, + KMMRCServerMaxHeapSize, + NULL + ); + + // The thread has been created OK so get it started - however + // we need to make sure that it has started before we continue. + if (res==KErrNone) + { + TRequestStatus rendezvousStatus; + + aServerThread.SetPriority(EPriorityNormal); + aServerThread.Rendezvous(rendezvousStatus); + aServerThread.Resume(); + User::WaitForRequest(rendezvousStatus); + } + + // The thread has not been created - clearly there's been a problem. + else + { + aServerThread.Close(); + } + } + return res; + } + +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcservercontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcservercontroller.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,917 @@ +// Copyright (c) 2007-2009 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 "mmrcservercontroller.h" +#include "mmrcerrorcodes.h" +#include "mmrcserversession.h" +#include "mmrcserverinfo.h" +#include "mmrcserverrulemanager.h" +#include "mmrcadaptationproxy.h" +#include "mlogicalchain.h" +#include + +/** +@internalComponent + +This class implements a timer. +*/ +class CARNNotificationObject : public CActive + { + +public: + static CARNNotificationObject* NewL(const TInt aPriority, CMMRCServerInfo& aMMRCServerInfo); + ~CARNNotificationObject(); + void After(TTimeIntervalMicroSeconds32 aInterval); + void Initialize(); + +protected: + void RunL(); + void DoCancel(); + +private: + CARNNotificationObject(const TInt aPriority); + void ConstructL(CMMRCServerInfo& aMMRCServerInfo); + +public: + TInt iIndex; + +protected: + RTimer iTimer; + CMMRCServerInfo* iMMRCServerInfo; + }; + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Constructor + */ +CMMRCServerController::CMMRCServerController() + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServerController::CMMRCServerController *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * Destructor + */ +CMMRCServerController::~CMMRCServerController() + { + DP_CONTEXT(----> CMMRCServerController::~CMMRCServerController *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + delete iMMRCServerInfo; + delete iMMRCServerRuleManager; + delete iARNNotificationObject; + + DP_OUT(); + } + +/** + * Constructs, and returns a pointer to, a new CMMRCServerController object. + * Leaves on failure. + * @return CMMRCServerController* A pointer to newly created utlitly object. + */ +CMMRCServerController* CMMRCServerController::NewL() + { + DP_STATIC_CONTEXT(----> CMMRCServerController::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerController* self = NewLC(); + CleanupStack::Pop(self); + + DP0_RET(self, "self = 0x%x"); + } + +/** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerController object. + * Leaves on failure. + * @return CMMRCServerController* A pointer to newly created utlitly object. + */ +CMMRCServerController* CMMRCServerController::NewLC() + { + DP_STATIC_CONTEXT(----> CMMRCServerController::NewLC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerController* self = new(ELeave) CMMRCServerController(); + CleanupStack::PushL(self); + self->ConstructL(); + + DP0_RET(self, "self = 0x%x"); + } + +/** + * CMMRCServerController::ConstructL + * Symbian 2nd phase constructor can leave. + */ +void CMMRCServerController::ConstructL() + { + DP_CONTEXT(----> CMMRCServerController::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerInfo = CMMRCServerInfo::NewL(*this); + iMMRCServerRuleManager = CMMRCServerRuleManager::NewL(*this); + iARNNotificationObject = CARNNotificationObject::NewL(0, *iMMRCServerInfo); //Check the value + + DP_OUT(); + } + +/** +* Process the request pointer by a specific session +* @param CMMRCServerSession& aServerSession +* @return KerrNone in case of success of the process +*/ +TInt CMMRCServerController::EnqueueRequestL(CMMRCServerSession& aServerSession) + { + DP_CONTEXT(----> CMMRCServerController::ProcessRequestL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //add the request to the queue + iMMRCServerInfo->PushRequestL(aServerSession); + TInt err = ProcessNextRequestL(); + + DP0_RET(err, "err=%d"); + } + +/** + * Process the first request with the highest priority from the FIFO queue + * @return KerrNone in case of success of the process + */ + TInt CMMRCServerController::ProcessNextRequestL() + { + DP_CONTEXT(--------> CMMRCServerController::ProcessNextRequestL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + + TUint64 contextId; + TMMRCServerState serverState; + iMMRCServerInfo->ServerState(serverState, contextId); +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("serverState = %d"), serverState); + RDebug::Print(_L("size of message queue = %d"), iMMRCServerInfo->RequestsCount()); + RDebug::Print(_L("size of inprocess queue = %d"), iMMRCServerInfo->AllocatedResourceContextsCount()); + RDebug::Print(_L("size of paused queue = %d"), iMMRCServerInfo->AllocatedPausedContextsCount()); +#endif + if(EMMRCServerStateIdle != serverState) + { + DP0_RET(KErrNone, "%d"); + } + + CMMRCServerSession* serverSession = iMMRCServerInfo->PopAndRemoveFirstRequest(); //PopAndRemoveRequestFirstHighestPriority(); + //Pop the next next commited message with the highest priority + if( NULL == serverSession ) + { + DP0_RET(KErrNone, "%d"); + } + + if (!serverSession->HasUserEnvironmentCapability()) + { + /* Check to see if it's a record use case and in IDLE, Active, or PRIME. + // in which case you should refuse the request for reasons + KErrPermissionDenied + */ + MLogicalChain* requestedChange = serverSession->LogicalChainRequestedStack(); + if ((requestedChange!=NULL) && (requestedChange->StreamState() > EInitialized)) // trying to play + { + TInt count = requestedChange->AudioProcessingUnitsCount(); + for (TInt i=0; iAudioProcessingUnitUid(i)) + { + serverSession->NotifyClientOfError(KErrPermissionDenied); + // The following return value, doesn't actually make it back to the client + // We do however Notify the client above using NotifyClientOfError() + DP0_RET(KErrPermissionDenied, "%d"); + } + } + } + + } + + //Pop the last commited message in process = the current resource in use + CMMRCServerSession* serverSessionAllocatedResource = iMMRCServerInfo->PopFirstAllocatedResourceContext(); + //If no resource locked... + if( NULL == serverSessionAllocatedResource ) + { + + err = SendResourceRequest ( *serverSession ); + } + else //If a resource has been allocated or is used, possibly preemption + { + TAudioContextId contextId = serverSession->ContextId( ); + TAudioContextId contextIdAllocatedResource = serverSessionAllocatedResource->ContextId( ); + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("contextId = %d"), contextId.Id()); + RDebug::Print(_L("contextIdAllocatedResource = %d"), contextIdAllocatedResource.Id()); + #endif + + //in case of processing the same context, remove the last committed request from the queue + // of in-process request to avoid preemption within the same context. + if(contextId == contextIdAllocatedResource) + { + err = SendResourceRequest ( *serverSession ); + } + else // maybe preemption + { + //Pop the rule + + MLogicalChain* logicalChainUsingResource = serverSessionAllocatedResource->LogicalChainLastCommited(); + MLogicalChain* logicalChainNew = serverSession->LogicalChainRequestedStack(); + //Should not/cannot be null! + if( NULL==logicalChainUsingResource || NULL==logicalChainNew ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerController::ProcessNextRequestL - logicalChainUsingResource or logicalChainNew NULL")); + ASSERT(0); + #endif + User::Leave(EMMRCErrorLogicalChainNull); + } + + TAudioState audioStateAllocatedResource = logicalChainUsingResource->StreamState(); + TAudioState audioStateNew = logicalChainNew->StreamState ( ); + TMMRCRule rule = DecisionRule(audioStateAllocatedResource, audioStateNew); + //Process according to the rule + if( rule == EAlwaysProcess ) + { + err = SendResourceRequest( *serverSession ); + } + else // process only in case of higher priority + { + TInt currentClientPriority = logicalChainUsingResource->Priority(); + TInt newClientPriority = logicalChainNew->Priority(); + TBool currentClient_HasMMDD = serverSessionAllocatedResource->HasMultimediaCapability(); + TBool newClient_HasMMDD = serverSession->HasMultimediaCapability(); + + // If new client has multimedia capability and current doesn't have, + // priorities don't matter preempt the current client + + // But if both are equal competitors (both has MMDD capability or both hasn't) + // and the newcomer has higher priority preempt too + if ( (!currentClient_HasMMDD && newClient_HasMMDD) || + ( (currentClient_HasMMDD == newClient_HasMMDD) && + (newClientPriority > currentClientPriority) ) ) + { + //The process is delayed. First we have to preempt the current inprocess resource + // so puch back the request (its session) + iMMRCServerInfo->PushRequestL(*serverSession); + // + //send a premption message to the last commited message session + err = SendPreemptionRequest ( *serverSessionAllocatedResource ); + } + else + { + // Deny the resource + TAudioContextId iId = serverSession->ContextId( ); + TBool iIsOnPauseList = iMMRCServerInfo->IsOnPauseList(iId); + if(!iIsOnPauseList) + { + iMMRCServerInfo->PushPausedContextL(*serverSession); + } +// nothing pending, deny resources, and notify client. + serverSession->AdaptationRequestAcknowledgment(EMMRCAdaptationToServerResourceIncomplete, KErrInUse); +// Server is back to idle. + iMMRCServerInfo->SwitchServerState(EMMRCServerStateIdle, 0); + } + } + } + } + +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + if(err != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCServerController::ProcessNextRequestL - error = %d"), err); + } +#endif + + DP0_RET(err, "err=%d"); + } + +/** + * Pop the decision rule on the base of the current in-process request and a new committed request + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule + */ +TMMRCRule CMMRCServerController::DecisionRule(TAudioState aAudioStateAllocatedResource, TAudioState aAudioStateRequiringProcess) + { + DP_CONTEXT(----> CMMRCServerController::DecisionRule *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TMMRCRule rule = iMMRCServerRuleManager->DecisionRule(aAudioStateAllocatedResource, aAudioStateRequiringProcess); + + DP0_RET(rule, "rule=%d"); + } + +/** + * Pop the action reason on the base of the last committed request and the current one + * @param TAudioState aAudioStateLastCommitted + * @param TAudioState aAudioStateRequested + * @return TReason + */ +TReason CMMRCServerController::ActionReason(TAudioState aAudioStateLastCommitted, TAudioState aAudioStateRequested) + { + DP_CONTEXT(----> CMMRCServerController::ActionReason *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TReason reason = iMMRCServerRuleManager->ActionReason(aAudioStateLastCommitted, aAudioStateRequested); + + DP0_RET(reason, "reason=%d"); + } + +/** + * Send a resource request to the adaptation + * @param MLogicalChain* aOldChain + * @param MLogicalChain* aNewChain + * @return KerrNone in case of success of the process + */ +TInt CMMRCServerController::SendResourceRequest( CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerController::SendResourceRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerInfo->SwitchServerState( EMMRCServerStateWaitResourceResponseFromAdaptation, aServerSession.ContextId() ); + +// if entering APR state, remove from Paused list. + TRAPD(err, aServerSession.StartProcessL()); + { + MLogicalChain* logicalChainNew = aServerSession.LogicalChainRequested(); + if (logicalChainNew) + { + TAudioState audioStateNew = logicalChainNew->StreamState(); + if ( + (audioStateNew == EActive ) || + (audioStateNew == EPrimed) || + (audioStateNew == EIdle) + + ) + { + TInt contextId = aServerSession.ContextId( ); + iMMRCServerInfo->PopAndRemovePausedContext(contextId); + } + } + } + if(err == KErrNone) + { + //Send request + if (!aServerSession.SendRequestToAdaptation(ENormalRequest)) + { +// TBD fail at current task. +// return server shutting down + } + } + +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + if(err != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCServerController::SendResourceRequest - error = %d"), err); + } +#endif + + DP0_RET(err, "err=%d"); + } + +/** + * Send a preemption request to the adaptation + * @param MLogicalChain* aOldChain + * @param MLogicalChain* aNewChain + * @return KerrNone in case of success of the process + */ +TInt CMMRCServerController::SendPreemptionRequest( CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerController::SendPreemptionRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerInfo->SwitchServerState( EMMRCServerStateWaitPreemptionResponse, aServerSession.ContextId() ); + + //Update logical chains + TRAPD(err, aServerSession.StartPreemptionL()); + + + if(err == KErrNone) + { + //Send request + if (!aServerSession.SendRequestToAdaptation(EPreemptionRequest)) + { + // TBD fail at current task. + // return server shutting down/low memory where necessary + } + } + +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + if(err != KErrNone) + { + RDebug::Print(_L("!!!!CMMRCServerController::SendPreemptionRequest - error = %d"), err); + } +#endif + + DP0_RET(err, "err=%d"); + } + +/** + * Callback from the adaptation + * @param MLogicalChain* aOldChain + * @param MLogicalChain* aNewChain + * @param TMMRCAdaptationToServerRequestResults aResult + */ +void CMMRCServerController::AdaptationRequestAcknowledgment(CMMRCServerSession& aServerSession, TMMRCAdaptationToServerRequestResults aResult, TInt /*aError*/) + { + DP_CONTEXT(--------> CMMRCServerController::AdaptationRequestAcknowledgment *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("size of message queue = %d"), iMMRCServerInfo->RequestsCount()); + RDebug::Print(_L("size of inprocess queue = %d"), iMMRCServerInfo->AllocatedResourceContextsCount()); + RDebug::Print(_L("size of paused queue = %d"), iMMRCServerInfo->AllocatedPausedContextsCount()); +#endif + + TUint64 contextId; + TMMRCServerState serverState; + TInt err = KErrNone; + iMMRCServerInfo->ServerState(serverState, contextId); + switch(serverState) + { + case EMMRCServerStateWaitPreemptionResponse: // here we process the response + { + switch(aResult) + { + case EMMRCAdaptationToServerResourceComplete: + { + //we remove the request in process from the queue + CMMRCServerSession* serverSession = iMMRCServerInfo->PopAndRemoveFirstAllocatedResourceContext(); + if(serverSession) + { + TRAP(err, iMMRCServerInfo->PushPausedContextL(*serverSession)); + DP1(DLERR,"EPushPauseContextLeft %d", err); + __ASSERT_DEBUG(err == KErrNone, Panic(EPushPauseContextLeft)); + } + //Do not wait for a client acknowledgment + iMMRCServerInfo->SwitchServerState(EMMRCServerStateIdle, 0); + } + break; + case EMMRCAdaptationToServerResourceTimeout: + default: + { + //jjpy TODO: What if the preemption request failed?! + // That will be specified/implemented during the integration with the resource manager + //we remove the request in process from the queue + iMMRCServerInfo->PopAndRemoveFirstAllocatedResourceContext(); + } + } // end switch(aResult) + } //end case EMMRCServerStateWaitPreemptionResponse + break; + case EMMRCServerStateWaitResourceResponseFromAdaptation: // here we process the response + { + switch(aResult) + { + case EMMRCAdaptationToServerResourceComplete: + { + CMMRCServerSession* serverSessionAllocatedResource = iMMRCServerInfo->PopFirstAllocatedResourceContext(); + if( serverSessionAllocatedResource ) //If some previously some context has allocated a resource + { + //check if same context, if not it might be an error + TAudioContextId contextId = aServerSession.ContextId( ); + TAudioContextId contextIdAllocatedResource = serverSessionAllocatedResource->ContextId( ); + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("contextId = %d"), contextId.Id()); + RDebug::Print(_L("contextIdAllocatedResource = %d"), contextIdAllocatedResource.Id()); + #endif + MLogicalChain* logicalChainNew = aServerSession.LogicalChainRequested(); + MLogicalChain* logicalChainOld = aServerSession.LogicalChainLastCommited(); + TAudioState audioStateNew = logicalChainNew->StreamState ( ); + if(contextId != contextIdAllocatedResource) + { + //it is ok if the rule said process always + MLogicalChain* logicalChainUsingResource = serverSessionAllocatedResource->LogicalChainLastCommited(); + TAudioState audioStateAllocatedResource = logicalChainUsingResource->StreamState(); + TAudioState audioStateNew = logicalChainNew->StreamState ( ); + TMMRCRule rule = DecisionRule(audioStateAllocatedResource, audioStateNew); + if( rule != EAlwaysProcess ) + { + //not possible in theory... this is an error + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("!!!!CMMRCServerController::AdaptationRequestAcknowledgment - contextId allocating a resource and new request different. Should be the same!"), iMMRCServerInfo->AllocatedResourceContextsCount()); + #endif + } + } + else //same context here, so check if the resource has been deallocated + { + // in case of stop etc. remove from in process request + //now check the reason + TAudioState audioStateOld = EUninitialized; + if(logicalChainOld) + { + audioStateOld = logicalChainOld->StreamState(); + } + TReason reason = ActionReason(audioStateOld, audioStateNew); + + if (reason == ELoad) + { + iARNNotificationObject->Cancel(); + iMMRCServerInfo->PopAndRemovePausedContext(contextId); + } + else if (reason == EUnload) + { + iARNNotificationObject->Initialize(); + iMMRCServerInfo->PopAndRemoveFirstAllocatedResourceContextByContextId(contextId); + } + } + } + else //no in process request locking a resource + { + MLogicalChain* logicalChainNew = aServerSession.LogicalChainRequested(); + MLogicalChain* logicalChainOld = aServerSession.LogicalChainLastCommited(); + TAudioState audioStateNew = logicalChainNew->StreamState ( ); + TAudioState audioStateOld = EUninitialized; + if(logicalChainOld) + { + audioStateOld = logicalChainOld->StreamState(); + } + TReason reason = ActionReason(audioStateOld, audioStateNew); + if( reason == ELoad || + reason == EPrimeReason || + reason == EActivate ) + { + TRAP(err, iMMRCServerInfo->PushAllocatedResourceContextL( aServerSession )); + DP1(DLERR,"EPushAllocatedResourceContextFailed %d", err); + __ASSERT_DEBUG(err == KErrNone, Panic(EPushAllocatedResourceContextFailed)); + } + } + iMMRCServerInfo->SwitchServerState(EMMRCServerStateIdle, 0); + } + break; + case EMMRCAdaptationToServerResourceTimeout: + default: + { + //Just switch the state + iMMRCServerInfo->SwitchServerState(EMMRCServerStateIdle, 0); + } + break; + } //end switch switch(aResult) + } // end case EMMRCServerStateWaitResourceResponseFromAdaptation + break; + case EMMRCServerStateIdle: //not possible.... + default: + break; + } + + TRAP(err, ProcessNextRequestL()); + DP1(DLERR,"EProcessNextRequestLeft %d", err); + __ASSERT_DEBUG(err == KErrNone, Panic(EProcessNextRequestLeft)); + DP_OUT(); + } + +/* + * + */ +void CMMRCServerController::NotifyPausedClientsResourceUnallocated() + { + DP_CONTEXT(----> CMMRCServerController::NotifyClientsResourceUnallocated *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = iMMRCServerInfo->PopAndRemoveFirstPausedContext( ); + while( serverSession ) + { + serverSession->NotifyClientResourceUnallocated(); + serverSession = iMMRCServerInfo->PopAndRemoveFirstPausedContext( ); + } + + DP_OUT(); + } + +/* + * + */ +void CMMRCServerController::CloseSessionByContextId(TInt32 aContextId) + { + DP_CONTEXT(----> CMMRCServerController::CloseSessionByContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + while( iMMRCServerInfo->PopAndRemoveFirstAllocatedResourceContextByContextId( aContextId ) ){} + while( iMMRCServerInfo->PopAndRemoveFirstRequestByContextId( aContextId ) ){} + while( iMMRCServerInfo->PopAndRemovePausedContext( aContextId ) ){} + while( iMMRCServerInfo->PopAndRemoveFirstAPRContextByContextId( aContextId ) ){} + TUint64 contextId; + TMMRCServerState serverState; + iMMRCServerInfo->ServerState(serverState, contextId); + if( contextId == aContextId) + { + iMMRCServerInfo->SwitchServerState(EMMRCServerStateIdle, 0); + } +#ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("size of message queue = %d"), iMMRCServerInfo->RequestsCount()); + RDebug::Print(_L("size of inprocess queue = %d"), iMMRCServerInfo->AllocatedResourceContextsCount()); + RDebug::Print(_L("size of paused queue = %d"), iMMRCServerInfo->AllocatedPausedContextsCount()); + RDebug::Print(_L("size of APR queue = %d"), iMMRCServerInfo->AllocatedAPRContextsCount()); +#endif + + DP_OUT(); + } + +/* + * + */ +void CMMRCServerController::ServerState(TMMRCServerState& aServerState, TUint64& aContextId) const + { + iMMRCServerInfo->ServerState(aServerState, aContextId); + } + +/** + +*/ +TInt CMMRCServerController::EnqueueRequestForAPRL(CMMRCServerSession& aServerSession) + { + DP_CONTEXT(----> CMMRCServerController::EnqueueRequestForAPRL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //add the request to the queue + TInt err = KErrNone; + //if already there, should return KErrAlreadyExists + + if (iMMRCServerInfo->IsOnAPRList(aServerSession.ContextId())) + { + err = KErrAlreadyExists; + } + else + { + iMMRCServerInfo->PushAPRContextL(aServerSession); + } + DP0_RET(err, "err=%d"); + } + +/** + +*/ +TInt CMMRCServerController::RemoveRequestForAPR(CMMRCServerSession& aServerSession) + { + DP_CONTEXT(----> CMMRCServerController::RemoveRequestForAPR *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + TInt32 iContextId = aServerSession.ContextId(); + TBool iIsOnAPRList = iMMRCServerInfo->IsOnAPRList(iContextId); + if(iIsOnAPRList) + { + + // Its possible that the remove request has occured whilst clients are being notified that the resource is available + // Check if a notification sequence is currently under way + if ( iARNNotificationObject->IsActive() ) + { + + // Iterate through each paused client + for ( TInt index = 0 ; index < iMMRCServerInfo->AllocatedPausedContextsCount() ; index++ ) + { + + // Find the client that has requested removal in the list + TAudioContextId id = iMMRCServerInfo->PausedContextByIndex(index)->ContextId(); + if ( aServerSession.ContextId() == id ) + { + // Object has already received a notification + if ( index < iARNNotificationObject->iIndex ) + { + // decrement the notification objects list index to account for the item that will be removed from the queue + --iARNNotificationObject->iIndex; + } + + // no action needs to be taken if + // index >= iMMRCServerInfo.iIndex + + break; + } + } + + } + + iMMRCServerInfo->PopAndRemoveFirstAPRContextByContextId(iContextId); + iMMRCServerInfo->PopAndRemovePausedContext(iContextId); //removing this session from the list of paused too. + } + else + { + err = KErrCancel; + } + + DP0_RET(err, "err=%d"); + } + +/** + +*/ +TInt CMMRCServerController::WillResumePlay() + { + DP_CONTEXT(----> CMMRCServerController::WillResumePlay *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + iARNNotificationObject->Cancel(); + + + DP0_RET(err, "err=%d"); + } + + +//From CActive +/** + * Constructor. + */ +CARNNotificationObject::CARNNotificationObject(const TInt aPriority) +:CActive(aPriority) + { + TRACE_CREATE(); + DP_CONTEXT(----> CARNNotificationObject::CARNNotificationObject *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + + DP_OUT(); + } + + +/** + * Destructor. + */ +CARNNotificationObject::~CARNNotificationObject() + { + DP_CONTEXT(----> CARNNotificationObject::~CARNNotificationObject *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + Cancel(); + iTimer.Close(); + delete iMMRCServerInfo; + + DP_OUT(); + } + + +/** + CARNNotificationObject::ConstructL + Symbian 2nd phase constructor can leave. + */ +void CARNNotificationObject::ConstructL(CMMRCServerInfo& aMMRCServerInfo) + { + DP_CONTEXT(----> CARNNotificationObject::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerInfo = &aMMRCServerInfo; + CActiveScheduler::Add(this); + User::LeaveIfError(iTimer.CreateLocal()); + + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CARNNotificationObject::NewL +// --------------------------------------------------------------------------- +CARNNotificationObject* CARNNotificationObject::NewL(const TInt aPriority, CMMRCServerInfo& aMMRCServerInfo) + { + DP_STATIC_CONTEXT(----> CARNNotificationObject::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CARNNotificationObject* self = new(ELeave)CARNNotificationObject(aPriority); + CleanupStack::PushL(self); + self->ConstructL(aMMRCServerInfo); + CleanupStack::Pop(self); + + DP0_RET(self, "0x%x"); + } + +// --------------------------------------------------------------------------- +// CARNNotificationObject::RunL +// --------------------------------------------------------------------------- +void CARNNotificationObject::RunL() + { + DP_CONTEXT(CARNNotificationObject::RunL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + #if defined(_DEBUG) && defined(__WINS__) + const TTimeIntervalMicroSeconds32 KTimer = 1.8*1000000; // 1.8 seconds + #else + const TTimeIntervalMicroSeconds32 KTimer = 800000; // 0.8 seconds + #endif + + TInt numPausedContext = iMMRCServerInfo->AllocatedPausedContextsCount(); + + // The list may have been modified whilst the AO was asleep, need to check that: + // 1) iIndex is still in range + // 2) the object at that location should still receive a notification + + if ( (iIndex > -1) && (iIndex < numPausedContext) ) + { + CMMRCServerSession* mmrcSession = iMMRCServerInfo->PausedContextByIndex(iIndex); + + TAudioContextId id = mmrcSession->ContextId( ); + TBool isOnAPRList = iMMRCServerInfo->IsOnAPRList(id); + if(isOnAPRList) + { + mmrcSession->NotifyClientResourceUnallocated(); + } + + + for(TInt aux = iIndex + 1; aux < numPausedContext ; aux++) + { + mmrcSession = iMMRCServerInfo->PausedContextByIndex(aux); + id = mmrcSession->ContextId( ); + isOnAPRList = iMMRCServerInfo->IsOnAPRList(id); + if(isOnAPRList) + { + iIndex = aux; + After(KTimer); + break; + } + } + } + + else + { + iIndex = 0; + } + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CARNNotificationObject::After +// --------------------------------------------------------------------------- +void CARNNotificationObject::After(TTimeIntervalMicroSeconds32 aInterval) + { + DP_CONTEXT(CARNNotificationObject::After *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + Cancel(); + iTimer.After(iStatus,aInterval); + SetActive(); + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CARNNotificationObject::Initialize +// --------------------------------------------------------------------------- +void CARNNotificationObject::Initialize() + { + DP_CONTEXT(CARNNotificationObject::Initialize *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + #if defined(_DEBUG) && defined(__WINS__) + const TTimeIntervalMicroSeconds32 KTimer = 1.8*1000000; // 1.8 seconds + #else + const TTimeIntervalMicroSeconds32 KTimer = 800000; // 0.8 seconds + #endif + + TInt numPausedContext = iMMRCServerInfo->AllocatedPausedContextsCount(); + iIndex = 0; + CMMRCServerSession* mmrcSession = NULL; + + if(numPausedContext) // don't bother if zero. + { + for(TInt i(0); iPausedContextByIndex(i); + TAudioContextId id = mmrcSession->ContextId( ); + TBool isOnAPRList = iMMRCServerInfo->IsOnAPRList(id); + if(isOnAPRList) + { + iIndex = i; + After(KTimer); + break; + } + } + } + + DP_OUT(); + } + +// --------------------------------------------------------------------------- +// CMMRCServer::DoCancel +// --------------------------------------------------------------------------- +void CARNNotificationObject::DoCancel() + { + DP_CONTEXT(CARNNotificationObject::DoCancel *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iTimer.Cancel(); + + DP_OUT(); + } + + +void CMMRCServerController::Panic(TMMRCServerControllerPanicCodes aCode) + { + User::Panic(KMMRCServerControllerPanicCategory, aCode); + } +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserverinfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserverinfo.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,913 @@ +// Copyright (c) 2007-2009 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 "mmrcserverinfo.h" +#include "mmrcserversession.h" +#include "mmrcservercontroller.h" +#include "mlogicalchain.h" +#include "mmrcutil.h" +#include + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ +CMMRCServerInfo::CMMRCServerInfo(CMMRCServerController& aServerController) +: iMMRCServerController( aServerController) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServerInfo::CMMRCServerInfo *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + + +/** + * destructor + */ +CMMRCServerInfo::~CMMRCServerInfo() + { + DP_CONTEXT(----> CMMRCServerInfo::~CMMRCServerInfo *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCAllocatedResourceContextsQueue.ResetAndDestroy(); + iMMRCContextsQueue.ResetAndDestroy(); + iMMRCAPRContextsQueue.ResetAndDestroy(); + iMMRCPausedContextsQueue.ResetAndDestroy(); + + DP_OUT(); + } + +/** + * Constructs, and returns a pointer to, a new CMMRCServerInfo object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerInfo* A pointer to newly created utlitly object. + */ +CMMRCServerInfo* CMMRCServerInfo::NewL(CMMRCServerController& aServerController) + { + DP_STATIC_CONTEXT(----> CMMRCServerInfo::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerInfo* self = NewLC(aServerController); + CleanupStack::Pop(self); + + DP0_RET(self, "self = 0x%x"); + } + +/** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerInfo object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerInfo* A pointer to newly created utlitly object. + */ +CMMRCServerInfo* CMMRCServerInfo::NewLC(CMMRCServerController& aServerController) + { + DP_STATIC_CONTEXT(----> CMMRCServerInfo::NewLC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerInfo* self=new(ELeave) CMMRCServerInfo(aServerController); + CleanupStack::PushL(self); + self->ConstructL( ); + + DP0_RET(self, "self = 0x%x"); + } + +/** + CMMRCServerInfo::ConstructL + Symbian 2nd phase constructor can leave. + */ +void CMMRCServerInfo::ConstructL() + { + DP_CONTEXT(----> CMMRCServerInfo::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * Change the state of the server + * @param TMMRCServerState aNewState + */ +void CMMRCServerInfo::SwitchServerState(TMMRCServerState aNewState, TUint64 aContextId) + { + DP_CONTEXT(----> CMMRCServerInfo::SwitchServerState *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iMMRCServerInfoState = aNewState; + iLastTransactionContextId = aContextId; + + DP_OUT(); + } + +/** + * return the current server state + * @return TMMRCServerState& aServerState + */ +void CMMRCServerInfo::ServerState(TMMRCServerState& aServerState, TUint64& aContextId) const + { + DP_CONTEXT(----> CMMRCServerInfo::ServerState *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + aContextId = iLastTransactionContextId; + aServerState = iMMRCServerInfoState; + + DP_OUT(); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Push an Context on the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ +void CMMRCServerInfo::PushContextL(RMMRCContextsQueueTD& aContextsQueue, const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushContextL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + aContextsQueue.PushL(&aServerSession); + + DP_OUT(); + } + +/** + * Pop and remove the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContext(RMMRCContextsQueueTD& aContextsQueue) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = 0; + //PopAndRemove return null if the queue is empty; + serverSession = aContextsQueue.PopAndRemove(); + + DP0_RET(serverSession, "serverSession = 0x%x"); + } + +/** + * Pop and remove the first Context from the Context queue in parameter by contextId + * @param RMMRCContextsQueueTD& aContextsQueue + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContextByContextId(RMMRCContextsQueueTD& aContextsQueue, const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContextByContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = NULL; + + TInt nbContexts = aContextsQueue.Count(); + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + serverSession = aContextsQueue[i]; + + TAudioContextId contextId = serverSession->ContextId(); + if( aContextId == contextId ) + { + aContextsQueue.PopAndRemove(i); + break; + } + else + { + serverSession = NULL; + } + } + + DP0_RET(serverSession, "serverSession = 0x%x"); + } + + +/** + * Pop and remove the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt nbContexts = aContextsQueue.Count(); + if( 0 == nbContexts ) + { + return NULL; + } + + TInt highestPriority = 0; + TInt sessionIdx = 0; + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + const CMMRCServerSession* srvSession = aContextsQueue[i]; + // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly + const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); + if(!logicalChain) + { + logicalChain = srvSession->LogicalChainLastCommited(); + } + if(!logicalChain) + { + return NULL; + } +// AM Getting the priority + TInt currentChainPriority = (const_cast(logicalChain))->Priority(); + if( currentChainPriority > highestPriority ) + { + highestPriority = currentChainPriority; + sessionIdx = i; + } + + +// JIn edited as these settings have been removed +/* TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; + if( audioTypeSettings.iPriority > highestPriority ) + { + highestPriority = audioTypeSettings.iPriority; + sessionIdx = i; + } +*/ + +// AM + // highestPriority = 5; + // sessionIdx = i; + +//EOJin + } + CMMRCServerSession* serverSession = aContextsQueue.PopAndRemove(sessionIdx); + + DP0_RET(serverSession, "serverSession=0x%x"); + } + +/** + * Pop and remove the first Context of the highest priority and more than aPriority + * from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority(RMMRCContextsQueueTD& aContextsQueue, TInt /*aPriority*/ ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = NULL; + TInt nbContexts = aContextsQueue.Count(); + if( 0 == nbContexts ) + { + return NULL; + } + + TInt highestPriority = 0; + TInt sessionIdx = 0; + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + const CMMRCServerSession* srvSession = aContextsQueue[i]; + // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly + const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); + if(!logicalChain) + { + return NULL; + } + +// AM Getting the priority + TInt currentChainPriority = (const_cast(logicalChain))->Priority(); + if( currentChainPriority > highestPriority ) + { + highestPriority = currentChainPriority; + sessionIdx = i; + } + + + +// EOJin + } + + if( sessionIdx < nbContexts ) + { + serverSession = aContextsQueue.PopAndRemove(sessionIdx); + } + +DP0_RET(serverSession, "serverSession=0x%x"); + } + +/** + * Pop the first Context from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopFirstContext(const RMMRCContextsQueueTD& aContextsQueue) const + { + DP_CONTEXT(----> CMMRCServerInfo::PopFirstContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = 0; + //PopAndRemove return null if the queue is empty; + serverSession = aContextsQueue.Pop(); + + DP0_RET(serverSession, "serverSession=0x%x"); + } + +/** + * Pop the first Context of the highest priority from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue) const + { + DP_CONTEXT(----> CMMRCServerInfo::PopContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt nbContexts = aContextsQueue.Count(); + if( 0 == nbContexts ) + { + return NULL; + } + + TInt highestPriority = 0; + TInt sessionIdx = 0; + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + const CMMRCServerSession* srvSession = aContextsQueue[i]; + // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly + const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); + if(!logicalChain) + { + logicalChain = srvSession->LogicalChainLastCommited(); + } + if(!logicalChain) + { + return NULL; + } + +// Jin edited to remove dependency on missing element +/* + TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; + if( audioTypeSettings.iPriority > highestPriority ) + { + highestPriority = audioTypeSettings.iPriority; + sessionIdx = i; + } +*/ +// AM +/* highestPriority = 5; + sessionIdx = i; + +*/ +// AM Getting the priority + TInt currentChainPriority = (const_cast(logicalChain))->Priority(); + if( currentChainPriority > highestPriority ) + { + highestPriority = currentChainPriority; + sessionIdx = i; + } + +// EOJIn + } + CMMRCServerSession* serverSession = aContextsQueue.Pop(sessionIdx); + + DP0_RET(serverSession, "serverSession=0x%x"); + } + +/** + * Pop the first Context of the highest priority and more than aPriority + * from the Context queue in parameter + * @param RMMRCContextsQueueTD& aContextsQueue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopContextFirstHighestPriority(const RMMRCContextsQueueTD& aContextsQueue, TInt /*aPriority*/ ) const + { + DP_CONTEXT(----> CMMRCServerInfo::PopContextFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt nbContexts = aContextsQueue.Count(); + if( 0 == nbContexts ) + { + return NULL; + } + + TInt highestPriority = 0; + TInt sessionIdx = 0; + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + const CMMRCServerSession* srvSession = aContextsQueue[i]; + // LogicalChainLastCommited or LogicalChainRequested is not null necesseraly + const MLogicalChain* logicalChain = srvSession->LogicalChainRequested(); + if(!logicalChain) + { + logicalChain = srvSession->LogicalChainLastCommited(); + } + if(!logicalChain) + { + return NULL; + } + +// JIn edited to remove dependency +/* + TAudioTypeSettings audioTypeSettings = (logicalChain->ChainConfiguration()).iAudioTypeSettings; + if( audioTypeSettings.iPriority > aPriority && audioTypeSettings.iPriority > highestPriority ) + { + highestPriority = audioTypeSettings.iPriority; + sessionIdx = i; + } +*/ + +// AM New way to access +// highestPriority = 5; +// sessionIdx = i; + +// AM Getting the priority + TInt currentChainPriority = (const_cast(logicalChain))->Priority(); + if( currentChainPriority > highestPriority ) + { + highestPriority = currentChainPriority; + sessionIdx = i; + } +// EOJIn + } + + CMMRCServerSession* serverSession = NULL; + if( sessionIdx < nbContexts ) + { + serverSession = aContextsQueue.Pop(sessionIdx); + } + + DP0_RET(serverSession, "serverSession=0x%x"); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Push an Context on the Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ +void CMMRCServerInfo::PushRequestL(const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushRequestL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + PushContextL(iMMRCContextsQueue, aServerSession); + + DP_OUT(); + } + +/** + * Pop and remove the first Context from the Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstRequest() + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop and remove the first Context from the Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstRequestByContextId(const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstRequestByContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCContextsQueue, aContextId); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + + +/** + * Pop and remove the first Context of the highest priority from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority() + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveContextFirstHighestPriority(iMMRCContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop and remove the first Context of the highest priority and more than aPriority + * from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority( TInt aPriority ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveContextFirstHighestPriority(iMMRCContextsQueue, aPriority); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop the first Context from the Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopFirstRequest() const + { + DP_CONTEXT(----> CMMRCServerInfo::PopFirstRequest *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop the first Context of the highest priority from the Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopRequestFirstHighestPriority() const + { + DP_CONTEXT(----> CMMRCServerInfo::PopRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopContextFirstHighestPriority(iMMRCContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop the first Context of the highest priority and more than aPriority + * from the Context queue + * @param TInt aPriority + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopRequestFirstHighestPriority(TInt aPriority ) const + { + DP_CONTEXT(----> CMMRCServerInfo::PopRequestFirstHighestPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopContextFirstHighestPriority(iMMRCContextsQueue, aPriority); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Push an Context on the in-process Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ +void CMMRCServerInfo::PushAllocatedResourceContextL(const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushAllocatedResourceContextL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + PushContextL(iMMRCAllocatedResourceContextsQueue, aServerSession); + + DP_OUT(); + } + +/** + * Pop and remove the first Context of the highest priority from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContext() + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCAllocatedResourceContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop and remove the first Context from the in-process Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContextByContextId(const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAllocatedResourceContextByContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCAllocatedResourceContextsQueue, aContextId); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + * Pop the first Context from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopFirstAllocatedResourceContext() const + { + DP_CONTEXT(----> CMMRCServerInfo::PopFirstAllocatedResourceContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCAllocatedResourceContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Push an Context on the in-process Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ +void CMMRCServerInfo::PushPausedContextL(const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushPausedContextL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + PushContextInOrderL(iMMRCPausedContextsQueue, aServerSession); + + DP_OUT(); + } + +/** + * Pop and remove the first Context of the highest priority from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstPausedContext() + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstPausedContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextForPause(iMMRCPausedContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } +/** + * Pop and remove the first Context from the in-process Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemovePausedContext(const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemovePausedContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveContextIdForPause(iMMRCPausedContextsQueue, aContextId); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } +/** + * Pop the Context from the in-process Context queue + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PausedContextByIndex(TInt aIndex) + { + DP_CONTEXT(----> CMMRCServerInfo::PausedContextByIndex *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PausedContextByIndexForPause(iMMRCPausedContextsQueue, aIndex); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ + +/** + * Push an Context on the in-process Context queue + * @param CMMRCServerSession& aServerSession + * @leave in case of memory error + */ +void CMMRCServerInfo::PushAPRContextL(const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushAPRContextL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + PushContextL(iMMRCAPRContextsQueue, aServerSession); + + DP_OUT(); + } + +/** + * Pop and remove the first Context of the highest priority from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAPRContext() + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAPRContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContext(iMMRCAPRContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } +/** + * Pop and remove the first Context from the in-process Context queue by contextId + * @param const TAudioContextId& aContextId + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstAPRContextByContextId(const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstAPRContextByContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopAndRemoveFirstContextByContextId(iMMRCAPRContextsQueue, aContextId); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } +/** + * Pop the first Context from the in-process Context queue + * @return CMMRCServerSession* the session of the Context + */ +CMMRCServerSession* CMMRCServerInfo::PopFirstAPRContext() const + { + DP_CONTEXT(----> CMMRCServerInfo::PopFirstAPRContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* mmrcSession = PopFirstContext(iMMRCAPRContextsQueue); + + DP0_RET(mmrcSession, "mmrcSession = 0x%x"); + } + +/** + + */ +TBool CMMRCServerInfo::IsOnAPRList(TAudioContextId aId) + { + DP_CONTEXT(----> CMMRCServerInfo::IsOnAPRList *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool iIsContain = EFalse; + CMMRCServerSession* serverSession = NULL; + + TInt nbContexts = iMMRCAPRContextsQueue.Count(); + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + serverSession = iMMRCAPRContextsQueue[i]; + + TAudioContextId contextId = serverSession->ContextId(); + if( aId == contextId ) + { + iIsContain = ETrue; + break; + } + } + + DP0_RET(iIsContain, "%d"); + } + +/** + + */ +void CMMRCServerInfo::PushContextInOrderL(RMMRCContextsQueueOrderTD& aContextsQueue, const CMMRCServerSession& aServerSession ) + { + DP_CONTEXT(----> CMMRCServerInfo::PushContextInOrderL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + aContextsQueue.PushL(&aServerSession); + + DP_OUT(); + } + + +/** + + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveFirstContextForPause(RMMRCContextsQueueOrderTD& aContextsQueue) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveFirstContextForPause *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = 0; + //PopAndRemove return null if the queue is empty; + serverSession = aContextsQueue.PopAndRemoveForPause(0); + + DP0_RET(serverSession, "serverSession = 0x%x"); + } + +/** + + */ +CMMRCServerSession* CMMRCServerInfo::PopAndRemoveContextIdForPause(RMMRCContextsQueueOrderTD& aContextsQueue, const TAudioContextId& aContextId ) + { + DP_CONTEXT(----> CMMRCServerInfo::PopAndRemoveContextIdForPause *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = NULL; + + TInt nbContexts = aContextsQueue.Count(); + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + serverSession = aContextsQueue[i]; + + TAudioContextId contextId = serverSession->ContextId(); + if( aContextId == contextId ) + { + aContextsQueue.PopAndRemoveForPause(i); + break; + } + else + { + serverSession = NULL; + } + } + + DP0_RET(serverSession, "serverSession = 0x%x"); + } + + +/** + + */ +CMMRCServerSession* CMMRCServerInfo::PausedContextByIndexForPause(RMMRCContextsQueueOrderTD& aContextsQueue, TInt aIndex) + { + DP_CONTEXT(----> CMMRCServerInfo::PausedContextByIndexForPause *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* serverSession = 0; + //PopAndRemove return null if the queue is empty; + serverSession = aContextsQueue[aIndex]; + + DP0_RET(serverSession, "serverSession = 0x%x"); + } + + + +/** + + */ +TBool CMMRCServerInfo::IsOnPauseList(TAudioContextId aId) + { + DP_CONTEXT(----> CMMRCServerInfo::IsOnAPRList *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TBool iIsContain = EFalse; + CMMRCServerSession* serverSession = NULL; + + TInt nbContexts = iMMRCPausedContextsQueue.Count(); + for( TInt i = 0 ; i < nbContexts ; i++ ) + { + serverSession = iMMRCPausedContextsQueue[i]; + + TAudioContextId contextId = serverSession->ContextId(); + if( aId == contextId ) + { + iIsContain = ETrue; + break; + } + } + + DP0_RET(iIsContain, "%d"); + } + + + + +TInt CMMRCServerInfo::RequestsCount() + { return iMMRCContextsQueue.Count(); } +TInt CMMRCServerInfo::AllocatedResourceContextsCount() + { return iMMRCAllocatedResourceContextsQueue.Count(); } +TInt CMMRCServerInfo::AllocatedAPRContextsCount() + { return iMMRCAPRContextsQueue.Count(); } +TInt CMMRCServerInfo::AllocatedPausedContextsCount() + { return iMMRCPausedContextsQueue.Count(); } + +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserverrulemanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserverrulemanager.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,253 @@ +// Copyright (c) 2007-2009 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: +// mmrcserverpolicymanager.cpp +// +// + +#include "mmrcserverrulemanager.h" +#include "mmrcserversession.h" +#include "mmrcservercontroller.h" +#include "mmrcerrorcodes.h" +#include "mlogicalchain.h" +#include + + +/** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ +CMMRCServerRuleManager::CMMRCServerRuleManager(CMMRCServerController& aServerController) +:iMMRCServerController(aServerController) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServerRuleManager::CMMRCServerRuleManager *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * Destructor + */ +CMMRCServerRuleManager::~CMMRCServerRuleManager( ) + { + DP_CONTEXT(----> CMMRCServerRuleManager::~CMMRCServerRuleManager *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * Constructs, and returns a pointer to, a new CMMRCServerRuleManager object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerRuleManager* A pointer to newly created utlitly object. + */ +CMMRCServerRuleManager* CMMRCServerRuleManager::NewL(CMMRCServerController& aServerController) + { + DP_STATIC_CONTEXT(----> CMMRCServerRuleManager::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerRuleManager* self = NewLC(aServerController); + CleanupStack::Pop ( self ); + + DP0_RET(self, "self=0x%x"); + } + +/** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerRuleManager object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @return CMMRCServerRuleManager* A pointer to newly created utlitly object. + */ +CMMRCServerRuleManager* CMMRCServerRuleManager::NewLC(CMMRCServerController& aServerController) + { + DP_STATIC_CONTEXT(----> CMMRCServerRuleManager::NewLC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerRuleManager* self = new(ELeave) CMMRCServerRuleManager(aServerController); + CleanupStack::PushL (self ); + self->ConstructL ( ); + + DP0_RET(self, "self=0x%x"); + } + +/** + CMMRCServerRuleManager::ConstructL + Symbian 2nd phase constructor can leave. + */ +void CMMRCServerRuleManager::ConstructL() + { + DP_CONTEXT(----> CMMRCServerRuleManager::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP_OUT(); + } + +/** + * Deduce the rule on the message according to the previous and current state + * Return EProcessOnIdle if no rule has been found. + * Leaves on failure. + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule rule + */ +TMMRCRule CMMRCServerRuleManager::DecisionRule(TAudioState aAudioStateAllocatedResource, TAudioState aAudioStateRequiringProcess ) + { + DP_CONTEXT(RMMRCClient::Open *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TMMRCRule rule = EProcessOnIdle; + switch ( aAudioStateAllocatedResource ) + { + // + case EUninitialized: + case EInitialized: + case EDead: + rule = EAlwaysProcess; + break; + + // + case EIdle: + case EPrimed: + case EActive: + { + if ( aAudioStateRequiringProcess == EUninitialized || aAudioStateRequiringProcess == EInitialized) + { + rule = EAlwaysProcess; + } + } + break; + + default: + __ASSERT_DEBUG(EFalse, User::Panic(KMMRCErrorNameUnkwnonAudioState, EMMRCErrorUnkwnonAudioState)); + break; + } + + DP0_RET(rule, "rule=%d"); + } + +/** + * Deduce the rule on the message according to the previous and current state + * Return EStop if no rule has been found. + * @param TAudioState aAudioStateAllocatedResource + * @param TAudioState aAudioStateRequiringProcess + * @return TMMRCRule rule + */ +TReason CMMRCServerRuleManager::ActionReason(TAudioState aAudioStateLastCommited, TAudioState aAudioStateRequested ) + { + DP_CONTEXT(----> CMMRCServerRuleManager::ActionReason *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TReason reason; + switch (aAudioStateRequested ) + { + case EUninitialized: + if ( aAudioStateLastCommited == EInitialized ) + { + reason = EUninitialize; + } + else + { + reason = EUninitialize ; + } + break; + + case EInitialized: + if ( aAudioStateLastCommited == EUninitialized ) + { + reason = EInitialize; + } + else if ( aAudioStateLastCommited == EIdle ) + { + reason = EUnload; + } + else if ( aAudioStateLastCommited == EPrimed ) + { + reason = EPrimeReason; + } + else if ( aAudioStateLastCommited == EActive ) + { + reason = EStop; + } + else + { + reason = EInitialize ; + } + break; + + case EIdle: + if ( aAudioStateLastCommited == EUninitialized ) + { + reason = ELoad; + } + else if ( aAudioStateLastCommited == EInitialized ) + { + reason = ELoad; + } + else if ( aAudioStateLastCommited == EPrimed ) + { + reason = EStop; + } + else if ( aAudioStateLastCommited == EActive ) + { + reason = EStop; + } + else + { + reason = ELoad; + } + break; + + case EPrimed: + if ( aAudioStateLastCommited == EIdle ) + { + reason = EPrimeReason; + } + else if ( aAudioStateLastCommited == EActive ) + { + reason = EPrimeReason; + } + else + { + reason = EPrimeReason; + } + break; + + case EActive: + if ( aAudioStateLastCommited == EPrimed ) + { + reason = EActivate; + } + else if ( aAudioStateLastCommited == EIdle ) + { + reason = EActivate; + } + else + { + reason = EActivate; + } + break; + + case EDead: + default: + reason = EStop; + break; + } + + DP0_RET(reason, "reason=%d"); + } + +//EOF diff -r 000000000000 -r 79dd3e2336a0 mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserversession.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmresourcemgmt/mmresctrl/src/mmrcserver/mmrcserversession.cpp Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,953 @@ +// Copyright (c) 2007-2009 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 "mmrcserversession.h" +#include "mmrcerrorcodes.h" +#include "mmrcservercontroller.h" +#include "mmrcadaptationproxy.h" + +#include + +#include "mlogicalchain.h" +#include "logicalaudiostream.h" +#include "audiocontext.h" + +#include + + +//------------------------------------------------------------------------------------ +// +//------------------------------------------------------------------------------------ +/** + * By default Symbian 2nd phase constructor is private. + * @param CMMRCServerController& A reference on the MMRC Server controller + */ +CMMRCServerSession::CMMRCServerSession(CMMRCServerController& aServerController, + const CFourCCConvertor& aFourCCConvertor) +: iMMRCServerController(aServerController), + iShutdown(0), + iLogicalChainRequested(NULL), + iLogicalChainLastCommited(NULL), + iLogicalChainRequestResponse(NULL), + iLogicalChainPreemptionNotification(NULL) + { + TRACE_CREATE(); + DP_CONTEXT(----> CMMRCServerSession::CMMRCServerSession *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + iFourCCConvertor = &aFourCCConvertor; + DP_OUT(); + } + +/** + * Destructor + */ +CMMRCServerSession::~CMMRCServerSession() + { + DP_CONTEXT(----> CMMRCServerSession::~CMMRCServerSession *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + //remove any request associated to this session from the controller + iMMRCServerController.CloseSessionByContextId(iContextId); + + if (iMMRCServerSideAdaptationResponseAO) + { + delete iMMRCServerSideAdaptationResponseAO; + iMMRCServerSideAdaptationResponseAO=0; + }; + + if( iLogicalChainLastCommited ) + { + iLogicalChainLastCommited->Release(); + iLogicalChainLastCommited = NULL; + }; + + if( iLogicalChainRequested ) + { + iLogicalChainRequested->Release(); + iLogicalChainRequested = NULL; + } + if( iLogicalChainRequestResponse ) + { + iLogicalChainRequestResponse->Release(); + iLogicalChainRequestResponse = NULL; + }; + + if( iLogicalChainPreemptionNotification ) + { + iLogicalChainPreemptionNotification->Release(); + iLogicalChainPreemptionNotification = NULL; + }; + + iMsgQueue.Close(); + + DP_OUT(); + } + +/** + * Constructs, and returns a pointer to, a new CMMRCServerSession object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @param CFourCCConvertor& A reference to the Fourcc to format converter + * @return CMMRCServerSession* A pointer to newly created utlitly object. + */ +CMMRCServerSession* CMMRCServerSession::NewL(CMMRCServerController& aServerController, + const CFourCCConvertor& aFourCCConvertor) + { + DP_STATIC_CONTEXT(----> CMMRCServerSession::NewL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* self = NewLC(aServerController, aFourCCConvertor); + CleanupStack::Pop(self); + + DP0_RET(self, "self=0x%x"); + } + +/** + * Constructs, leaves object on the cleanup stack, and returns a pointer + * to, a new CMMRCServerSession object. + * Leaves on failure. + * @param CMMRCServerController& A reference on the MMRC Server controller + * @param CFourCCConvertor& A reference to the Fourcc to format converter + * @return CMMRCServerSession* A pointer to newly created utlitly object. + */ +CMMRCServerSession* CMMRCServerSession::NewLC(CMMRCServerController& aServerController, + const CFourCCConvertor& aFourCCConvertor) + { + DP_STATIC_CONTEXT(----> CMMRCServerSession::NewLC *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CMMRCServerSession* self = new(ELeave) CMMRCServerSession(aServerController, aFourCCConvertor); + CleanupStack::PushL( self ); + self->ConstructL(); + + DP0_RET(self, "self=0x%x"); + } + +/** + CMMRCServerSession::ConstructL + Symbian 2nd phase constructor can leave. + */ +void CMMRCServerSession::ConstructL() + { + DP_CONTEXT(----> CMMRCServerSession::ConstructL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + iContextId = reinterpret_cast(this); + iMMRCServerSideAdaptationResponseAO = CMMRCServerSideAdaptationResponseAO::NewL(); + iMMRCServerSideAdaptationResponseAO->Initialize(this, &iServerThread); + + DP_OUT(); + } + +/** + * from CSession2 + * @param aMessage - Function and data for the session + */ +void CMMRCServerSession::ServiceL(const RMessage2& aMessage) + { + DP_CONTEXT(----> CMMRCServerSession::ServiceL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TRAPD( errL, DispatchMessageL(aMessage) ); + + if( errL != KErrNone ) + { + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("CMMRCServerSession::ServiceL - err %d"), errL); + #endif + } + + DP_OUT(); + } + +/** + * Dispatch the message received from ServeL + * EMMRCClientToServerSetMsgQueueHandle - Initialise the queue handler + * EMMRCClientToServerMessage - Process a message from the client + * EMMRCClientToServerMessageUpdate - Process a message update from the client + * EMMRCClientToServerMessageAcknowledgement - Process the acknowldgement from the client + * @param aMessage - Function and data for the session + * @return error code + * @leave in case of writeL leave or request leave + */ +TInt CMMRCServerSession::DispatchMessageL(const RMessage2& aMessage) + { + DP_CONTEXT(----> CMMRCServerSession::DispatchMessageL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt error(KErrNone); + + TMMRCClientToServerMessages messageFunction = static_cast(aMessage.Function()); + switch(messageFunction) + { + + case EMMRCClientToServerSetClientThreadId: + { + TThreadId* id = static_cast(const_cast(aMessage.Ptr0())); + iClientThread.Open(*id); + RThread me; + iServerThread.Open(me.Id()); + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerSetAdaptationProxy: + { + iMMRCClientSideServerRequestToAdaptationAO = static_cast(const_cast(aMessage.Ptr0())); + + if(iMMRCClientSideServerRequestToAdaptationAO) + { + iMMRCClientSideServerRequestToAdaptationAO->Initialize(this, + iMMRCServerSideAdaptationResponseAO, + &iClientThread, + *iFourCCConvertor); + } + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerSetMsgQueueHandle: + { + error = iMsgQueue.Open( aMessage, 0 ); + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerCloseSession: + { + //set a flag so that any subsequent acknowledgment will be ignored... + iShutdown=ETrue; + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerRequestResource: + { + error = EnqueueRequestL(aMessage); + // AM this is needed since the request is not asynchronous. + // It is processed asynchronously which is different + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerRequestContextId: + { + // CDS This code does not appear to be handling PlatSec functionality well + + TProcessId PID; + TPckg processIdPckg(PID); + TPckgBuf contextIdPckg; + + aMessage.ReadL( 0, processIdPckg ); + + RProcess client; + TInt err = client.Open(PID); + if(err == KErrNone) + { + iClientHasMMCapability = client.HasCapability(ECapabilityMultimediaDD, KSuppressPlatSecDiagnostic); + iClientHasUECapability = client.HasCapability(ECapabilityUserEnvironment, KSuppressPlatSecDiagnostic); + client.Close(); + } + aMessage.WriteL( 1, contextIdPckg ); + aMessage.Complete(error); + } + break; + + + case EMMRCClientToServerRegisterAsClient: + { + // ignoring arguments + error = iMMRCServerController.EnqueueRequestForAPRL(*this); + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerCancelRegisterAsClient: + { + // ignoring arguments + error = iMMRCServerController.RemoveRequestForAPR(*this); + aMessage.Complete(error); + } + break; + + case EMMRCClientToServerWillResumePlay: + { + error = iMMRCServerController.WillResumePlay(); + aMessage.Complete(error); + } + break; + + default: + { + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("!!!!CMMRCServerSession::DispatchMessageL - unknown message")); + #endif + // Unknown Message + error = KErrNotSupported; + } + break; + } + + DP0_RET(error, "err=%d"); + } + +/** + * Process a message that can be + * EMMRCMessageStateAffecting a state-effecting message + * EMMRCMessageCommit a resource request + * @param const RMessage2& aMessage + */ +void CMMRCServerSession::PreProcessRequestL(const RMessage2& aMessage) + { + DP_CONTEXT(----> CMMRCServerSession::PreprocessMessageL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + MLogicalChain* logicalChainRequested = static_cast(const_cast(aMessage.Ptr1())); + if( logicalChainRequested == NULL ) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerSession::PreProcessRequestL - logicalChainRequested NULL")); + ASSERT(0); + #endif + User::Leave(KErrArgument); + } + + TInt err1 = KErrNone, err2 = KErrNone; + iAudioContext = static_cast(const_cast(aMessage.Ptr2())); + MLogicalChain* logicalChainLastCommited = static_cast(const_cast(aMessage.Ptr0())); + + if(iLogicalChainLastCommitedStack) + { + iLogicalChainLastCommitedStack->Release(); + iLogicalChainLastCommitedStack = NULL; + } + if(iLogicalChainRequestedStack) + { + iLogicalChainRequestedStack->Release(); + iLogicalChainRequestedStack = NULL; + } + + iAudioContext->CriticalSection().Wait(); + TInt msgVersion = iAudioContext->MsgVersion(); + if(msgVersion == aMessage.Int3()) + { + if(logicalChainLastCommited) + { + TRAP(err1, iLogicalChainLastCommitedStack = logicalChainLastCommited->CloneL()); + } + + if(logicalChainRequested) + { + TRAP(err2, iLogicalChainRequestedStack = logicalChainRequested->CloneL()); + } + } + iAudioContext->CriticalSection().Signal(); + + if(msgVersion != aMessage.Int3()) + { + User::Leave(KErrCompletion); + } + + if(err1!=KErrNone) + { + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("!!!!CMMRCServerSession::PreProcessRequestL - logicalChainLastCommited->CloneL - error = %d"), err1); + #endif + ASSERT(0); + User::Leave(err1); + } + + if(err2!=KErrNone) + { + #ifdef SYMBIAN_MULTIMEDIA_ENABLE_LOGGING + RDebug::Print(_L("!!!!CMMRCServerSession::PreProcessRequestL - logicalChainRequested->CloneL - error = %d"), err2); + #endif + if(iLogicalChainLastCommitedStack) + { + iLogicalChainRequestedStack->Release(); + iLogicalChainRequestedStack = NULL; + } + ASSERT(0); + User::Leave(err2); + } + + DP_OUT(); + } + +/** + * Process a message that can be + * EMMRCMessageStateAffecting a state-effecting message + * EMMRCMessageCommit a resource request + * @param const RMessage2& aMessage + */ +TInt CMMRCServerSession::EnqueueRequestL(const RMessage2& aMessage) + { + DP_CONTEXT(----####> CMMRCServerSession::ProcessRequestL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TInt err = KErrNone; + TRAP(err, PreProcessRequestL(aMessage)); + if( err == KErrNone ) + { + err = iMMRCServerController.EnqueueRequestL(*this); + } + + DP0_RET(err, "err = %d"); + } + +/* + * + */ +void CMMRCServerSession::StartProcessL() + { + DP_CONTEXT(----> CMMRCServerSession::StartProcessL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + if( iLogicalChainLastCommited ) + { + //jjpy TODO should compare with iLogicalChainRequestedStack + iLogicalChainLastCommited->Release(); + } + + if(iLogicalChainRequested) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerSession::StartProcessL - iLogicalChainRequested not NULL")); + ASSERT(0); + #endif + iLogicalChainRequested->Release(); + } + + iLogicalChainLastCommited = iLogicalChainLastCommitedStack; + iLogicalChainRequested = iLogicalChainRequestedStack; + + iLogicalChainLastCommitedStack = 0; + iLogicalChainRequestedStack = 0; + + //Send the CommitUpdate to the client + TMMRCQueueItem messageItem; + messageItem.iRequestType = EMMRCRequestCommitUpdate; + messageItem.iResult = EMMRCServerToClientCommitUpdate; + messageItem.iErrorCode = KErrNone; + TInt errSend = iMsgQueue.Send(messageItem); + #ifdef _DEBUG + if(errSend!=KErrNone) + { + RDebug::Print(_L("!!!!CMMRCServerSession::PreProcessRequestL - error = %d"), errSend); + ASSERT(0); + } + #endif + User::LeaveIfError(errSend); + + DP_OUT(); + } + +/* + * + */ +void CMMRCServerSession::StartPreemptionL() + { + DP_CONTEXT(----> CMMRCServerSession::StartPreemptionL *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + //Should be NULL + if(iLogicalChainRequested) + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerSession::StartPreemptionL - iLogicalChainRequested not NULL")); + ASSERT(0); + #endif + iLogicalChainRequested->Release(); + } + + //Should NOT be NULL. + if( iLogicalChainLastCommited ) + { + iLogicalChainRequested = iLogicalChainLastCommited->CloneL(); + CLogicalAudioStream* audiostream = static_cast(iLogicalChainRequested); + TAudioState state = audiostream->StreamState(); + + // MMRC wont't support demote to EIdle anymore + // All stream are demote to EInitialised + switch(state) + { + case EIdle: + { + audiostream->Unload(); + } + break; + + case EPrimed: + case EActive: + { + User::LeaveIfError(audiostream->Stop()); + audiostream->Unload(); + } + break; + default: + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerSession::StartPreemptionL - wrong state ")); + ASSERT(0); + #endif + break; + } + } + + DP_OUT(); + } + +/** + * Callback on a resource request + * @param TMMRCServerToClientMessageResults aResult the result on the request + * @leave + */ +void CMMRCServerSession::AdaptationRequestAcknowledgment(TMMRCAdaptationToServerRequestResults aResult, TInt aError) + { + DP_CONTEXT(----@@@@> CMMRCServerSession::AdaptationRequestAcknowledgment *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TMMRCQueueItem messageItem; + messageItem.iRequestType = EMMRCRequestCommitResponse; + + switch(aResult) + { + case EMMRCAdaptationToServerResourceComplete: + { + TUint64 contextId; + TMMRCServerState serverState; + iMMRCServerController.ServerState(serverState, contextId); + switch(serverState) + { + case EMMRCServerStateWaitResourceResponseFromAdaptation: // here we process the response + { + messageItem.iResult = EMMRCServerToClientResourceAgreed; + messageItem.iErrorCode = aError; + iMMRCServerController.AdaptationRequestAcknowledgment(*this, aResult, aError); + SendRequestResponseToClient(messageItem); + } //end case EMMRCServerStateWaitResourceResponseFromAdaptation + break; + case EMMRCServerStateWaitPreemptionResponse: // here we process the response + { + messageItem.iResult = EMMRCServerToClientResourcePreempt; + messageItem.iErrorCode = KErrCompletion; + iMMRCServerController.AdaptationRequestAcknowledgment(*this, aResult, KErrCompletion); + SendPreemptionNotificationToClient(messageItem); + } + break; + default: + { + #ifdef _DEBUG + RDebug::Print(_L("!!!!CMMRCServerSession::AdaptationRequestAcknowledgment - Unknown message")); + ASSERT(0); + #endif + } + break; + } //end case EMMRCServerStateWaitPreemptionRespons + } + break; + + case EMMRCAdaptationToServerResourceIncomplete: + { + messageItem.iResult = EMMRCServerToClientResourceDenied; + messageItem.iErrorCode = aError; + iMMRCServerController.AdaptationRequestAcknowledgment(*this, aResult, aError); + SendRequestResponseToClient(messageItem); + } + break; + + case EMMRCAdaptationToServerResourceTimeout: + { + messageItem.iResult = EMMRCServerToClientRequestError; + messageItem.iErrorCode = KErrCompletion; + iMMRCServerController.AdaptationRequestAcknowledgment(*this, EMMRCAdaptationToServerResourceTimeout, KErrCompletion); + SendRequestResponseToClient(messageItem); + } + break; + + default: + break; + } + + DP_OUT(); + } + +/** + * + * + */ +void CMMRCServerSession::SendRequestResponseToClient(TMMRCQueueItem& messageItem) + { + DP_CONTEXT(----====> CMMRCServerSession::SendRequestResponseToClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + if(messageItem.iErrorCode == KErrNone) + { + //1) Set the iLogicalChainRequestResponse + if(iLogicalChainRequestResponse) + { + iLogicalChainRequestResponse->Release(); + iLogicalChainRequestResponse = NULL; + } + if(iLogicalChainRequested) + { + TInt errT; + TRAP(errT, iLogicalChainRequestResponse = iLogicalChainRequested->CloneL()); + DP1(DLERR,"ECloneLeftWhenSendingResponseToClient %d", errT); + __ASSERT_DEBUG(errT == KErrNone, Panic(ECloneLeftWhenSendingResponseToClient)); + } + //2) Set the last commited chain et set the desired one to NULL + if( iLogicalChainLastCommited ) + { + iLogicalChainLastCommited->Release(); + iLogicalChainLastCommited = NULL; + } + iLogicalChainLastCommited = iLogicalChainRequested; + iLogicalChainRequested = NULL; + } + else //In case of ERROR + { + //1) Set the iLogicalChainRequestResponse + if(iLogicalChainRequestResponse) + { + iLogicalChainRequestResponse->Release(); + iLogicalChainRequestResponse = NULL; + } + if(iLogicalChainRequested) + { + TInt errT; + TRAP(errT, iLogicalChainRequestResponse = iLogicalChainLastCommited->CloneL()); + DP1(DLERR,"ECloneLeftWhenSendingResponseToClient %d", errT); + __ASSERT_DEBUG(errT == KErrNone, Panic(ECloneLeftWhenSendingResponseToClient)); + } + //2) Set the last commited chain et set the desired one to NULL + if( iLogicalChainRequested ) + { + iLogicalChainRequested->Release(); + iLogicalChainRequested = NULL; + } + + if(iLogicalChainRequestedStack) + { + CLogicalAudioStream* lChain = static_cast (iLogicalChainLastCommited); + TAudioTypeSettings settings; + settings.iPriority = iLogicalChainRequestedStack->Priority(); + settings.iPref = 0; + lChain->SetAudioType(settings); + } + } + // Set the data for the client + messageItem.iData = iLogicalChainRequestResponse; + + //send the response to the client + TInt errSend = iMsgQueue.Send(messageItem); + DP1(DLERR,"EMsgQueueFailedToSendMsg %d", errSend); + __ASSERT_DEBUG(errSend == KErrNone, Panic(EMsgQueueFailedToSendMsg)); + + DP_OUT(); + } + +/** + * + * + */ +void CMMRCServerSession::SendPreemptionNotificationToClient(TMMRCQueueItem& messageItem) + { + DP_CONTEXT(----~~~~> CMMRCServerSession::SendRequestResponseToClient *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + //1) Set the iLogicalChainPreemptionNotification + if(iLogicalChainPreemptionNotification) + { + iLogicalChainPreemptionNotification->Release(); + iLogicalChainPreemptionNotification = NULL; + } + if(iLogicalChainRequested) + { + TInt errT; + TRAP(errT, iLogicalChainPreemptionNotification = iLogicalChainRequested->CloneL()); + DP1(DLERR,"ECloneLeftWhenSendingResponseToClient %d", errT); + __ASSERT_DEBUG(errT == KErrNone, Panic(ECloneLeftWhenSendingResponseToClient)); + + iLogicalChainRequested->Release(); + iLogicalChainRequested = NULL; + } + + messageItem.iData = iLogicalChainPreemptionNotification; + + //send the response to the client + TInt errSend = iMsgQueue.Send(messageItem); + DP1(DLERR,"EMsgQueueFailedToSendMsg %d", errSend); + __ASSERT_DEBUG(errSend == KErrNone, Panic(EMsgQueueFailedToSendMsg)); + + DP_OUT(); + } + +/** + * Notify all the paused client that a resource has been unallocated + */ +void CMMRCServerSession::NotifyClientResourceUnallocated() + { + DP_CONTEXT(----****> CMMRCServerSession::NotifyClientsResourceUnallocated *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + TMMRCQueueItem messageItem; + messageItem.iRequestType = EMMRCRequestResourceUnallocated; + TInt errSend = iMsgQueue.Send(messageItem); + DP1(DLERR,"EMsgQueueFailedToSendMsg %d", errSend); + __ASSERT_DEBUG(errSend == KErrNone, Panic(EMsgQueueFailedToSendMsg)); + + DP_OUT(); + } + + +/** + * return the current committed chain (const) + * @return the current committed chain + */ +const MLogicalChain* CMMRCServerSession::LogicalChainRequested() const + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainRequested const *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainRequested, "iLogicalChainRequested=0x%x"); + } + +/** + * return the current committed chain (const) + * @return the current committed chain + */ +const MLogicalChain* CMMRCServerSession::LogicalChainRequestedStack() const + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainRequestedStack const *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainRequestedStack, "iLogicalChainRequestedStack=0x%x"); + } + + +/** + * return the last committed chain (const) + * @return the last committed chain + */ +const MLogicalChain* CMMRCServerSession::LogicalChainLastCommited() const + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainLastCommited const *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainLastCommited, "iLogicalChainLastCommited=0x%x"); + } + +/** + * return the Audio Context (const) + * @return the Audio Context + */ +const MAudioContext* CMMRCServerSession::AudioContext() const + { + DP_CONTEXT(----> CMMRCServerSession::AudioContext *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iAudioContext, "iAudioContext=0x%x"); + } + +/** + * return the current committed chain + * @return the current committed chain + */ +MLogicalChain* CMMRCServerSession::LogicalChainRequested() + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainRequested *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainRequested, "iLogicalChainRequested=0x%x"); + } + +/** + * return the current committed chain + * @return the current committed chain + */ +MLogicalChain* CMMRCServerSession::LogicalChainRequestedStack() + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainRequestedStack *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainRequestedStack, "iLogicalChainRequestedStack=0x%x"); + } + +/** + * return the last committed chain + * @return the last committed chain + */ +MLogicalChain* CMMRCServerSession::LogicalChainLastCommited() + { + DP_CONTEXT(----> CMMRCServerSession::LogicalChainLastCommited *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iLogicalChainLastCommited, "iLogicalChainLastCommited=0x%x"); + } + +/** + * + * @param + * @return + */ +CMMRCClientSideServerRequestToAdaptationAO* CMMRCServerSession::AdaptationProxy() +{ + DP_CONTEXT(----> CMMRCServerSession::AdaptationProxy *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iMMRCClientSideServerRequestToAdaptationAO, "iMMRCServerAdaptationProxy=0x%x"); +} + +/** + * + * @param + * @return + */ +TUint64 CMMRCServerSession::ContextId() + { + DP_CONTEXT(----> CMMRCServerSession::ContextId *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iContextId, "iContextId=%d"); + } + +/** + * + */ +TBool CMMRCServerSession::HasMultimediaCapability() const + { + return iClientHasMMCapability; + } + + +/** + * + */ +void CMMRCServerSession::Clean() + { + DP_CONTEXT(----> CMMRCServerSession::Clean *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + DP_OUT(); + } + +/** + * + * @param + */ +void CMMRCServerSession::Disconnect(const RMessage2& aMessage) + { + DP_CONTEXT(----> CMMRCServerSession::Disconnect *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + CSession2::Disconnect(aMessage); + + DP_OUT(); + } + +/** + * + * @return + */ +TBool CMMRCServerSession::IsServerShuttingDown() + { + DP_CONTEXT(----> CMMRCServerSession::IsServerShuttingDown *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + + DP0_RET(iShutdown, "state(bool) = %d"); + } + +TInt CMMRCServerSession::RequestsSent() + { + return iRequestsSent; + }; + +void CMMRCServerSession::IncrementRequestsSent() + { + iRequestsSent++; + }; + +CMMRCServerSideAdaptationResponseAO* CMMRCServerSession::ServerProxy() + { + return iMMRCServerSideAdaptationResponseAO; + }; + +TInt CMMRCServerSession::SendRequestToAdaptation(TMMRCServerSessionRequestType aRequestType) + { + TInt err=KErrNone; + if (!IsServerShuttingDown()) + { + IncrementRequestsSent(); + ServerProxy()->StartAdaptationListening(); + AdaptationProxy()->Service(aRequestType); + } + else + { +// send some server shutting down error code. + } + return err; + }; + +TInt CMMRCServerSession::GetPriority() const + { + DP_CONTEXT(----> CMMRCServerSession::GetPriority *CD1*, CtxDevSound, DPLOCAL); + DP_IN(); + TInt priority = 0; + if(LogicalChainLastCommited() != NULL) + { + priority = const_cast( LogicalChainLastCommited() )->Priority(); + } + DP0_RET(priority, "priority = %d"); + } + +void CMMRCServerSession::Panic(TMMRCServerSessionPanicCodes aCode) + { + User::Panic(KMMRCServerSessionPanicCategory, aCode); + } + +/** + * @ return Boolean value specifying whether Client has UserEnvironment Capability. + */ +TBool CMMRCServerSession::HasUserEnvironmentCapability() + { + return iClientHasUECapability; + } + +/** + * @ param Error Value to send + * @ return Error Value specifying any error in adding the message to the message queue. + */ + +TInt CMMRCServerSession::NotifyClientOfError(TInt aError) + { + // Create message and send to Client + TMMRCQueueItem messageItem; + messageItem.iRequestType = EMMRCRequestCommitUpdate; + messageItem.iResult = EMMRCServerToClientCommitUpdate; + messageItem.iErrorCode = KErrNone; + TInt errSend = iMsgQueue.Send(messageItem); + + // Create a message with the Error and send to Client + messageItem.iRequestType = EMMRCRequestCommitResponse; + messageItem.iResult = EMMRCServerToClientResourceAgreed; + messageItem.iErrorCode = aError; + TInt errSend2 = iMsgQueue.Send(messageItem); + if (errSend!=KErrNone) + { + return errSend; + } + else + { + return errSend2; + } + } +//EOF diff -r 000000000000 -r 79dd3e2336a0 package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 000000000000 -r 79dd3e2336a0 package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Fri Oct 08 19:40:43 2010 +0100 @@ -0,0 +1,1 @@ +