|
1 /* |
|
2 * Copyright (c) 2004-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: Provides a baseclass for subthread clients to implement |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef MCCSUBTHREADCLIENTBASE_H |
|
22 #define MCCSUBTHREADCLIENTBASE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "mccinternalcodecs.h" |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class MDataSource; |
|
32 class MDataSink; |
|
33 class MMccEventHandler; |
|
34 class TMccEvent; |
|
35 class CMccRtpManager; |
|
36 class MMccResources; |
|
37 class CMccRtpMediaClock; |
|
38 class TMccCreateLink; |
|
39 class CMccSymStreamBase; |
|
40 class TMccCryptoContext; |
|
41 |
|
42 /** |
|
43 * Mcc Subthread Client baseclass |
|
44 * |
|
45 * @lib Mccsubthreads.lib |
|
46 * @since Series 60 3.0 |
|
47 */ |
|
48 NONSHARABLE_CLASS( CMccSubThreadClientBase ) : public CBase |
|
49 { |
|
50 public: // Constructor |
|
51 |
|
52 /** |
|
53 * Destructor |
|
54 */ |
|
55 virtual ~CMccSubThreadClientBase(); |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * 1st step to create link asynchronously |
|
61 * @since Series 60 3.0 |
|
62 * @param [input/output] aStatus |
|
63 * @param [input] aIapId |
|
64 * @return void |
|
65 */ |
|
66 virtual void InitializeLinkL( TRequestStatus& aStatus, |
|
67 TInt aIapId ); |
|
68 |
|
69 /** |
|
70 * 2nd step to create link. Creates a RTP session in the subthread |
|
71 * @since Series 60 3.0 |
|
72 * @param [input/output] aPort Local port |
|
73 * @param [input] aEnableRTCP Whether to enable RTCP for RTP session |
|
74 * @param [input] aIpTos TOS bit settings |
|
75 * @param [input] aClock Mediaclock for timestamp synchronization |
|
76 * @return void |
|
77 */ |
|
78 virtual void CreateRtpSessionL( TUint aPort, |
|
79 TBool aEnableRTCP, |
|
80 TInt aIpTos, |
|
81 CMccRtpMediaClock& aClock ); |
|
82 |
|
83 /** |
|
84 * Returns the codec info of the subthread client |
|
85 * @since Series 60 3.0 |
|
86 * @param aStreamId The stream id |
|
87 * @param [output] aCodec The codec info reference where to write |
|
88 * @return void |
|
89 */ |
|
90 void CodecInformationL( TUint32 aStreamId, TMccCodecInfo& aCodec ); |
|
91 |
|
92 /** |
|
93 * Sets the codec information for this stream |
|
94 * @since Series 60 3.0 |
|
95 * @param aStreamId Stream ID |
|
96 * @param aCodecInfo Codec information |
|
97 * @param aFmtp FMTP line associated with codec |
|
98 * @return void |
|
99 */ |
|
100 void SetCodecInformationL( TUint32 aStreamId, |
|
101 const TMccCodecInfo& aCodecInfo, |
|
102 const TDesC8& aFmtp ); |
|
103 |
|
104 /** |
|
105 * Sets the MMF priority settings for the subthread |
|
106 * @since Series 60 3.0 |
|
107 * @param aStreamId The stream id |
|
108 * @param [input] aPrioritySettings The priority settings |
|
109 * @return void |
|
110 */ |
|
111 void SetPrioritySettingsL( TUint32 aStreamId, |
|
112 const TMMFPrioritySettings& aPrioritySet ); |
|
113 |
|
114 /** |
|
115 * Stores the link id number |
|
116 * @since Series 60 3.0 |
|
117 * @param [input] aLinkId Link index number |
|
118 * @return void |
|
119 */ |
|
120 void SetLinkId( const TUint32 aLinkId ); |
|
121 |
|
122 /** |
|
123 * Returns the link index number |
|
124 * @since Series 60 3.0 |
|
125 * @param None |
|
126 * @return TInt System wide error code |
|
127 */ |
|
128 TUint32 GetLinkId() const; |
|
129 |
|
130 /** |
|
131 * Returns the MCC session id |
|
132 * @since Series 60 3.0 |
|
133 * @param None |
|
134 * @return TInt System wide error code |
|
135 */ |
|
136 TUint32 MccSessionId() const; |
|
137 |
|
138 /** |
|
139 * Returns current volume |
|
140 * @since Series 60 3.0 |
|
141 * @param [input] Stream ID |
|
142 * @return TInt Current volume |
|
143 */ |
|
144 virtual TInt GetVolumeL( const TUint32 aStreamId ) = 0; |
|
145 |
|
146 /** |
|
147 * Sets current volume |
|
148 * @since Series 60 3.0 |
|
149 * @param [input] New volume |
|
150 * @return void |
|
151 */ |
|
152 virtual void SetVolumeL( TInt aVolume ) = 0; |
|
153 |
|
154 /** |
|
155 * Returns maximum volume |
|
156 * @since Series 60 3.0 |
|
157 * @param [input] Stream ID |
|
158 * @return TInt Max volume |
|
159 */ |
|
160 virtual TInt MaxVolumeL( const TUint32 aStreamId ) = 0; |
|
161 |
|
162 /** |
|
163 * Returns current gain of uplink subthread |
|
164 * @since Series 60 3.0 |
|
165 * @param [input] Stream ID |
|
166 * @return TInt Current gain |
|
167 */ |
|
168 virtual TInt GetGainL( const TUint32 aStreamId ) = 0; |
|
169 |
|
170 /** |
|
171 * Sets the gain for uplink subthread |
|
172 * @since Series 60 3.0 |
|
173 * @param [input] aGain Gain for uplink playback |
|
174 * @return void |
|
175 */ |
|
176 virtual void SetGainL( TInt aGain ) = 0; |
|
177 |
|
178 /** |
|
179 * Returns the maximum gain for uplink subthread |
|
180 * @since Series 60 3.0 |
|
181 * @param [input] Stream ID |
|
182 * @param [output] aMaxGain Contains the audio HW maximum gain |
|
183 * @return void |
|
184 */ |
|
185 virtual TInt MaxGainL( const TUint32 aStreamId ) = 0; |
|
186 |
|
187 /** |
|
188 * Opens & creates the subthread |
|
189 * @since Series 60 3.0 |
|
190 * @param [input] aStreamType The type of stream |
|
191 * @param [input] aFourCC the fourCC code of the desired codec |
|
192 * @param [input] aDatasource Datasource |
|
193 * @param [input] aDatasink Datasink |
|
194 * @param [input] aStreamId id of the new stream |
|
195 * @return TUint32 |
|
196 */ |
|
197 virtual void OpenL( TInt aStreamType, |
|
198 TFourCC aFourCC, |
|
199 MDataSource* aDatasource, |
|
200 MDataSink* aDatasink, |
|
201 const TUint32 aStreamID, |
|
202 TMMFPrioritySettings aSettings ) = 0; |
|
203 |
|
204 /** |
|
205 * Sets the record/playback balance for ul/dl streams |
|
206 * @since Series 60 3.0 |
|
207 * @param [input] Stream ID |
|
208 * @param [input] aLeftBalance Left side balance for balance |
|
209 * @param [input] aRightBalance Right side balance for balance |
|
210 * @return void |
|
211 */ |
|
212 virtual void SetBalanceL( const TUint32 aStreamId, |
|
213 TInt aLeftBalance, |
|
214 TInt aRightBalance ) = 0; |
|
215 |
|
216 /** |
|
217 * Returns the record/playback balance for ul/dl streams |
|
218 * @since Series 60 3.0 |
|
219 * @param [input] Stream ID |
|
220 * @param [output] aLeftBalance Return value of left side balance for |
|
221 * balance |
|
222 * @param [output] aRightBalance Return value of right side balance for |
|
223 * balance |
|
224 * @return void |
|
225 */ |
|
226 virtual void GetBalanceL( const TUint32 aStreamId, |
|
227 TInt& aLeftBalance, |
|
228 TInt& aRightBalance ) = 0; |
|
229 |
|
230 /** |
|
231 * Sets the remote address |
|
232 * @since Series 60 3.0 |
|
233 * @param [input] aRemAddr Contains the remote host IP address |
|
234 * @return void |
|
235 */ |
|
236 virtual void SetRemoteAddressL( TInetAddr aRemAddr ); |
|
237 |
|
238 /** |
|
239 * Sets the remote rtcp address |
|
240 * @since Series 60 3.0 |
|
241 * @param [input] aRemAddr Contains the remote rtcp host IP address |
|
242 * @return void |
|
243 */ |
|
244 virtual void SetRemoteRtcpAddrL( TInetAddr aRemAddr ); |
|
245 |
|
246 /** |
|
247 * Prepares the subthread |
|
248 * @since Series 60 3.0 |
|
249 * @param aStreamId Stream ID |
|
250 * @return void |
|
251 */ |
|
252 virtual void PrepareL( const TUint32 aStreamId, |
|
253 const TUint32 aEndpointId ) = 0; |
|
254 |
|
255 /** |
|
256 * Starts a subthread |
|
257 * @since Series 60 3.0 |
|
258 * @param aStreamId Stream ID |
|
259 * @return void |
|
260 */ |
|
261 virtual void PlayL( const TUint32 aStreamId, |
|
262 const TUint32 aEndpointId, |
|
263 TBool aStreamPaused, |
|
264 TBool aEnableRTCP ) = 0; |
|
265 |
|
266 /** |
|
267 * Stops a subthread |
|
268 * @since Series 60 3.0 |
|
269 * @param aStreamId Stream ID |
|
270 * @return void |
|
271 */ |
|
272 virtual void StopL( const TUint32 aStreamId, |
|
273 const TUint32 aEndpointId ) = 0; |
|
274 |
|
275 /** |
|
276 * Pauses subthread record or playback |
|
277 * @since Series 60 3.0 |
|
278 * @param aStreamId Stream ID |
|
279 * @return void |
|
280 */ |
|
281 virtual void PauseL( const TUint32 aStreamId, |
|
282 const TUint32 aEndpointId, |
|
283 TBool aEnableRTCP ) = 0; |
|
284 |
|
285 /** |
|
286 * Resumes a paused subthread |
|
287 * @since Series 60 3.0 |
|
288 * @param aStreamId Stream ID |
|
289 * @return void |
|
290 */ |
|
291 virtual void ResumeL( const TUint32 aStreamId, |
|
292 const TUint32 aEndpointId, |
|
293 TBool aEnableRTCP ) = 0; |
|
294 |
|
295 /** |
|
296 * Closes the subthread clients |
|
297 * @since Series 60 3.0 |
|
298 * @param aStreamId Stream ID |
|
299 * @return void |
|
300 */ |
|
301 virtual void CloseL( const TUint32 aStreamId ) = 0; |
|
302 |
|
303 /** |
|
304 * Closes all subthread clients |
|
305 * @since Series 60 3.0 |
|
306 * @param aStreamId Stream ID |
|
307 * @return void |
|
308 */ |
|
309 virtual void CloseL(); |
|
310 |
|
311 /** |
|
312 * Checks if link contains any streams |
|
313 * @since Series 60 3.0 |
|
314 * @return ETrue, if streams exists |
|
315 */ |
|
316 virtual TBool StreamsExistsL(); |
|
317 |
|
318 /** |
|
319 * Sends media signals to this stream |
|
320 * @since Series 60 3.0 |
|
321 * @param aEvent Media event to be sent |
|
322 * @return void |
|
323 */ |
|
324 virtual void SendMediaSignalL( const TMccEvent& aEvent ); |
|
325 |
|
326 /** |
|
327 * Sends RTCP receiver report to uplink if possible. |
|
328 * @param aStreamId - [input] Stream ID identifying stream |
|
329 * @return void |
|
330 */ |
|
331 virtual void SendRTCPReceiverReportL( const TUint32 aStreamId ); |
|
332 |
|
333 /** |
|
334 * Sends RTCP sender report to uplink if possible. |
|
335 * @param aStreamId - [input] Stream ID identifying stream |
|
336 * @return void |
|
337 */ |
|
338 virtual void SendRTCPSenderReportL( const TUint32 aStreamId ); |
|
339 |
|
340 /** |
|
341 * Sends Non-RTCP data to uplink if possible. |
|
342 * @param aStreamId - [input] Stream ID identifying stream |
|
343 * @param aData - [input] Data to send |
|
344 * @return void |
|
345 */ |
|
346 virtual void SendRTCPDataL( const TUint32 aStreamId, |
|
347 const TDesC8& aData ); |
|
348 |
|
349 /** |
|
350 * Starts inactivity timer for a stream in a given session. |
|
351 * @param aStreamId - [input] Stream ID identifying stream |
|
352 * @param aTimeoutTime - [input] timeout value in milliseconds |
|
353 * @return One of the standard system-wide error codes. |
|
354 */ |
|
355 virtual void StartInactivityTimerL( const TUint32 aStreamId, |
|
356 TUint32 aTimeoutTime ); |
|
357 |
|
358 /** |
|
359 * Stops inactivity timer for a stream in a given session. |
|
360 * @param aStreamId - [input] Stream ID identifying stream |
|
361 * @return One of the standard system-wide error codes. |
|
362 */ |
|
363 virtual void StopInactivityTimerL( const TUint32 aStreamId ); |
|
364 |
|
365 /** |
|
366 * Get the supported bitrates from the codec of the specified stream |
|
367 * @since Series 60 3.0 |
|
368 * @param aStreamId - [input] Stream ID identifying stream |
|
369 * @param aBitrates Array for the bitrates |
|
370 * @leave System wide error code if unsuccessful |
|
371 * @return None |
|
372 */ |
|
373 virtual void GetSupportedBitratesL( const TUint32 aStreamId, |
|
374 RArray<TUint>& aBitrates ); |
|
375 |
|
376 /** |
|
377 * Get Syncronization source for the specified stream |
|
378 * @since Series 60 3.0 |
|
379 * @param aStreamId - [input] Stream ID identifying stream |
|
380 * @param aSSRCValue - [input] a reference value of SSRC. |
|
381 * @leave System wide error code if unsuccessful |
|
382 * @return None. |
|
383 */ |
|
384 |
|
385 virtual void GetSSRCL( const TUint32 aStreamId, |
|
386 TUint32& aSSRCValue); |
|
387 |
|
388 /** |
|
389 * Get the supported bitrates from the codec of the specified stream |
|
390 * @since Series 60 3.0 |
|
391 * @param aStreamId - [input] Stream ID identifying stream |
|
392 * @return None |
|
393 */ |
|
394 virtual void GetFmtpAttrL( const TUint32 aStreamId, TDes8& aFmtp ); |
|
395 |
|
396 virtual inline TBool IsDtmf() |
|
397 { |
|
398 return iIsDTMF; |
|
399 } |
|
400 |
|
401 virtual MDataSink* DataSink( const TUint32 aStreamId ) = 0; |
|
402 |
|
403 virtual MDataSource* DataSource( const TUint32 aStreamId ) = 0; |
|
404 |
|
405 virtual void SetAudioRouteL( TUint32 aStreamId, |
|
406 TUint32 aRoutingDestination ) = 0; |
|
407 |
|
408 virtual void GetAudioRouteL( TUint32 aStreamId, |
|
409 TUint32& aRoutingDestination ) = 0; |
|
410 |
|
411 virtual void UnuseL( TUint32 aStreamId ) = 0; |
|
412 |
|
413 /** |
|
414 * Resolves local IP addresses and ports |
|
415 * @since Series 60 3.2 |
|
416 * @param [input/output] aClientData Client data |
|
417 * @return void |
|
418 */ |
|
419 virtual void GetLocalIpAddressesL( TMccCreateLink& aClientData ) = 0; |
|
420 |
|
421 virtual void SetParameterL( TUint32 aParam, |
|
422 TUint32 aStreamId, |
|
423 TUint32 aEndpointId, |
|
424 const TDesC8& aVal ) = 0; |
|
425 |
|
426 virtual void GetParameterL( TUint32 aParam, |
|
427 TUint32 aStreamId, |
|
428 TUint32 aEndpointId, |
|
429 TDesC8& aVal ) = 0; |
|
430 |
|
431 /** |
|
432 * Bind context into stream. |
|
433 * @since Series 60 3.2 |
|
434 * @param aStreamId The stream id |
|
435 * @param aEndpointId The endpoint id |
|
436 * @param aContextParams Crypto context |
|
437 * @return void |
|
438 */ |
|
439 virtual void BindContextIntoStreamL( TUint32 aStreamId, |
|
440 TUint32 aEndpointId, |
|
441 const TMccCryptoContext& aContextParams ) = 0; |
|
442 |
|
443 /** |
|
444 * Remove context. |
|
445 * @since Series 60 3.2 |
|
446 * @param aStreamId The stream id |
|
447 * @param aEndpointId The endpoint id |
|
448 * @return void |
|
449 */ |
|
450 virtual void RemoveContextL( TUint32 aStreamId, |
|
451 TUint32 aEndpointId ) = 0; |
|
452 |
|
453 protected: // Constructor |
|
454 |
|
455 /** |
|
456 * C++ constructor |
|
457 */ |
|
458 inline CMccSubThreadClientBase( MMccEventHandler* aObserver, |
|
459 MMccResources* aMccResources, |
|
460 TInt aLinkType, |
|
461 TUint32 aSessionId ) : |
|
462 iDatasink( NULL ), |
|
463 iDatasource( NULL ), |
|
464 iLinkType( aLinkType ), |
|
465 iSessionId( aSessionId ), |
|
466 iObserver( aObserver ), |
|
467 iMccResources( aMccResources ), |
|
468 iSessionCreated( EFalse ), |
|
469 iIsDTMF( EFalse ) |
|
470 { |
|
471 } |
|
472 |
|
473 |
|
474 /** |
|
475 * Helper functions for searching a stream with given |
|
476 * ID. |
|
477 */ |
|
478 TInt FindStreamL( TUint32 aStreamId ); |
|
479 TInt FindStream( TUint32 aStreamId ); |
|
480 |
|
481 protected: // Data |
|
482 |
|
483 CMccRtpManager* iRtpmanager; |
|
484 |
|
485 // Datasink of the subthread |
|
486 MDataSink* iDatasink; |
|
487 |
|
488 // Datasource of the subthread |
|
489 MDataSource* iDatasource; |
|
490 |
|
491 // Client observer |
|
492 MMccEventHandler* iObserver; |
|
493 |
|
494 MMccResources* iMccResources; |
|
495 |
|
496 // Priority settings |
|
497 TMMFPrioritySettings iPrioritySettings; |
|
498 |
|
499 // Flag for session creation |
|
500 TBool iSessionCreated; |
|
501 |
|
502 //Flag dtmf |
|
503 TBool iIsDTMF; |
|
504 |
|
505 /** |
|
506 * Link type |
|
507 */ |
|
508 TInt iLinkType; |
|
509 |
|
510 // Id of this link |
|
511 TUint32 iLinkId; |
|
512 |
|
513 // Streams owned by the link |
|
514 RPointerArray<CMccSymStreamBase> iStreams; |
|
515 |
|
516 // MCC session id |
|
517 TUint32 iSessionId; |
|
518 |
|
519 #ifdef TEST_EUNIT |
|
520 friend class UT_CMccSymSubthreadClient; |
|
521 #endif |
|
522 }; |
|
523 |
|
524 #endif // MCCSUBTHREADCLIENTBASE_H |
|
525 |
|
526 // End of File |