[FFmpeg-cvslog] avfilter/af_agate: switch to internal timeline

Paul B Mahol git at videolan.org
Sun Oct 3 14:08:00 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Oct  3 12:43:01 2021 +0200| [f9fc1fed2957490673be13b53c2d574456f5b959] | committer: Paul B Mahol

avfilter/af_agate: switch to internal timeline

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

 libavfilter/af_agate.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_agate.c b/libavfilter/af_agate.c
index 5de2cc0f0e..08ce064918 100644
--- a/libavfilter/af_agate.c
+++ b/libavfilter/af_agate.c
@@ -144,6 +144,7 @@ static void gate(AudioGateContext *s,
                  int nb_samples, double level_in, double level_sc,
                  AVFilterLink *inlink, AVFilterLink *sclink)
 {
+    AVFilterContext *ctx = inlink->dst;
     const double makeup = s->makeup;
     const double attack_coeff = s->attack_coeff;
     const double release_coeff = s->release_coeff;
@@ -151,6 +152,7 @@ static void gate(AudioGateContext *s,
 
     for (n = 0; n < nb_samples; n++, src += inlink->channels, dst += inlink->channels, scsrc += sclink->channels) {
         double abs_sample = fabs(scsrc[0] * level_sc), gain = 1.0;
+        double factor;
         int detected;
 
         if (s->link == 1) {
@@ -178,8 +180,9 @@ static void gate(AudioGateContext *s,
                                s->knee, s->knee_start, s->knee_stop,
                                s->range, s->mode);
 
+        factor = ctx->is_disabled ? 1.f : level_in * gain * makeup;
         for (c = 0; c < inlink->channels; c++)
-            dst[c] = src[c] * level_in * gain * makeup;
+            dst[c] = src[c] * factor;
     }
 }
 
@@ -407,6 +410,6 @@ const AVFilter ff_af_sidechaingate = {
     FILTER_INPUTS(sidechaingate_inputs),
     FILTER_OUTPUTS(sidechaingate_outputs),
     .process_command = ff_filter_process_command,
-    .flags          = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
+    .flags          = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
 };
 #endif  /* CONFIG_SIDECHAINGATE_FILTER */



More information about the ffmpeg-cvslog mailing list