os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/aacdecoderconfigtestdevice.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/aacdecoderconfigtestdevice.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,210 @@
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/implementationproxy.h>
1.21 +#include <ecom/ecom.h>
1.22 +#include <f32file.h>
1.23 +#include "aacdecoderconfigtestdevice.h"
1.24 +#include "devsoundciutestdevices.hrh"
1.25 +
1.26 +
1.27 +/*
1.28 +CMMFAacDecoderConfig implementation
1.29 +*/
1.30 +CMMFAacDecoderConfig* CMMFAacDecoderConfig::NewL()
1.31 + {
1.32 + CMMFAacDecoderConfig* self = new(ELeave) CMMFAacDecoderConfig();
1.33 + return self;
1.34 + }
1.35 +
1.36 +CMMFAacDecoderConfig::~CMMFAacDecoderConfig()
1.37 + {
1.38 + }
1.39 +
1.40 +// Actual implementation of method
1.41 +TInt CMMFAacDecoderConfig::SetAudioConfig(TAudioConfig& aAudioConfig)
1.42 + {
1.43 + RFs fs;
1.44 + RFile file;
1.45 + TInt err = KErrNone;
1.46 +
1.47 + if ( KErrNone != (err = fs.Connect()) )
1.48 + {
1.49 + return err;
1.50 + }
1.51 +
1.52 + // this file name will be use on the testStep to compare the stored value.
1.53 + _LIT(KFileName, "c:\\temp\\aacDecoderConfig.txt");
1.54 + fs.MkDirAll(KFileName);
1.55 +
1.56 + if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
1.57 + {
1.58 + return err;
1.59 + }
1.60 +
1.61 + TBuf8<4> Line;
1.62 + Line.Format(_L8("%02d"), aAudioConfig.iAudioObjectType);
1.63 +
1.64 + file.Write(Line);
1.65 + file.Close();
1.66 + fs.Close();
1.67 +
1.68 + return err;
1.69 + }
1.70 +
1.71 +// Actual implementation of method
1.72 +TInt CMMFAacDecoderConfig::GetSupportedAudioConfigs(RArray<TAudioConfig>& aSupportedAudioConfigs)
1.73 + {
1.74 + TAudioConfig audioConfig;
1.75 + audioConfig.iAudioObjectType = TAudioConfig::ESbr;
1.76 + aSupportedAudioConfigs.Append(audioConfig);
1.77 + audioConfig.iAudioObjectType = TAudioConfig::EAacLtp;
1.78 + aSupportedAudioConfigs.Append(audioConfig);
1.79 + audioConfig.iAudioObjectType = TAudioConfig::EAacSsr;
1.80 + aSupportedAudioConfigs.Append(audioConfig);
1.81 + audioConfig.iAudioObjectType = TAudioConfig::EAacLc;
1.82 + aSupportedAudioConfigs.Append(audioConfig);
1.83 + audioConfig.iAudioObjectType = TAudioConfig::EAacMain;
1.84 + aSupportedAudioConfigs.Append(audioConfig);
1.85 + return KErrNone;
1.86 + }
1.87 +
1.88 +
1.89 +/*
1.90 +CAacDecoderConfigTestDevice Implementation
1.91 +*/
1.92 +CMMFHwDevice* CAacDecoderConfigTestDevice::NewL()
1.93 + {
1.94 + CAacDecoderConfigTestDevice* self=new(ELeave) CAacDecoderConfigTestDevice();
1.95 + CleanupStack::PushL(self);
1.96 + self->ConstructL();
1.97 + CleanupStack::Pop(self);
1.98 + return self;
1.99 + }
1.100 +
1.101 +CAacDecoderConfigTestDevice::~CAacDecoderConfigTestDevice()
1.102 + {
1.103 + delete iAacDecoderConfig;
1.104 + }
1.105 +
1.106 +CAacDecoderConfigTestDevice::CAacDecoderConfigTestDevice()
1.107 + {
1.108 + }
1.109 +
1.110 +void CAacDecoderConfigTestDevice::ConstructL()
1.111 + {
1.112 + }
1.113 +
1.114 +TInt CAacDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/)
1.115 + {
1.116 + return 0;
1.117 + }
1.118 +
1.119 +TInt CAacDecoderConfigTestDevice::Stop()
1.120 + {
1.121 + return 0;
1.122 + }
1.123 +
1.124 +TInt CAacDecoderConfigTestDevice::Pause()
1.125 + {
1.126 + return 0;
1.127 + }
1.128 +
1.129 +TInt CAacDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
1.130 + {
1.131 + return 0;
1.132 + }
1.133 +
1.134 +TAny* CAacDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
1.135 + {
1.136 + // Just return something non-NULL to keep the
1.137 + // DevSound initialisation process happy
1.138 + TAny* ret = static_cast<TAny*>(this);
1.139 +
1.140 + // Now for the CIs we want to test...
1.141 + if (aInterfaceId == KUidAacDecoderConfig)
1.142 + {
1.143 + if (!iAacDecoderConfig)
1.144 + {
1.145 + TRAPD(err, iAacDecoderConfig = CMMFAacDecoderConfig::NewL());
1.146 + if (err == KErrNone && iAacDecoderConfig)
1.147 + {
1.148 + MAacDecoderConfig* ptr = this;
1.149 + ret = static_cast<TAny*>(ptr);
1.150 + }
1.151 + else
1.152 + {
1.153 + ret = NULL;
1.154 + }
1.155 + }
1.156 + }
1.157 +
1.158 + return ret;
1.159 + }
1.160 +
1.161 +TInt CAacDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
1.162 + {
1.163 + return 0;
1.164 + }
1.165 +
1.166 +TInt CAacDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
1.167 + {
1.168 + return 0;
1.169 + }
1.170 +
1.171 +TInt CAacDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
1.172 + {
1.173 + return 0;
1.174 + }
1.175 +
1.176 +TInt CAacDecoderConfigTestDevice::StopAndDeleteCodec()
1.177 + {
1.178 + return 0;
1.179 + }
1.180 +
1.181 +TInt CAacDecoderConfigTestDevice::DeleteCodec()
1.182 + {
1.183 + return 0;
1.184 + }
1.185 +
1.186 +CMMFSwCodec& CAacDecoderConfigTestDevice::Codec()
1.187 + {
1.188 + return *iCodec;
1.189 + }
1.190 +
1.191 +TInt CAacDecoderConfigTestDevice::SetAudioConfig(TAudioConfig& aAudioConfig)
1.192 + {
1.193 + TInt result = KErrBadHandle;
1.194 +
1.195 + if (iAacDecoderConfig)
1.196 + {
1.197 + result = iAacDecoderConfig->SetAudioConfig(aAudioConfig);
1.198 + }
1.199 +
1.200 + return result;
1.201 + }
1.202 +
1.203 +TInt CAacDecoderConfigTestDevice::GetSupportedAudioConfigs(RArray<MAacDecoderConfig::TAudioConfig>& aSupportedAudioConfigs)
1.204 + {
1.205 + TInt result = KErrBadHandle;
1.206 +
1.207 + if (iAacDecoderConfig)
1.208 + {
1.209 + result = iAacDecoderConfig->GetSupportedAudioConfigs(aSupportedAudioConfigs);
1.210 + }
1.211 +
1.212 + return result;
1.213 + }