]> git.sesse.net Git - nageru/blobdiff - x264_encoder.h
Add a menu option to change x264 video bitrate while running.
[nageru] / x264_encoder.h
index ef118c6f4410d7e3554aad2a4e8354d6875e1c0b..bb9f1dc066dd43b0b544b744452a1c93251a56da 100644 (file)
@@ -50,6 +50,10 @@ public:
 
        std::string get_global_headers() const { return global_headers; }
 
+       void change_bitrate(unsigned rate_kbit) {
+               new_bitrate_kbit = rate_kbit;
+       }
+
 private:
        struct QueuedFrame {
                int64_t pts, duration;
@@ -75,6 +79,8 @@ private:
        x264_t *x264;
        std::unique_ptr<X264SpeedControl> speed_control;
 
+       std::atomic<unsigned> new_bitrate_kbit{0};  // 0 for no change.
+
        // Protects everything below it.
        std::mutex mu;