X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Faudio_encoder.h;h=49cead7c4851dee82097fb2caed462373283ba6e;hb=a0e57ec99e9dfdd7e79bcf21e8c996dc43b6cb49;hp=d28d7eee3c04ff1d0ee89ac38e62cdae22260402;hpb=b563b8903fa84bb7fd62d7d0b84b70cb26843dbf;p=nageru diff --git a/nageru/audio_encoder.h b/nageru/audio_encoder.h index d28d7ee..49cead7 100644 --- a/nageru/audio_encoder.h +++ b/nageru/audio_encoder.h @@ -3,15 +3,17 @@ #ifndef _AUDIO_ENCODER_H #define _AUDIO_ENCODER_H 1 +#include #include #include #include #include extern "C" { +#include #include #include -#include +#include #include } @@ -25,11 +27,13 @@ public: ~AudioEncoder(); void add_mux(Mux *mux) { // Does not take ownership. + assert(mux != nullptr); muxes.push_back(mux); } void encode_audio(const std::vector &audio, int64_t audio_pts); void encode_last_audio(); + const AVCodec *get_codec() const { return ctx->codec; } AVCodecParametersWithDeleter get_codec_parameters(); private: @@ -39,7 +43,7 @@ private: int64_t last_pts = 0; // The first pts after all audio we've encoded. AVCodecContext *ctx; - AVAudioResampleContext *resampler; + SwrContext *resampler; AVFrame *audio_frame = nullptr; std::vector muxes; };