sl@0: /* sl@0: * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef AUDIOCODECTESTADAPTER_H sl@0: #define AUDIOCODECTESTADAPTER_H sl@0: sl@0: #include <mmf/server/mmfhwdevice.h> sl@0: #include <mdf/mdfinputport.h> sl@0: #include <mdf/mdfoutputport.h> sl@0: #include <mdf/mdfprocessingunit.h> sl@0: #include <mdf/mdfpuloader.h> sl@0: #include <mmf/server/mmfdatabuffer.h> sl@0: #include <mmf/server/mmfhwdevicesetup.h> sl@0: #include <mmf/common/mmfutilities.h> sl@0: sl@0: class CMMFBuffer; sl@0: sl@0: class CMdfHwDeviceCodecTestAdapter : public CMMFHwDevice, sl@0: public MMdfInputPortObserver, sl@0: public MMdfOutputPortObserver, sl@0: public MMdfProcessingUnitObserver, sl@0: public MMdfHwDeviceSetup sl@0: { sl@0: public: sl@0: /* sl@0: Hardware Device Adapter panics raised as a result of a programming error. sl@0: */ sl@0: enum THwDeviceAdapterPanics sl@0: { sl@0: /* sl@0: Raised when the Codec Processing Unit has not been initialised. sl@0: @see CMdfHwDeviceAdapter::CustomInterface sl@0: @see CMdfHwDeviceAdapter::SetDataTypesL sl@0: */ sl@0: EPanicCodecNotSet sl@0: }; sl@0: /** sl@0: The current state of the Hardware Device Adapter. sl@0: */ sl@0: enum THwDevAdapterState sl@0: { sl@0: /* sl@0: The PULoader has been loaded. sl@0: */ sl@0: EProcessingUnitLoaderLoaded, sl@0: /* sl@0: The Processing Units have been loaded. sl@0: */ sl@0: EProcessingUnitLoaded, sl@0: /* sl@0: The Processing Units are currently being initialised. sl@0: */ sl@0: EProcessingUnitInitializing, sl@0: /* sl@0: The Processing Units are currently in the idle state. sl@0: */ sl@0: EProcessingUnitIdle, sl@0: /* sl@0: The Processing Units are currently in the executing state. sl@0: */ sl@0: EProcessingUnitExecuting, sl@0: /* sl@0: The Processing Units are currently in the paused state. sl@0: */ sl@0: EProcessingUnitPaused sl@0: }; sl@0: sl@0: public: sl@0: static CMdfHwDeviceCodecTestAdapter* NewL(); sl@0: sl@0: // from CMMFHwDevice sl@0: TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd); sl@0: TInt Stop(); sl@0: TInt Pause(); sl@0: TInt Init(THwDeviceInitParams& aDevInfo); sl@0: TAny* CustomInterface(TUid aInterfaceId); sl@0: TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr); sl@0: TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr); sl@0: TInt SetConfig(TTaskConfig& aConfig); sl@0: TInt StopAndDeleteCodec(); sl@0: TInt DeleteCodec(); sl@0: ~CMdfHwDeviceCodecTestAdapter(); sl@0: sl@0: // from MMdfInputPortObserver sl@0: void MipoWriteDataComplete(const MMdfInputPort* aPu, sl@0: CMMFBuffer* aBuffer, TInt aErrorCode); sl@0: void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); sl@0: void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode); sl@0: sl@0: // from MMdfOutputPortObserver sl@0: void MopoReadDataComplete(const MMdfOutputPort* aPu, sl@0: CMMFBuffer* aBuffer, TInt aErrorCode); sl@0: void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); sl@0: void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode); sl@0: sl@0: // from MMdfProcessingUnitObserver sl@0: void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); sl@0: void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode); sl@0: sl@0: // from MMdfHwDeviceSetup sl@0: void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType); sl@0: sl@0: void GetState(THwDevAdapterState& aState) const; sl@0: sl@0: private: sl@0: CMdfHwDeviceCodecTestAdapter(); sl@0: void ConstructL(); sl@0: TInt CreateBuffers(); sl@0: TInt StartEncode(); sl@0: TInt StartDecode(); sl@0: TInt InitializeEncodeDecode(); sl@0: TInt StartExecuting(); sl@0: sl@0: void StopHwDevice(TInt error); sl@0: sl@0: private: sl@0: CMdfPuLoader* iPuLoader; sl@0: TUid iPuLoaderDtorKey; sl@0: MMdfInputPort* iInputPort; sl@0: MMdfOutputPort* iOutputPort; sl@0: sl@0: CMdfProcessingUnit* iCodecPU; sl@0: sl@0: THwDevAdapterState iState; sl@0: TBool iStopping; sl@0: sl@0: TBool iPCMPUCallbackComplete; sl@0: sl@0: TBool iPCMPuMopoStopCompleted; sl@0: TBool iPCMPuMipoStopCompleted; sl@0: sl@0: TInt iExecuteError; sl@0: sl@0: enum TPUType sl@0: { sl@0: EPcmPu sl@0: }; sl@0: sl@0: CMMFBuffer* iInputBuffer; sl@0: CMMFBuffer* iOutputBuffer; sl@0: sl@0: TUint32 iInputPortBufferSize; sl@0: TUint32 iOutputPortBufferSize; sl@0: TInt iInputPortBufferData; sl@0: TInt iOutputPortBufferData; sl@0: sl@0: CActiveSchedulerWait* iActiveWait; sl@0: sl@0: TDeviceFunc iFuncCmd; sl@0: sl@0: TFourCC iFirstFourCC; sl@0: TFourCC iSecondFourCC; sl@0: }; sl@0: sl@0: #endif // AUDIOCODECTESTADAPTER_H