X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shared%2Fmux.h;h=d3d7798fc237c2fcb583230c49be3ef7142ecad6;hb=b44bf7cfce6a5aaffbcd1e37df39068a163438ad;hp=62cd37cf80791f061182ebf50498756948f24a78;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/shared/mux.h b/shared/mux.h index 62cd37c..d3d7798 100644 --- a/shared/mux.h +++ b/shared/mux.h @@ -53,10 +53,6 @@ public: CODEC_NV12, // Uncompressed 4:2:0. CODEC_MJPEG }; - enum WithAudio { - WITH_AUDIO, - WITHOUT_AUDIO - }; enum WriteStrategy { // add_packet() will write the packet immediately, unless plugged. WRITE_FOREGROUND, @@ -74,7 +70,9 @@ public: // the just-written frame. (write_callback can be nullptr.) // Does not take ownership of ; elements in there, if any, // will be added to. - Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const std::string &video_extradata, const AVCodecParameters *audio_codecpar, AVColorSpace color_space, WithAudio with_audio, int time_base, std::function write_callback, WriteStrategy write_strategy, const std::vector &metrics); + // + // If audio_codecpar is nullptr, there will be no audio stream. + Mux(AVFormatContext *avctx, int width, int height, Codec video_codec, const std::string &video_extradata, const AVCodecParameters *audio_codecpar, AVColorSpace color_space, int time_base, std::function write_callback, WriteStrategy write_strategy, const std::vector &metrics); ~Mux(); void add_packet(const AVPacket &pkt, int64_t pts, int64_t dts, AVRational timebase = { 1, TIMEBASE }, int stream_index_override = -1); @@ -114,7 +112,7 @@ private: std::vector packet_queue; std::condition_variable packet_queue_ready; - AVStream *avstream_video, *avstream_audio; + std::vector streams; std::function write_callback; std::vector metrics;