X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Fvideo_encoder.h;h=86badf2a9a189fa708789045273f576336225e5e;hb=e2b654d6a8cc8c64142a9a8ef8bcd82e9d9a9289;hp=61b16f763d3cdb3211ca864fc311b79c9c47cb22;hpb=0a087eeaf663c3f7b1d9431c725fcae10f60d732;p=nageru diff --git a/nageru/video_encoder.h b/nageru/video_encoder.h index 61b16f7..86badf2 100644 --- a/nageru/video_encoder.h +++ b/nageru/video_encoder.h @@ -20,6 +20,8 @@ extern "C" { #include } +#include + #include "shared/mux.h" #include "shared/ref_counted_gl_sync.h" @@ -75,11 +77,16 @@ public: void change_x264_bitrate(unsigned rate_kbit); private: - void open_output_stream(); + void open_output_streams(); static int write_packet2_thunk(void *opaque, uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time); int write_packet2(uint8_t *buf, int buf_size, AVIODataMarkerType type, int64_t time); - const AVOutputFormat *oformat; + static int write_srt_packet_thunk(void *opaque, uint8_t *buf, int buf_size); + int write_srt_packet(uint8_t *buf, int buf_size); + int open_srt_socket(); // Returns -1 on error. + int connect_to_srt(); // Returns -1 on error. + + const AVOutputFormat *oformat, *srt_oformat; mutable std::mutex qs_mu, qs_audio_mu; std::unique_ptr quicksync_encoder; // Under _and_ . movit::ResourcePool *resource_pool; @@ -92,6 +99,7 @@ private: bool seen_sync_markers = false; std::unique_ptr http_mux; // To the HTTP server. + std::unique_ptr srt_mux; // To the SRT endpoint (if any). std::unique_ptr stream_audio_encoder; std::unique_ptr x264_encoder; // nullptr if not using x264. std::unique_ptr x264_disk_encoder; // nullptr if not using x264, or if not having separate disk encodes. @@ -99,8 +107,11 @@ private: std::unique_ptr av1_encoder; // nullptr if not using SVT-AV1. #endif + SRTSOCKET srt_sock = -1; + std::string http_mux_header; MuxMetrics http_mux_metrics; + MuxMetrics srt_mux_metrics; std::atomic quicksync_encoders_in_shutdown{0}; std::atomic overriding_bitrate{0};