os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/aacdecoderconfigtestdevice.cpp
Update contrib.
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/implementationproxy.h>
18 #include <ecom/ecom.h>
20 #include "aacdecoderconfigtestdevice.h"
21 #include "devsoundciutestdevices.hrh"
25 CMMFAacDecoderConfig implementation
27 CMMFAacDecoderConfig* CMMFAacDecoderConfig::NewL()
29 CMMFAacDecoderConfig* self = new(ELeave) CMMFAacDecoderConfig();
33 CMMFAacDecoderConfig::~CMMFAacDecoderConfig()
37 // Actual implementation of method
38 TInt CMMFAacDecoderConfig::SetAudioConfig(TAudioConfig& aAudioConfig)
44 if ( KErrNone != (err = fs.Connect()) )
49 // this file name will be use on the testStep to compare the stored value.
50 _LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
51 fs.MkDirAll(KFileName);
53 if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
59 Line.Format(_L8("%02d"), aAudioConfig.iAudioObjectType);
68 // Actual implementation of method
69 TInt CMMFAacDecoderConfig::GetSupportedAudioConfigs(RArray<TAudioConfig>& aSupportedAudioConfigs)
71 TAudioConfig audioConfig;
72 audioConfig.iAudioObjectType = TAudioConfig::ESbr;
73 aSupportedAudioConfigs.Append(audioConfig);
74 audioConfig.iAudioObjectType = TAudioConfig::EAacLtp;
75 aSupportedAudioConfigs.Append(audioConfig);
76 audioConfig.iAudioObjectType = TAudioConfig::EAacSsr;
77 aSupportedAudioConfigs.Append(audioConfig);
78 audioConfig.iAudioObjectType = TAudioConfig::EAacLc;
79 aSupportedAudioConfigs.Append(audioConfig);
80 audioConfig.iAudioObjectType = TAudioConfig::EAacMain;
81 aSupportedAudioConfigs.Append(audioConfig);
87 CAacDecoderConfigTestDevice Implementation
89 CMMFHwDevice* CAacDecoderConfigTestDevice::NewL()
91 CAacDecoderConfigTestDevice* self=new(ELeave) CAacDecoderConfigTestDevice();
92 CleanupStack::PushL(self);
94 CleanupStack::Pop(self);
98 CAacDecoderConfigTestDevice::~CAacDecoderConfigTestDevice()
100 delete iAacDecoderConfig;
103 CAacDecoderConfigTestDevice::CAacDecoderConfigTestDevice()
107 void CAacDecoderConfigTestDevice::ConstructL()
111 TInt CAacDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
116 TInt CAacDecoderConfigTestDevice::Stop()
121 TInt CAacDecoderConfigTestDevice::Pause()
126 TInt CAacDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
131 TAny* CAacDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
133 // Just return something non-NULL to keep the
134 // DevSound initialisation process happy
135 TAny* ret = static_cast<TAny*>(this);
137 // Now for the CIs we want to test...
138 if (aInterfaceId == KUidAacDecoderConfig)
140 if (!iAacDecoderConfig)
142 TRAPD(err, iAacDecoderConfig = CMMFAacDecoderConfig::NewL());
143 if (err == KErrNone && iAacDecoderConfig)
145 MAacDecoderConfig* ptr = this;
146 ret = static_cast<TAny*>(ptr);
158 TInt CAacDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
163 TInt CAacDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
168 TInt CAacDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
173 TInt CAacDecoderConfigTestDevice::StopAndDeleteCodec()
178 TInt CAacDecoderConfigTestDevice::DeleteCodec()
183 CMMFSwCodec& CAacDecoderConfigTestDevice::Codec()
188 TInt CAacDecoderConfigTestDevice::SetAudioConfig(TAudioConfig& aAudioConfig)
190 TInt result = KErrBadHandle;
192 if (iAacDecoderConfig)
194 result = iAacDecoderConfig->SetAudioConfig(aAudioConfig);
200 TInt CAacDecoderConfigTestDevice::GetSupportedAudioConfigs(RArray<MAacDecoderConfig::TAudioConfig>& aSupportedAudioConfigs)
202 TInt result = KErrBadHandle;
204 if (iAacDecoderConfig)
206 result = iAacDecoderConfig->GetSupportedAudioConfigs(aSupportedAudioConfigs);