#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.
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);