]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/af_adelay: allow setting delays in seconds
authorPaul B Mahol <onemda@gmail.com>
Tue, 1 Jan 2019 12:33:16 +0000 (13:33 +0100)
committerPaul B Mahol <onemda@gmail.com>
Tue, 1 Jan 2019 12:33:16 +0000 (13:33 +0100)
doc/filters.texi
libavfilter/af_adelay.c

index 45582dd2bd4956974f1f777c0b583f9932a5e03e..5c651fc345d642bf016ea2748f1606c8f8de4801 100644 (file)
@@ -683,6 +683,7 @@ Set list of delays in milliseconds for each channel separated by '|'.
 Unused delays will be silently ignored. If number of given delays is
 smaller than number of channels all remaining channels will not be delayed.
 If you want to delay exact number of samples, append 'S' to number.
+If you want instead to delay in seconds, append 's' to number.
 @end table
 
 @subsection Examples
index 7bc731d48a363f3f180eaad6bd6a8cc57df233b1..eb97039566d7169867e0eb90b51046fd4d4962b2 100644 (file)
@@ -141,7 +141,7 @@ static int config_input(AVFilterLink *inlink)
     p = s->delays;
     for (i = 0; i < s->nb_delays; i++) {
         ChanDelay *d = &s->chandelay[i];
-        float delay;
+        float delay, div;
         char type = 0;
         int ret;
 
@@ -152,8 +152,9 @@ static int config_input(AVFilterLink *inlink)
 
         ret = av_sscanf(arg, "%d%c", &d->delay, &type);
         if (ret != 2 || type != 'S') {
+            div = type == 's' ? 1.0 : 1000.0;
             av_sscanf(arg, "%f", &delay);
-            d->delay = delay * inlink->sample_rate / 1000.0;
+            d->delay = delay * inlink->sample_rate / div;
         }
 
         if (d->delay < 0) {