X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=metacube2.h;fp=metacube2.h;h=5b6077e8ae4d08d232cd8840f119c7ac5ac41f6b;hp=43de8b7480de172fe621d5865df053cb8ebf1e68;hb=b05c2965d3d5bfc4f24f17a27716a69ddf03a3cc;hpb=023de2890fe7300d8940e66ae73b48262e86976c diff --git a/metacube2.h b/metacube2.h index 43de8b7..5b6077e 100644 --- a/metacube2.h +++ b/metacube2.h @@ -14,13 +14,42 @@ #define METACUBE_FLAGS_HEADER 0x1 #define METACUBE_FLAGS_NOT_SUITABLE_FOR_STREAM_START 0x2 +/* + * Metadata packets; should not be counted as data, but rather + * parsed (or ignored if you don't understand them). + * + * Metadata packets start with a uint64_t (network byte order) + * that describe the type; the rest is defined by the type. + */ +#define METACUBE_FLAGS_METADATA 0x4 + struct metacube2_block_header { char sync[8]; /* METACUBE2_SYNC */ uint32_t size; /* Network byte order. Does not include header. */ uint16_t flags; /* Network byte order. METACUBE_FLAGS_*. */ - uint16_t csum; /* Network byte order. CRC16 of size and flags. */ + uint16_t csum; /* Network byte order. CRC16 of size and flags. + If METACUBE_FLAGS_METADATA is set, inverted + so that older clients will ignore it as broken. */ }; uint16_t metacube2_compute_crc(const struct metacube2_block_header *hdr); +/* + * The only currently defined metadata type. Set by the encoder, + * and can be measured for latency purposes (e.g., if the network + * can't keep up, the latency will tend to increase. + */ +#define METACUBE_METADATA_TYPE_ENCODER_TIMESTAMP 0x1 + +struct metacube2_timestamp_packet { + uint64_t type; /* METACUBE_METADATA_TYPE_ENCODER_TIMESTAMP, in network byte order. */ + + /* + * Time since the UTC epoch. Basically a struct timespec. + * Both are in network byte order. + */ + uint64_t tv_sec; + uint64_t tv_nsec; +}; + #endif /* !defined(_METACUBE_H) */