]> git.sesse.net Git - nageru/blobdiff - x264_encoder.h
Support switching Y'CbCr coefficients midway, which will allow doing the Right Thing...
[nageru] / x264_encoder.h
index 8adb42ae19102808b2f35d3395aeb3a83e50d9e0..2e64e66118328cd99e7240d5fcef22a257f7a0fe 100644 (file)
@@ -33,6 +33,8 @@ extern "C" {
 #include <libavformat/avformat.h>
 }
 
+#include <movit/image_format.h>
+
 #include "print_latency.h"
 
 class Mux;
@@ -51,7 +53,7 @@ public:
 
        // <data> is taken to be raw NV12 data of WIDTHxHEIGHT resolution.
        // Does not block.
-       void add_frame(int64_t pts, int64_t duration, const uint8_t *data, const ReceivedTimestamps &received_ts);
+       void add_frame(int64_t pts, int64_t duration, movit::YCbCrLumaCoefficients ycbcr_coefficients, const uint8_t *data, const ReceivedTimestamps &received_ts);
 
        std::string get_global_headers() const {
                while (!x264_init_done) {
@@ -67,6 +69,7 @@ public:
 private:
        struct QueuedFrame {
                int64_t pts, duration;
+               movit::YCbCrLumaCoefficients ycbcr_coefficients;
                uint8_t *data;
                ReceivedTimestamps received_ts;
        };
@@ -91,6 +94,8 @@ private:
        x264_t *x264;
        std::unique_ptr<X264SpeedControl> speed_control;
 
+       std::function<void(x264_param_t *)> bitrate_override_func;
+
        std::atomic<unsigned> new_bitrate_kbit{0};  // 0 for no change.
 
        // Protects everything below it.