os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/sbcencodertestdevice.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 <mmf/server/mmfswcodecwrappercustominterfacesuids.hrh>
18 #include "sbcencodertestdevice.h"
21 /*****************************************************************************/
24 CMMFHwDevice* CSbcEncoderTestDevice::NewL()
26 CSbcEncoderTestDevice* self = new(ELeave) CSbcEncoderTestDevice();
27 CleanupStack::PushL(self);
29 CleanupStack::Pop(self);
33 /*****************************************************************************/
34 CSbcEncoderTestDevice::~CSbcEncoderTestDevice()
38 /*****************************************************************************/
39 CSbcEncoderTestDevice::CSbcEncoderTestDevice()
43 /*****************************************************************************/
44 void CSbcEncoderTestDevice::ConstructL()
48 /*****************************************************************************/
49 TInt CSbcEncoderTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
54 /*****************************************************************************/
55 TInt CSbcEncoderTestDevice::Stop()
60 /*****************************************************************************/
61 TInt CSbcEncoderTestDevice::Pause()
66 /*****************************************************************************/
67 TInt CSbcEncoderTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
72 /*****************************************************************************/
73 TAny* CSbcEncoderTestDevice::CustomInterface(TUid aInterfaceId)
75 MSbcEncoderIntfc* interface = NULL;
77 // DevSound initialisation requires something to be returned for both of
78 // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface
79 if ((aInterfaceId == KUidSbcEncoderIntfc) || // This interface
80 (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) ||
81 (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface))
89 /*****************************************************************************/
90 TInt CSbcEncoderTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
95 /*****************************************************************************/
96 TInt CSbcEncoderTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
101 /*****************************************************************************/
102 TInt CSbcEncoderTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
107 /*****************************************************************************/
108 TInt CSbcEncoderTestDevice::StopAndDeleteCodec()
113 /*****************************************************************************/
114 TInt CSbcEncoderTestDevice::DeleteCodec()
119 /*****************************************************************************/
120 CMMFSwCodec& CSbcEncoderTestDevice::Codec()
125 /*****************************************************************************/
126 TInt CSbcEncoderTestDevice::GetSupportedSamplingFrequencies ( RArray<TUint>& aSamplingFrequencies )
128 TInt retVal = KErrNone;
129 // Assume the strategy is to hard code a set of frequencies...
131 // Reset the input array
132 aSamplingFrequencies.Reset();
133 // Populate the array
135 for (TInt i = 0; i < 10; i++)
137 retVal = aSamplingFrequencies.Append(value);
138 if (retVal != KErrNone)
148 TInt CSbcEncoderTestDevice::GetSupportedChannelModes ( RArray<TSbcChannelMode>& aChannelModes )
150 TInt retVal = KErrNone;
151 aChannelModes.Reset();
152 retVal = aChannelModes.Append(ESbcChannelMono);
153 if (retVal == KErrNone)
155 retVal = aChannelModes.Append(ESbcChannelDual);
156 if (retVal == KErrNone)
158 retVal = aChannelModes.Append(ESbcChannelStereo);
159 if (retVal == KErrNone)
161 retVal = aChannelModes.Append(ESbcChannelJointStereo);
168 TInt CSbcEncoderTestDevice::GetSupportedNumOfSubbands ( RArray<TUint>& aNumOfSubbands )
170 TInt retVal = KErrNone;
171 aNumOfSubbands.Reset();
173 for (TInt i = 0; i < 5; i++)
175 retVal = aNumOfSubbands.Append(val);
176 if (retVal != KErrNone)
185 TInt CSbcEncoderTestDevice::GetSupportedAllocationMethods ( RArray<TSbcAllocationMethod>& aAllocationMethods )
187 TInt retVal = KErrNone;
188 aAllocationMethods.Reset();
189 retVal = aAllocationMethods.Append(ESbcAllocationSNR);
190 if (retVal == KErrNone)
192 retVal = aAllocationMethods.Append(ESbcAllocationLoudness);
197 TInt CSbcEncoderTestDevice::GetSupportedNumOfBlocks ( RArray<TUint>& aNumOfBlocks )
199 TInt retVal = KErrNone;
200 aNumOfBlocks.Reset();
202 for (TInt i = 0; i < 10; i++, val++)
204 retVal = aNumOfBlocks.Append(val);
205 if (retVal != KErrNone)
213 TInt CSbcEncoderTestDevice::GetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize)
216 aMinSupportedBitpoolSize = 1;
217 aMaxSupportedBitpoolSize = 2;
222 void CSbcEncoderTestDevice::SetSamplingFrequency ( TUint aSamplingFrequency )
224 iSamplingFrequency = aSamplingFrequency;
227 void CSbcEncoderTestDevice::SetChannelMode (TSbcChannelMode aChannelMode )
229 iChannelMode = aChannelMode;
232 void CSbcEncoderTestDevice::SetNumOfSubbands ( TUint aNumOfSubbands )
234 iNumOfSubbands = aNumOfSubbands;
237 void CSbcEncoderTestDevice::SetAllocationMethod (TSbcAllocationMethod aAllocationMethod )
239 iAllocMethod = aAllocationMethod;
242 void CSbcEncoderTestDevice::SetBitpoolSize (TUint aBitpoolSize )
244 iBitpoolSize = aBitpoolSize;
247 TInt CSbcEncoderTestDevice::ApplyConfig()
249 iApplyConfig = ETrue;
253 TInt CSbcEncoderTestDevice::GetSamplingFrequency ( TUint& aSamplingFrequency )
255 TInt retVal = KErrNone;
256 aSamplingFrequency = iSamplingFrequency;
260 TInt CSbcEncoderTestDevice::GetChannelMode (TSbcChannelMode& aChannelMode )
262 TInt retVal = KErrNone;
263 aChannelMode = iChannelMode;
267 TInt CSbcEncoderTestDevice::GetNumOfSubbands ( TUint& aNumOfSubbands )
269 TInt retVal = KErrNone;
270 aNumOfSubbands = iNumOfSubbands;
275 TInt CSbcEncoderTestDevice::GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod )
277 TInt retVal = KErrNone;
278 aAllocationMethod = iAllocMethod;
282 TInt CSbcEncoderTestDevice::GetBitpoolSize (TUint& aBitpoolSize )
284 TInt retVal = KErrNone;
285 aBitpoolSize = iBitpoolSize;
289 void CSbcEncoderTestDevice::SetNumOfBlocks ( TUint aNumOfBlocks )
291 iNumOfBlocks = aNumOfBlocks;
294 TInt CSbcEncoderTestDevice::GetNumOfBlocks ( TUint& aNumOfBlocks )
296 TInt retVal = KErrNone;
297 aNumOfBlocks = iNumOfBlocks;