sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include sl@0: sl@0: #include "sbcencodertestdevice.h" sl@0: sl@0: sl@0: /*****************************************************************************/ sl@0: // Implementation sl@0: sl@0: CMMFHwDevice* CSbcEncoderTestDevice::NewL() sl@0: { sl@0: CSbcEncoderTestDevice* self = new(ELeave) CSbcEncoderTestDevice(); sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CSbcEncoderTestDevice::~CSbcEncoderTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CSbcEncoderTestDevice::CSbcEncoderTestDevice() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: void CSbcEncoderTestDevice::ConstructL() sl@0: { sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::Stop() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::Pause() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TAny* CSbcEncoderTestDevice::CustomInterface(TUid aInterfaceId) sl@0: { sl@0: MSbcEncoderIntfc* interface = NULL; sl@0: sl@0: // DevSound initialisation requires something to be returned for both of sl@0: // these two uids: KMmfPlaySettingsCustomInterface, KMmfRecordSettingsCustomInterface sl@0: if ((aInterfaceId == KUidSbcEncoderIntfc) || // This interface sl@0: (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface) || sl@0: (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)) sl@0: { sl@0: interface = this; sl@0: } sl@0: sl@0: return interface; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::SetConfig(TTaskConfig& /*aConfig*/) sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::StopAndDeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::DeleteCodec() sl@0: { sl@0: return 0; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: CMMFSwCodec& CSbcEncoderTestDevice::Codec() sl@0: { sl@0: return *iCodec; sl@0: } sl@0: sl@0: /*****************************************************************************/ sl@0: TInt CSbcEncoderTestDevice::GetSupportedSamplingFrequencies ( RArray& aSamplingFrequencies ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: // Assume the strategy is to hard code a set of frequencies... sl@0: // sl@0: // Reset the input array sl@0: aSamplingFrequencies.Reset(); sl@0: // Populate the array sl@0: TUint value = 0; sl@0: for (TInt i = 0; i < 10; i++) sl@0: { sl@0: retVal = aSamplingFrequencies.Append(value); sl@0: if (retVal != KErrNone) sl@0: { sl@0: break; sl@0: } sl@0: value += 1000; sl@0: } sl@0: sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSupportedChannelModes ( RArray& aChannelModes ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aChannelModes.Reset(); sl@0: retVal = aChannelModes.Append(ESbcChannelMono); sl@0: if (retVal == KErrNone) sl@0: { sl@0: retVal = aChannelModes.Append(ESbcChannelDual); sl@0: if (retVal == KErrNone) sl@0: { sl@0: retVal = aChannelModes.Append(ESbcChannelStereo); sl@0: if (retVal == KErrNone) sl@0: { sl@0: retVal = aChannelModes.Append(ESbcChannelJointStereo); sl@0: } sl@0: } sl@0: } sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSupportedNumOfSubbands ( RArray& aNumOfSubbands ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aNumOfSubbands.Reset(); sl@0: TUint val = 100; sl@0: for (TInt i = 0; i < 5; i++) sl@0: { sl@0: retVal = aNumOfSubbands.Append(val); sl@0: if (retVal != KErrNone) sl@0: { sl@0: break; sl@0: } sl@0: val += 100; sl@0: } sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSupportedAllocationMethods ( RArray& aAllocationMethods ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aAllocationMethods.Reset(); sl@0: retVal = aAllocationMethods.Append(ESbcAllocationSNR); sl@0: if (retVal == KErrNone) sl@0: { sl@0: retVal = aAllocationMethods.Append(ESbcAllocationLoudness); sl@0: } sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSupportedNumOfBlocks ( RArray& aNumOfBlocks ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aNumOfBlocks.Reset(); sl@0: TUint val = 1; sl@0: for (TInt i = 0; i < 10; i++, val++) sl@0: { sl@0: retVal = aNumOfBlocks.Append(val); sl@0: if (retVal != KErrNone) sl@0: { sl@0: break; sl@0: } sl@0: } sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSupportedBitpoolRange (TUint& aMinSupportedBitpoolSize, TUint& aMaxSupportedBitpoolSize) sl@0: { sl@0: // Arbitrary values sl@0: aMinSupportedBitpoolSize = 1; sl@0: aMaxSupportedBitpoolSize = 2; sl@0: sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetSamplingFrequency ( TUint aSamplingFrequency ) sl@0: { sl@0: iSamplingFrequency = aSamplingFrequency; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetChannelMode (TSbcChannelMode aChannelMode ) sl@0: { sl@0: iChannelMode = aChannelMode; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetNumOfSubbands ( TUint aNumOfSubbands ) sl@0: { sl@0: iNumOfSubbands = aNumOfSubbands; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetAllocationMethod (TSbcAllocationMethod aAllocationMethod ) sl@0: { sl@0: iAllocMethod = aAllocationMethod; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetBitpoolSize (TUint aBitpoolSize ) sl@0: { sl@0: iBitpoolSize = aBitpoolSize; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::ApplyConfig() sl@0: { sl@0: iApplyConfig = ETrue; sl@0: return KErrNone; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetSamplingFrequency ( TUint& aSamplingFrequency ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aSamplingFrequency = iSamplingFrequency; sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetChannelMode (TSbcChannelMode& aChannelMode ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aChannelMode = iChannelMode; sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetNumOfSubbands ( TUint& aNumOfSubbands ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aNumOfSubbands = iNumOfSubbands; sl@0: sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetAllocationMethod (TSbcAllocationMethod& aAllocationMethod ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aAllocationMethod = iAllocMethod; sl@0: return retVal; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetBitpoolSize (TUint& aBitpoolSize ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aBitpoolSize = iBitpoolSize; sl@0: return retVal; sl@0: } sl@0: sl@0: void CSbcEncoderTestDevice::SetNumOfBlocks ( TUint aNumOfBlocks ) sl@0: { sl@0: iNumOfBlocks = aNumOfBlocks; sl@0: } sl@0: sl@0: TInt CSbcEncoderTestDevice::GetNumOfBlocks ( TUint& aNumOfBlocks ) sl@0: { sl@0: TInt retVal = KErrNone; sl@0: aNumOfBlocks = iNumOfBlocks; sl@0: return retVal; sl@0: } sl@0: