@@ -10,7 +10,8 @@ extern "C" {
10
10
11
11
// Endian: All wire-messages are in little-endian.
12
12
13
- #define PYRO_MAKE_MESSAGE_TYPE (t , s ) ((((uint32_t)'P') << 26) | (((uint32_t)'Y') << 20) | (((uint32_t)'R') << 14) | (t) | ((s) << 6))
13
+ #define PYRO_VERSION_MASK (0xaa02 << 16)
14
+ #define PYRO_MAKE_MESSAGE_TYPE (t , s ) (((((uint32_t)'P') << 26) | (((uint32_t)'Y') << 20) | (((uint32_t)'R') << 14) | (t) | ((s) << 6)) ^ PYRO_VERSION_MASK)
14
15
#define PYRO_MESSAGE_MAGIC_MASK (~(uint32_t)0 << 14)
15
16
#define PYRO_MAX_PAYLOAD_SIZE 1024
16
17
@@ -32,9 +33,17 @@ typedef enum pyro_audio_codec_type
32
33
PYRO_AUDIO_CODEC_MAX_INT = INT32_MAX
33
34
} pyro_audio_codec_type ;
34
35
36
+ typedef enum pyro_video_color_profile
37
+ {
38
+ /* Standard 4:2:0 H.264 / H.265. ChromaX is even sited, ChromaY is center with BT709 primaries and limited range. */
39
+ PYRO_VIDEO_COLOR_BT709_LIMITED_LEFT_CHROMA_420 = 0 ,
40
+ PYRO_VIDEO_COLOR_MAX_INT = INT32_MAX
41
+ } pyro_video_color ;
42
+
35
43
struct pyro_codec_parameters
36
44
{
37
45
pyro_video_codec_type video_codec ;
46
+ pyro_video_color_profile video_color_profile ;
38
47
pyro_audio_codec_type audio_codec ;
39
48
uint16_t frame_rate_num ;
40
49
uint16_t frame_rate_den ;
@@ -47,6 +56,7 @@ struct pyro_codec_parameters
47
56
struct pyro_progress_report
48
57
{
49
58
uint64_t total_received_packets ;
59
+ uint64_t total_recovered_packets ;
50
60
uint64_t total_dropped_packets ;
51
61
uint64_t total_received_key_frames ;
52
62
};
@@ -143,12 +153,23 @@ static inline uint32_t pyro_message_get_length(uint32_t v)
143
153
// UDP: server to client. Size is implied by datagram.
144
154
enum pyro_payload_flag_bits
145
155
{
146
- PYRO_PAYLOAD_KEY_FRAME_BIT = 1 << 0 , // For video, useful to know when clean recovery can be made, or when to start the stream
147
- PYRO_PAYLOAD_STREAM_TYPE_BIT = 1 << 1 , // 0: video, 1: audio
148
- PYRO_PAYLOAD_PACKET_DONE_BIT = 1 << 2 , // Set on last subpacket within a packet
149
- PYRO_PAYLOAD_PACKET_BEGIN_BIT = 1 << 3 , // Set on first subpacket within a packet
150
- PYRO_PAYLOAD_PACKET_SEQ_OFFSET = 4 , // Sequence increases by one on a per-stream basis.
156
+ // For video, useful to know when clean recovery can be made, or when to start the stream
157
+ // 0: video, 1: audio
158
+ PYRO_PAYLOAD_KEY_FRAME_BIT = 1 << 0 ,
159
+ PYRO_PAYLOAD_STREAM_TYPE_BIT = 1 << 1 ,
160
+
161
+ // This is a FEC block.
162
+ // SUBPACKET_SEQ is not wrapped.
163
+ // Max FEC blocks is bounded to 1 << SUBPACKET_SEQ_BITS.
164
+ PYRO_PAYLOAD_PACKET_FEC_BIT = 1 << 2 ,
165
+
166
+ // Set on first subpacket within a packet. Not used for FEC.
167
+ PYRO_PAYLOAD_PACKET_BEGIN_BIT = 1 << 3 ,
168
+
169
+ // Sequence increases by one on a per-stream basis.
170
+ PYRO_PAYLOAD_PACKET_SEQ_OFFSET = 4 ,
151
171
PYRO_PAYLOAD_PACKET_SEQ_BITS = 14 ,
172
+
152
173
PYRO_PAYLOAD_SUBPACKET_SEQ_OFFSET = 18 ,
153
174
PYRO_PAYLOAD_SUBPACKET_SEQ_BITS = 14 ,
154
175
};
@@ -190,6 +211,8 @@ struct pyro_payload_header
190
211
{
191
212
uint32_t pts_lo , pts_hi ;
192
213
uint32_t dts_delta ; // dts = pts - dts_delta
214
+ uint32_t payload_size ;
215
+ uint16_t num_fec_blocks , num_xor_blocks ;
193
216
pyro_payload_flags encoded ;
194
217
};
195
218
0 commit comments