avfilter/af_asetnsamples: add timeline support

This commit is contained in:
Paul B Mahol 2023-05-05 20:53:39 +02:00
parent 03800bcaf3
commit 782ea8b2e5
1 changed files with 6 additions and 2 deletions

View File

@ -61,12 +61,15 @@ static int activate(AVFilterContext *ctx)
FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);
ret = ff_inlink_consume_samples(inlink, s->nb_out_samples, s->nb_out_samples, &frame); if (ctx->is_disabled)
ret = ff_inlink_consume_frame(inlink, &frame);
else
ret = ff_inlink_consume_samples(inlink, s->nb_out_samples, s->nb_out_samples, &frame);
if (ret < 0) if (ret < 0)
return ret; return ret;
if (ret > 0) { if (ret > 0) {
if (!s->pad || frame->nb_samples == s->nb_out_samples) if (!s->pad || ctx->is_disabled || frame->nb_samples == s->nb_out_samples)
return ff_filter_frame(outlink, frame); return ff_filter_frame(outlink, frame);
pad_frame = ff_get_audio_buffer(outlink, s->nb_out_samples); pad_frame = ff_get_audio_buffer(outlink, s->nb_out_samples);
@ -123,5 +126,6 @@ const AVFilter ff_af_asetnsamples = {
FILTER_INPUTS(asetnsamples_inputs), FILTER_INPUTS(asetnsamples_inputs),
FILTER_OUTPUTS(asetnsamples_outputs), FILTER_OUTPUTS(asetnsamples_outputs),
.activate = activate, .activate = activate,
.flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL,
.process_command = ff_filter_process_command, .process_command = ff_filter_process_command,
}; };