os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/g711decoderconfigtestdevice.cpp
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/g711decoderconfigtestdevice.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,249 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <ecom/implementationproxy.h>
1.20 +#include <ecom/ecom.h>
1.21 +#include <f32file.h>
1.22 +#include "g711decoderconfigtestdevice.h"
1.23 +#include "devsoundciutestdevices.hrh"
1.24 +
1.25 +
1.26 +/*
1.27 +CMMFG711DecoderConfig implementation
1.28 +*/
1.29 +CMMFG711DecoderConfig* CMMFG711DecoderConfig::NewL()
1.30 + {
1.31 + CMMFG711DecoderConfig* self = new(ELeave) CMMFG711DecoderConfig();
1.32 + return self;
1.33 + }
1.34 +
1.35 +CMMFG711DecoderConfig::~CMMFG711DecoderConfig()
1.36 + {
1.37 + }
1.38 +
1.39 +//Actual implementation of method SetDecoderMode
1.40 +TInt CMMFG711DecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode)
1.41 + {
1.42 + iDecodeMode = aDecodeMode;
1.43 + return KErrNone;
1.44 + }
1.45 +
1.46 +//Actual implementation of method SetDecoderMode
1.47 +TInt CMMFG711DecoderConfig::GetDecoderMode(TDecodeMode& aDecodeMode)
1.48 + {
1.49 + aDecodeMode = iDecodeMode;
1.50 + return KErrNone;
1.51 + }
1.52 +
1.53 +//Actual implementation of method SetCng
1.54 +TInt CMMFG711DecoderConfig::SetComfortNoiseGeneration(TBool aCng)
1.55 + {
1.56 + iCng = aCng;
1.57 + return KErrNone;
1.58 + }
1.59 +
1.60 +//Actual implementation of method GetCng
1.61 +TInt CMMFG711DecoderConfig::GetComfortNoiseGeneration(TBool& aCng)
1.62 + {
1.63 + aCng = iCng;
1.64 + return KErrNone;
1.65 + }
1.66 +
1.67 +//Actual implementation of method SetPlc
1.68 +TInt CMMFG711DecoderConfig::SetPacketLossConcealment(TBool aPlc)
1.69 + {
1.70 + iPlc = aPlc;
1.71 + return KErrNone;
1.72 + }
1.73 +//Actual implementation of method SetPlc
1.74 +TInt CMMFG711DecoderConfig::GetPacketLossConcealment(TBool& aPlc)
1.75 + {
1.76 + aPlc = iPlc;
1.77 + return KErrNone;
1.78 + }
1.79 +
1.80 +/*
1.81 +CG711DecoderConfigTestDevice implementation
1.82 +*/
1.83 +CMMFHwDevice* CG711DecoderConfigTestDevice::NewL()
1.84 + {
1.85 + CG711DecoderConfigTestDevice* self = new(ELeave) CG711DecoderConfigTestDevice();
1.86 + CleanupStack::PushL(self);
1.87 + self->ConstructL();
1.88 + CleanupStack::Pop(self);
1.89 + return self;
1.90 + }
1.91 +
1.92 +CG711DecoderConfigTestDevice::~CG711DecoderConfigTestDevice()
1.93 + {
1.94 + delete iG711DecoderConfig;
1.95 + }
1.96 +
1.97 +CG711DecoderConfigTestDevice::CG711DecoderConfigTestDevice()
1.98 + {
1.99 + }
1.100 +
1.101 +void CG711DecoderConfigTestDevice::ConstructL()
1.102 + {
1.103 + }
1.104 +
1.105 +TInt CG711DecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
1.106 + {
1.107 + return 0;
1.108 + }
1.109 +
1.110 +TInt CG711DecoderConfigTestDevice::Stop()
1.111 + {
1.112 + return 0;
1.113 + }
1.114 +
1.115 +TInt CG711DecoderConfigTestDevice::Pause()
1.116 + {
1.117 + return 0;
1.118 + }
1.119 +
1.120 +TInt CG711DecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
1.121 + {
1.122 + return 0;
1.123 + }
1.124 +
1.125 +TAny* CG711DecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
1.126 + {
1.127 + // Just return something non-NULL to keep the
1.128 + // DevSound initialisation process happy
1.129 + TAny* ret = static_cast<TAny*>(this);
1.130 +
1.131 + // Now for the CIs we want to test...
1.132 + if (aInterfaceId == KUidG711DecoderIntfc)
1.133 + {
1.134 + if (!iG711DecoderConfig)
1.135 + {
1.136 + TRAPD(err, iG711DecoderConfig = CMMFG711DecoderConfig::NewL());
1.137 + if (err == KErrNone && iG711DecoderConfig)
1.138 + {
1.139 + MG711DecoderIntfc* ptr = this;
1.140 + ret = static_cast<TAny*>(ptr);
1.141 + }
1.142 + else
1.143 + {
1.144 + ret = NULL;
1.145 + }
1.146 + }
1.147 + }
1.148 +
1.149 + return ret;
1.150 + }
1.151 +
1.152 +TInt CG711DecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
1.153 + {
1.154 + return 0;
1.155 + }
1.156 +
1.157 +TInt CG711DecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
1.158 + {
1.159 + return 0;
1.160 + }
1.161 +
1.162 +TInt CG711DecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
1.163 + {
1.164 + return 0;
1.165 + }
1.166 +
1.167 +TInt CG711DecoderConfigTestDevice::StopAndDeleteCodec()
1.168 + {
1.169 + return 0;
1.170 + }
1.171 +
1.172 +TInt CG711DecoderConfigTestDevice::DeleteCodec()
1.173 + {
1.174 + return 0;
1.175 + }
1.176 +
1.177 +CMMFSwCodec& CG711DecoderConfigTestDevice::Codec()
1.178 + {
1.179 + return *iCodec;
1.180 + }
1.181 +
1.182 +TInt CG711DecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode)
1.183 + {
1.184 + TInt result = KErrBadHandle;
1.185 +
1.186 + if (iG711DecoderConfig)
1.187 + {
1.188 + result = iG711DecoderConfig->SetDecoderMode(aDecodeMode);
1.189 + }
1.190 +
1.191 + return result;
1.192 + }
1.193 +
1.194 +TInt CG711DecoderConfigTestDevice::GetDecoderMode(TDecodeMode& aDecodeMode)
1.195 + {
1.196 + TInt result = KErrBadHandle;
1.197 +
1.198 + if (iG711DecoderConfig)
1.199 + {
1.200 + result = iG711DecoderConfig->GetDecoderMode(aDecodeMode);
1.201 + }
1.202 +
1.203 + return result;
1.204 + }
1.205 +
1.206 +TInt CG711DecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng)
1.207 + {
1.208 + TInt result = KErrBadHandle;
1.209 +
1.210 + if (iG711DecoderConfig)
1.211 + {
1.212 + result = iG711DecoderConfig->SetComfortNoiseGeneration(aCng);
1.213 + }
1.214 +
1.215 + return result;
1.216 + }
1.217 +
1.218 +TInt CG711DecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng)
1.219 + {
1.220 + TInt result = KErrBadHandle;
1.221 +
1.222 + if (iG711DecoderConfig)
1.223 + {
1.224 + result = iG711DecoderConfig->GetComfortNoiseGeneration(aCng);
1.225 + }
1.226 +
1.227 + return result;
1.228 + }
1.229 +
1.230 +TInt CG711DecoderConfigTestDevice::SetPacketLossConcealment(TBool aPlc)
1.231 + {
1.232 + TInt result = KErrBadHandle;
1.233 +
1.234 + if (iG711DecoderConfig)
1.235 + {
1.236 + result = iG711DecoderConfig->SetPacketLossConcealment(aPlc);
1.237 + }
1.238 +
1.239 + return result;
1.240 + }
1.241 +
1.242 +TInt CG711DecoderConfigTestDevice::GetPacketLossConcealment(TBool& aPlc)
1.243 + {
1.244 + TInt result = KErrBadHandle;
1.245 +
1.246 + if (iG711DecoderConfig)
1.247 + {
1.248 + result = iG711DecoderConfig->GetPacketLossConcealment(aPlc);
1.249 + }
1.250 +
1.251 + return result;
1.252 + }