#ifndef AUDIO_RESAMPLER_H_ #define AUDIO_RESAMPLER_H_ #include #include #include #include "decoder.h" #include "encoder.h" struct Resampler { SwrContext *swr; uint64_t stored; uint64_t needed; int in_sample_rate; /* Passed by *_init, used by *_conf */ const AVChannelLayout *out_chlayout; enum AVSampleFormat out_sample_fmt; uint64_t out_sample_rate; uint64_t out_frame_size; }; int resampler_init_for_encoder (struct Resampler *resampler, const struct Encoder *encoder); int resampler_conf_for_decoder (struct Resampler *resampler, const struct Decoder *decoder); int resampler_send_frame (struct Resampler *resampler, AVFrame *in); int resampler_send_empty (struct Resampler *resampler, unsigned int microsecond); int resampler_convert (struct Resampler *resmapler, AVFrame *out); int resampler_has_enough (struct Resampler *resampler); void resampler_free (struct Resampler *resampler); #endif // AUDIO_RESAMPLER_H_