]> git.sesse.net Git - nageru/blobdiff - x264encode.h
Remove some debugging output.
[nageru] / x264encode.h
index f1c3a37380beff14e8fa1c8d90b55be09f98363f..6f0d6a54210725b39d851e778d93291967c39a20 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <stdint.h>
 
+#include <atomic>
 #include <condition_variable>
 #include <memory>
 #include <mutex>
@@ -28,21 +29,20 @@ extern "C" {
 #include "x264.h"
 }
 
-class HTTPD;
+class Mux;
 
 class X264Encoder {
 public:
-       X264Encoder(HTTPD *httpd);  // Does not take ownership.
+       X264Encoder(Mux *httpd);  // Does not take ownership.
+
+       // Called after the last frame. Will block; once this returns,
+       // the last data is flushed.
        ~X264Encoder();
 
        // <data> is taken to be raw NV12 data of WIDTHxHEIGHT resolution.
        // Does not block.
        void add_frame(int64_t pts, const uint8_t *data);
 
-       // Called after the last frame. Will block; once this returns,
-       // the last data is flushed.
-       void end_encoding();
-
 private:
        struct QueuedFrame {
                int64_t pts;
@@ -57,9 +57,10 @@ private:
        // pool.
        std::unique_ptr<uint8_t[]> frame_pool;
 
-       HTTPD *httpd = nullptr;
+       Mux *mux = nullptr;
 
        std::thread encoder_thread;
+       std::atomic<bool> should_quit{false};
        x264_t *x264;
 
        // Protects everything below it.