sl@0
|
1 |
// Copyright (c) 2005-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 |
// mmfhwdeviceadapter.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
/**
|
sl@0
|
19 |
@file
|
sl@0
|
20 |
@publishedPartner
|
sl@0
|
21 |
@prototype
|
sl@0
|
22 |
@see CMMFHwDevice
|
sl@0
|
23 |
@see MMdfInputPortObserver
|
sl@0
|
24 |
@see MMdfOutputPortObserver
|
sl@0
|
25 |
@see MMdfProcessingUnitObserver
|
sl@0
|
26 |
@see MMdfHwDeviceSetup
|
sl@0
|
27 |
*/
|
sl@0
|
28 |
|
sl@0
|
29 |
#ifndef HWDEVICEADAPTER_H
|
sl@0
|
30 |
#define HWDEVICEADAPTER_H
|
sl@0
|
31 |
|
sl@0
|
32 |
#include <mdf/mdfinputport.h>
|
sl@0
|
33 |
#include <mdf/mdfoutputport.h>
|
sl@0
|
34 |
#include <mdf/mdfprocessingunit.h>
|
sl@0
|
35 |
#include <mdf/mdfpuloader.h>
|
sl@0
|
36 |
#include <mmf/server/mmfhwdevice.h>
|
sl@0
|
37 |
#include <mmf/server/mmfdatabuffer.h>
|
sl@0
|
38 |
#include <mmf/server/mmfhwdevicesetup.h>
|
sl@0
|
39 |
#include <mmf/common/mmfutilities.h>
|
sl@0
|
40 |
|
sl@0
|
41 |
class CMMFBuffer;
|
sl@0
|
42 |
|
sl@0
|
43 |
/*
|
sl@0
|
44 |
Hardware Device Adapter class that uses Processing Units (and their associated Ports) in
|
sl@0
|
45 |
order to decode and encode audio data.
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
class CMdfHwDeviceAdapter : public CMMFHwDevice,
|
sl@0
|
48 |
public MMdfInputPortObserver,
|
sl@0
|
49 |
public MMdfOutputPortObserver,
|
sl@0
|
50 |
public MMdfProcessingUnitObserver,
|
sl@0
|
51 |
public MMdfHwDeviceSetup
|
sl@0
|
52 |
{
|
sl@0
|
53 |
public:
|
sl@0
|
54 |
/*
|
sl@0
|
55 |
The current state of the Hardware Device Adapter.
|
sl@0
|
56 |
*/
|
sl@0
|
57 |
enum THwDevAdapterState
|
sl@0
|
58 |
{
|
sl@0
|
59 |
/*
|
sl@0
|
60 |
The PULoader has been loaded.
|
sl@0
|
61 |
*/
|
sl@0
|
62 |
EProcessingUnitLoaderLoaded,
|
sl@0
|
63 |
/*
|
sl@0
|
64 |
The Processing Units have been loaded.
|
sl@0
|
65 |
*/
|
sl@0
|
66 |
EProcessingUnitLoaded,
|
sl@0
|
67 |
/*
|
sl@0
|
68 |
The Processing Units are currently being initialised.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
EProcessingUnitInitializing,
|
sl@0
|
71 |
/*
|
sl@0
|
72 |
The Processing Units are currently in the idle state.
|
sl@0
|
73 |
*/
|
sl@0
|
74 |
EProcessingUnitIdle,
|
sl@0
|
75 |
/*
|
sl@0
|
76 |
The Processing Units are currently in the executing state.
|
sl@0
|
77 |
*/
|
sl@0
|
78 |
EProcessingUnitExecuting,
|
sl@0
|
79 |
/*
|
sl@0
|
80 |
The Processing Units are currently in the paused state.
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
EProcessingUnitPaused
|
sl@0
|
83 |
};
|
sl@0
|
84 |
|
sl@0
|
85 |
public:
|
sl@0
|
86 |
static CMdfHwDeviceAdapter* NewL();
|
sl@0
|
87 |
|
sl@0
|
88 |
// from CMMFHwDevice
|
sl@0
|
89 |
TInt Start(TDeviceFunc aFuncCmd, TDeviceFlow aFlowCmd);
|
sl@0
|
90 |
TInt Stop();
|
sl@0
|
91 |
TInt Pause();
|
sl@0
|
92 |
TInt Init(THwDeviceInitParams& aDevInfo);
|
sl@0
|
93 |
TAny* CustomInterface(TUid aInterfaceId);
|
sl@0
|
94 |
TInt ThisHwBufferFilled(CMMFBuffer& aFillBufferPtr);
|
sl@0
|
95 |
TInt ThisHwBufferEmptied(CMMFBuffer& aEmptyBufferPtr);
|
sl@0
|
96 |
TInt SetConfig(TTaskConfig& aConfig);
|
sl@0
|
97 |
TInt StopAndDeleteCodec();
|
sl@0
|
98 |
TInt DeleteCodec();
|
sl@0
|
99 |
~CMdfHwDeviceAdapter();
|
sl@0
|
100 |
|
sl@0
|
101 |
// from MMdfInputPortObserver
|
sl@0
|
102 |
void MipoWriteDataComplete(const MMdfInputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode);
|
sl@0
|
103 |
void MipoDisconnectTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
|
sl@0
|
104 |
void MipoRestartTunnelComplete(const MMdfInputPort* aPu, TInt aErrorCode);
|
sl@0
|
105 |
|
sl@0
|
106 |
// from MMdfOutputPortObserver
|
sl@0
|
107 |
void MopoReadDataComplete(const MMdfOutputPort* aPu, CMMFBuffer* aBuffer, TInt aErrorCode);
|
sl@0
|
108 |
void MopoDisconnectTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
|
sl@0
|
109 |
void MopoRestartTunnelComplete(const MMdfOutputPort* aPu, TInt aErrorCode);
|
sl@0
|
110 |
|
sl@0
|
111 |
// from MMdfProcessingUnitObserver
|
sl@0
|
112 |
void InitializeComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
|
sl@0
|
113 |
void ExecuteComplete(const CMdfProcessingUnit* aPu, TInt aErrorCode);
|
sl@0
|
114 |
|
sl@0
|
115 |
// from MMdfHwDeviceSetup
|
sl@0
|
116 |
void SetDataTypesL(TFourCC aSrcType, TFourCC aDestType);
|
sl@0
|
117 |
|
sl@0
|
118 |
// CMdfHwDeviceAdapter
|
sl@0
|
119 |
void GetState(THwDevAdapterState& aState) const;
|
sl@0
|
120 |
|
sl@0
|
121 |
protected:
|
sl@0
|
122 |
/*
|
sl@0
|
123 |
Hardware Device Adapter panics raised as a result of a programming error.
|
sl@0
|
124 |
*/
|
sl@0
|
125 |
enum THwDeviceAdapterPanics
|
sl@0
|
126 |
{
|
sl@0
|
127 |
/*
|
sl@0
|
128 |
Raised when the Codec Processing Unit has not been initialised.
|
sl@0
|
129 |
@see CMdfHwDeviceAdapter::CustomInterface
|
sl@0
|
130 |
@see CMdfHwDeviceAdapter::SetDataTypesL
|
sl@0
|
131 |
*/
|
sl@0
|
132 |
EPanicCodecNotSet
|
sl@0
|
133 |
};
|
sl@0
|
134 |
|
sl@0
|
135 |
private:
|
sl@0
|
136 |
CMdfHwDeviceAdapter();
|
sl@0
|
137 |
void ConstructL();
|
sl@0
|
138 |
TInt CreateBuffers();
|
sl@0
|
139 |
TInt StartEncode();
|
sl@0
|
140 |
TInt StartDecode();
|
sl@0
|
141 |
TInt InitializeEncode();
|
sl@0
|
142 |
TInt InitializeDecode();
|
sl@0
|
143 |
TInt StartExecuting();
|
sl@0
|
144 |
void StopHwDevice(TInt error);
|
sl@0
|
145 |
private:
|
sl@0
|
146 |
enum TPUType
|
sl@0
|
147 |
{
|
sl@0
|
148 |
EPcmPu,
|
sl@0
|
149 |
ESourceSinkPu
|
sl@0
|
150 |
};
|
sl@0
|
151 |
CMdfPuLoader* iPuLoader;
|
sl@0
|
152 |
TUid iPuLoaderDtorKey;
|
sl@0
|
153 |
MMdfInputPort* iCodecInputPort;
|
sl@0
|
154 |
MMdfOutputPort* iCodecOutputPort;
|
sl@0
|
155 |
MMdfInputPort* iSinkInputPort;
|
sl@0
|
156 |
MMdfOutputPort* iSourceOutputPort;
|
sl@0
|
157 |
CMdfProcessingUnit* iCodecPU;
|
sl@0
|
158 |
CMdfProcessingUnit* iAudioDevicePU;
|
sl@0
|
159 |
THwDevAdapterState iState;
|
sl@0
|
160 |
TBool iPCMPUCallbackComplete;
|
sl@0
|
161 |
TBool iSourceSinkPUCallbackComplete;
|
sl@0
|
162 |
TBool iSourceSinkPuMopoStopCompleted;
|
sl@0
|
163 |
TBool iPCMPuMopoStopCompleted;
|
sl@0
|
164 |
TBool iPCMPuMipoStopCompleted;
|
sl@0
|
165 |
TBool iStopping;
|
sl@0
|
166 |
TInt iInitError;
|
sl@0
|
167 |
TInt iExecuteError;
|
sl@0
|
168 |
CMMFBuffer* iInputBuffer;
|
sl@0
|
169 |
CMMFBuffer* iOutputBuffer;
|
sl@0
|
170 |
TInt iInputPortBufferData;
|
sl@0
|
171 |
TInt iOutputPortBufferData;
|
sl@0
|
172 |
CActiveSchedulerWait* iActiveWait;
|
sl@0
|
173 |
TDeviceFunc iFuncCmd;
|
sl@0
|
174 |
TFourCC iFirstFourCC;
|
sl@0
|
175 |
TFourCC iSecondFourCC;
|
sl@0
|
176 |
};
|
sl@0
|
177 |
|
sl@0
|
178 |
#endif // HWDEVICEADAPTER_H
|