FreeCalypso > hg > rtp-debug-utils
comparison rtp-gsmfr-extr.c @ 2:210dfa39f573
rtp-gsmfr-extr: support new TRAUlike RTP payload format
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 16 Apr 2023 04:18:14 +0000 |
parents | 05ff0f7ac977 |
children |
comparison
equal
deleted
inserted
replaced
1:41eba040785a | 2:210dfa39f573 |
---|---|
95 process_packet(pkt, caplen, pkt_idx) | 95 process_packet(pkt, caplen, pkt_idx) |
96 u_char *pkt; | 96 u_char *pkt; |
97 unsigned caplen, pkt_idx; | 97 unsigned caplen, pkt_idx; |
98 { | 98 { |
99 unsigned udplen, payload_len; | 99 unsigned udplen, payload_len; |
100 u_char synth_bfi[2]; | |
100 | 101 |
101 if (caplen < link_hdr_len + 28) | 102 if (caplen < link_hdr_len + 28) |
102 return; | 103 return; |
103 if (link_hdr_len) { | 104 if (link_hdr_len) { |
104 if (pkt[ethertype_offset] != 0x08) | 105 if (pkt[ethertype_offset] != 0x08) |
139 exit(1); | 140 exit(1); |
140 } | 141 } |
141 rtp_stream_logic(pkt + 28, pkt_idx); | 142 rtp_stream_logic(pkt + 28, pkt_idx); |
142 payload_len = udplen - 20; | 143 payload_len = udplen - 20; |
143 switch (payload_len) { | 144 switch (payload_len) { |
145 case 0: | |
146 synth_bfi[0] = 0xBF; | |
147 synth_bfi[1] = 0; | |
148 emit_synth_bfi: | |
149 fwrite(synth_bfi, 1, 2, outfile); | |
150 return; | |
151 case 1: | |
152 if ((pkt[40] & 0xF6) != 0xE6) | |
153 break; | |
154 traulike_bfi: | |
155 synth_bfi[0] = 0xBF; | |
156 synth_bfi[1] = pkt[40] & 1; | |
157 goto emit_synth_bfi; | |
144 case 2: | 158 case 2: |
145 if (pkt[40] == 0xBF) | 159 if (pkt[40] != 0xBF) |
146 break; | 160 break; |
147 goto bad_payload; | 161 emit_payload: |
162 fwrite(pkt + 40, 1, payload_len, outfile); | |
163 return; | |
148 case 31: | 164 case 31: |
149 if ((pkt[40] & 0xF0) == 0xC0) | 165 if ((pkt[40] & 0xF0) != 0xC0) |
150 break; | 166 break; |
151 goto bad_payload; | 167 goto emit_payload; |
168 case 32: | |
169 if ((pkt[40] & 0xF4) != 0xE0) | |
170 break; | |
171 if ((pkt[41] & 0xF0) != 0xC0) | |
172 break; | |
173 if (pkt[40] & 2) | |
174 goto traulike_bfi; | |
175 fwrite(pkt + 41, 1, 31, outfile); | |
176 return; | |
152 case 33: | 177 case 33: |
153 if ((pkt[40] & 0xF0) == 0xD0) | 178 if ((pkt[40] & 0xF0) != 0xD0) |
154 break; | 179 break; |
155 /* FALL THRU */ | 180 goto emit_payload; |
156 default: | 181 case 34: |
157 bad_payload: | 182 if ((pkt[40] & 0xF4) != 0xE0) |
158 fprintf(stderr, "error in packet #%u: unsupported payload\n", | 183 break; |
159 pkt_idx); | 184 if ((pkt[41] & 0xF0) != 0xD0) |
160 exit(1); | 185 break; |
161 } | 186 if (pkt[40] & 2) |
162 fwrite(pkt + 40, 1, payload_len, outfile); | 187 goto traulike_bfi; |
188 fwrite(pkt + 41, 1, 33, outfile); | |
189 return; | |
190 } | |
191 fprintf(stderr, "error in packet #%u: unsupported payload\n", pkt_idx); | |
192 exit(1); | |
163 } | 193 } |
164 | 194 |
165 main(argc, argv) | 195 main(argc, argv) |
166 char **argv; | 196 char **argv; |
167 { | 197 { |