Mercurial > hg > audiostuff
comparison intercom/rtp.h @ 2:13be24d74cd2
import intercom-0.4.1
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 09:57:52 +0200 |
parents | |
children | c6c5a16ce2f2 |
comparison
equal
deleted
inserted
replaced
1:9cadc470e3da | 2:13be24d74cd2 |
---|---|
1 /* rtp.h | |
2 * | |
3 * Copyright (C) DFS Deutsche Flugsicherung (2004, 2005). | |
4 * All Rights Reserved. | |
5 * Author: Andre Adrian | |
6 * | |
7 * subset of Real Time Protocol Version 2 (RFC3550 and RFC3551) | |
8 * handling of extension and padding is missing | |
9 * | |
10 * Version 0.3.5 | |
11 */ | |
12 | |
13 class RTP { | |
14 /* Format in Host Byte order. Conversion with htonl() to Network Byte | |
15 * order. This data structure is implementation dependent! | |
16 * Tested with GCC and x86 */ | |
17 | |
18 /* first 32bits */ | |
19 unsigned long sequence:16; | |
20 unsigned long payload_type:7; | |
21 unsigned long marker:1; | |
22 unsigned long csrc_count:4; | |
23 unsigned long extension:1; | |
24 unsigned long padding:1; | |
25 unsigned long version:2; | |
26 | |
27 /* second 32bits */ | |
28 unsigned long timestamp; | |
29 | |
30 /* third 32bits */ | |
31 unsigned long ssrc; /* used as unique identifier */ | |
32 | |
33 /* optional - used with telephone conference */ | |
34 unsigned long csrc[15]; | |
35 | |
36 public: | |
37 RTP::RTP(); | |
38 void RTP::init(int payload_type_, unsigned long ssrc_); | |
39 int RTP::add_csrc(unsigned long csrc_); | |
40 void RTP::reset_csrc(); | |
41 int RTP::find_csrc(unsigned long ssrc_); | |
42 void RTP::next(int frameduration); | |
43 int RTP::check(); | |
44 unsigned long RTP::getssrc() { | |
45 return ssrc; | |
46 }; | |
47 int RTP::get_pt() { | |
48 return (int) payload_type; | |
49 }; | |
50 int RTP::get_cc() { | |
51 return (int) csrc_count; | |
52 } | |
53 }; | |
54 | |
55 const unsigned PT_PCMU = 0; // 8000 sample/second, G.711 u-Law | |
56 const unsigned PT_GSM = 3; // 8000 sample/second, GSM | |
57 const unsigned PT_PCMA = 8; // 8000 sample/second, G.711 A-Law | |
58 const unsigned PT_G729 = 18; // 8000 sample/second, G.729 | |
59 const unsigned PT_EFR = 97; // inofficial type GSM-EFR | |
60 const unsigned PT_iLBC = 98; // inofficial type iLBC 20ms | |
61 const unsigned PT_G726 = 99; // inofficial type G.726 32kbps | |
62 const unsigned PT_SPX = 101; // inofficial type Wideband Speex | |
63 | |
64 // Speex Wideband kbps/Bytes: 16.8/42, 20.6/52, 23.8/60, 27.8/70, | |
65 // 34.2/86, 42.2/106 | |
66 const int SPX_BITRATE = 27800; | |
67 const int SPX_COMPLEXITY = 3; | |
68 const int SPX_QUALITY = 8; | |
69 const int SPX_ENH = 1; | |
70 | |
71 #define SZ_PCMA 160 | |
72 #define SZ_PCMU 160 | |
73 #define SZ_G726 80 | |
74 #define SZ_GSM 33 | |
75 #define SZ_EFR 31 | |
76 #define SZ_SPX 70 | |
77 #define SZ_iLBC 38 | |
78 | |
79 char *RTP_network_copy(char *to, RTP * from); | |
80 char *RTP_host_copy(RTP * to, char *from); | |
81 unsigned long random32(int type); |