diff options
author | Paul B Mahol <onemda@gmail.com> | 2023-05-27 11:03:18 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2023-05-27 11:18:00 +0200 |
commit | 965f99f904a433c341c04ac992d5ab8f08f0aae2 (patch) | |
tree | 32ac7f74e28b4f1674b0451eee1d56cc8897359f | |
parent | 7927a96e2b8b9063592d7c609af5b7d544a9c475 (diff) | |
download | ffmpeg-965f99f904a433c341c04ac992d5ab8f08f0aae2.tar.gz |
avfilter/af_silenceremove: add timeline support
-rw-r--r-- | libavfilter/af_silenceremove.c | 1 | ||||
-rw-r--r-- | libavfilter/silenceremove_template.c | 13 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libavfilter/af_silenceremove.c b/libavfilter/af_silenceremove.c index 755ed10bd0..865df4d13a 100644 --- a/libavfilter/af_silenceremove.c +++ b/libavfilter/af_silenceremove.c @@ -442,4 +442,5 @@ const AVFilter ff_af_silenceremove = { FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), .process_command = ff_filter_process_command, + .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, }; diff --git a/libavfilter/silenceremove_template.c b/libavfilter/silenceremove_template.c index 143d399f9e..e07a615ae7 100644 --- a/libavfilter/silenceremove_template.c +++ b/libavfilter/silenceremove_template.c @@ -318,9 +318,10 @@ static void fn(filter_start)(AVFilterContext *ctx, if (s->start_sample_count > start_duration) { s->start_found_periods++; if (s->start_found_periods >= start_periods) { - fn(flush)(dst, start, s->start_queue_pos, nb_channels, - s->start_silence_count, start_nb_samples, - &out_nb_samples); + if (!ctx->is_disabled) + fn(flush)(dst, start, s->start_queue_pos, nb_channels, + s->start_silence_count, start_nb_samples, + &out_nb_samples); s->start_silence_count = 0; s->start_found_periods = -1; } @@ -329,7 +330,7 @@ static void fn(filter_start)(AVFilterContext *ctx, } skip: - if (s->start_found_periods < 0) { + if (s->start_found_periods < 0 || ctx->is_disabled) { const int dst_pos = out_nb_samples * nb_channels; for (int ch = 0; ch < nb_channels; ch++) dst[dst_pos + ch] = start[start_pos + ch]; @@ -401,7 +402,7 @@ static void fn(filter_stop)(AVFilterContext *ctx, if (restart && !stop_thres) s->stop_found_periods = 0; - if (s->stop_found_periods >= 0) { + if (s->stop_found_periods >= 0 || ctx->is_disabled) { if (s->found_nonsilence) { s->stop_sample_count += stop_thres; s->stop_sample_count *= stop_thres; @@ -424,7 +425,7 @@ static void fn(filter_stop)(AVFilterContext *ctx, s->stop_sample_count = 0; } - if (s->stop_found_periods >= 0) { + if (s->stop_found_periods >= 0 || ctx->is_disabled) { const int dst_pos = out_nb_samples * nb_channels; for (int ch = 0; ch < nb_channels; ch++) dst[dst_pos + ch] = stop[stop_pos + ch]; |