diff options
author | wm4 <wm4@nowhere> | 2018-01-18 14:44:20 +0100 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2018-01-30 03:10:27 -0800 |
commit | b9f804b566c4c528714e4ec5e63675ad7ba5fefd (patch) | |
tree | 49d6fcd42ce6597a67aa2af59b7f20beb21a2e14 /filters/f_swresample.h | |
parent | 76276c92104c31ee936ba5c76a76072f09978c5f (diff) | |
download | mpv-b9f804b566c4c528714e4ec5e63675ad7ba5fefd.tar.bz2 mpv-b9f804b566c4c528714e4ec5e63675ad7ba5fefd.tar.xz |
audio: rewrite filtering glue code
Use the new filtering code for audio too.
Diffstat (limited to 'filters/f_swresample.h')
-rw-r--r-- | filters/f_swresample.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/filters/f_swresample.h b/filters/f_swresample.h new file mode 100644 index 0000000000..44b2e35d08 --- /dev/null +++ b/filters/f_swresample.h @@ -0,0 +1,42 @@ +#pragma once + +#include <stdbool.h> + +#include "audio/chmap.h" +#include "filter.h" + +// Resampler filter, wrapping libswresample or libavresample. +struct mp_swresample { + struct mp_filter *f; + // Desired output parameters. For unset parameters, passes through the + // format. + int out_rate; + int out_format; + struct mp_chmap out_channels; + double speed; +}; + +struct mp_resample_opts { + int filter_size; + int phase_shift; + int linear; + double cutoff; + int normalize; + int allow_passthrough; + char **avopts; +}; + +#define MP_RESAMPLE_OPTS_DEF { \ + .filter_size = 16, \ + .cutoff = 0.0, \ + .phase_shift = 10, \ + .normalize = 0, \ + } + +// Create the filter. If opts==NULL, use the global options as defaults. +// Free with talloc_free(mp_swresample.f). +struct mp_swresample *mp_swresample_create(struct mp_filter *parent, + struct mp_resample_opts *opts); + +// Internal resampler delay. Does not include data buffered in mp_pins and such. +double mp_swresample_get_delay(struct mp_swresample *s); |