5 * Definitions for the Metacube2 protocol, used to communicate with Cubemap.
7 * Note: This file is meant to compile as both C and C++, for easier inclusion
13 #define METACUBE2_SYNC "cube!map" /* 8 bytes long. */
14 #define METACUBE_FLAGS_HEADER 0x1
15 #define METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START 0x2
18 * Metadata packets; should not be counted as data, but rather
19 * parsed (or ignored if you don't understand them).
21 * Metadata packets start with a uint64_t (network byte order)
22 * that describe the type; the rest is defined by the type.
24 #define METACUBE_FLAGS_METADATA 0x4
26 struct metacube2_block_header {
27 char sync[8]; /* METACUBE2_SYNC */
28 uint32_t size; /* Network byte order. Does not include header. */
29 uint16_t flags; /* Network byte order. METACUBE_FLAGS_*. */
30 uint16_t csum; /* Network byte order. CRC16 of size and flags.
31 If METACUBE_FLAGS_METADATA is set, inverted
32 so that older clients will ignore it as broken. */
35 uint16_t metacube2_compute_crc(const struct metacube2_block_header *hdr);
38 * The only currently defined metadata type. Set by the encoder,
39 * and can be measured for latency purposes (e.g., if the network
40 * can't keep up, the latency will tend to increase.
42 #define METACUBE_METADATA_TYPE_ENCODER_TIMESTAMP 0x1
44 struct metacube2_timestamp_packet {
45 uint64_t type; /* METACUBE_METADATA_TYPE_ENCODER_TIMESTAMP, in network byte order. */
48 * Time since the UTC epoch. Basically a struct timespec.
49 * Both are in network byte order.
55 #endif /* !defined(_METACUBE_H) */