summaryrefslogtreecommitdiffstats
path: root/filters/f_swresample.h
diff options
context:
space:
mode:
Diffstat (limited to 'filters/f_swresample.h')
-rw-r--r--filters/f_swresample.h42
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);