enum Codec {
CODEC_H264,
CODEC_AV1,
- CODEC_NV12, // Uncompressed 4:2:0.
CODEC_MJPEG
};
enum WriteStrategy {
void plug();
void unplug();
+ // Temporary stop the mux; any packets coming in are discarded, and any existing ones
+ // in the queue will be dropped. Any writes in progress will finish as usual.
+ // Incompatible with plug().
+ void drain();
+ void undrain();
+
private:
// If write_strategy == WRITE_FOREGORUND, Must be called with <mu> held.
void write_packet_or_die(const AVPacket &pkt, int64_t unscaled_pts);
void thread_func();
+ void write_header();
WriteStrategy write_strategy;
AVFormatContext *avctx; // Protected by <mu>, iff write_strategy == WRITE_BACKGROUND.
int plug_count = 0; // Protected by <mu>.
+ bool drained = false; // Protected by <mu>.
// Protected by <mu>. If write_strategy == WRITE_FOREGROUND,
// this is only in use when plugging.