-
Notifications
You must be signed in to change notification settings - Fork 1
/
rtp_v2.dogma
44 lines (40 loc) · 1.6 KB
/
rtp_v2.dogma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
dogma_v1 utf-8
- identifier = rtp_v2
- description = Real-time Transport Protocol packet, version 2
- reference = https://www.rfc-editor.org/rfc/rfc3550
- dogma = https://github.com/kstenerud/dogma/blob/master/v1/dogma_v1.md
rtp_packet = version
& uint(1,var(has_padding,~))
& uint(1,var(has_extension,~))
& uint(4,var(csrc_count,~))
& marker
& payload_type
& sequence_no
& timestamp
& ssrc
& csrc_list(has_padding, csrc_count)
& [has_extension = 1: extension;]
;
version = uint(2,2);
marker = uint(1,~);
payload_type = uint(7,~);
sequence_no = uint(16,~);
timestamp = uint(32,~);
ssrc = uint(32,~);
csrc = uint(32,~);
csrc_list(has_padding, count) = [
has_padding = 1: peek(uint(8,~){count*4-3} & uint(8,var(pad_length,4~)))
& csrc{count - pad_length/4}
& padding{pad_length-4}
& padding_last(pad_length)
;
: csrc{count};
];
padding = uint(8,0);
padding_last(length) = padding{3} & uint(8,length);
extension = custom_data
& uint(16,var(length,~))
& extension_payload(length)
;
custom_data = uint(16,~);
ext_payload(length) = uint(32,~){length};