os/mm/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.h
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmdevicefw/mdfunittest/codecapi/omxvorbis/hwdeviceadapter/audiocodectestadapter.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,175 @@
1.4 +/*
1.5 +* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 +@file
1.24 +@internalComponent
1.25 +*/
1.26 +
1.27 +#ifndef AUDIOCODECTESTADAPTER_H
1.28 +#define AUDIOCODECTESTADAPTER_H
1.29 +
1.30 +#include <mmf/server/mmfhwdevice.h>
1.31 +#include <mdf/mdfinputport.h>
1.32 +#include <mdf/mdfoutputport.h>
1.33 +#include <mdf/mdfprocessingunit.h>
1.34 +#include <mdf/mdfpuloader.h>
1.35 +#include <mmf/server/mmfdatabuffer.h>
1.36 +#include <mmf/server/mmfhwdevicesetup.h>
1.37 +#include <mmf/common/mmfutilities.h>
1.38 +
1.39 +class CMMFBuffer;
1.40 +
1.41 +class CMdfHwDeviceCodecTestAdapter : public CMMFHwDevice,
1.42 + public MMdfInputPortObserver,
1.43 + public MMdfOutputPortObserver,
1.44 + public MMdfProcessingUnitObserver,
1.45 + public MMdfHwDeviceSetup
1.46 + {
1.47 +public:
1.48 + /*
1.49 + Hardware Device Adapter panics raised as a result of a programming error.
1.50 + */
1.51 + enum THwDeviceAdapterPanics
1.52 + {
1.53 + /*
1.54 + Raised when the Codec Processing Unit has not been initialised.
1.55 + @see CMdfHwDeviceAdapter::CustomInterface
1.56 + @see CMdfHwDeviceAdapter::SetDataTypesL
1.57 + */
1.58 + EPanicCodecNotSet
1.59 + };
1.60 + /**
1.61 + The current state of the Hardware Device Adapter.
1.62 + */
1.63 + enum THwDevAdapterState
1.64 + {
1.65 + /*
1.66 + The PULoader has been loaded.
1.67 + */
1.68 + EProcessingUnitLoaderLoaded,
1.69 + /*
1.70 + The Processing Units have been loaded.
1.71 + */
1.72 + EProcessingUnitLoaded,
1.73 + /*
1.74 + The Processing Units are currently being initialised.
1.75 + */
1.76 + EProcessingUnitInitializing,
1.77 + /*
1.78 + The Processing Units are currently in the idle state.
1.79 + */
1.80 + EProcessingUnitIdle,
1.81 + /*
1.82 + The Processing Units are currently in the executing state.
1.83 + */
1.84 + EProcessingUnitExecuting,
1.85 + /*
1.86 + The Processing Units are currently in the paused state.
1.87 + */
1.88 + EProcessingUnitPaused
1.89 + };
1.90 +
1.91 +public:
1.92 + static CMdfHwDeviceCodecTestAdapter* NewL();
1.93 +
1.94 + // from CMMFHwDevice
1.95 + TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd);
1.96 + TInt Stop();
1.97 + TInt Pause();
1.98 + TInt Init(THwDeviceInitParams& aDevInfo);
1.99 + TAny* CustomInterface(TUid aInterfaceId);
1.100 + TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr);
1.101 + TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr);
1.102 + TInt SetConfig(TTaskConfig& aConfig);
1.103 + TInt StopAndDeleteCodec();
1.104 + TInt DeleteCodec();
1.105 + ~CMdfHwDeviceCodecTestAdapter();
1.106 +
1.107 + // from MMdfInputPortObserver
1.108 + void MipoWriteDataComplete(const MMdfInputPort* aPu,
1.109 + CMMFBuffer* aBuffer, TInt aErrorCode);
1.110 + void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
1.111 + void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
1.112 +
1.113 + // from MMdfOutputPortObserver
1.114 + void MopoReadDataComplete(const MMdfOutputPort* aPu,
1.115 + CMMFBuffer* aBuffer, TInt aErrorCode);
1.116 + void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
1.117 + void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
1.118 +
1.119 + // from MMdfProcessingUnitObserver
1.120 + void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
1.121 + void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
1.122 +
1.123 + // from MMdfHwDeviceSetup
1.124 + void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType);
1.125 +
1.126 + void GetState(THwDevAdapterState& aState) const;
1.127 +
1.128 +private:
1.129 + CMdfHwDeviceCodecTestAdapter();
1.130 + void ConstructL();
1.131 + TInt CreateBuffers();
1.132 + TInt StartEncode();
1.133 + TInt StartDecode();
1.134 + TInt InitializeEncodeDecode();
1.135 + TInt StartExecuting();
1.136 +
1.137 + void StopHwDevice(TInt error);
1.138 +
1.139 +private:
1.140 + CMdfPuLoader* iPuLoader;
1.141 + TUid iPuLoaderDtorKey;
1.142 + MMdfInputPort* iInputPort;
1.143 + MMdfOutputPort* iOutputPort;
1.144 +
1.145 + CMdfProcessingUnit* iCodecPU;
1.146 +
1.147 + THwDevAdapterState iState;
1.148 + TBool iStopping;
1.149 +
1.150 + TBool iPCMPUCallbackComplete;
1.151 +
1.152 + TBool iPCMPuMopoStopCompleted;
1.153 + TBool iPCMPuMipoStopCompleted;
1.154 +
1.155 + TInt iExecuteError;
1.156 +
1.157 + enum TPUType
1.158 + {
1.159 + EPcmPu
1.160 + };
1.161 +
1.162 + CMMFBuffer* iInputBuffer;
1.163 + CMMFBuffer* iOutputBuffer;
1.164 +
1.165 + TUint32 iInputPortBufferSize;
1.166 + TUint32 iOutputPortBufferSize;
1.167 + TInt iInputPortBufferData;
1.168 + TInt iOutputPortBufferData;
1.169 +
1.170 + CActiveSchedulerWait* iActiveWait;
1.171 +
1.172 + TDeviceFunc iFuncCmd;
1.173 +
1.174 + TFourCC iFirstFourCC;
1.175 + TFourCC iSecondFourCC;
1.176 + };
1.177 +
1.178 +#endif // AUDIOCODECTESTADAPTER_H