Skip to content

Commit 64422e4

Browse files
committed
Update pyro header.
1 parent 1809b0d commit 64422e4

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

video/pyro_protocol.h

+29-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ extern "C" {
1010

1111
// Endian: All wire-messages are in little-endian.
1212

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)
1415
#define PYRO_MESSAGE_MAGIC_MASK (~(uint32_t)0 << 14)
1516
#define PYRO_MAX_PAYLOAD_SIZE 1024
1617

@@ -32,9 +33,17 @@ typedef enum pyro_audio_codec_type
3233
PYRO_AUDIO_CODEC_MAX_INT = INT32_MAX
3334
} pyro_audio_codec_type;
3435

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+
3543
struct pyro_codec_parameters
3644
{
3745
pyro_video_codec_type video_codec;
46+
pyro_video_color_profile video_color_profile;
3847
pyro_audio_codec_type audio_codec;
3948
uint16_t frame_rate_num;
4049
uint16_t frame_rate_den;
@@ -47,6 +56,7 @@ struct pyro_codec_parameters
4756
struct pyro_progress_report
4857
{
4958
uint64_t total_received_packets;
59+
uint64_t total_recovered_packets;
5060
uint64_t total_dropped_packets;
5161
uint64_t total_received_key_frames;
5262
};
@@ -143,12 +153,23 @@ static inline uint32_t pyro_message_get_length(uint32_t v)
143153
// UDP: server to client. Size is implied by datagram.
144154
enum pyro_payload_flag_bits
145155
{
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,
151171
PYRO_PAYLOAD_PACKET_SEQ_BITS = 14,
172+
152173
PYRO_PAYLOAD_SUBPACKET_SEQ_OFFSET = 18,
153174
PYRO_PAYLOAD_SUBPACKET_SEQ_BITS = 14,
154175
};
@@ -190,6 +211,8 @@ struct pyro_payload_header
190211
{
191212
uint32_t pts_lo, pts_hi;
192213
uint32_t dts_delta; // dts = pts - dts_delta
214+
uint32_t payload_size;
215+
uint16_t num_fec_blocks, num_xor_blocks;
193216
pyro_payload_flags encoded;
194217
};
195218

0 commit comments

Comments
 (0)