- // You can only have one going at the same time.
- void open_output_file(const std::string &filename);
- void close_output_file();
+ enum StreamType {
+ MAIN_STREAM,
+ MULTICAM_STREAM,
+ NUM_STREAM_TYPES
+ };
+
+ // Should be called before start().
+ void set_header(StreamType stream_type, const std::string &data) {
+ header[stream_type] = data;
+ }
+
+ // Should be called before start() (due to threading issues).
+ enum CORSPolicy {
+ NO_CORS_POLICY,
+ ALLOW_ALL_ORIGINS
+ };
+ void add_endpoint(const std::string &url, const EndpointCallback &callback, CORSPolicy cors_policy) {
+ endpoints[url] = Endpoint{ callback, cors_policy };
+ }
+
+ void start(int port);
+ void stop();
+ void add_data(StreamType stream_type, const char *buf, size_t size, bool keyframe, int64_t time, AVRational timebase);
+ int64_t get_num_connected_clients() const {
+ return metric_num_connected_clients.load();
+ }