4 // Various routines that deal with parsing the configuration file.
7 #include <netinet/in.h>
13 std::string url; // As seen by the client.
14 std::string hls_url; // As seen by the client. Can be empty.
15 std::string src; // Can be empty.
17 size_t prebuffering_bytes;
18 uint32_t pacing_rate; // In bytes per second. Default is ~0U (no limit).
19 enum Encoding { STREAM_ENCODING_RAW = 0, STREAM_ENCODING_METACUBE };
21 Encoding src_encoding;
22 std::string allow_origin;
24 // These only matter if hls_url is nonempty.
25 int hls_frag_duration = 6; // Apple recommendation (“HLS Authoring Specification for Apple Devices”, point 7.5).
26 int hls_backlog_margin = 0;
29 struct UDPStreamConfig {
31 std::string src; // Can be empty.
32 uint32_t pacing_rate; // In bytes per second. Default is ~0U (no limit).
33 int ttl; // Default is -1 (use operating system default).
34 int multicast_iface_index; // Default is -1 (use operating system default).
38 std::string url; // As seen by the client.
39 std::string allow_origin; // Can be empty.
42 struct AcceptorConfig {
45 std::string certificate_chain, private_key; // In PEM format.
49 enum { LOG_TYPE_FILE, LOG_TYPE_CONSOLE, LOG_TYPE_SYSLOG } type;
56 std::vector<StreamConfig> streams;
57 std::vector<UDPStreamConfig> udpstreams;
58 std::vector<Gen204Config> pings;
59 std::vector<AcceptorConfig> acceptors;
60 std::vector<LogConfig> log_destinations;
62 std::string stats_file; // Empty means no stats file.
65 std::string input_stats_file; // Empty means no input stats file.
66 int input_stats_interval;
68 std::string access_log_file; // Empty means no accses_log file.
71 // Parse and validate configuration. Returns false on error.
72 // <config> is taken to be empty (uninitialized) on entry.
73 bool parse_config(const std::string &filename, Config *config);
75 #endif // !defined(_CONFIG_H)