X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=x264_encoder.h;h=c71cba2f373e7bc3864a23224a734a17ffeb9ead;hb=refs%2Fheads%2Fmultichannel_audio;hp=729cb7f02bcc0063861aa946ec700e6321e566b8;hpb=3be00c8dd8b841cecc44f57234b9fc2d3a94cb45;p=nageru diff --git a/x264_encoder.h b/x264_encoder.h index 729cb7f..c71cba2 100644 --- a/x264_encoder.h +++ b/x264_encoder.h @@ -17,20 +17,21 @@ #define _X264ENCODE_H 1 #include - +#include #include #include #include #include -#include #include +#include +#include extern "C" { -#include "x264.h" #include } class Mux; +class X264SpeedControl; class X264Encoder { public: @@ -49,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; @@ -72,6 +77,9 @@ private: std::thread encoder_thread; std::atomic should_quit{false}; x264_t *x264; + std::unique_ptr speed_control; + + std::atomic new_bitrate_kbit{0}; // 0 for no change. // Protects everything below it. std::mutex mu;