X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=x264_speed_control.h;h=7add8fdd4c2c2a3c9386d74a0854aa2389bc9e41;hb=a89f0c565d3410cfd9b266dd661a934408a01028;hp=84eb090380850f8264ed224a3f26a987a0f80ebf;hpb=9d603968d9163e2e821c6630420faa931e2b4c2d;p=nageru diff --git a/x264_speed_control.h b/x264_speed_control.h index 84eb090..7add8fd 100644 --- a/x264_speed_control.h +++ b/x264_speed_control.h @@ -47,6 +47,7 @@ #include #include #include +#include extern "C" { #include "x264.h" @@ -80,6 +81,17 @@ public: void before_frame(float new_buffer_fill, int new_buffer_size, float f_uspf); void after_frame(); + // x264 seemingly has an issue where x264_encoder_reconfig() is not reflected + // immediately in x264_encoder_parameters(). Since speed control keeps calling + // those two all the time, any changes you make outside X264SpeedControl + // could be overridden. Thus, to make changes to encoder parameters, you should + // instead set a function here, which will be called every time parameters + // are modified. + void set_config_override_function(std::function override_func) + { + this->override_func = override_func; + } + private: void set_buffer_size(int new_buffer_size); int dither_preset(float f); @@ -112,4 +124,6 @@ private: double avg_preset; int den; } stat; + + std::function override_func = nullptr; };