summaryrefslogtreecommitdiff
path: root/libavfilter/asrc_hilbert.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-08-21 16:31:04 +0200
committerPaul B Mahol <onemda@gmail.com>2021-08-21 16:31:40 +0200
commit6854cc2ec70f5fa9f7f410ec802126fc97630c15 (patch)
treea205385ed02806cbe507c4112c10a48fdec7045d /libavfilter/asrc_hilbert.c
parent5e2e9d50cec0bda144828af272346b6f86613909 (diff)
downloadffmpeg-6854cc2ec70f5fa9f7f410ec802126fc97630c15.tar.gz
avfilter/asrc_hilbert: switch to activate
Allow to set the EOF timestamp.
Diffstat (limited to 'libavfilter/asrc_hilbert.c')
-rw-r--r--libavfilter/asrc_hilbert.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/libavfilter/asrc_hilbert.c b/libavfilter/asrc_hilbert.c
index 460721d96a..8ff9934967 100644
--- a/libavfilter/asrc_hilbert.c
+++ b/libavfilter/asrc_hilbert.c
@@ -23,6 +23,7 @@
#include "audio.h"
#include "avfilter.h"
#include "internal.h"
+#include "filters.h"
#include "window_func.h"
typedef struct HilbertContext {
@@ -143,16 +144,21 @@ static av_cold int config_props(AVFilterLink *outlink)
return 0;
}
-static int request_frame(AVFilterLink *outlink)
+static int activate(AVFilterContext *ctx)
{
- AVFilterContext *ctx = outlink->src;
+ AVFilterLink *outlink = ctx->outputs[0];
HilbertContext *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);
@@ -168,7 +174,6 @@ static const AVFilterPad hilbert_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
- .request_frame = request_frame,
.config_props = config_props,
},
};
@@ -179,6 +184,7 @@ const AVFilter ff_asrc_hilbert = {
.query_formats = query_formats,
.init = init,
.uninit = uninit,
+ .activate = activate,
.priv_size = sizeof(HilbertContext),
.inputs = NULL,
FILTER_OUTPUTS(hilbert_outputs),