|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Declares constants, structures and enumerated list of |
|
15 * commands shared between VoIP client and the server. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef __VOIPSHAREDDATA_H |
|
20 #define __VOIPSHAREDDATA_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <sounddevice.h> |
|
25 #include <audio.h> |
|
26 #include <voipjitterbufferintfc.h> |
|
27 #include <voipaudiocommon.h> |
|
28 #include <voipformatintfc.h> |
|
29 |
|
30 #if defined(__SERIES60_31__) |
|
31 // s60 3.1 mapping of FourCC values for supported codecs |
|
32 const TUint32 KMccFourCCIdAMRNB = 0x524d4120; // (' ', 'A', 'M', 'R') |
|
33 const TUint32 KMccFourCCIdG711 = 0x31313747; // ('G', '7', '1', '1') |
|
34 const TUint32 KMccFourCCIdG729 = 0x39323747; // ('G', '7', '2', '9') |
|
35 const TUint32 KMccFourCCIdILBC = 0x43424c49; // ('i', 'L', 'B', 'C') |
|
36 #else |
|
37 #include <mmcccodecinformation.h> |
|
38 #endif |
|
39 |
|
40 #include "VoIPAudioClientServer.h" |
|
41 |
|
42 // CONSTANTS |
|
43 const TUint KQueueCreateWaitTime = 10; //10ms |
|
44 const TUint KVoIPG711FrameLen10ms = 82; // 80 + 2 for header |
|
45 const TUint KVoIPG711FrameLen20ms = 162; // 160 + 2 for header |
|
46 const TInt KVoIPAMRNBFrameLen = 32; |
|
47 const TInt KVoIPILBCFrameLen = 52; // 40 in 20ms; 52 in 30ms |
|
48 const TInt KVoIPG729FrameLen = 24; // 10 octets + 2 for header |
|
49 const TUint KVoIPPCM16FrameLen = 4096; |
|
50 |
|
51 // ENUMERATIONS |
|
52 |
|
53 // ITC communication commands between the threads |
|
54 enum TUserCommand |
|
55 { |
|
56 ECmdStartDownlink = 0, |
|
57 ECmdStartUplink, |
|
58 ECmdInitDownlink, |
|
59 ECmdInitUplink, |
|
60 ECmdStopDownlink, |
|
61 ECmdStopUplink, |
|
62 ECmdBufferFilled, |
|
63 ECmdBufferEmptied, |
|
64 ECmdGetVolume, |
|
65 ECmdSetVolume, |
|
66 ECmdGetGain, |
|
67 ECmdSetGain, |
|
68 ECmdSetAudioDevice, |
|
69 ECmdGetAudioDevice, |
|
70 ECmdTerminateThread, |
|
71 |
|
72 ECmdDnLinkError, |
|
73 ECmdUpLinkError, |
|
74 ECmdDnLinkJBError, |
|
75 |
|
76 ECmdSetG711CodecMode, |
|
77 ECmdGetG711CodecMode, |
|
78 ECmdSetIlbcCodecMode, |
|
79 ECmdGetIlbcCodecMode, |
|
80 ECmdGetSupportedBitrates, |
|
81 ECmdSetBitrate, |
|
82 ECmdGetBitrate, |
|
83 ECmdSetFrameMode, |
|
84 ECmdGetFrameMode, |
|
85 ECmdFrameModeRqrdForEC, |
|
86 ECmdConcealErrForNextBuf, |
|
87 ECmdSetVad, |
|
88 ECmdGetVad, |
|
89 ECmdSetCng, |
|
90 ECmdGetCng, |
|
91 ECmdSetPlc, |
|
92 ECmdGetPlc, |
|
93 ECmdBadLsfNextBuffer, |
|
94 ECmdVoIPConfigJB, |
|
95 ECmdVoIPResetJB, |
|
96 ECmdVoIPJBDelayDown, |
|
97 ECmdVoIPJBDelayUp, |
|
98 |
|
99 // Event returned from the work thread upon async request complete |
|
100 ECmdGetVolumeComplete, |
|
101 ECmdGetGainComplete, |
|
102 ECmdGetAudioDeviceComplete, |
|
103 ECmdGetG711CodecModeComplete, |
|
104 ECmdGetIlbcCodecModeComplete, |
|
105 ECmdGetFrameModeComplete, |
|
106 ECmdGetFrameModeReqForECComplete, |
|
107 ECmdGetVadComplete, |
|
108 ECmdGetCngComplete, |
|
109 ECmdGetPlcComplete, |
|
110 ECmdGetSupportedBitratesComplete, |
|
111 ECmdGetBitrateComplete, |
|
112 |
|
113 // Server side events sent to the client |
|
114 ECmdDownlinkInitComplete, |
|
115 ECmdUplinkInitComplete, |
|
116 ECmdFillBuffer, |
|
117 ECmdEmptyBuffer, |
|
118 ECmdDTMFOpenDnlinkComplete, |
|
119 ECmdDTMFOpenUplinkComplete, |
|
120 ECmdDTMFTonePlayFinished, |
|
121 ECmdRingToneOpenComplete, |
|
122 ECmdRingTonePlayComplete, |
|
123 ECmdDownlinkThreadClosed, |
|
124 ECmdUplinkThreadClosed |
|
125 }; |
|
126 |
|
127 // ----------------------------------------------------------------------------- |
|
128 // Class Name: TVoIPCodecSettings |
|
129 // |
|
130 // Structure used for setting codec configuration. |
|
131 // ----------------------------------------------------------------------------- |
|
132 class TVoIPCodecSettings |
|
133 { |
|
134 public: |
|
135 enum TG711FrameRate |
|
136 { |
|
137 E10MS, |
|
138 E20MS |
|
139 }; |
|
140 |
|
141 public: |
|
142 CVoIPFormatIntfc::TG711CodecMode iG711CodecMode; |
|
143 CVoIPFormatIntfc::TILBCCodecMode iILBCCodecMode; |
|
144 TUint32 iFourCC; |
|
145 TG711FrameRate iG711FrameRate; |
|
146 TBool iVad; |
|
147 TBool iCng; |
|
148 TBool iPlc; |
|
149 TBool iFrameMode; |
|
150 TBool iFrameModeReqForEC; |
|
151 TUint iBitrate; |
|
152 RArray<TUint> iArrBitrates; |
|
153 }; |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // Class Name: TSharedData |
|
157 // |
|
158 // Structure used for ITC communication and data transfer. |
|
159 // ----------------------------------------------------------------------------- |
|
160 class TSharedData |
|
161 { |
|
162 public: |
|
163 |
|
164 // Main thread's ID |
|
165 TThreadId iMainThreadID; |
|
166 |
|
167 // For thread end signalling |
|
168 RMutex iMutex; |
|
169 |
|
170 // Request status pointer for signalling thread via A/O |
|
171 TRequestStatus* iThreadStatus; |
|
172 TRequestStatus* iMnThreadStatus; |
|
173 |
|
174 // Audio configuration settings |
|
175 TInt iPriority; |
|
176 TInt iPreference; |
|
177 TUint iAudioDevice; |
|
178 TInt iMaxVolume; |
|
179 TInt iMaxGain; |
|
180 |
|
181 // Codec configuration settings |
|
182 TVoIPCodecSettings iCodecSettings; |
|
183 |
|
184 // Jitter Buffer configuration |
|
185 TVoIPJBConfig iJBConfig; |
|
186 |
|
187 // Command parameter for signalling between the threads via A/O |
|
188 TUserCommand iCmd; |
|
189 |
|
190 // Size of the data buffer and frame sequence number |
|
191 TInt iBufferSize; |
|
192 TUint iSequenceNum; |
|
193 |
|
194 // Any data sent between both threads |
|
195 TInt iInt; |
|
196 TUint iUint; |
|
197 TBool iBool; |
|
198 |
|
199 }; |
|
200 |
|
201 #endif // __VOIPSHAREDDATA_H |
|
202 |
|
203 // End of file |