devsound/devsoundrefplugin/tsrc/CIPlugins/src/aacdecoderconfigtestdevice.cpp
changeset 0 79dd3e2336a0
equal deleted inserted replaced
-1:000000000000 0:79dd3e2336a0
       
     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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include <ecom/implementationproxy.h>
       
    17 #include <ecom/implementationproxy.h>
       
    18 #include <ecom/ecom.h>
       
    19 #include <f32file.h>
       
    20 #include "aacdecoderconfigtestdevice.h"
       
    21 #include "devsoundciutestdevices.hrh"
       
    22 
       
    23 
       
    24 /*
       
    25 CMMFAacDecoderConfig implementation
       
    26 */
       
    27 CMMFAacDecoderConfig* CMMFAacDecoderConfig::NewL()
       
    28 	{
       
    29 	CMMFAacDecoderConfig* self = new(ELeave) CMMFAacDecoderConfig();
       
    30 	return self;
       
    31 	}
       
    32 
       
    33 CMMFAacDecoderConfig::~CMMFAacDecoderConfig()
       
    34 	{
       
    35 	}
       
    36 
       
    37 // Actual implementation of method
       
    38 TInt CMMFAacDecoderConfig::SetAudioConfig(TAudioConfig& aAudioConfig)
       
    39 	{
       
    40 	RFs		fs;
       
    41 	RFile	file;
       
    42 	TInt	err = KErrNone;
       
    43 
       
    44 	if ( KErrNone != (err = fs.Connect()) )
       
    45 		{
       
    46 		return err;
       
    47 		}
       
    48 
       
    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);
       
    52 
       
    53 	if ( KErrNone != (err = file.Replace(fs, KFileName, EFileWrite)) )
       
    54 		{
       
    55 		return err;	
       
    56 		}
       
    57 
       
    58 	TBuf8<4> Line;
       
    59 	Line.Format(_L8("%02d"), aAudioConfig.iAudioObjectType);
       
    60 
       
    61 	file.Write(Line);
       
    62 	file.Close();
       
    63 	fs.Close();
       
    64 
       
    65 	return err;
       
    66 	}
       
    67 
       
    68 // Actual implementation of method
       
    69 TInt CMMFAacDecoderConfig::GetSupportedAudioConfigs(RArray<TAudioConfig>& aSupportedAudioConfigs)
       
    70 	{
       
    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);
       
    82 	return KErrNone;
       
    83 	}
       
    84 
       
    85 
       
    86 /*
       
    87 CAacDecoderConfigTestDevice Implementation
       
    88 */
       
    89 CMMFHwDevice* CAacDecoderConfigTestDevice::NewL()
       
    90 	{
       
    91 	CAacDecoderConfigTestDevice* self=new(ELeave) CAacDecoderConfigTestDevice();
       
    92 	CleanupStack::PushL(self);
       
    93 	self->ConstructL();
       
    94 	CleanupStack::Pop(self);
       
    95 	return self;
       
    96 	}
       
    97 
       
    98 CAacDecoderConfigTestDevice::~CAacDecoderConfigTestDevice()
       
    99 	{
       
   100 	delete iAacDecoderConfig;
       
   101 	}
       
   102 
       
   103 CAacDecoderConfigTestDevice::CAacDecoderConfigTestDevice()
       
   104 	{
       
   105 	}
       
   106 
       
   107 void CAacDecoderConfigTestDevice::ConstructL()
       
   108 	{
       
   109 	}
       
   110 
       
   111 TInt CAacDecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) 
       
   112 	{
       
   113 	return 0;
       
   114 	}
       
   115 
       
   116 TInt CAacDecoderConfigTestDevice::Stop()
       
   117 	{
       
   118 	return 0;
       
   119 	}
       
   120 
       
   121 TInt CAacDecoderConfigTestDevice::Pause()
       
   122 	{
       
   123 	return 0;
       
   124 	}
       
   125 
       
   126 TInt CAacDecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
       
   127 	{
       
   128 	return 0;
       
   129 	}
       
   130 
       
   131 TAny* CAacDecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
       
   132 	{
       
   133 	// Just return something non-NULL to keep the
       
   134 	// DevSound initialisation process happy
       
   135 	TAny* ret = static_cast<TAny*>(this);
       
   136 
       
   137 	// Now for the CIs we want to test...
       
   138 	if (aInterfaceId == KUidAacDecoderConfig)
       
   139 		{
       
   140 		if (!iAacDecoderConfig)
       
   141 			{
       
   142 			TRAPD(err, iAacDecoderConfig = CMMFAacDecoderConfig::NewL());
       
   143 			if (err == KErrNone && iAacDecoderConfig)
       
   144 				{
       
   145 				MAacDecoderConfig* ptr = this;
       
   146 				ret = static_cast<TAny*>(ptr);
       
   147 				}
       
   148 			else
       
   149 				{
       
   150 				ret = NULL;
       
   151 				}
       
   152 			}
       
   153 		}
       
   154 
       
   155 	return ret;
       
   156 	}
       
   157 
       
   158 TInt CAacDecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
       
   159 	{
       
   160 	return 0;
       
   161 	}
       
   162 
       
   163 TInt CAacDecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
       
   164 	{
       
   165 	return 0;
       
   166 	}
       
   167 
       
   168 TInt CAacDecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
       
   169 	{
       
   170 	return 0;
       
   171 	}
       
   172 
       
   173 TInt CAacDecoderConfigTestDevice::StopAndDeleteCodec()
       
   174 	{
       
   175 	return 0;
       
   176 	}
       
   177 
       
   178 TInt CAacDecoderConfigTestDevice::DeleteCodec()
       
   179 	{
       
   180 	return 0;
       
   181 	}
       
   182 
       
   183 CMMFSwCodec& CAacDecoderConfigTestDevice::Codec()
       
   184 	{
       
   185 	return *iCodec;
       
   186 	}
       
   187 
       
   188 TInt CAacDecoderConfigTestDevice::SetAudioConfig(TAudioConfig& aAudioConfig)
       
   189 	{
       
   190 	TInt result = KErrBadHandle;
       
   191 
       
   192 	if (iAacDecoderConfig)
       
   193 		{
       
   194 		result = iAacDecoderConfig->SetAudioConfig(aAudioConfig);
       
   195 		}
       
   196 
       
   197 	return result;
       
   198 	}
       
   199 
       
   200 TInt CAacDecoderConfigTestDevice::GetSupportedAudioConfigs(RArray<MAacDecoderConfig::TAudioConfig>& aSupportedAudioConfigs)
       
   201 	{
       
   202 	TInt result = KErrBadHandle;
       
   203 
       
   204 	if (iAacDecoderConfig)
       
   205 		{
       
   206 		result = iAacDecoderConfig->GetSupportedAudioConfigs(aSupportedAudioConfigs);
       
   207 		}
       
   208 
       
   209 	return result;
       
   210 	}