os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/sbcencodertestdevice.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/sbcencodertestdevice.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,300 @@
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 <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
1.20 +
1.21 +#include "sbcencodertestdevice.h"
1.22 +
1.23 +
1.24 +/*****************************************************************************/
1.25 +// Implementation
1.26 +
1.27 +CMMFHwDevice* CSbcEncoderTestDevice::NewL()
1.28 + {
1.29 + CSbcEncoderTestDevice* self = new(ELeave) CSbcEncoderTestDevice();
1.30 + CleanupStack::PushL(self);
1.31 + self->ConstructL();
1.32 + CleanupStack::Pop(self);
1.33 + return self;
1.34 + }
1.35 +
1.36 +/*****************************************************************************/
1.37 +CSbcEncoderTestDevice::~CSbcEncoderTestDevice()
1.38 + {
1.39 + }
1.40 +
1.41 +/*****************************************************************************/
1.42 +CSbcEncoderTestDevice::CSbcEncoderTestDevice()
1.43 + {
1.44 + }
1.45 +
1.46 +/*****************************************************************************/
1.47 +void CSbcEncoderTestDevice::ConstructL()
1.48 + {
1.49 + }
1.50 +
1.51 +/*****************************************************************************/
1.52 +TInt CSbcEncoderTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
1.53 + {
1.54 + return 0;
1.55 + }
1.56 +
1.57 +/*****************************************************************************/
1.58 +TInt CSbcEncoderTestDevice::Stop()
1.59 + {
1.60 + return 0;
1.61 + }
1.62 +
1.63 +/*****************************************************************************/
1.64 +TInt CSbcEncoderTestDevice::Pause()
1.65 + {
1.66 + return 0;
1.67 + }
1.68 +
1.69 +/*****************************************************************************/
1.70 +TInt CSbcEncoderTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
1.71 + {
1.72 + return 0;
1.73 + }
1.74 +
1.75 +/*****************************************************************************/
1.76 +TAny* CSbcEncoderTestDevice::CustomInterface(TUid aInterfaceId)
1.77 + {
1.78 + MSbcEncoderIntfc* interface = NULL;
1.79 +
1.80 + // DevSound initialisation requires something to be returned for both of
1.81 + // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
1.82 + if ((aInterfaceId == KUidSbcEncoderIntfc) || // This interface
1.83 + (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
1.84 + (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
1.85 + {
1.86 + interface = this;
1.87 + }
1.88 +
1.89 + return interface;
1.90 + }
1.91 +
1.92 +/*****************************************************************************/
1.93 +TInt CSbcEncoderTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
1.94 + {
1.95 + return 0;
1.96 + }
1.97 +
1.98 +/*****************************************************************************/
1.99 +TInt CSbcEncoderTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
1.100 + {
1.101 + return 0;
1.102 + }
1.103 +
1.104 +/*****************************************************************************/
1.105 +TInt CSbcEncoderTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
1.106 + {
1.107 + return 0;
1.108 + }
1.109 +
1.110 +/*****************************************************************************/
1.111 +TInt CSbcEncoderTestDevice::StopAndDeleteCodec()
1.112 + {
1.113 + return 0;
1.114 + }
1.115 +
1.116 +/*****************************************************************************/
1.117 +TInt CSbcEncoderTestDevice::DeleteCodec()
1.118 + {
1.119 + return 0;
1.120 + }
1.121 +
1.122 +/*****************************************************************************/
1.123 +CMMFSwCodec& CSbcEncoderTestDevice::Codec()
1.124 + {
1.125 + return *iCodec;
1.126 + }
1.127 +
1.128 +/*****************************************************************************/
1.129 +TInt CSbcEncoderTestDevice::GetSupportedSamplingFrequencies ( RArray<TUint>& aSamplingFrequencies )
1.130 + {
1.131 + TInt retVal = KErrNone;
1.132 + // Assume the strategy is to hard code a set of frequencies...
1.133 + //
1.134 + // Reset the input array
1.135 + aSamplingFrequencies.Reset();
1.136 + // Populate the array
1.137 + TUint value = 0;
1.138 + for (TInt i = 0; i < 10; i++)
1.139 + {
1.140 + retVal = aSamplingFrequencies.Append(value);
1.141 + if (retVal != KErrNone)
1.142 + {
1.143 + break;
1.144 + }
1.145 + value += 1000;
1.146 + }
1.147 +
1.148 + return retVal;
1.149 + }
1.150 +
1.151 +TInt CSbcEncoderTestDevice::GetSupportedChannelModes ( RArray<TSbcChannelMode>& aChannelModes )
1.152 + {
1.153 + TInt retVal = KErrNone;
1.154 + aChannelModes.Reset();
1.155 + retVal = aChannelModes.Append(ESbcChannelMono);
1.156 + if (retVal == KErrNone)
1.157 + {
1.158 + retVal = aChannelModes.Append(ESbcChannelDual);
1.159 + if (retVal == KErrNone)
1.160 + {
1.161 + retVal = aChannelModes.Append(ESbcChannelStereo);
1.162 + if (retVal == KErrNone)
1.163 + {
1.164 + retVal = aChannelModes.Append(ESbcChannelJointStereo);
1.165 + }
1.166 + }
1.167 + }
1.168 + return retVal;
1.169 + }
1.170 +
1.171 +TInt CSbcEncoderTestDevice::GetSupportedNumOfSubbands ( RArray<TUint>& aNumOfSubbands )
1.172 + {
1.173 + TInt retVal = KErrNone;
1.174 + aNumOfSubbands.Reset();
1.175 + TUint val = 100;
1.176 + for (TInt i = 0; i < 5; i++)
1.177 + {
1.178 + retVal = aNumOfSubbands.Append(val);
1.179 + if (retVal != KErrNone)
1.180 + {
1.181 + break;
1.182 + }
1.183 + val += 100;
1.184 + }
1.185 + return retVal;
1.186 + }
1.187 +
1.188 +TInt CSbcEncoderTestDevice::GetSupportedAllocationMethods ( RArray<TSbcAllocationMethod>& aAllocationMethods )
1.189 + {
1.190 + TInt retVal = KErrNone;
1.191 + aAllocationMethods.Reset();
1.192 + retVal = aAllocationMethods.Append(ESbcAllocationSNR);
1.193 + if (retVal == KErrNone)
1.194 + {
1.195 + retVal = aAllocationMethods.Append(ESbcAllocationLoudness);
1.196 + }
1.197 + return retVal;
1.198 + }
1.199 +
1.200 +TInt CSbcEncoderTestDevice::GetSupportedNumOfBlocks ( RArray<TUint>& aNumOfBlocks )
1.201 + {
1.202 + TInt retVal = KErrNone;
1.203 + aNumOfBlocks.Reset();
1.204 + TUint val = 1;
1.205 + for (TInt i = 0; i < 10; i++, val++)
1.206 + {
1.207 + retVal = aNumOfBlocks.Append(val);
1.208 + if (retVal != KErrNone)
1.209 + {
1.210 + break;
1.211 + }
1.212 + }
1.213 + return retVal;
1.214 + }
1.215 +
1.216 +TInt CSbcEncoderTestDevice::GetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize)
1.217 + {
1.218 + // Arbitrary values
1.219 + aMinSupportedBitpoolSize = 1;
1.220 + aMaxSupportedBitpoolSize = 2;
1.221 +
1.222 + return KErrNone;
1.223 + }
1.224 +
1.225 +void CSbcEncoderTestDevice::SetSamplingFrequency ( TUint aSamplingFrequency )
1.226 + {
1.227 + iSamplingFrequency = aSamplingFrequency;
1.228 + }
1.229 +
1.230 +void CSbcEncoderTestDevice::SetChannelMode (TSbcChannelMode aChannelMode )
1.231 + {
1.232 + iChannelMode = aChannelMode;
1.233 + }
1.234 +
1.235 +void CSbcEncoderTestDevice::SetNumOfSubbands ( TUint aNumOfSubbands )
1.236 + {
1.237 + iNumOfSubbands = aNumOfSubbands;
1.238 + }
1.239 +
1.240 +void CSbcEncoderTestDevice::SetAllocationMethod (TSbcAllocationMethod aAllocationMethod )
1.241 + {
1.242 + iAllocMethod = aAllocationMethod;
1.243 + }
1.244 +
1.245 +void CSbcEncoderTestDevice::SetBitpoolSize (TUint aBitpoolSize )
1.246 + {
1.247 + iBitpoolSize = aBitpoolSize;
1.248 + }
1.249 +
1.250 +TInt CSbcEncoderTestDevice::ApplyConfig()
1.251 + {
1.252 + iApplyConfig = ETrue;
1.253 + return KErrNone;
1.254 + }
1.255 +
1.256 +TInt CSbcEncoderTestDevice::GetSamplingFrequency ( TUint& aSamplingFrequency )
1.257 + {
1.258 + TInt retVal = KErrNone;
1.259 + aSamplingFrequency = iSamplingFrequency;
1.260 + return retVal;
1.261 + }
1.262 +
1.263 +TInt CSbcEncoderTestDevice::GetChannelMode (TSbcChannelMode& aChannelMode )
1.264 + {
1.265 + TInt retVal = KErrNone;
1.266 + aChannelMode = iChannelMode;
1.267 + return retVal;
1.268 + }
1.269 +
1.270 +TInt CSbcEncoderTestDevice::GetNumOfSubbands ( TUint& aNumOfSubbands )
1.271 + {
1.272 + TInt retVal = KErrNone;
1.273 + aNumOfSubbands = iNumOfSubbands;
1.274 +
1.275 + return retVal;
1.276 + }
1.277 +
1.278 +TInt CSbcEncoderTestDevice::GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod )
1.279 + {
1.280 + TInt retVal = KErrNone;
1.281 + aAllocationMethod = iAllocMethod;
1.282 + return retVal;
1.283 + }
1.284 +
1.285 +TInt CSbcEncoderTestDevice::GetBitpoolSize (TUint& aBitpoolSize )
1.286 + {
1.287 + TInt retVal = KErrNone;
1.288 + aBitpoolSize = iBitpoolSize;
1.289 + return retVal;
1.290 + }
1.291 +
1.292 +void CSbcEncoderTestDevice::SetNumOfBlocks ( TUint aNumOfBlocks )
1.293 + {
1.294 + iNumOfBlocks = aNumOfBlocks;
1.295 + }
1.296 +
1.297 +TInt CSbcEncoderTestDevice::GetNumOfBlocks ( TUint& aNumOfBlocks )
1.298 + {
1.299 + TInt retVal = KErrNone;
1.300 + aNumOfBlocks = iNumOfBlocks;
1.301 + return retVal;
1.302 + }
1.303 +