]> git.sesse.net Git - nageru/blobdiff - audio_encoder.h
Fix an issue where the mixer lagging too much behind CEF would cause us to display...
[nageru] / audio_encoder.h
index 682cc47414698973e26646e260c8e3e2f1001c63..93adbafce954d6188f3d5ca86770ff7dace53f6c 100644 (file)
@@ -3,20 +3,25 @@
 #ifndef _AUDIO_ENCODER_H
 #define _AUDIO_ENCODER_H 1
 
+#include <stddef.h>
+#include <stdint.h>
 #include <string>
 #include <vector>
 
 extern "C" {
 #include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
 #include <libavresample/avresample.h>
 #include <libavutil/frame.h>
 }
 
-#include "mux.h"
+#include "ffmpeg_raii.h"
+
+class Mux;
 
 class AudioEncoder {
 public:
-       AudioEncoder(const std::string &codec_name, int bit_rate);
+       AudioEncoder(const std::string &codec_name, int bit_rate, const AVOutputFormat *oformat);
        ~AudioEncoder();
 
        void add_mux(Mux *mux) {  // Does not take ownership.
@@ -25,7 +30,7 @@ public:
        void encode_audio(const std::vector<float> &audio, int64_t audio_pts);
        void encode_last_audio();
 
-       const AVCodec *get_codec() { return ctx->codec; }
+       AVCodecParametersWithDeleter get_codec_parameters();
 
 private:
        void encode_audio_one_frame(const float *audio, size_t num_samples, int64_t audio_pts);