os/mm/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
/**
sl@0
    20
@file
sl@0
    21
@internalComponent
sl@0
    22
*/
sl@0
    23
sl@0
    24
#ifndef AUDIOCODECTESTADAPTER_H
sl@0
    25
#define AUDIOCODECTESTADAPTER_H
sl@0
    26
sl@0
    27
#include <mmf/server/mmfhwdevice.h>
sl@0
    28
#include <mdf/mdfinputport.h>
sl@0
    29
#include <mdf/mdfoutputport.h>
sl@0
    30
#include <mdf/mdfprocessingunit.h>
sl@0
    31
#include <mdf/mdfpuloader.h>
sl@0
    32
#include <mmf/server/mmfdatabuffer.h>
sl@0
    33
#include <mmf/server/mmfhwdevicesetup.h>
sl@0
    34
#include <mmf/common/mmfutilities.h>
sl@0
    35
sl@0
    36
class CMMFBuffer;
sl@0
    37
sl@0
    38
class CMdfHwDeviceCodecTestAdapter :	public CMMFHwDevice,
sl@0
    39
									 	public MMdfInputPortObserver,
sl@0
    40
										public MMdfOutputPortObserver,
sl@0
    41
										public MMdfProcessingUnitObserver,
sl@0
    42
										public MMdfHwDeviceSetup
sl@0
    43
	{
sl@0
    44
public:
sl@0
    45
	/*
sl@0
    46
	Hardware Device Adapter panics raised as a result of a programming error.
sl@0
    47
	*/	
sl@0
    48
	enum THwDeviceAdapterPanics
sl@0
    49
		{
sl@0
    50
		/*
sl@0
    51
		Raised when the Codec Processing Unit has not been initialised.
sl@0
    52
		@see CMdfHwDeviceAdapter::CustomInterface
sl@0
    53
		@see CMdfHwDeviceAdapter::SetDataTypesL
sl@0
    54
		*/
sl@0
    55
		EPanicCodecNotSet
sl@0
    56
		};
sl@0
    57
	/**
sl@0
    58
	The current state of the Hardware Device Adapter.
sl@0
    59
	*/
sl@0
    60
	enum THwDevAdapterState
sl@0
    61
		{
sl@0
    62
		/*
sl@0
    63
		The PULoader has been loaded.
sl@0
    64
		*/
sl@0
    65
		EProcessingUnitLoaderLoaded,
sl@0
    66
		/*
sl@0
    67
		The Processing Units have been loaded.
sl@0
    68
		*/
sl@0
    69
		EProcessingUnitLoaded,
sl@0
    70
		/*
sl@0
    71
		The Processing Units are currently being initialised.
sl@0
    72
		*/
sl@0
    73
		EProcessingUnitInitializing,
sl@0
    74
		/*
sl@0
    75
		The Processing Units are currently in the idle state.
sl@0
    76
		*/
sl@0
    77
		EProcessingUnitIdle,
sl@0
    78
		/*
sl@0
    79
		The Processing Units are currently in the executing state.
sl@0
    80
		*/
sl@0
    81
		EProcessingUnitExecuting,
sl@0
    82
		/*
sl@0
    83
		The Processing Units are currently in the paused state.
sl@0
    84
		*/
sl@0
    85
		EProcessingUnitPaused		
sl@0
    86
		};		
sl@0
    87
	
sl@0
    88
public:
sl@0
    89
	static CMdfHwDeviceCodecTestAdapter* NewL();
sl@0
    90
	
sl@0
    91
	// from CMMFHwDevice
sl@0
    92
	TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd);
sl@0
    93
	TInt Stop();
sl@0
    94
	TInt Pause();
sl@0
    95
	TInt Init(THwDeviceInitParams& aDevInfo);
sl@0
    96
	TAny* CustomInterface(TUid aInterfaceId);
sl@0
    97
	TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr);
sl@0
    98
	TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr);
sl@0
    99
	TInt SetConfig(TTaskConfig& aConfig);
sl@0
   100
	TInt StopAndDeleteCodec();
sl@0
   101
	TInt DeleteCodec();
sl@0
   102
	~CMdfHwDeviceCodecTestAdapter();
sl@0
   103
	
sl@0
   104
	// from MMdfInputPortObserver
sl@0
   105
	void MipoWriteDataComplete(const MMdfInputPort* aPu,
sl@0
   106
		CMMFBuffer* aBuffer, TInt aErrorCode);
sl@0
   107
	void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu,  TInt aErrorCode);
sl@0
   108
	void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
sl@0
   109
	
sl@0
   110
	// from MMdfOutputPortObserver
sl@0
   111
	void MopoReadDataComplete(const MMdfOutputPort* aPu, 
sl@0
   112
		CMMFBuffer* aBuffer, TInt aErrorCode);
sl@0
   113
	void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
sl@0
   114
	void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
sl@0
   115
	
sl@0
   116
	// from MMdfProcessingUnitObserver
sl@0
   117
	void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
sl@0
   118
	void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
sl@0
   119
	
sl@0
   120
	// from MMdfHwDeviceSetup	
sl@0
   121
	void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType);
sl@0
   122
	
sl@0
   123
	void GetState(THwDevAdapterState& aState) const;
sl@0
   124
	
sl@0
   125
private:
sl@0
   126
	CMdfHwDeviceCodecTestAdapter();
sl@0
   127
	void ConstructL();
sl@0
   128
	TInt CreateBuffers();
sl@0
   129
	TInt StartEncode();
sl@0
   130
	TInt StartDecode();
sl@0
   131
	TInt InitializeEncodeDecode();
sl@0
   132
	TInt StartExecuting();
sl@0
   133
	
sl@0
   134
	void StopHwDevice(TInt error);
sl@0
   135
sl@0
   136
private:
sl@0
   137
	CMdfPuLoader* iPuLoader;
sl@0
   138
	TUid iPuLoaderDtorKey;
sl@0
   139
	MMdfInputPort* iInputPort;
sl@0
   140
	MMdfOutputPort* iOutputPort;
sl@0
   141
	
sl@0
   142
	CMdfProcessingUnit* iCodecPU;
sl@0
   143
		
sl@0
   144
	THwDevAdapterState iState;
sl@0
   145
	TBool iStopping;
sl@0
   146
	
sl@0
   147
	TBool iPCMPUCallbackComplete;
sl@0
   148
	
sl@0
   149
	TBool iPCMPuMopoStopCompleted;
sl@0
   150
	TBool iPCMPuMipoStopCompleted;
sl@0
   151
	
sl@0
   152
	TInt iExecuteError;
sl@0
   153
	
sl@0
   154
	enum TPUType
sl@0
   155
		{
sl@0
   156
		EPcmPu
sl@0
   157
		};
sl@0
   158
sl@0
   159
	CMMFBuffer* iInputBuffer;
sl@0
   160
	CMMFBuffer* iOutputBuffer;
sl@0
   161
	
sl@0
   162
	TUint32 iInputPortBufferSize;
sl@0
   163
	TUint32 iOutputPortBufferSize;
sl@0
   164
	TInt iInputPortBufferData;	
sl@0
   165
	TInt iOutputPortBufferData;
sl@0
   166
	
sl@0
   167
	CActiveSchedulerWait* iActiveWait;
sl@0
   168
sl@0
   169
	TDeviceFunc iFuncCmd;
sl@0
   170
sl@0
   171
	TFourCC iFirstFourCC;
sl@0
   172
	TFourCC iSecondFourCC;
sl@0
   173
	};
sl@0
   174
	
sl@0
   175
#endif // AUDIOCODECTESTADAPTER_H