#pragma once #include #include #include #include #include #include namespace stream { // Count the complete UDP payload, including the optional encryption prefix, // against the 64 KiB Windows buffering limit and 64-segment Linux GSO limit. std::size_t video_send_batch_size(std::size_t block_size, std::size_t prefix_size, std::size_t max_batch_bytes); inline std::string canonical_codec_name(std::string_view codec) { if (codec.empty()) { return {}; } std::string lowered(codec); for (char &ch : lowered) { if (ch >= 'A' && ch <= 'Z') { ch = static_cast(ch - 'A' + 'a'); } } if (lowered == "h264" || lowered == "h.264") return "H.264"; if (lowered == "h265" || lowered == "hevc") return "HEVC"; if (lowered == "av1") return "AV1"; return std::string(codec); } struct control_packet_view_t { std::uint16_t type = 0; std::string_view payload; }; std::optional decode_control_packet(std::string_view packet_bytes); std::vector concat_and_insert( std::uint64_t insert_size, std::uint64_t slice_size, std::string_view data1, std::string_view data2 ); } // namespace stream