| @@ -22,7 +22,7 @@ · 21 unmodified lines |
| 22 | 22 | #include "avfilter.h" |
| 23 | 23 | #include "audio.h" |
| 24 | 24 | #include "formats.h" |
| 25 | | −#include "framesync.h" |
| 25 | +#include "framesync2.h" |
| 26 | 26 | #include "internal.h" |
| 27 | 27 | #include "video.h" |
| 28 | 28 | |
| @@ -48,12 +48,6 @@ static const AVOption streamselect_options[] = { · 19 unmodified lines |
| 48 | 48 | |
| 49 | 49 | AVFILTER_DEFINE_CLASS(streamselect); |
| 50 | 50 | |
| 51 | | −static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 52 | | −{ |
| 53 | | − StreamSelectContext *s = inlink->dst->priv; |
| 54 | | − return ff_framesync_filter_frame(&s->fs, inlink, in); |
| 55 | | −} |
| 56 | | − |
| 57 | 51 | static int process_frame(FFFrameSync *fs) |
| 58 | 52 | { |
| 59 | 53 | AVFilterContext *ctx = fs->parent; |
| @@ -62,7 +56,7 @@ static int process_frame(FFFrameSync *fs) · 2 unmodified lines |
| 62 | 56 | int i, j, ret = 0; |
| 63 | 57 | |
| 64 | 58 | for (i = 0; i < ctx->nb_inputs; i++) { |
| 65 | | − if ((ret = ff_framesync_get_frame(&s->fs, i, &in[i], 0)) < 0) |
| 59 | + if ((ret = ff_framesync2_get_frame(&s->fs, i, &in[i], 0)) < 0) |
| 66 | 60 | return ret; |
| 67 | 61 | } |
| 68 | 62 | |
| @@ -90,10 +84,10 @@ static int process_frame(FFFrameSync *fs) · 21 unmodified lines |
| 90 | 84 | return ret; |
| 91 | 85 | } |
| 92 | 86 | |
| 93 | | −static int request_frame(AVFilterLink *outlink) |
| 87 | +static int activate(AVFilterContext *ctx) |
| 94 | 88 | { |
| 95 | | − StreamSelectContext *s = outlink->src->priv; |
| 96 | | − return ff_framesync_request_frame(&s->fs, outlink); |
| 89 | + StreamSelectContext *s = ctx->priv; |
| 90 | + return ff_framesync2_activate(&s->fs); |
| 97 | 91 | } |
| 98 | 92 | |
| 99 | 93 | static int config_output(AVFilterLink *outlink) |
| @@ -130,7 +124,7 @@ static int config_output(AVFilterLink *outlink) · 30 unmodified lines |
| 130 | 124 | if (s->fs.opaque == s) |
| 131 | 125 | return 0; |
| 132 | 126 | |
| 133 | | − if ((ret = ff_framesync_init(&s->fs, ctx, ctx->nb_inputs)) < 0) |
| 127 | + if ((ret = ff_framesync2_init(&s->fs, ctx, ctx->nb_inputs)) < 0) |
| 134 | 128 | return ret; |
| 135 | 129 | |
| 136 | 130 | in = s->fs.in; |
| @@ -148,12 +142,11 @@ static int config_output(AVFilterLink *outlink) · 11 unmodified lines |
| 148 | 142 | if (!s->frames) |
| 149 | 143 | return AVERROR(ENOMEM); |
| 150 | 144 | |
| 151 | | − return ff_framesync_configure(&s->fs); |
| 145 | + return ff_framesync2_configure(&s->fs); |
| 152 | 146 | } |
| 153 | 147 | |
| 154 | | −static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_frame, int is_audio) |
| 148 | +static int parse_definition(AVFilterContext *ctx, int nb_pads, int is_input, int is_audio) |
| 155 | 149 | { |
| 156 | | − const int is_input = !!filter_frame; |
| 157 | 150 | const char *padtype = is_input ? "in" : "out"; |
| 158 | 151 | int i = 0, ret = 0; |
| 159 | 152 | |
| @@ -169,11 +162,9 @@ static int parse_definition(AVFilterContext *ctx, int nb_pads, void *filter_fram · 9 unmodified lines |
| 169 | 162 | av_log(ctx, AV_LOG_DEBUG, "Add %s pad %s\n", padtype, pad.name); |
| 170 | 163 | |
| 171 | 164 | if (is_input) { |
| 172 | | − pad.filter_frame = filter_frame; |
| 173 | 165 | ret = ff_insert_inpad(ctx, i, &pad); |
| 174 | 166 | } else { |
| 175 | 167 | pad.config_props = config_output; |
| 176 | | − pad.request_frame = request_frame; |
| 177 | 168 | ret = ff_insert_outpad(ctx, i, &pad); |
| 178 | 169 | } |
| 179 | 170 | |
| @@ -281,8 +272,8 @@ static av_cold int init(AVFilterContext *ctx) · 101 unmodified lines |
| 281 | 272 | if (!s->last_pts) |
| 282 | 273 | return AVERROR(ENOMEM); |
| 283 | 274 | |
| 284 | | − if ((ret = parse_definition(ctx, s->nb_inputs, filter_frame, s->is_audio)) < 0 || |
| 285 | | − (ret = parse_definition(ctx, nb_outputs, NULL, s->is_audio)) < 0) |
| 275 | + if ((ret = parse_definition(ctx, s->nb_inputs, 1, s->is_audio)) < 0 || |
| 276 | + (ret = parse_definition(ctx, nb_outputs, 0, s->is_audio)) < 0) |
| 286 | 277 | return ret; |
| 287 | 278 | |
| 288 | 279 | av_log(ctx, AV_LOG_DEBUG, "Configured with %d inpad and %d outpad\n", |
| @@ -298,7 +289,7 @@ static av_cold void uninit(AVFilterContext *ctx) · 9 unmodified lines |
| 298 | 289 | av_freep(&s->last_pts); |
| 299 | 290 | av_freep(&s->map); |
| 300 | 291 | av_freep(&s->frames); |
| 301 | | − ff_framesync_uninit(&s->fs); |
| 292 | + ff_framesync2_uninit(&s->fs); |
| 302 | 293 | } |
| 303 | 294 | |
| 304 | 295 | static int query_formats(AVFilterContext *ctx) |
| @@ -332,6 +323,7 @@ AVFilter ff_vf_streamselect = { · 27 unmodified lines |
| 332 | 323 | .query_formats = query_formats, |
| 333 | 324 | .process_command = process_command, |
| 334 | 325 | .uninit = uninit, |
| 326 | + .activate = activate, |
| 335 | 327 | .priv_size = sizeof(StreamSelectContext), |
| 336 | 328 | .priv_class = &streamselect_class, |
| 337 | 329 | .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS, |
| @@ -347,6 +339,7 @@ AVFilter ff_af_astreamselect = { · 9 unmodified lines |
| 347 | 339 | .query_formats = query_formats, |
| 348 | 340 | .process_command = process_command, |
| 349 | 341 | .uninit = uninit, |
| 342 | + .activate = activate, |
| 350 | 343 | .priv_size = sizeof(StreamSelectContext), |
| 351 | 344 | .priv_class = &astreamselect_class, |
| 352 | 345 | .flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS, |