summaryrefslogtreecommitdiffstats
path: root/audio/filter/af_lavrresample.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-06-04 19:22:45 +0200
committerwm4 <wm4@nowhere>2015-06-04 19:22:45 +0200
commit935997d4d68d7dc142a1b5c492be64a8e87b4763 (patch)
treec4c3c068584530d149b72e2c155bd3004a8f3f00 /audio/filter/af_lavrresample.c
parent2dc46423d6c794b0b840f939afdc3e3cd5125480 (diff)
downloadmpv-935997d4d68d7dc142a1b5c492be64a8e87b4763.tar.bz2
mpv-935997d4d68d7dc142a1b5c492be64a8e87b4763.tar.xz
af_lavrresample: use a new libswresample function if available
It was recently added to libswresample, and it does exactly what we need.
Diffstat (limited to 'audio/filter/af_lavrresample.c')
-rw-r--r--audio/filter/af_lavrresample.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/audio/filter/af_lavrresample.c b/audio/filter/af_lavrresample.c
index f5c0e33fe9..fec3927671 100644
--- a/audio/filter/af_lavrresample.c
+++ b/audio/filter/af_lavrresample.c
@@ -114,8 +114,12 @@ static void drop_all_output(struct af_resample *s)
}
static int get_out_samples(struct af_resample *s, int in_samples)
{
+#if LIBSWRESAMPLE_VERSION_MAJOR > 1 || LIBSWRESAMPLE_VERSION_MINOR >= 2
+ return swr_get_out_samples(s->avrctx, in_samples);
+#else
return av_rescale_rnd(in_samples, s->ctx.out_rate, s->ctx.in_rate, AV_ROUND_UP)
+ swr_get_delay(s->avrctx, s->ctx.out_rate);
+#endif
}
#endif