os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/g711decoderconfigtestdevice.cpp
First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include <ecom/implementationproxy.h>
17 #include <ecom/ecom.h>
19 #include "g711decoderconfigtestdevice.h"
20 #include "devsoundciutestdevices.hrh"
24 CMMFG711DecoderConfig implementation
26 CMMFG711DecoderConfig* CMMFG711DecoderConfig::NewL()
28 CMMFG711DecoderConfig* self = new(ELeave) CMMFG711DecoderConfig();
32 CMMFG711DecoderConfig::~CMMFG711DecoderConfig()
36 //Actual implementation of method SetDecoderMode
37 TInt CMMFG711DecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode)
39 iDecodeMode = aDecodeMode;
43 //Actual implementation of method SetDecoderMode
44 TInt CMMFG711DecoderConfig::GetDecoderMode(TDecodeMode& aDecodeMode)
46 aDecodeMode = iDecodeMode;
50 //Actual implementation of method SetCng
51 TInt CMMFG711DecoderConfig::SetComfortNoiseGeneration(TBool aCng)
57 //Actual implementation of method GetCng
58 TInt CMMFG711DecoderConfig::GetComfortNoiseGeneration(TBool& aCng)
64 //Actual implementation of method SetPlc
65 TInt CMMFG711DecoderConfig::SetPacketLossConcealment(TBool aPlc)
70 //Actual implementation of method SetPlc
71 TInt CMMFG711DecoderConfig::GetPacketLossConcealment(TBool& aPlc)
78 CG711DecoderConfigTestDevice implementation
80 CMMFHwDevice* CG711DecoderConfigTestDevice::NewL()
82 CG711DecoderConfigTestDevice* self = new(ELeave) CG711DecoderConfigTestDevice();
83 CleanupStack::PushL(self);
85 CleanupStack::Pop(self);
89 CG711DecoderConfigTestDevice::~CG711DecoderConfigTestDevice()
91 delete iG711DecoderConfig;
94 CG711DecoderConfigTestDevice::CG711DecoderConfigTestDevice()
98 void CG711DecoderConfigTestDevice::ConstructL()
102 TInt CG711DecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
107 TInt CG711DecoderConfigTestDevice::Stop()
112 TInt CG711DecoderConfigTestDevice::Pause()
117 TInt CG711DecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
122 TAny* CG711DecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
124 // Just return something non-NULL to keep the
125 // DevSound initialisation process happy
126 TAny* ret = static_cast<TAny*>(this);
128 // Now for the CIs we want to test...
129 if (aInterfaceId == KUidG711DecoderIntfc)
131 if (!iG711DecoderConfig)
133 TRAPD(err, iG711DecoderConfig = CMMFG711DecoderConfig::NewL());
134 if (err == KErrNone && iG711DecoderConfig)
136 MG711DecoderIntfc* ptr = this;
137 ret = static_cast<TAny*>(ptr);
149 TInt CG711DecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
154 TInt CG711DecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
159 TInt CG711DecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
164 TInt CG711DecoderConfigTestDevice::StopAndDeleteCodec()
169 TInt CG711DecoderConfigTestDevice::DeleteCodec()
174 CMMFSwCodec& CG711DecoderConfigTestDevice::Codec()
179 TInt CG711DecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode)
181 TInt result = KErrBadHandle;
183 if (iG711DecoderConfig)
185 result = iG711DecoderConfig->SetDecoderMode(aDecodeMode);
191 TInt CG711DecoderConfigTestDevice::GetDecoderMode(TDecodeMode& aDecodeMode)
193 TInt result = KErrBadHandle;
195 if (iG711DecoderConfig)
197 result = iG711DecoderConfig->GetDecoderMode(aDecodeMode);
203 TInt CG711DecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng)
205 TInt result = KErrBadHandle;
207 if (iG711DecoderConfig)
209 result = iG711DecoderConfig->SetComfortNoiseGeneration(aCng);
215 TInt CG711DecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng)
217 TInt result = KErrBadHandle;
219 if (iG711DecoderConfig)
221 result = iG711DecoderConfig->GetComfortNoiseGeneration(aCng);
227 TInt CG711DecoderConfigTestDevice::SetPacketLossConcealment(TBool aPlc)
229 TInt result = KErrBadHandle;
231 if (iG711DecoderConfig)
233 result = iG711DecoderConfig->SetPacketLossConcealment(aPlc);
239 TInt CG711DecoderConfigTestDevice::GetPacketLossConcealment(TBool& aPlc)
241 TInt result = KErrBadHandle;
243 if (iG711DecoderConfig)
245 result = iG711DecoderConfig->GetPacketLossConcealment(aPlc);