diff options
author | bbergeron <[email protected]> | 2024-04-03 17:32:01 -0400 |
---|---|---|
committer | bbergeron <[email protected]> | 2024-04-03 17:32:01 -0400 |
commit | c1cb78d574c0429aa5e3ff3a2b3886e4bc153212 (patch) | |
tree | bf68806bcbddcafafc015b28c25550ea457eeecc /audio/resampler.h |
Reset Git repo and use a pseudonym to sign commits
I used to sign my commits with my real name and my personal email
address, which I wanted scrubbed off the "B." pseudosphere. Re-creating
a new git repository was safer than simpler than re-writing the
history (although the latter could've also worked but, oh well).
Diffstat (limited to 'audio/resampler.h')
-rw-r--r-- | audio/resampler.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/audio/resampler.h b/audio/resampler.h new file mode 100644 index 0000000..0bb471c --- /dev/null +++ b/audio/resampler.h @@ -0,0 +1,31 @@ +#ifndef AUDIO_RESAMPLER_H_ +#define AUDIO_RESAMPLER_H_ + +#include <libavutil/channel_layout.h> +#include <libavutil/samplefmt.h> +#include <libswresample/swresample.h> +#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_ |