diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-29 16:05:12 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-29 23:01:13 +0000 |
commit | 623e9ac331df7323660e21c8a2226523a5ee713b (patch) | |
tree | c80e28171974a53972cbfcc6928818e907653823 /toxav/rtp.h | |
parent | 6f6c4dc2bd8820e6bccb9353ad42c951dc7adcd4 (diff) |
Add RTP header fields for the full frame length and offset.
This also adds RTPCapabilities and a header field to tell the receiver
about capabilities used in encoding this frame. It is intended to contain
settings relevant to the current frame being sent.
Diffstat (limited to 'toxav/rtp.h')
-rw-r--r-- | toxav/rtp.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/toxav/rtp.h b/toxav/rtp.h index 85da8fe1..391ace74 100644 --- a/toxav/rtp.h +++ b/toxav/rtp.h | |||
@@ -32,7 +32,19 @@ | |||
32 | */ | 32 | */ |
33 | enum { | 33 | enum { |
34 | rtp_TypeAudio = 192, | 34 | rtp_TypeAudio = 192, |
35 | rtp_TypeVideo, | 35 | rtp_TypeVideo = 193, |
36 | }; | ||
37 | |||
38 | /** | ||
39 | * A bit mask (up to 32 bits) specifying features of the current frame affecting | ||
40 | * the behaviour of the decoder. | ||
41 | */ | ||
42 | enum RTPCapabilities { | ||
43 | /** | ||
44 | * Support frames larger than 64KiB. The full 32 bit length and offset are | ||
45 | * set in \ref RTPHeader::data_length_full and \ref RTPHeader::offset_full. | ||
46 | */ | ||
47 | RTP_LARGE_FRAME = 1 << 0, | ||
36 | }; | 48 | }; |
37 | 49 | ||
38 | struct RTPHeader { | 50 | struct RTPHeader { |
@@ -58,11 +70,44 @@ struct RTPHeader { | |||
58 | uint16_t sequnum; | 70 | uint16_t sequnum; |
59 | uint32_t timestamp; | 71 | uint32_t timestamp; |
60 | uint32_t ssrc; | 72 | uint32_t ssrc; |
61 | uint32_t csrc[16]; | ||
62 | 73 | ||
63 | /* Non-standard TOX-specific fields */ | 74 | /* Non-standard Tox-specific fields */ |
64 | uint16_t offset_lower;/* Data offset of the current part */ | 75 | |
65 | uint16_t data_length_lower; /* Total message length */ | 76 | /** |
77 | * Bit mask of \ref RTPCapabilities setting features for the current frame. | ||
78 | */ | ||
79 | uint32_t capabilities; | ||
80 | |||
81 | /** | ||
82 | * The full 32 bit data offset of the current data chunk. The \ref | ||
83 | * offset_lower data member contains the lower 16 bits of this value. For | ||
84 | * frames smaller than 64KiB, \ref offset_full and \ref offset_lower are | ||
85 | * equal. | ||
86 | */ | ||
87 | uint32_t offset_full; | ||
88 | /** | ||
89 | * The full 32 bit payload length without header and packet id. | ||
90 | */ | ||
91 | uint32_t data_length_full; | ||
92 | /** | ||
93 | * Only the receiver uses this field (why do we have this?). | ||
94 | */ | ||
95 | uint32_t received_length_full; | ||
96 | |||
97 | /** | ||
98 | * Unused fields. If you want to add more information to this header, remove | ||
99 | * one csrc and add the appropriate number of fields in its place. | ||
100 | */ | ||
101 | uint32_t csrc[12]; | ||
102 | |||
103 | /** | ||
104 | * Data offset of the current part (lower bits). | ||
105 | */ | ||
106 | uint16_t offset_lower; | ||
107 | /** | ||
108 | * Total message length (lower bits). | ||
109 | */ | ||
110 | uint16_t data_length_lower; | ||
66 | } __attribute__((packed)); | 111 | } __attribute__((packed)); |
67 | 112 | ||
68 | /* Check alignment */ | 113 | /* Check alignment */ |