]> git.sesse.net Git - nageru/blobdiff - shared/httpd.h
Merge branch 'mjpeg'
[nageru] / shared / httpd.h
similarity index 95%
rename from httpd.h
rename to shared/httpd.h
index 1ff5c51108facf03ca1b0d8fc2f076a63938e595..8c3c8105c5b959155abbd19d95b10a1fcfc0ffa6 100644 (file)
--- a/httpd.h
@@ -3,16 +3,16 @@
 
 // A class dealing with stream output to HTTP.
 
-#include <stddef.h>
-#include <stdint.h>
-#include <sys/types.h>
 #include <atomic>
 #include <condition_variable>
 #include <deque>
 #include <functional>
 #include <mutex>
 #include <set>
+#include <stddef.h>
+#include <stdint.h>
 #include <string>
+#include <sys/types.h>
 #include <unordered_map>
 #include <utility>
 
@@ -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<int64_t> metric_num_connected_clients{0};
+       std::atomic<int64_t> metric_num_connected_clients{ 0 };
 };
 
 #endif  // !defined(_HTTPD_H)