X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Faudio_encoder.h;h=3a47f99afb0c3fe2cc792af12152312919017b39;hb=HEAD;hp=93adbafce954d6188f3d5ca86770ff7dace53f6c;hpb=392f9d1ccb835c05a3874c4bea163788b2c37024;p=nageru diff --git a/nageru/audio_encoder.h b/nageru/audio_encoder.h index 93adbaf..49cead7 100644 --- a/nageru/audio_encoder.h +++ b/nageru/audio_encoder.h @@ -3,19 +3,21 @@ #ifndef _AUDIO_ENCODER_H #define _AUDIO_ENCODER_H 1 +#include #include #include #include #include extern "C" { +#include #include #include -#include +#include #include } -#include "ffmpeg_raii.h" +#include "shared/ffmpeg_raii.h" class Mux; @@ -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; };