|
1 /* |
|
2 * Copyright (c) 2004-2005 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: Header file for definitions related to RTP |
|
15 * : (Real-time Transport Protocol) library |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #ifndef __RTPDEF_H |
|
23 #define __RTPDEF_H |
|
24 |
|
25 // INCLUDES |
|
26 |
|
27 #include <e32std.h> |
|
28 #include <in_sock.h> |
|
29 #include <es_sock.h> |
|
30 |
|
31 // CONSTANTS |
|
32 const TUint KMaxRtcpAppData = 512; |
|
33 const TInt KMaxRtcpReason = 255; // max of RTCP APP packet in bytes |
|
34 const TUint KMaxSdesItemSize = 255; |
|
35 const TUint KSocketBufSize = 4096; |
|
36 const TInt KMinRtpHeaderSize = 12; // 96 bits in header, 96/8 = 12 |
|
37 |
|
38 // DATA TYPES |
|
39 |
|
40 typedef TUint32 TRtpId; |
|
41 const TRtpId KNullId = 0xffffffff; |
|
42 |
|
43 typedef TUint32 TRtpSSRC; // |
|
44 typedef TUint8 TRtpPayloadType; // payload type of the RTP packet |
|
45 typedef TUint16 TRtpSequence; // sequence number of the RTP packet |
|
46 typedef TUint32 TRtpTimeStamp; // timestamp of the RTP packet |
|
47 |
|
48 // |
|
49 // TRtcpAppName, TRtcpAppSubType, TRtcpApp - RTCP APP packet |
|
50 // related data types. See RFC1889.txt for detailed description |
|
51 // |
|
52 typedef TUint8 TRtcpAppName[4]; // APP packet name |
|
53 typedef TInt TRtcpAppSubType; // subtype ID under the same name |
|
54 |
|
55 // FORWARD DECLARATIONS |
|
56 class TRtpSendHeader; |
|
57 class TRtpRecvHeader; |
|
58 |
|
59 // CLASS DECLARATION |
|
60 |
|
61 /** |
|
62 * RTCP APP class. |
|
63 * |
|
64 * @lib RtpService.dll |
|
65 */ |
|
66 class TRtcpApp |
|
67 { |
|
68 public: |
|
69 inline TRtcpApp() |
|
70 : iSubType( 0 ), |
|
71 iAppDataLen( 0 ) |
|
72 {}; |
|
73 TRtcpAppSubType iSubType; |
|
74 TRtcpAppName iName; |
|
75 TUint8 iAppData[KMaxRtcpAppData]; |
|
76 TUint iAppDataLen; |
|
77 }; |
|
78 |
|
79 /** |
|
80 * Parameters for creating session. |
|
81 * |
|
82 * @lib RtpService.dll |
|
83 */ |
|
84 class TCreateSessionParams |
|
85 { |
|
86 public: |
|
87 inline TCreateSessionParams() |
|
88 : iPriority( EPriorityStandard ), iSocketBufSize( KSocketBufSize ) {}; |
|
89 |
|
90 enum TPriority |
|
91 { |
|
92 EPriorityIdle = -100, |
|
93 EPriorityLow = -20, |
|
94 EPriorityStandard = 0, |
|
95 EPriorityUserInput = 10, |
|
96 EPriorityHigh = 20 |
|
97 }; |
|
98 TPriority iPriority; |
|
99 TInt iSocketBufSize; // For RTP sending only; |
|
100 }; |
|
101 |
|
102 /** |
|
103 * RTCP SDES class. |
|
104 * |
|
105 * @lib RtpService.dll |
|
106 */ |
|
107 class TRtpSdesParams |
|
108 { |
|
109 public: |
|
110 inline TRtpSdesParams& operator = ( const TRtpSdesParams& aParams ); |
|
111 TPtrC8 iCName; |
|
112 TPtrC8 iUserName; |
|
113 TPtrC8 iEmail; |
|
114 TPtrC8 iPhoneNumber; |
|
115 TPtrC8 iLocation; |
|
116 TPtrC8 iSwToolName; |
|
117 TPtrC8 iNoticeStatus; |
|
118 TPtrC8 iPrivate; |
|
119 }; |
|
120 |
|
121 TRtpSdesParams& TRtpSdesParams::operator = ( const TRtpSdesParams& aParams ) |
|
122 { |
|
123 iCName.Set( aParams.iCName ); |
|
124 iUserName.Set( aParams.iUserName ); |
|
125 iEmail.Set( aParams.iEmail ); |
|
126 iPhoneNumber.Set( aParams.iPhoneNumber ); |
|
127 iLocation.Set( aParams.iLocation ); |
|
128 iSwToolName.Set( aParams.iSwToolName ); |
|
129 iNoticeStatus.Set( aParams.iNoticeStatus ); |
|
130 iPrivate.Set( aParams.iPrivate ); |
|
131 |
|
132 return *this; |
|
133 } |
|
134 |
|
135 /** |
|
136 * Parameters for creating receiving stream. |
|
137 * |
|
138 * @lib RtpService.dll |
|
139 */ |
|
140 class TRcvStreamParams |
|
141 { |
|
142 public: |
|
143 TRtpPayloadType iPayloadType; |
|
144 }; |
|
145 |
|
146 /** |
|
147 * Parameters for creating transmit stream. |
|
148 * |
|
149 * @lib RtpService.dll |
|
150 */ |
|
151 class TTranStreamParams |
|
152 { |
|
153 public: |
|
154 TRtpPayloadType iPayloadType; |
|
155 }; |
|
156 |
|
157 /** |
|
158 * Statistics for each stream. |
|
159 * |
|
160 * @lib RtpService.dll |
|
161 */ |
|
162 class TRtpPeerStat |
|
163 { |
|
164 public: |
|
165 // sender related stat |
|
166 TInt iNumPacketsSent; // cumulative number of packets sent |
|
167 TInt iCumNumOctetsSent; // cumulative number of octets sent |
|
168 TUint iRoundTripDelay; // Round trip delay |
|
169 TUint iTxBandwidth; // transmitter bandwidth (bps) |
|
170 |
|
171 // receiver related stat |
|
172 TInt iCumNumPacketsLost; // packets lost |
|
173 TUint8 iFractionLost; // fraction of packets lost between last two reports |
|
174 TInt iArrivalJitter; // arrival jitter in tenth of millsecond. |
|
175 TUint iRxBandwidth; // receiver bandwidth (bps) calculated by the transmitter |
|
176 TUint iChannelBufferSize; // an estimate of the channel buffer size |
|
177 TUint32 iNTPTimeStampSec; // NTP seconds |
|
178 TUint32 iNTPTimeStampFrac; // NTP fraction |
|
179 TRtpTimeStamp iTimeStamp; // RTP Time stamp of last packet sent by TX stream |
|
180 }; |
|
181 |
|
182 /** |
|
183 * RTCP parameters for RTCP interval calculation and timeout. |
|
184 * |
|
185 * @lib RtpService.dll |
|
186 */ |
|
187 class TRtcpParams |
|
188 { |
|
189 public: |
|
190 TUint iSessionBWidth; // Session bandwidth in bps |
|
191 TReal iRtcpFraction; // Fraction of session bandwidth to be allocated to RTCP |
|
192 TTimeIntervalMicroSeconds32 iRtcpTimeOut; // Time out for RTCP asynchronous sending |
|
193 }; |
|
194 |
|
195 /** |
|
196 * Time stamps from RTCP report for A/V sync. |
|
197 * |
|
198 * @lib RtpService.dll |
|
199 */ |
|
200 class TTimeStamps |
|
201 { |
|
202 public: |
|
203 TUint32 iNTPTimeStampSec; // NTP seconds |
|
204 TUint32 iNTPTimeStampFrac; // NTP fraction of second |
|
205 TRtpTimeStamp iTimeStamp; // RTP Time stamp |
|
206 }; |
|
207 |
|
208 |
|
209 |
|
210 /** |
|
211 * An interface to the callback functions for asynchronous event |
|
212 * notifications from RTP module. |
|
213 * |
|
214 * The class is a mixin and is intended to be inherited by the client |
|
215 * class which is observing RTP module error. A reference to |
|
216 * this object is passed as a parameter when constructing an RTP object. |
|
217 */ |
|
218 class MRtpErrNotify |
|
219 { |
|
220 public: |
|
221 |
|
222 /** |
|
223 * Error call back |
|
224 * @param aErrCode - System wide error code |
|
225 */ |
|
226 virtual void ErrorNotify( TInt aErrCode ) = 0; |
|
227 }; |
|
228 |
|
229 |
|
230 /** |
|
231 * callback function for received rtp packet. |
|
232 * |
|
233 * @lib RtpService.dll |
|
234 */ |
|
235 class MRtpObserver |
|
236 { |
|
237 public: |
|
238 /** |
|
239 * Callback function to receive an RTP packet. |
|
240 * @param TRtpId aStreamId - RTP receive-stream ID |
|
241 * @param TRtpRecvHeader& aHeaderInfo - Header info of RTP packet received |
|
242 * @param TDesC8& aPayloadData - Payload data of RTP packet received |
|
243 * @return None |
|
244 */ |
|
245 virtual void RtpPacketReceived( TRtpId aStreamId, |
|
246 const TRtpRecvHeader& aHeaderInfo, |
|
247 const TDesC8& aPayloadData ) = 0; |
|
248 }; |
|
249 |
|
250 /** |
|
251 * callback functions for received rtcp packet. |
|
252 * |
|
253 * @lib RtpService.dll |
|
254 */ |
|
255 class MRtcpObserver |
|
256 { |
|
257 public: |
|
258 /** |
|
259 * Callback function to receive an RTCP SDES (Source Description) packet. |
|
260 * @param TRtpSSRC aSSRC - SSRC value |
|
261 * @param TRtpSdesParams& aParams - SDES parameters received |
|
262 * @return None |
|
263 */ |
|
264 virtual void SdesReceived( TRtpSSRC aSSRC, const TRtpSdesParams& aParams ) = 0; |
|
265 |
|
266 /** |
|
267 * Callback function to receive an RTCP BYE packet. |
|
268 * @param TRtpId aStreamId - RTP stream ID |
|
269 * @param TRtpSSRC aSSRC - SSRC value |
|
270 * @param TDesC8& aReason - Reason for leaving |
|
271 * @return None |
|
272 */ |
|
273 virtual void ByeReceived( TRtpId aStreamId, TRtpSSRC aSSRC, const TDesC8& aReason ) = 0; |
|
274 |
|
275 /** |
|
276 * Callback function to receive an RTCP APP packet. |
|
277 * @param TRtpId aStreamId - RTP stream ID |
|
278 * @param TRtpSSRC aSSRC - SSRC value |
|
279 * @param TRtcpApp& aApp - APP contain |
|
280 * @return None |
|
281 */ |
|
282 virtual void AppReceived( TRtpId aStreamId, TRtpSSRC aSSRC, const TRtcpApp& aApp ) = 0; |
|
283 |
|
284 /** |
|
285 * Callback function to receive an RTCP SR packet. |
|
286 * @param TRtpId aStreamId - RTP stream ID |
|
287 * @param TRtpSSRC aSSRC - SSRC value |
|
288 * @param TTimeStamps& aTimeStamps - RTP and NTP timestamps for A/V synch. |
|
289 * @return None |
|
290 */ |
|
291 virtual void SrReceived( TRtpId aStreamId, TRtpSSRC aSSRC, const TTimeStamps& aTimeStamps ) = 0; |
|
292 |
|
293 /** |
|
294 * Callback function to receive an RTCP RR packet. |
|
295 * @param TRtpId aStreamId - RTP stream ID or Session ID if empty RR received. |
|
296 * @param TRtpSSRC aSSRC - SSRC value |
|
297 * @return None |
|
298 */ |
|
299 virtual void RrReceived( TRtpId aStreamId, TRtpSSRC aSSRC ) = 0; |
|
300 }; |
|
301 |
|
302 /** |
|
303 * callback functions for any received non-RTP (control) packets. |
|
304 * |
|
305 * @lib RtpService.dll |
|
306 */ |
|
307 class MNonRTPDataObserver |
|
308 { |
|
309 public: |
|
310 /** |
|
311 * Callback function to receive a non-RTP packet. |
|
312 * @param TUint aPort - port ID |
|
313 * @param TBool aRTPport - RTP port true, RTCP port false |
|
314 * @param TDesC8& aNonRTPData - non-RTP packet received |
|
315 * @return None |
|
316 */ |
|
317 virtual void NonRTPDataReceived( TUint aPort, TBool aRTPport, const TDesC8& aNonRTPData ) = 0; |
|
318 |
|
319 }; |
|
320 |
|
321 #endif // __RTPDEF_H |