Allow to set the EOF timestamp.
Unified · Split
| @@ -23,6 +23,7 @@ · 22 unmodified lines | ||
| 23 | 23 | #include "audio.h" |
| 24 | 24 | #include "avfilter.h" |
| 25 | 25 | #include "internal.h" |
| 26 | +#include "filters.h" | |
| 26 | 27 | #include "window_func.h" |
| 27 | 28 | |
| 28 | 29 | typedef struct HilbertContext { |
| @@ -143,16 +144,21 @@ static av_cold int config_props(AVFilterLink *outlink) · 114 unmodified lines | ||
| 143 | 144 | return 0; |
| 144 | 145 | } |
| 145 | 146 | |
| 146 | −static int request_frame(AVFilterLink *outlink) | |
| 147 | +static int activate(AVFilterContext *ctx) | |
| 147 | 148 | { |
| 148 | − AVFilterContext *ctx = outlink->src; | |
| 149 | + AVFilterLink *outlink = ctx->outputs[0]; | |
| 149 | 150 | HilbertContext *s = ctx->priv; |
| 150 | 151 | AVFrame *frame; |
| 151 | 152 | int nb_samples; |
| 152 | 153 | |
| 154 | + if (!ff_outlink_frame_wanted(outlink)) | |
| 155 | + return FFERROR_NOT_READY; | |
| 156 | + | |
| 153 | 157 | nb_samples = FFMIN(s->nb_samples, s->nb_taps - s->pts); |
| 154 | − if (!nb_samples) | |
| 155 | − return AVERROR_EOF; | |
| 158 | + if (nb_samples <= 0) { | |
| 159 | + ff_outlink_set_status(outlink, AVERROR_EOF, s->pts); | |
| 160 | + return 0; | |
| 161 | + } | |
| 156 | 162 | |
| 157 | 163 | if (!(frame = ff_get_audio_buffer(outlink, nb_samples))) |
| 158 | 164 | return AVERROR(ENOMEM); |
| @@ -168,7 +174,6 @@ static const AVFilterPad hilbert_outputs[] = { · 9 unmodified lines | ||
| 168 | 174 | { |
| 169 | 175 | .name = "default", |
| 170 | 176 | .type = AVMEDIA_TYPE_AUDIO, |
| 171 | − .request_frame = request_frame, | |
| 172 | 177 | .config_props = config_props, |
| 173 | 178 | }, |
| 174 | 179 | }; |
| @@ -179,6 +184,7 @@ const AVFilter ff_asrc_hilbert = { · 4 unmodified lines | ||
| 179 | 184 | .query_formats = query_formats, |
| 180 | 185 | .init = init, |
| 181 | 186 | .uninit = uninit, |
| 187 | + .activate = activate, | |
| 182 | 188 | .priv_size = sizeof(HilbertContext), |
| 183 | 189 | .inputs = NULL, |
| 184 | 190 | FILTER_OUTPUTS(hilbert_outputs), |