# HG changeset patch # User Mychaela Falconia # Date 1681618694 0 # Node ID 210dfa39f57332dcd4a12be8b298b0dfaa0e5de3 # Parent 41eba040785aa58adf52470bcdee537861036fa7 rtp-gsmfr-extr: support new TRAUlike RTP payload format diff -r 41eba040785a -r 210dfa39f573 rtp-gsmfr-extr.c --- a/rtp-gsmfr-extr.c Sun Apr 02 05:36:35 2023 +0000 +++ b/rtp-gsmfr-extr.c Sun Apr 16 04:18:14 2023 +0000 @@ -97,6 +97,7 @@ unsigned caplen, pkt_idx; { unsigned udplen, payload_len; + u_char synth_bfi[2]; if (caplen < link_hdr_len + 28) return; @@ -141,25 +142,54 @@ rtp_stream_logic(pkt + 28, pkt_idx); payload_len = udplen - 20; switch (payload_len) { + case 0: + synth_bfi[0] = 0xBF; + synth_bfi[1] = 0; + emit_synth_bfi: + fwrite(synth_bfi, 1, 2, outfile); + return; + case 1: + if ((pkt[40] & 0xF6) != 0xE6) + break; + traulike_bfi: + synth_bfi[0] = 0xBF; + synth_bfi[1] = pkt[40] & 1; + goto emit_synth_bfi; case 2: - if (pkt[40] == 0xBF) + if (pkt[40] != 0xBF) break; - goto bad_payload; + emit_payload: + fwrite(pkt + 40, 1, payload_len, outfile); + return; case 31: - if ((pkt[40] & 0xF0) == 0xC0) + if ((pkt[40] & 0xF0) != 0xC0) + break; + goto emit_payload; + case 32: + if ((pkt[40] & 0xF4) != 0xE0) break; - goto bad_payload; + if ((pkt[41] & 0xF0) != 0xC0) + break; + if (pkt[40] & 2) + goto traulike_bfi; + fwrite(pkt + 41, 1, 31, outfile); + return; case 33: - if ((pkt[40] & 0xF0) == 0xD0) + if ((pkt[40] & 0xF0) != 0xD0) + break; + goto emit_payload; + case 34: + if ((pkt[40] & 0xF4) != 0xE0) + break; + if ((pkt[41] & 0xF0) != 0xD0) break; - /* FALL THRU */ - default: - bad_payload: - fprintf(stderr, "error in packet #%u: unsupported payload\n", - pkt_idx); - exit(1); + if (pkt[40] & 2) + goto traulike_bfi; + fwrite(pkt + 41, 1, 33, outfile); + return; } - fwrite(pkt + 40, 1, payload_len, outfile); + fprintf(stderr, "error in packet #%u: unsupported payload\n", pkt_idx); + exit(1); } main(argc, argv)