[FFmpeg-cvslog] avfilter/asrc_afirsrc: switch to activate
Paul B Mahol
git at videolan.org
Sat Aug 21 17:45:58 EEST 2021
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Aug 21 16:26:46 2021 +0200| [5e2e9d50cec0bda144828af272346b6f86613909] | committer: Paul B Mahol
avfilter/asrc_afirsrc: switch to activate
Allow to set the EOF timestamp.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5e2e9d50cec0bda144828af272346b6f86613909
---
libavfilter/asrc_afirsrc.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/libavfilter/asrc_afirsrc.c b/libavfilter/asrc_afirsrc.c
index 9dd04d9533..cea9b2fe8a 100644
--- a/libavfilter/asrc_afirsrc.c
+++ b/libavfilter/asrc_afirsrc.c
@@ -24,6 +24,7 @@
#include "libavutil/tx.h"
#include "audio.h"
#include "avfilter.h"
+#include "filters.h"
#include "internal.h"
#include "window_func.h"
@@ -273,16 +274,21 @@ static av_cold int config_output(AVFilterLink *outlink)
return 0;
}
-static int request_frame(AVFilterLink *outlink)
+static int activate(AVFilterContext *ctx)
{
- AVFilterContext *ctx = outlink->src;
+ AVFilterLink *outlink = ctx->outputs[0];
AudioFIRSourceContext *s = ctx->priv;
AVFrame *frame;
int nb_samples;
+ if (!ff_outlink_frame_wanted(outlink))
+ return FFERROR_NOT_READY;
+
nb_samples = FFMIN(s->nb_samples, s->nb_taps - s->pts);
- if (!nb_samples)
- return AVERROR_EOF;
+ if (nb_samples <= 0) {
+ ff_outlink_set_status(outlink, AVERROR_EOF, s->pts);
+ return 0;
+ }
if (!(frame = ff_get_audio_buffer(outlink, nb_samples)))
return AVERROR(ENOMEM);
@@ -298,7 +304,6 @@ static const AVFilterPad afirsrc_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
- .request_frame = request_frame,
.config_props = config_output,
},
};
@@ -309,6 +314,7 @@ const AVFilter ff_asrc_afirsrc = {
.query_formats = query_formats,
.init = init,
.uninit = uninit,
+ .activate = activate,
.priv_size = sizeof(AudioFIRSourceContext),
.inputs = NULL,
FILTER_OUTPUTS(afirsrc_outputs),
More information about the ffmpeg-cvslog
mailing list