os/mm/mmlibs/mmfw/tsrc/mmfunittest/DevSoundTest/CIPlugins/src/g711decoderconfigtestdevice.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     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/ecom.h>
    18 #include <f32file.h>
    19 #include "g711decoderconfigtestdevice.h"
    20 #include "devsoundciutestdevices.hrh"
    21 
    22 
    23 /*
    24 CMMFG711DecoderConfig implementation
    25 */
    26 CMMFG711DecoderConfig* CMMFG711DecoderConfig::NewL()
    27 	{
    28 	CMMFG711DecoderConfig* self = new(ELeave) CMMFG711DecoderConfig();
    29 	return self;
    30 	}
    31 
    32 CMMFG711DecoderConfig::~CMMFG711DecoderConfig()
    33 	{
    34 	}
    35 
    36 //Actual implementation of method SetDecoderMode
    37 TInt CMMFG711DecoderConfig::SetDecoderMode(TDecodeMode aDecodeMode)
    38 	{
    39 	iDecodeMode = aDecodeMode;
    40 	return KErrNone;
    41 	}
    42 
    43 //Actual implementation of method SetDecoderMode
    44 TInt CMMFG711DecoderConfig::GetDecoderMode(TDecodeMode& aDecodeMode)
    45 	{
    46 	aDecodeMode = iDecodeMode;
    47 	return KErrNone;
    48 	}
    49 
    50 //Actual implementation of method SetCng
    51 TInt CMMFG711DecoderConfig::SetComfortNoiseGeneration(TBool aCng)
    52 	{
    53 	iCng = aCng;
    54 	return KErrNone;
    55 	}
    56 
    57 //Actual implementation of method GetCng
    58 TInt CMMFG711DecoderConfig::GetComfortNoiseGeneration(TBool& aCng)
    59 	{
    60 	aCng = iCng;
    61 	return KErrNone;
    62 	}
    63 
    64 //Actual implementation of method SetPlc
    65 TInt CMMFG711DecoderConfig::SetPacketLossConcealment(TBool aPlc)
    66 	{
    67 	iPlc = aPlc;
    68 	return KErrNone;
    69 	}
    70 //Actual implementation of method SetPlc
    71 TInt CMMFG711DecoderConfig::GetPacketLossConcealment(TBool& aPlc)
    72 	{
    73 	aPlc = iPlc;
    74 	return KErrNone;
    75 	}
    76 
    77 /*
    78 CG711DecoderConfigTestDevice implementation
    79 */
    80 CMMFHwDevice* CG711DecoderConfigTestDevice::NewL()
    81 	{
    82 	CG711DecoderConfigTestDevice* self = new(ELeave) CG711DecoderConfigTestDevice();
    83 	CleanupStack::PushL(self);
    84 	self->ConstructL();
    85 	CleanupStack::Pop(self);
    86 	return self;
    87 	}
    88 
    89 CG711DecoderConfigTestDevice::~CG711DecoderConfigTestDevice()
    90 	{
    91 	delete iG711DecoderConfig;
    92 	}
    93 
    94 CG711DecoderConfigTestDevice::CG711DecoderConfigTestDevice()
    95 	{
    96 	}
    97 
    98 void CG711DecoderConfigTestDevice::ConstructL()
    99 	{
   100 	}
   101 
   102 TInt CG711DecoderConfigTestDevice::Start(TDeviceFunc /*aFuncCmd*/, TDeviceFlow /*aFlowCmd*/) 
   103 	{
   104 	return 0;
   105 	}
   106 
   107 TInt CG711DecoderConfigTestDevice::Stop()
   108 	{
   109 	return 0;
   110 	}
   111 
   112 TInt CG711DecoderConfigTestDevice::Pause()
   113 	{
   114 	return 0;
   115 	}
   116 
   117 TInt CG711DecoderConfigTestDevice::Init(THwDeviceInitParams& /*aDevInfo*/)
   118 	{
   119 	return 0;
   120 	}
   121 
   122 TAny* CG711DecoderConfigTestDevice::CustomInterface(TUid aInterfaceId)
   123 	{
   124 	// Just return something non-NULL to keep the
   125 	// DevSound initialisation process happy
   126 	TAny* ret = static_cast<TAny*>(this);
   127 
   128 	// Now for the CIs we want to test...
   129 	if (aInterfaceId == KUidG711DecoderIntfc)
   130 		{
   131 		if (!iG711DecoderConfig)
   132 			{
   133 			TRAPD(err, iG711DecoderConfig = CMMFG711DecoderConfig::NewL());
   134 			if (err == KErrNone && iG711DecoderConfig)
   135 				{
   136 				MG711DecoderIntfc* ptr = this;
   137 				ret = static_cast<TAny*>(ptr);
   138 				}
   139 			else
   140 				{
   141 				ret = NULL;
   142 				}
   143 			}
   144 		}
   145 
   146 	return ret;
   147 	}
   148 
   149 TInt CG711DecoderConfigTestDevice::ThisHwBufferFilled(CMMFBuffer& /*aFillBufferPtr*/)
   150 	{
   151 	return 0;
   152 	}
   153 
   154 TInt CG711DecoderConfigTestDevice::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
   155 	{
   156 	return 0;
   157 	}
   158 
   159 TInt CG711DecoderConfigTestDevice::SetConfig(TTaskConfig& /*aConfig*/)
   160 	{
   161 	return 0;
   162 	}
   163 
   164 TInt CG711DecoderConfigTestDevice::StopAndDeleteCodec()
   165 	{
   166 	return 0;
   167 	}
   168 
   169 TInt CG711DecoderConfigTestDevice::DeleteCodec()
   170 	{
   171 	return 0;
   172 	}
   173 
   174 CMMFSwCodec& CG711DecoderConfigTestDevice::Codec()
   175 	{
   176 	return *iCodec;
   177 	}
   178 
   179 TInt CG711DecoderConfigTestDevice::SetDecoderMode(TDecodeMode aDecodeMode)
   180 	{
   181 	TInt result = KErrBadHandle;
   182 
   183 	if (iG711DecoderConfig)
   184 		{
   185 		result = iG711DecoderConfig->SetDecoderMode(aDecodeMode);
   186 		}
   187 
   188 	return result;
   189 	}
   190 
   191 TInt CG711DecoderConfigTestDevice::GetDecoderMode(TDecodeMode& aDecodeMode)
   192 	{
   193 	TInt result = KErrBadHandle;
   194 
   195 	if (iG711DecoderConfig)
   196 		{
   197 		result = iG711DecoderConfig->GetDecoderMode(aDecodeMode);
   198 		}
   199 
   200 	return result;
   201 	}
   202 
   203 TInt CG711DecoderConfigTestDevice::SetComfortNoiseGeneration(TBool aCng)
   204 	{
   205 	TInt result = KErrBadHandle;
   206 
   207 	if (iG711DecoderConfig)
   208 		{
   209 		result = iG711DecoderConfig->SetComfortNoiseGeneration(aCng);
   210 		}
   211 
   212 	return result;
   213 	}
   214 
   215 TInt CG711DecoderConfigTestDevice::GetComfortNoiseGeneration(TBool& aCng)
   216 	{
   217 	TInt result = KErrBadHandle;
   218 
   219 	if (iG711DecoderConfig)
   220 		{
   221 		result = iG711DecoderConfig->GetComfortNoiseGeneration(aCng);
   222 		}
   223 
   224 	return result;
   225 	}
   226 
   227 TInt CG711DecoderConfigTestDevice::SetPacketLossConcealment(TBool aPlc)
   228 	{
   229 	TInt result = KErrBadHandle;
   230 
   231 	if (iG711DecoderConfig)
   232 		{
   233 		result = iG711DecoderConfig->SetPacketLossConcealment(aPlc);
   234 		}
   235 
   236 	return result;
   237 	}
   238 
   239 TInt CG711DecoderConfigTestDevice::GetPacketLossConcealment(TBool& aPlc)
   240 	{
   241 	TInt result = KErrBadHandle;
   242 
   243 	if (iG711DecoderConfig)
   244 		{
   245 		result = iG711DecoderConfig->GetPacketLossConcealment(aPlc);
   246 		}
   247 
   248 	return result;
   249 	}