diff options
author | Paul B Mahol <onemda@gmail.com> | 2021-08-21 16:37:20 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2021-08-21 16:43:21 +0200 |
commit | 99ccad843f51e2fc16a8dada225a14928bd46fa6 (patch) | |
tree | 2a7a47e66950bdaf0be097a6e9e5fa19aca3f2de /libavfilter | |
parent | 6854cc2ec70f5fa9f7f410ec802126fc97630c15 (diff) | |
download | ffmpeg-99ccad843f51e2fc16a8dada225a14928bd46fa6.tar.gz |
avfilter/aevalsrc: switch to activate
Allow to set the EOF timestamp.
FATE test is updated, as last 2 frames were duplicated.
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/aeval.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c index 7cb05d206a..5f0f25dd59 100644 --- a/libavfilter/aeval.c +++ b/libavfilter/aeval.c @@ -30,6 +30,7 @@ #include "libavutil/parseutils.h" #include "avfilter.h" #include "audio.h" +#include "filters.h" #include "internal.h" static const char * const var_names[] = { @@ -259,21 +260,27 @@ static int query_formats(AVFilterContext *ctx) return ff_set_common_samplerates_from_list(ctx, sample_rates); } -static int request_frame(AVFilterLink *outlink) +static int activate(AVFilterContext *ctx) { + AVFilterLink *outlink = ctx->outputs[0]; EvalContext *eval = outlink->src->priv; AVFrame *samplesref; int i, j; int64_t t = av_rescale(eval->n, AV_TIME_BASE, eval->sample_rate); int nb_samples; + if (!ff_outlink_frame_wanted(outlink)) + return FFERROR_NOT_READY; + if (eval->duration >= 0 && t >= eval->duration) return AVERROR_EOF; if (eval->duration >= 0) { nb_samples = FFMIN(eval->nb_samples, av_rescale(eval->duration, eval->sample_rate, AV_TIME_BASE) - eval->pts); - if (!nb_samples) - return AVERROR_EOF; + if (!nb_samples) { + ff_outlink_set_status(outlink, AVERROR_EOF, eval->pts); + return 0; + } } else { nb_samples = eval->nb_samples; } @@ -305,7 +312,6 @@ static const AVFilterPad aevalsrc_outputs[] = { .name = "default", .type = AVMEDIA_TYPE_AUDIO, .config_props = config_props, - .request_frame = request_frame, }, }; @@ -315,6 +321,7 @@ const AVFilter ff_asrc_aevalsrc = { .query_formats = query_formats, .init = init, .uninit = uninit, + .activate = activate, .priv_size = sizeof(EvalContext), .inputs = NULL, FILTER_OUTPUTS(aevalsrc_outputs), |