X-Git-Url: https://git.sesse.net/?p=nageru;a=blobdiff_plain;f=shared%2Fhttpd.h;fp=httpd.h;h=8c3c8105c5b959155abbd19d95b10a1fcfc0ffa6;hp=1ff5c51108facf03ca1b0d8fc2f076a63938e595;hb=eeda8995329601f9f4e35047358400833eeae68e;hpb=8e86ae071c057a26e933b8452ac541050ba2cb9f diff --git a/httpd.h b/shared/httpd.h similarity index 95% rename from httpd.h rename to shared/httpd.h index 1ff5c51..8c3c810 100644 --- a/httpd.h +++ b/shared/httpd.h @@ -3,16 +3,16 @@ // A class dealing with stream output to HTTP. -#include -#include -#include #include #include #include #include #include #include +#include +#include #include +#include #include #include @@ -47,14 +47,16 @@ public: NO_CORS_POLICY, ALLOW_ALL_ORIGINS }; - void add_endpoint(const std::string &url, const EndpointCallback &callback, CORSPolicy cors_policy) { + 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 { + int64_t get_num_connected_clients() const + { return metric_num_connected_clients.load(); } @@ -71,7 +73,6 @@ private: static void free_stream(void *cls); - class Stream { public: enum Framing { @@ -118,7 +119,7 @@ private: std::string header[NUM_STREAM_TYPES]; // Metrics. - std::atomic metric_num_connected_clients{0}; + std::atomic metric_num_connected_clients{ 0 }; }; #endif // !defined(_HTTPD_H)