ffmpeg | branch: master | Paul B Mahol <[email protected]> | Tue Jan  1 13:33:16 
2019 +0100| [35a8179149c1995c4b720f0e9ac7762c5a9a46df] | committer: Paul B Mahol

avfilter/af_adelay: allow setting delays in seconds

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35a8179149c1995c4b720f0e9ac7762c5a9a46df
---

 doc/filters.texi        | 1 +
 libavfilter/af_adelay.c | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 45582dd2bd..5c651fc345 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -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
diff --git a/libavfilter/af_adelay.c b/libavfilter/af_adelay.c
index 7bc731d48a..eb97039566 100644
--- a/libavfilter/af_adelay.c
+++ b/libavfilter/af_adelay.c
@@ -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) {

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to