X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=x264_encoder.h;h=729cb7f02bcc0063861aa946ec700e6321e566b8;hb=3be00c8dd8b841cecc44f57234b9fc2d3a94cb45;hp=e146cd2b2b6a3044a5ab20d3d9195fa05f831e32;hpb=e1a58f0f4e9cd05441f1e1b43fc4c83d1f862dd7;p=nageru diff --git a/x264_encoder.h b/x264_encoder.h index e146cd2..729cb7f 100644 --- a/x264_encoder.h +++ b/x264_encoder.h @@ -27,22 +27,28 @@ extern "C" { #include "x264.h" +#include } class Mux; class X264Encoder { public: - X264Encoder(Mux *httpd); // Does not take ownership. + X264Encoder(AVOutputFormat *oformat); // Does not take ownership. // Called after the last frame. Will block; once this returns, // the last data is flushed. ~X264Encoder(); + // Must be called before first frame. Does not take ownership. + void set_mux(Mux *mux) { this->mux = mux; } + // 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); + std::string get_global_headers() const { return global_headers; } + private: struct QueuedFrame { int64_t pts, duration; @@ -58,6 +64,10 @@ private: std::unique_ptr frame_pool; Mux *mux = nullptr; + bool wants_global_headers; + + std::string global_headers; + std::string buffered_sei; // Will be output before first frame, if any. std::thread encoder_thread; std::atomic should_quit{false};