Update contrib.
1 // Copyright (c) 2005-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // mmfhwdeviceadapter.h
23 @see MMdfInputPortObserver
24 @see MMdfOutputPortObserver
25 @see MMdfProcessingUnitObserver
26 @see MMdfHwDeviceSetup
29 #ifndef HWDEVICEADAPTER_H
30 #define HWDEVICEADAPTER_H
32 #include <mdf/mdfinputport.h>
33 #include <mdf/mdfoutputport.h>
34 #include <mdf/mdfprocessingunit.h>
35 #include <mdf/mdfpuloader.h>
36 #include <mmf/server/mmfhwdevice.h>
37 #include <mmf/server/mmfdatabuffer.h>
38 #include <mmf/server/mmfhwdevicesetup.h>
39 #include <mmf/common/mmfutilities.h>
44 Hardware Device Adapter class that uses Processing Units (and their associated Ports) in
45 order to decode and encode audio data.
47 class CMdfHwDeviceAdapter : public CMMFHwDevice,
48 public MMdfInputPortObserver,
49 public MMdfOutputPortObserver,
50 public MMdfProcessingUnitObserver,
51 public MMdfHwDeviceSetup
55 The current state of the Hardware Device Adapter.
57 enum THwDevAdapterState
60 The PULoader has been loaded.
62 EProcessingUnitLoaderLoaded,
64 The Processing Units have been loaded.
66 EProcessingUnitLoaded,
68 The Processing Units are currently being initialised.
70 EProcessingUnitInitializing,
72 The Processing Units are currently in the idle state.
76 The Processing Units are currently in the executing state.
78 EProcessingUnitExecuting,
80 The Processing Units are currently in the paused state.
86 static CMdfHwDeviceAdapter* NewL();
89 TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd);
92 TInt Init(THwDeviceInitParams& aDevInfo);
93 TAny* CustomInterface(TUid aInterfaceId);
94 TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr);
95 TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr);
96 TInt SetConfig(TTaskConfig& aConfig);
97 TInt StopAndDeleteCodec();
99 ~CMdfHwDeviceAdapter();
101 // from MMdfInputPortObserver
102 void MipoWriteDataComplete(const MMdfInputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode);
103 void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
104 void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
106 // from MMdfOutputPortObserver
107 void MopoReadDataComplete(const MMdfOutputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode);
108 void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
109 void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
111 // from MMdfProcessingUnitObserver
112 void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
113 void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
115 // from MMdfHwDeviceSetup
116 void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType);
118 // CMdfHwDeviceAdapter
119 void GetState(THwDevAdapterState& aState) const;
123 Hardware Device Adapter panics raised as a result of a programming error.
125 enum THwDeviceAdapterPanics
128 Raised when the Codec Processing Unit has not been initialised.
129 @see CMdfHwDeviceAdapter::CustomInterface
130 @see CMdfHwDeviceAdapter::SetDataTypesL
136 CMdfHwDeviceAdapter();
138 TInt CreateBuffers();
141 TInt InitializeEncode();
142 TInt InitializeDecode();
143 TInt StartExecuting();
144 void StopHwDevice(TInt error);
151 CMdfPuLoader* iPuLoader;
152 TUid iPuLoaderDtorKey;
153 MMdfInputPort* iCodecInputPort;
154 MMdfOutputPort* iCodecOutputPort;
155 MMdfInputPort* iSinkInputPort;
156 MMdfOutputPort* iSourceOutputPort;
157 CMdfProcessingUnit* iCodecPU;
158 CMdfProcessingUnit* iAudioDevicePU;
159 THwDevAdapterState iState;
160 TBool iPCMPUCallbackComplete;
161 TBool iSourceSinkPUCallbackComplete;
162 TBool iSourceSinkPuMopoStopCompleted;
163 TBool iPCMPuMopoStopCompleted;
164 TBool iPCMPuMipoStopCompleted;
168 CMMFBuffer* iInputBuffer;
169 CMMFBuffer* iOutputBuffer;
170 TInt iInputPortBufferData;
171 TInt iOutputPortBufferData;
172 CActiveSchedulerWait* iActiveWait;
173 TDeviceFunc iFuncCmd;
174 TFourCC iFirstFourCC;
175 TFourCC iSecondFourCC;
178 #endif // HWDEVICEADAPTER_H