|
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: VOIP Audio Services |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __VOIPDOWNLINKSTREAMIMPL_H |
|
20 #define __VOIPDOWNLINKSTREAMIMPL_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <voipdownlinkstream.h> |
|
25 #include "VoIPAudioSession.h" |
|
26 #include "VoIPDtmfTonePlayerImpl.h" |
|
27 #include "VoIPQueueHandler.h" |
|
28 |
|
29 |
|
30 /** |
|
31 * CVoIPAudioDownlinkStreamImpl class |
|
32 * |
|
33 * ?more_complete_description |
|
34 * |
|
35 * @lib VoIPAudioIntfc.dll |
|
36 * @since S60 v5.0 |
|
37 */ |
|
38 NONSHARABLE_CLASS(CVoIPAudioDownlinkStreamImpl) : |
|
39 public CBase, |
|
40 public CVoIPAudioDownlinkStream, |
|
41 public MQueueHandlerObserver |
|
42 { |
|
43 enum TQueueType |
|
44 { |
|
45 EMsgBufQueue, |
|
46 EMsgComQueue |
|
47 }; |
|
48 |
|
49 public: |
|
50 |
|
51 /** |
|
52 * 2-phased constructor |
|
53 * |
|
54 * @since S60 v5.0 |
|
55 * @param none |
|
56 * @return none |
|
57 */ |
|
58 static CVoIPAudioDownlinkStreamImpl* NewL( |
|
59 const TMMFPrioritySettings aPriority); |
|
60 |
|
61 /** |
|
62 * Destructor |
|
63 * |
|
64 * @since S60 v5.0 |
|
65 * @param none |
|
66 * @return none |
|
67 */ |
|
68 virtual ~CVoIPAudioDownlinkStreamImpl(); |
|
69 |
|
70 /** |
|
71 * ?description |
|
72 * |
|
73 * @since S60 v5.0 |
|
74 * @param MVoIPDownlinkObserver& |
|
75 * @return TInt |
|
76 */ |
|
77 TInt Open(MVoIPDownlinkObserver& aObserver); |
|
78 |
|
79 /** |
|
80 * ?description |
|
81 * |
|
82 * @since S60 v5.0 |
|
83 * @param TVersion& |
|
84 * @return TInt |
|
85 */ |
|
86 TInt GetVersion(TVersion& aVersion); |
|
87 |
|
88 /** |
|
89 * ?description |
|
90 * |
|
91 * @since S60 v5.0 |
|
92 * @param TInt& |
|
93 * @return TInt |
|
94 */ |
|
95 TInt GetMaxVolume(TInt& aVolume); |
|
96 |
|
97 /** |
|
98 * ?description |
|
99 * |
|
100 * @since S60 v5.0 |
|
101 * @param TInt |
|
102 * @return TInt |
|
103 */ |
|
104 TInt SetVolume(TInt aVolume); |
|
105 |
|
106 /** |
|
107 * ?description |
|
108 * |
|
109 * @since S60 v5.0 |
|
110 * @param TInt& |
|
111 * @return TInt |
|
112 */ |
|
113 TInt GetVolume(TInt& aVolume); |
|
114 |
|
115 /** |
|
116 * ?description |
|
117 * |
|
118 * @since S60 v5.0 |
|
119 * @param const TMMFPrioritySettings |
|
120 * @param RArray<TVoIPCodecFormat>& |
|
121 * @return void |
|
122 */ |
|
123 void GetSupportedFormatsL(const TMMFPrioritySettings aPriority, |
|
124 RArray<TVoIPCodecFormat>& aFormats); |
|
125 |
|
126 /** |
|
127 * ?description |
|
128 * |
|
129 * @since S60 v5.0 |
|
130 * @param TVoIPCodecFormat |
|
131 * @param CVoIPFormatIntfc& |
|
132 * @return void |
|
133 */ |
|
134 void SetFormatL(TVoIPCodecFormat aFormat, CVoIPFormatIntfc*& aIntfc); |
|
135 |
|
136 /** |
|
137 * ?description |
|
138 * |
|
139 * @since S60 v5.0 |
|
140 * @param none |
|
141 * @return TVoIPCodecFormat |
|
142 */ |
|
143 TVoIPCodecFormat GetFormat(); |
|
144 |
|
145 /** |
|
146 * ?description |
|
147 * |
|
148 * @since S60 v5.0 |
|
149 * @param TVoIPOutputDevice |
|
150 * @return TInt |
|
151 */ |
|
152 TInt SetAudioDevice(const TVoIPOutputDevice aDevice); |
|
153 |
|
154 /** |
|
155 * ?description |
|
156 * |
|
157 * @since S60 v5.0 |
|
158 * @param TVoIPOutputDevice& |
|
159 * @return TInt |
|
160 */ |
|
161 TInt GetAudioDevice(TVoIPOutputDevice& aDevice); |
|
162 |
|
163 /** |
|
164 * ?description |
|
165 * |
|
166 * @since S60 v5.0 |
|
167 * @param none |
|
168 * @return TInt |
|
169 */ |
|
170 TInt Start(); |
|
171 |
|
172 /** |
|
173 * ?description |
|
174 * |
|
175 * @since S60 v5.0 |
|
176 * @param none |
|
177 * @return TInt |
|
178 */ |
|
179 TInt Stop(); |
|
180 |
|
181 /** |
|
182 * ?description |
|
183 * |
|
184 * @since S60 v5.0 |
|
185 * @param none |
|
186 * @return void |
|
187 */ |
|
188 void Close(); |
|
189 |
|
190 /** |
|
191 * ?description |
|
192 * |
|
193 * @since S60 v5.0 |
|
194 * @param CVoIPDataBuffer* |
|
195 * @return TInt |
|
196 */ |
|
197 TInt BufferFilled(CVoIPDataBuffer* aBuffer); |
|
198 |
|
199 /** |
|
200 * ?description |
|
201 * |
|
202 * @since S60 v5.0 |
|
203 * @param CVoIPJitterBufferIntfc*& |
|
204 * @return void |
|
205 */ |
|
206 void CreateJitterBufferIntfcL(CVoIPJitterBufferIntfc*& aJBIntfc); |
|
207 |
|
208 /** |
|
209 * ?description |
|
210 * |
|
211 * @since S60 v5.0 |
|
212 * @param none |
|
213 * @return RVoIPAudioSession* |
|
214 */ |
|
215 RVoIPAudioSession* GetSession(); |
|
216 |
|
217 |
|
218 // From MQueueHandlerObserver |
|
219 |
|
220 /** |
|
221 * ?description |
|
222 * |
|
223 * @since S60 v5.0 |
|
224 * @param CVoIPDataBuffer* |
|
225 * @return void |
|
226 */ |
|
227 virtual void FillBuffer(CVoIPDataBuffer* aBuffer); |
|
228 |
|
229 /** |
|
230 * ?description |
|
231 * |
|
232 * @since S60 v5.0 |
|
233 * @param TPtr8 |
|
234 * @return void |
|
235 */ |
|
236 virtual void EmptyBuffer(CVoIPDataBuffer* /*aBuffer*/) {} |
|
237 |
|
238 /** |
|
239 * ?description |
|
240 * |
|
241 * @since S60 v5.0 |
|
242 * @param TInt |
|
243 * @param TInt |
|
244 * @return void |
|
245 */ |
|
246 virtual void Event(TInt aEventType, TInt aError); |
|
247 |
|
248 private: |
|
249 |
|
250 /** |
|
251 * Constructor |
|
252 * |
|
253 * @since S60 v5.0 |
|
254 * @param none |
|
255 * @return TInt |
|
256 */ |
|
257 CVoIPAudioDownlinkStreamImpl(); |
|
258 |
|
259 /** |
|
260 * Symbian constructor |
|
261 * |
|
262 * @since S60 v5.0 |
|
263 * @param none |
|
264 * @return void |
|
265 */ |
|
266 void ConstructL(const TMMFPrioritySettings aPriority); |
|
267 |
|
268 /** |
|
269 * ?description |
|
270 * |
|
271 * @since S60 v5.0 |
|
272 * @param TDesC& |
|
273 * @param TInt |
|
274 * @param TQueueType |
|
275 * @return TInt |
|
276 */ |
|
277 TInt CreateQueue(const TDesC& aQueueName, |
|
278 const TInt aNumSlots, |
|
279 const TQueueType aQueueType); |
|
280 |
|
281 /** |
|
282 * ?description |
|
283 * |
|
284 * @since S60 v5.0 |
|
285 * @param none |
|
286 * @return void |
|
287 */ |
|
288 void ReceiveMsgQHandlerEventsL(); |
|
289 |
|
290 /** |
|
291 * ?description |
|
292 * |
|
293 * @since S60 v5.0 |
|
294 * @param none |
|
295 * @return void |
|
296 */ |
|
297 void ReceiveMsgQComHandlerEventsL(); |
|
298 |
|
299 /** |
|
300 * ?description |
|
301 * |
|
302 * @since S60 v5.0 |
|
303 * @param TVoIPCodecFormat |
|
304 * @return TFourCC |
|
305 */ |
|
306 TUint32 CodecFourCC(TVoIPCodecFormat aFormat); |
|
307 |
|
308 /** |
|
309 * ?description |
|
310 * |
|
311 * @since S60 v5.0 |
|
312 * @param TUint32 |
|
313 * @return TVoIPCodecFormat |
|
314 */ |
|
315 TVoIPCodecFormat ConvertFourCC(TUint32 aCodec); |
|
316 |
|
317 /** |
|
318 * ?description |
|
319 * |
|
320 * @since S60 v5.0 |
|
321 * @param TVoIPCodecFormat |
|
322 * @return TBool |
|
323 */ |
|
324 TBool IsCodecSupportedL(TVoIPCodecFormat aFormat); |
|
325 |
|
326 /** |
|
327 * ?description |
|
328 * |
|
329 * @since S60 v5.0 |
|
330 * @param TVoIPCodecFormat |
|
331 * @return TBool |
|
332 */ |
|
333 TBool FindFormat(TVoIPCodecFormat aFormat); |
|
334 |
|
335 private: |
|
336 friend class CDTMFTonePlayerImpl; |
|
337 |
|
338 private: |
|
339 // Client side VoIP server session |
|
340 RVoIPAudioSession iVoIPAudioSession; |
|
341 |
|
342 MVoIPDownlinkObserver* iObserver; |
|
343 |
|
344 // Message queues |
|
345 RMsgQueue<TVoIPMsgBuf> iMsgQueue; |
|
346 RMsgQueue<TVoIPMsgBuf> iMsgComQueue; |
|
347 |
|
348 // Message queue handlers |
|
349 CQueueHandler* iMsgQHandler; |
|
350 CQueueHandler* iMsgQComHandler; |
|
351 |
|
352 TMMFPrioritySettings iPriority; |
|
353 TPtr8 iBufferPtr; |
|
354 TInt iBufferLen; |
|
355 TInt iG711FrameSize; |
|
356 |
|
357 TVoIPCodecFormat iFormat; |
|
358 RArray<TVoIPCodecFormat>* iCodecFormats; |
|
359 |
|
360 }; |
|
361 |
|
362 #endif //__VOIPDOWNLINKSTREAMIMPL_H |
|
363 |
|
364 // End of file |