Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Koshevoy <pkoshevoy@gmail.com>2018-10-04 07:59:31 +0300
committerPavel Koshevoy <pkoshevoy@gmail.com>2018-10-05 06:09:41 +0300
commit03123e4053d640070ca77adf99d5ae487806d51e (patch)
tree64758fd69c1422145aff71e9dec479ae9d11822b /libavfilter/af_atempo.c
parentd39fae08866efebbfdf25951fbaff4df9d26e6b3 (diff)
lavfi/atempo: fix tempo range limit inconsistency
yae_set_tempo was overlooked when max tempo limit was raised to 100. tested with: ./ffmpeg_g -i Delerium/SemanticSpaces/Gateway.mp3 \ -af asendcmd=f=asendcmd.cfg,atempo=1.0 -y /tmp/asendcmd-atempo.wav where asendcmd.cfg was: 15.0-45.0 [enter] atempo tempo 2.0, [leave] atempo tempo 0.5; 60.0-300.0 [enter] atempo tempo 4.0, [leave] atempo tempo 1.0;
Diffstat (limited to 'libavfilter/af_atempo.c')
-rw-r--r--libavfilter/af_atempo.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/libavfilter/af_atempo.c b/libavfilter/af_atempo.c
index 52f15f2769..bfdad7d76b 100644
--- a/libavfilter/af_atempo.c
+++ b/libavfilter/af_atempo.c
@@ -149,11 +149,16 @@ typedef struct ATempoContext {
uint64_t nsamples_out;
} ATempoContext;
+#define YAE_ATEMPO_MIN 0.5
+#define YAE_ATEMPO_MAX 100.0
+
#define OFFSET(x) offsetof(ATempoContext, x)
static const AVOption atempo_options[] = {
{ "tempo", "set tempo scale factor",
- OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 0.5, 100.0,
+ OFFSET(tempo), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 },
+ YAE_ATEMPO_MIN,
+ YAE_ATEMPO_MAX,
AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM },
{ NULL }
};
@@ -331,9 +336,9 @@ static int yae_set_tempo(AVFilterContext *ctx, const char *arg_tempo)
return AVERROR(EINVAL);
}
- if (tempo < 0.5 || tempo > 2.0) {
- av_log(ctx, AV_LOG_ERROR, "Tempo value %f exceeds [0.5, 2.0] range\n",
- tempo);
+ if (tempo < YAE_ATEMPO_MIN || tempo > YAE_ATEMPO_MAX) {
+ av_log(ctx, AV_LOG_ERROR, "Tempo value %f exceeds [%f, %f] range\n",
+ tempo, YAE_ATEMPO_MIN, YAE_ATEMPO_MAX);
return AVERROR(EINVAL);
}