os/mm/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200 (2014-06-10)
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// This is a re-implementation of CMdfHwDeviceCodecTestAdapter 
sl@0
    15
// primarily intended for unit testing codec PUs in PREQ1024.
sl@0
    16
// It is NOT a subclass, as CMdfHwDeviceCodecTestAdapter itself has no
sl@0
    17
// virtual or protected methods to override.
sl@0
    18
// The only difference is that it encodes and decodes from codec
sl@0
    19
// to codec, unlike CMdfHwDeviceCodecTestAdapter which encodes from sounddev
sl@0
    20
// (mic) to codec and decodes from codec to sounddev (speaker)
sl@0
    21
// 
sl@0
    22
//
sl@0
    23
sl@0
    24
/**
sl@0
    25
 @file
sl@0
    26
 @internalComponent
sl@0
    27
*/
sl@0
    28
sl@0
    29
#include "audiocodectestadapter.h"
sl@0
    30
#include <mdf/codecapiuids.hrh>
sl@0
    31
#include <mdf/mdfpuconfig.h>
sl@0
    32
// for the bitrate custom interface
sl@0
    33
#include <mmf/server/devsoundstandardcustominterfaces.h>
sl@0
    34
sl@0
    35
#include <e32debug.h>
sl@0
    36
sl@0
    37
// #define AUDIOCODECTESTADAPTER_DEBUG	1
sl@0
    38
#if defined(AUDIOCODECTESTADAPTER_DEBUG)
sl@0
    39
#define DEBUG_PRINT RDebug::Print
sl@0
    40
#else
sl@0
    41
#define DEBUG_PRINT
sl@0
    42
#endif
sl@0
    43
sl@0
    44
// Interface UID for the Processing Unit Loader
sl@0
    45
const TUid KUidPuLoader = {KUidPuLoaderImplementation};
sl@0
    46
sl@0
    47
sl@0
    48
CMdfHwDeviceCodecTestAdapter::~CMdfHwDeviceCodecTestAdapter()
sl@0
    49
	{
sl@0
    50
	Stop();
sl@0
    51
	// Unload the PUs
sl@0
    52
	if (iCodecPU)
sl@0
    53
		{
sl@0
    54
		iPuLoader->UnloadProcessingUnit(iCodecPU);
sl@0
    55
		}
sl@0
    56
		
sl@0
    57
	// The I/O ports should have been deleted at this point
sl@0
    58
sl@0
    59
	delete iInputBuffer;
sl@0
    60
	delete iOutputBuffer;		
sl@0
    61
	delete iActiveWait;
sl@0
    62
	delete iPuLoader;	
sl@0
    63
	REComSession::DestroyedImplementation(iPuLoaderDtorKey);
sl@0
    64
	}
sl@0
    65
sl@0
    66
CMdfHwDeviceCodecTestAdapter* CMdfHwDeviceCodecTestAdapter::NewL()
sl@0
    67
	{
sl@0
    68
	CMdfHwDeviceCodecTestAdapter* self = new (ELeave) CMdfHwDeviceCodecTestAdapter;
sl@0
    69
	CleanupStack::PushL (self);
sl@0
    70
	self->ConstructL();
sl@0
    71
	CleanupStack::Pop(self);
sl@0
    72
	return self;
sl@0
    73
	}
sl@0
    74
	
sl@0
    75
CMdfHwDeviceCodecTestAdapter::CMdfHwDeviceCodecTestAdapter()
sl@0
    76
	{	
sl@0
    77
	}
sl@0
    78
	
sl@0
    79
void CMdfHwDeviceCodecTestAdapter::ConstructL()
sl@0
    80
	{		
sl@0
    81
	// Load the PU Loader plugin
sl@0
    82
	iPuLoader = static_cast<CMdfPuLoader*>
sl@0
    83
		(REComSession::CreateImplementationL(KUidPuLoader, iPuLoaderDtorKey));
sl@0
    84
	iActiveWait = new (ELeave) CActiveSchedulerWait;
sl@0
    85
	iState = EProcessingUnitLoaderLoaded;
sl@0
    86
	}	
sl@0
    87
	
sl@0
    88
TInt CMdfHwDeviceCodecTestAdapter::Start(TDeviceFunc aFuncCmd, TDeviceFlow /*aFlowCmd*/)
sl@0
    89
	{		
sl@0
    90
	if (!((aFuncCmd == EDevEncode)|(aFuncCmd == EDevDecode)|(aFuncCmd == EDevNullFunc)))
sl@0
    91
		{
sl@0
    92
		return KErrArgument;	
sl@0
    93
		}
sl@0
    94
		
sl@0
    95
	iFuncCmd = aFuncCmd;
sl@0
    96
	
sl@0
    97
	// NB: aFlowCmd not used - this is codec-codec processing by default.
sl@0
    98
sl@0
    99
	TInt err = KErrNone;
sl@0
   100
	switch(aFuncCmd)
sl@0
   101
		{
sl@0
   102
		case EDevEncode:
sl@0
   103
			{
sl@0
   104
			err = StartEncode();
sl@0
   105
			}
sl@0
   106
			break;
sl@0
   107
		case EDevDecode:
sl@0
   108
			{
sl@0
   109
			err = StartDecode();
sl@0
   110
			}
sl@0
   111
			break;
sl@0
   112
		case EDevNullFunc:
sl@0
   113
		default:
sl@0
   114
			{
sl@0
   115
			err = KErrNotSupported;	
sl@0
   116
			}		
sl@0
   117
			break;
sl@0
   118
		}
sl@0
   119
sl@0
   120
	
sl@0
   121
	return err;
sl@0
   122
	}
sl@0
   123
	
sl@0
   124
// encode and decode logic is identical for codec-codec processing
sl@0
   125
	
sl@0
   126
TInt CMdfHwDeviceCodecTestAdapter::InitializeEncodeDecode()
sl@0
   127
	{
sl@0
   128
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::InitializeEncodeDecode"));
sl@0
   129
	
sl@0
   130
	ASSERT(iOutputPort);
sl@0
   131
	
sl@0
   132
	iInputPortBufferSize = iInputPort->MipBufferSize();	
sl@0
   133
	TRAPD(err, iInputBuffer = CMMFDescriptorBuffer::NewL(iInputPortBufferSize));
sl@0
   134
	if(err != KErrNone)
sl@0
   135
		{
sl@0
   136
		return err;
sl@0
   137
		}
sl@0
   138
	iInputBuffer->SetLastBuffer(EFalse);
sl@0
   139
	iInputPort->MipUseBuffer(*iInputBuffer);	
sl@0
   140
	
sl@0
   141
	iOutputPortBufferSize = iOutputPort->MopBufferSize();			
sl@0
   142
	TRAP(err, iOutputBuffer = CMMFDescriptorBuffer::NewL(iOutputPortBufferSize));
sl@0
   143
	if(err != KErrNone)
sl@0
   144
		{
sl@0
   145
		return err;
sl@0
   146
		}	
sl@0
   147
	iOutputBuffer->SetLastBuffer(EFalse);
sl@0
   148
	iOutputPort->MopUseBuffer(*iOutputBuffer);		
sl@0
   149
sl@0
   150
	// VD: should not move the set up of the state after sending the Initialize() calls???
sl@0
   151
	iState = EProcessingUnitInitializing;
sl@0
   152
		
sl@0
   153
	iCodecPU->Initialize();
sl@0
   154
	
sl@0
   155
	iActiveWait->Start();
sl@0
   156
	return KErrNone;
sl@0
   157
	}
sl@0
   158
sl@0
   159
TInt CMdfHwDeviceCodecTestAdapter::StartEncode()
sl@0
   160
	{
sl@0
   161
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartEncode"));
sl@0
   162
	TInt err = KErrNone;
sl@0
   163
	if (iState == EProcessingUnitLoaded)
sl@0
   164
		{
sl@0
   165
		err = InitializeEncodeDecode();
sl@0
   166
		}
sl@0
   167
	if (err != KErrNone)
sl@0
   168
		{
sl@0
   169
		return err;
sl@0
   170
		}
sl@0
   171
			
sl@0
   172
	return StartExecuting();	
sl@0
   173
	}
sl@0
   174
	
sl@0
   175
TInt CMdfHwDeviceCodecTestAdapter::StartDecode()
sl@0
   176
	{
sl@0
   177
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartDecode"));
sl@0
   178
	
sl@0
   179
	TInt err = KErrNone;
sl@0
   180
	if (iState == EProcessingUnitLoaded)
sl@0
   181
		{
sl@0
   182
		err = InitializeEncodeDecode();
sl@0
   183
		}
sl@0
   184
	if (err != KErrNone)
sl@0
   185
		{
sl@0
   186
		return err;
sl@0
   187
		}
sl@0
   188
			
sl@0
   189
	return StartExecuting();	
sl@0
   190
	}
sl@0
   191
sl@0
   192
TInt CMdfHwDeviceCodecTestAdapter::StartExecuting()
sl@0
   193
	{
sl@0
   194
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::StartExecuting"));
sl@0
   195
	TInt err = KErrNone;
sl@0
   196
sl@0
   197
	iOutputPort->MopReadData(*iOutputBuffer);	
sl@0
   198
	err = iHwDeviceObserver->FillThisHwBuffer(*iInputBuffer);
sl@0
   199
	if(err != KErrNone)
sl@0
   200
		{
sl@0
   201
		return err;
sl@0
   202
		}
sl@0
   203
		
sl@0
   204
	iState = EProcessingUnitExecuting;
sl@0
   205
	iCodecPU->Execute();
sl@0
   206
	
sl@0
   207
	return KErrNone;
sl@0
   208
	}
sl@0
   209
	
sl@0
   210
TInt CMdfHwDeviceCodecTestAdapter::Stop()
sl@0
   211
	{	
sl@0
   212
	if(iState == EProcessingUnitExecuting || iState == EProcessingUnitPaused)
sl@0
   213
		{			
sl@0
   214
		iStopping = ETrue; // is used as a guard in ExecuteComplete
sl@0
   215
				
sl@0
   216
		if(iCodecPU)
sl@0
   217
			{
sl@0
   218
			iCodecPU->Stop();	
sl@0
   219
			}
sl@0
   220
				
sl@0
   221
		iPCMPUCallbackComplete = EFalse;		
sl@0
   222
				
sl@0
   223
		iState = EProcessingUnitIdle;
sl@0
   224
		iStopping = EFalse;	
sl@0
   225
		}
sl@0
   226
	return KErrNone;			
sl@0
   227
	}
sl@0
   228
sl@0
   229
TInt CMdfHwDeviceCodecTestAdapter::Pause()
sl@0
   230
	{
sl@0
   231
	return iCodecPU->Pause();
sl@0
   232
	}
sl@0
   233
	
sl@0
   234
TInt CMdfHwDeviceCodecTestAdapter::Init(THwDeviceInitParams& aDevInfo)
sl@0
   235
	{
sl@0
   236
	if(!iCodecPU)
sl@0
   237
		{
sl@0
   238
		return KErrNotSupported;
sl@0
   239
		}
sl@0
   240
sl@0
   241
	// Not currently using any other members of aDevInfo, except the Observer
sl@0
   242
	if(!aDevInfo.iHwDeviceObserver)
sl@0
   243
		{
sl@0
   244
		return KErrArgument;
sl@0
   245
		}
sl@0
   246
	iHwDeviceObserver = aDevInfo.iHwDeviceObserver;
sl@0
   247
	
sl@0
   248
	// Get ports and set observers
sl@0
   249
	RPointerArray<MMdfInputPort> inputPorts;
sl@0
   250
	TInt err = iCodecPU->GetInputPorts(inputPorts);
sl@0
   251
	if(err != KErrNone)
sl@0
   252
		{
sl@0
   253
		return err;
sl@0
   254
		}	
sl@0
   255
		
sl@0
   256
	if (inputPorts.Count()<1)
sl@0
   257
		{
sl@0
   258
		return KErrNotFound;
sl@0
   259
		}
sl@0
   260
		
sl@0
   261
	iInputPort = inputPorts[0];
sl@0
   262
	inputPorts.Close();
sl@0
   263
	
sl@0
   264
	iInputPort->MipSetObserver(*this);
sl@0
   265
sl@0
   266
	RPointerArray<MMdfOutputPort> outputPorts;
sl@0
   267
	err = iCodecPU->GetOutputPorts(outputPorts);
sl@0
   268
	if(err != KErrNone)
sl@0
   269
		{
sl@0
   270
		return err;
sl@0
   271
		}	
sl@0
   272
		
sl@0
   273
	if (outputPorts.Count()<1)
sl@0
   274
		{
sl@0
   275
		return KErrNotFound;
sl@0
   276
		}
sl@0
   277
		
sl@0
   278
	iOutputPort = outputPorts[0];
sl@0
   279
	outputPorts.Close();
sl@0
   280
	iOutputPort->MopSetObserver(*this);
sl@0
   281
	
sl@0
   282
	iState = EProcessingUnitLoaded;
sl@0
   283
		
sl@0
   284
	return KErrNone;		
sl@0
   285
	}
sl@0
   286
sl@0
   287
TAny* CMdfHwDeviceCodecTestAdapter::CustomInterface(TUid aInterfaceId)
sl@0
   288
	{
sl@0
   289
	if (aInterfaceId == KUidHwDeviceSetupInterface)
sl@0
   290
		{
sl@0
   291
		return static_cast<MMdfHwDeviceSetup*>(this);
sl@0
   292
		}
sl@0
   293
	else if (aInterfaceId.iUid == KMmfPlaySettingsCustomInterface)
sl@0
   294
		{
sl@0
   295
		return reinterpret_cast<MPlayCustomInterface*>(iInputPort);
sl@0
   296
		}
sl@0
   297
	else if (aInterfaceId.iUid == KMmfRecordSettingsCustomInterface)
sl@0
   298
		{
sl@0
   299
		return reinterpret_cast<MRecordCustomInterface*>(iOutputPort);
sl@0
   300
		}
sl@0
   301
	// if the PU is an encoder it may have a BitRate custom interface	
sl@0
   302
	else if (aInterfaceId == KUidCustomInterfaceDevSoundBitRate)
sl@0
   303
		{
sl@0
   304
		return static_cast<MMMFDevSoundCustomInterfaceBitRate*>(iCodecPU->CustomInterface(aInterfaceId));
sl@0
   305
		}
sl@0
   306
	else	
sl@0
   307
		{
sl@0
   308
		return NULL;
sl@0
   309
		}
sl@0
   310
	}
sl@0
   311
sl@0
   312
TInt CMdfHwDeviceCodecTestAdapter::ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr)
sl@0
   313
	{		
sl@0
   314
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::ThisHwBufferFilled"));
sl@0
   315
	
sl@0
   316
	aFillBufferPtr.SetStatus(EFull); 
sl@0
   317
	
sl@0
   318
	// if the buffer is empty or the last buffer, write it anyway -
sl@0
   319
	// the stop / error will be generated elsewhere
sl@0
   320
sl@0
   321
	iInputPort->MipWriteData(aFillBufferPtr);
sl@0
   322
	return KErrNone;
sl@0
   323
	}
sl@0
   324
sl@0
   325
TInt CMdfHwDeviceCodecTestAdapter::ThisHwBufferEmptied(CMMFBuffer& /*aEmptyBufferPtr*/)
sl@0
   326
	{
sl@0
   327
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::ThisHwBufferEmptied"));
sl@0
   328
	
sl@0
   329
	iOutputPort->MopReadData(*iOutputBuffer);
sl@0
   330
	return KErrNone;
sl@0
   331
	}
sl@0
   332
	
sl@0
   333
TInt CMdfHwDeviceCodecTestAdapter::SetConfig(TTaskConfig& aConfig)
sl@0
   334
	{
sl@0
   335
	TInt err = KErrNone;
sl@0
   336
	// Call to Configure the Codec PU
sl@0
   337
	TPuTaskConfig config(aConfig);
sl@0
   338
	err = iInputPort->MipConfigure(config);
sl@0
   339
	if(err != KErrNone)
sl@0
   340
		{
sl@0
   341
		return err;
sl@0
   342
		}
sl@0
   343
	err = iOutputPort->MopConfigure(config);
sl@0
   344
	if(err != KErrNone)
sl@0
   345
		{
sl@0
   346
		return err;
sl@0
   347
		}
sl@0
   348
sl@0
   349
//	iState = EProcessingUnitConfigured;
sl@0
   350
	
sl@0
   351
	return KErrNone;
sl@0
   352
	}
sl@0
   353
sl@0
   354
TInt CMdfHwDeviceCodecTestAdapter::StopAndDeleteCodec()
sl@0
   355
	{
sl@0
   356
	return KErrNone;
sl@0
   357
	}
sl@0
   358
sl@0
   359
TInt CMdfHwDeviceCodecTestAdapter::DeleteCodec()
sl@0
   360
	{
sl@0
   361
	return KErrNone;
sl@0
   362
	}
sl@0
   363
sl@0
   364
void CMdfHwDeviceCodecTestAdapter::MipoWriteDataComplete(const MMdfInputPort* aInputPort,
sl@0
   365
	CMMFBuffer* aBuffer, TInt aErrorCode)
sl@0
   366
	{
sl@0
   367
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::MipoWriteDataComplete"));
sl@0
   368
	
sl@0
   369
	if (aErrorCode == KErrNone && aInputPort == iInputPort)
sl@0
   370
		{
sl@0
   371
		if(aBuffer->LastBuffer())
sl@0
   372
			{
sl@0
   373
			if(iFuncCmd == EDevEncode) 
sl@0
   374
				{
sl@0
   375
				// we must cancel the PU here if it's an encoder - the decoder
sl@0
   376
				// will be done elsewhere
sl@0
   377
				iCodecPU->Stop();
sl@0
   378
				}
sl@0
   379
			}
sl@0
   380
		else
sl@0
   381
			{
sl@0
   382
			iHwDeviceObserver->FillThisHwBuffer(*aBuffer);
sl@0
   383
			}
sl@0
   384
		}
sl@0
   385
	else
sl@0
   386
		{
sl@0
   387
		StopHwDevice(aErrorCode);
sl@0
   388
		}		
sl@0
   389
	}
sl@0
   390
		
sl@0
   391
void CMdfHwDeviceCodecTestAdapter::MipoDisconnectTunnelComplete(const MMdfInputPort* aInputPort, 
sl@0
   392
	TInt aErrorCode)
sl@0
   393
	{
sl@0
   394
	// The Inputport of the PcmCodecPu will no longer receive data.
sl@0
   395
	// Set flag to indicate that the sink outputport has been stopped?
sl@0
   396
	if(aErrorCode == KErrNone)
sl@0
   397
		{
sl@0
   398
		if(aInputPort == iInputPort)
sl@0
   399
			{
sl@0
   400
			iPCMPuMipoStopCompleted = ETrue;
sl@0
   401
			}
sl@0
   402
		}
sl@0
   403
	else
sl@0
   404
		{
sl@0
   405
		iHwDeviceObserver->Error(aErrorCode);
sl@0
   406
		}	
sl@0
   407
	}
sl@0
   408
sl@0
   409
void CMdfHwDeviceCodecTestAdapter::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/,
sl@0
   410
	TInt /*aErrorCode*/)
sl@0
   411
	{
sl@0
   412
	
sl@0
   413
	}
sl@0
   414
sl@0
   415
void CMdfHwDeviceCodecTestAdapter::MopoReadDataComplete(const MMdfOutputPort* aOutputPort, 
sl@0
   416
	CMMFBuffer* aBuffer, TInt aErrorCode)
sl@0
   417
	{
sl@0
   418
	DEBUG_PRINT(_L("CMdfHwDeviceCodecTestAdapter::MopoReadDataComplete"));
sl@0
   419
	
sl@0
   420
	if(aErrorCode == KErrNone && aOutputPort == iOutputPort)
sl@0
   421
		{
sl@0
   422
		iHwDeviceObserver->EmptyThisHwBuffer(*aBuffer);
sl@0
   423
		}
sl@0
   424
	else
sl@0
   425
		{
sl@0
   426
		StopHwDevice(aErrorCode);
sl@0
   427
		}
sl@0
   428
	}
sl@0
   429
				
sl@0
   430
void CMdfHwDeviceCodecTestAdapter::MopoDisconnectTunnelComplete(const MMdfOutputPort* aOutputPort,
sl@0
   431
	TInt aErrorCode)
sl@0
   432
	{
sl@0
   433
	if(aErrorCode == KErrNone)
sl@0
   434
		{
sl@0
   435
		if(aOutputPort == iOutputPort)
sl@0
   436
			{
sl@0
   437
			iPCMPuMopoStopCompleted = ETrue;			
sl@0
   438
			}
sl@0
   439
		}
sl@0
   440
	else
sl@0
   441
		{
sl@0
   442
		iHwDeviceObserver->Error(aErrorCode);
sl@0
   443
		}
sl@0
   444
	if(iPCMPuMipoStopCompleted && iPCMPuMopoStopCompleted)
sl@0
   445
		{
sl@0
   446
		iState = EProcessingUnitIdle;
sl@0
   447
		}		
sl@0
   448
	}
sl@0
   449
	
sl@0
   450
void CMdfHwDeviceCodecTestAdapter::MopoRestartTunnelComplete(const MMdfOutputPort* /* aOutputPort */,
sl@0
   451
	TInt /*aErrorCode*/)
sl@0
   452
	{
sl@0
   453
	
sl@0
   454
	}
sl@0
   455
sl@0
   456
void CMdfHwDeviceCodecTestAdapter::InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode)
sl@0
   457
	{
sl@0
   458
	if(aErrorCode != KErrNone)
sl@0
   459
		{
sl@0
   460
		iHwDeviceObserver->Error(aErrorCode);
sl@0
   461
		return;
sl@0
   462
		}
sl@0
   463
			
sl@0
   464
	if(aPu == iCodecPU)
sl@0
   465
		{
sl@0
   466
		iPCMPUCallbackComplete = ETrue;
sl@0
   467
		}
sl@0
   468
	
sl@0
   469
	if(iPCMPUCallbackComplete)
sl@0
   470
		{
sl@0
   471
sl@0
   472
		// reset the flags
sl@0
   473
		iPCMPUCallbackComplete = EFalse;
sl@0
   474
		
sl@0
   475
		// PUs initialised OK
sl@0
   476
		iActiveWait->AsyncStop();
sl@0
   477
sl@0
   478
		}
sl@0
   479
	}
sl@0
   480
sl@0
   481
void CMdfHwDeviceCodecTestAdapter::ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode)
sl@0
   482
	{
sl@0
   483
	if(iStopping)
sl@0
   484
		{
sl@0
   485
		return;
sl@0
   486
		}
sl@0
   487
	
sl@0
   488
	if (iExecuteError == KErrNone)
sl@0
   489
		{
sl@0
   490
		iExecuteError = aErrorCode;
sl@0
   491
		}
sl@0
   492
	 		
sl@0
   493
	if(aPu == iCodecPU)
sl@0
   494
		{
sl@0
   495
		iPCMPUCallbackComplete = ETrue;
sl@0
   496
		}
sl@0
   497
	
sl@0
   498
	if(iExecuteError != KErrNone || (iPCMPUCallbackComplete) )
sl@0
   499
		{
sl@0
   500
		if (iState == EProcessingUnitExecuting)
sl@0
   501
			{
sl@0
   502
			// stop the hardware device if we are still executing
sl@0
   503
			StopHwDevice(iExecuteError);		
sl@0
   504
			iState = EProcessingUnitIdle;
sl@0
   505
			}
sl@0
   506
		// reset the flags
sl@0
   507
		iPCMPUCallbackComplete = EFalse;
sl@0
   508
		}
sl@0
   509
	}
sl@0
   510
sl@0
   511
void CMdfHwDeviceCodecTestAdapter::SetDataTypesL(TFourCC aSrcType, TFourCC aDestType)
sl@0
   512
	{
sl@0
   513
	// Find and load an appropriate Codec
sl@0
   514
	iCodecPU = iPuLoader->LoadProcessingUnitL(*this, aSrcType, aDestType);
sl@0
   515
	}
sl@0
   516
sl@0
   517
sl@0
   518
void CMdfHwDeviceCodecTestAdapter::StopHwDevice(TInt error)
sl@0
   519
	{
sl@0
   520
	iHwDeviceObserver->Stopped();
sl@0
   521
	iHwDeviceObserver->Error(error);		
sl@0
   522
	}
sl@0
   523
sl@0
   524
void CMdfHwDeviceCodecTestAdapter::GetState(THwDevAdapterState& aState) const
sl@0
   525
	{
sl@0
   526
	aState = iState;	
sl@0
   527
	}