From 490e263529a5e49e8a7b6d9c6c21a1312f3ac1a4 Mon Sep 17 00:00:00 2001 From: Christoph Heinrich Date: Sat, 16 Jul 2022 03:17:41 +0200 Subject: [PATCH] af_rubberband: add new engine option in rubberband 3.0.0 --- DOCS/interface-changes.rst | 2 ++ audio/filter/af_rubberband.c | 17 +++++++++++++++-- meson.build | 1 + wscript | 4 ++++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 1c3e6496a9..6629d3ee09 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -43,6 +43,8 @@ Interface changes - add `film-grain` sub-parameter to `format` video filter - add experimental `--vo=vaapi-wayland` video output driver - add `--x11-present` for controlling whether to use xorg's present extension + - add `engine` option to the `rubberband` audio filter to support the new + engine introduced in rubberband 3.0.0. Defaults to `finer` (new engine). --- mpv 0.34.0 --- - deprecate selecting by card number with `--drm-connector`, add `--drm-device` which can be used instead diff --git a/audio/filter/af_rubberband.c b/audio/filter/af_rubberband.c index 4df2001c49..40b0c7188b 100644 --- a/audio/filter/af_rubberband.c +++ b/audio/filter/af_rubberband.c @@ -20,6 +20,8 @@ #include +#include "config.h" + #include "audio/aframe.h" #include "audio/format.h" #include "common/common.h" @@ -31,7 +33,7 @@ // command line options struct f_opts { int transients, detector, phase, window, - smoothing, formant, pitch, channels; + smoothing, formant, pitch, channels, engine; double scale; }; @@ -78,7 +80,10 @@ static bool init_rubberband(struct mp_filter *f) int opts = p->opts->transients | p->opts->detector | p->opts->phase | p->opts->window | p->opts->smoothing | p->opts->formant | - p->opts->pitch | p-> opts->channels | + p->opts->pitch | p->opts->channels | +#if HAVE_RUBBERBAND_3 + p->opts->engine | +#endif RubberBandOptionProcessRealTime; int rate = mp_aframe_get_rate(p->pending); @@ -331,6 +336,9 @@ const struct mp_user_filter_entry af_rubberband = { .transients = RubberBandOptionTransientsMixed, .formant = RubberBandOptionFormantPreserved, .channels = RubberBandOptionChannelsTogether, +#if HAVE_RUBBERBAND_3 + .engine = RubberBandOptionEngineFiner, +#endif }, .options = (const struct m_option[]) { {"transients", OPT_CHOICE(transients, @@ -361,6 +369,11 @@ const struct mp_user_filter_entry af_rubberband = { {"channels", OPT_CHOICE(channels, {"apart", RubberBandOptionChannelsApart}, {"together", RubberBandOptionChannelsTogether})}, +#if HAVE_RUBBERBAND_3 + {"engine", OPT_CHOICE(engine, + {"finer", RubberBandOptionEngineFiner}, + {"faster", RubberBandOptionEngineFaster})}, +#endif {"pitch-scale", OPT_DOUBLE(scale), M_RANGE(0.01, 100)}, {0} }, diff --git a/meson.build b/meson.build index 4459f4ffaf..920230a301 100644 --- a/meson.build +++ b/meson.build @@ -1774,6 +1774,7 @@ conf_data.set10('HAVE_PULSE', pulse.found()) conf_data.set10('HAVE_RPI', rpi['use']) conf_data.set10('HAVE_RPI_MMAL', rpi_mmal.found()) conf_data.set10('HAVE_RUBBERBAND', rubberband.found()) +conf_data.set10('HAVE_RUBBERBAND_3', rubberband.version().version_compare('>= 3.0.0')) conf_data.set10('HAVE_SDL2', sdl2.found()) conf_data.set10('HAVE_SDL2_AUDIO', sdl2_audio.allowed()) conf_data.set10('HAVE_SDL2_GAMEPAD', sdl2_gamepad.allowed()) diff --git a/wscript b/wscript index 283f9b3ac5..40db44cb95 100644 --- a/wscript +++ b/wscript @@ -395,6 +395,10 @@ iconv support use --disable-iconv.", 'name': 'jpegxl', 'desc': 'JPEG XL support via libavcodec', 'func': check_pkg_config('libavcodec >= 59.27.100'), + }, { + 'name': 'rubberband-3', + 'desc': 'new engine support for librubberband', + 'func': check_pkg_config('rubberband >= 3.0.0'), } ]