avfilter/af_silenceremove: add timeline support
This commit is contained in:
parent
7927a96e2b
commit
965f99f904
@ -442,4 +442,5 @@ const AVFilter ff_af_silenceremove = {
|
|||||||
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLT,
|
FILTER_SAMPLEFMTS(AV_SAMPLE_FMT_FLT,
|
||||||
AV_SAMPLE_FMT_DBL),
|
AV_SAMPLE_FMT_DBL),
|
||||||
.process_command = ff_filter_process_command,
|
.process_command = ff_filter_process_command,
|
||||||
|
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
|
||||||
};
|
};
|
||||||
|
@ -318,6 +318,7 @@ static void fn(filter_start)(AVFilterContext *ctx,
|
|||||||
if (s->start_sample_count > start_duration) {
|
if (s->start_sample_count > start_duration) {
|
||||||
s->start_found_periods++;
|
s->start_found_periods++;
|
||||||
if (s->start_found_periods >= start_periods) {
|
if (s->start_found_periods >= start_periods) {
|
||||||
|
if (!ctx->is_disabled)
|
||||||
fn(flush)(dst, start, s->start_queue_pos, nb_channels,
|
fn(flush)(dst, start, s->start_queue_pos, nb_channels,
|
||||||
s->start_silence_count, start_nb_samples,
|
s->start_silence_count, start_nb_samples,
|
||||||
&out_nb_samples);
|
&out_nb_samples);
|
||||||
@ -329,7 +330,7 @@ static void fn(filter_start)(AVFilterContext *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip:
|
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;
|
const int dst_pos = out_nb_samples * nb_channels;
|
||||||
for (int ch = 0; ch < nb_channels; ch++)
|
for (int ch = 0; ch < nb_channels; ch++)
|
||||||
dst[dst_pos + ch] = start[start_pos + ch];
|
dst[dst_pos + ch] = start[start_pos + ch];
|
||||||
@ -401,7 +402,7 @@ static void fn(filter_stop)(AVFilterContext *ctx,
|
|||||||
if (restart && !stop_thres)
|
if (restart && !stop_thres)
|
||||||
s->stop_found_periods = 0;
|
s->stop_found_periods = 0;
|
||||||
|
|
||||||
if (s->stop_found_periods >= 0) {
|
if (s->stop_found_periods >= 0 || ctx->is_disabled) {
|
||||||
if (s->found_nonsilence) {
|
if (s->found_nonsilence) {
|
||||||
s->stop_sample_count += stop_thres;
|
s->stop_sample_count += stop_thres;
|
||||||
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;
|
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;
|
const int dst_pos = out_nb_samples * nb_channels;
|
||||||
for (int ch = 0; ch < nb_channels; ch++)
|
for (int ch = 0; ch < nb_channels; ch++)
|
||||||
dst[dst_pos + ch] = stop[stop_pos + ch];
|
dst[dst_pos + ch] = stop[stop_pos + ch];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user