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