-HTTPD::Stream::Stream(AVOutputFormat *oformat, int width, int height, int time_base, int bit_rate)
-{
- AVFormatContext *avctx = avformat_alloc_context();
- avctx->oformat = oformat;
- uint8_t *buf = (uint8_t *)av_malloc(MUX_BUFFER_SIZE);
- avctx->pb = avio_alloc_context(buf, MUX_BUFFER_SIZE, 1, this, nullptr, &HTTPD::Stream::write_packet_thunk, nullptr);
-
- Mux::Codec video_codec;
- if (global_flags.uncompressed_video_to_http) {
- video_codec = Mux::CODEC_NV12;
- } else {
- video_codec = Mux::CODEC_H264;
- }
-
- avctx->flags = AVFMT_FLAG_CUSTOM_IO;
-
- mux.reset(new Mux(avctx, width, height, video_codec, time_base, bit_rate));
-}
-