Showing the changes to libavfilter (56 of 56 files). Show all
Unified · Split
| @@ -363,6 +363,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 362 unmodified lines | ||
| 363 | 363 | { |
| 364 | 364 | AVFilterContext *ctx = inlink->dst; |
| 365 | 365 | AVFilterLink *outlink = ctx->outputs[0]; |
| 366 | + FilterLink *outl = ff_filter_link(outlink); | |
| 366 | 367 | AudioDRCContext *s = ctx->priv; |
| 367 | 368 | AVFrame *out; |
| 368 | 369 | int ret; |
| @@ -373,7 +374,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 4 unmodified lines | ||
| 373 | 374 | goto fail; |
| 374 | 375 | } |
| 375 | 376 | |
| 376 | − s->var_values[VAR_SN] = outlink->sample_count_in; | |
| 377 | + s->var_values[VAR_SN] = outl->sample_count_in; | |
| 377 | 378 | s->var_values[VAR_T] = s->var_values[VAR_SN] * (double)1/outlink->sample_rate; |
| 378 | 379 | |
| 379 | 380 | s->in = in; |
| @@ -355,8 +355,9 @@ static void process_frame(AVFilterContext *ctx, · 354 unmodified lines | ||
| 355 | 355 | double *prior, double *prior_band_excit, int track_noise) |
| 356 | 356 | { |
| 357 | 357 | AVFilterLink *outlink = ctx->outputs[0]; |
| 358 | + FilterLink *outl = ff_filter_link(outlink); | |
| 358 | 359 | const double *abs_var = dnch->abs_var; |
| 359 | − const double ratio = outlink->frame_count_out ? s->ratio : 1.0; | |
| 360 | + const double ratio = outl->frame_count_out ? s->ratio : 1.0; | |
| 360 | 361 | const double rratio = 1. - ratio; |
| 361 | 362 | const int *bin2band = s->bin2band; |
| 362 | 363 | double *noisy_data = dnch->noisy_data; |
| @@ -38,6 +38,7 @@ · 37 unmodified lines | ||
| 38 | 38 | |
| 39 | 39 | #include "audio.h" |
| 40 | 40 | #include "avfilter.h" |
| 41 | +#include "filters.h" | |
| 41 | 42 | #include "internal.h" |
| 42 | 43 | |
| 43 | 44 | typedef struct AShowInfoContext { |
| @@ -173,6 +174,7 @@ static void dump_unknown(AVFilterContext *ctx, AVFrameSideData *sd) · 129 unmodified lines | ||
| 173 | 174 | |
| 174 | 175 | static int filter_frame(AVFilterLink *inlink, AVFrame *buf) |
| 175 | 176 | { |
| 177 | + FilterLink *inl = ff_filter_link(inlink); | |
| 176 | 178 | AVFilterContext *ctx = inlink->dst; |
| 177 | 179 | AShowInfoContext *s = ctx->priv; |
| 178 | 180 | char chlayout_str[128]; |
| @@ -203,7 +205,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) · 24 unmodified lines | ||
| 203 | 205 | "n:%"PRId64" pts:%s pts_time:%s " |
| 204 | 206 | "fmt:%s channels:%d chlayout:%s rate:%d nb_samples:%d " |
| 205 | 207 | "checksum:%08"PRIX32" ", |
| 206 | − inlink->frame_count_out, | |
| 208 | + inl->frame_count_out, | |
| 207 | 209 | av_ts2str(buf->pts), av_ts2timestr(buf->pts, &inlink->time_base), |
| 208 | 210 | av_get_sample_fmt_name(buf->format), buf->ch_layout.nb_channels, chlayout_str, |
| 209 | 211 | buf->sample_rate, buf->nb_samples, |
| @@ -725,6 +725,7 @@ static void perform_compression(DynamicAudioNormalizerContext *s, AVFrame *frame · 724 unmodified lines | ||
| 725 | 725 | |
| 726 | 726 | static int analyze_frame(AVFilterContext *ctx, AVFilterLink *outlink, AVFrame **frame) |
| 727 | 727 | { |
| 728 | + FilterLink *outl = ff_filter_link(outlink); | |
| 728 | 729 | DynamicAudioNormalizerContext *s = ctx->priv; |
| 729 | 730 | AVFrame *analyze_frame; |
| 730 | 731 | |
| @@ -780,7 +781,7 @@ static int analyze_frame(AVFilterContext *ctx, AVFilterLink *outlink, AVFrame ** · 49 unmodified lines | ||
| 780 | 781 | analyze_frame = *frame; |
| 781 | 782 | } |
| 782 | 783 | |
| 783 | − s->var_values[VAR_SN] = outlink->sample_count_in; | |
| 784 | + s->var_values[VAR_SN] = outl->sample_count_in; | |
| 784 | 785 | s->var_values[VAR_T] = s->var_values[VAR_SN] * (double)1/outlink->sample_rate; |
| 785 | 786 | |
| 786 | 787 | if (s->channels_coupled) { |
| @@ -35,6 +35,7 @@ · 34 unmodified lines | ||
| 35 | 35 | |
| 36 | 36 | #include "audio.h" |
| 37 | 37 | #include "avfilter.h" |
| 38 | +#include "filters.h" | |
| 38 | 39 | #include "formats.h" |
| 39 | 40 | #include "internal.h" |
| 40 | 41 | #include "af_volume.h" |
| @@ -328,6 +329,7 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar · 287 unmodified lines | ||
| 328 | 329 | |
| 329 | 330 | static int filter_frame(AVFilterLink *inlink, AVFrame *buf) |
| 330 | 331 | { |
| 332 | + FilterLink *inl = ff_filter_link(inlink); | |
| 331 | 333 | AVFilterContext *ctx = inlink->dst; |
| 332 | 334 | VolumeContext *vol = inlink->dst->priv; |
| 333 | 335 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| @@ -380,7 +382,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) · 46 unmodified lines | ||
| 380 | 382 | } |
| 381 | 383 | vol->var_values[VAR_PTS] = TS2D(buf->pts); |
| 382 | 384 | vol->var_values[VAR_T ] = TS2T(buf->pts, inlink->time_base); |
| 383 | − vol->var_values[VAR_N ] = inlink->frame_count_out; | |
| 385 | + vol->var_values[VAR_N ] = inl->frame_count_out; | |
| 384 | 386 | |
| 385 | 387 | #if FF_API_FRAME_PKT |
| 386 | 388 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -207,10 +207,11 @@ static av_cold int config_props(AVFilterLink *outlink) · 206 unmodified lines | ||
| 207 | 207 | static int activate(AVFilterContext *ctx) |
| 208 | 208 | { |
| 209 | 209 | AVFilterLink *outlink = ctx->outputs[0]; |
| 210 | + FilterLink *outl = ff_filter_link(outlink); | |
| 210 | 211 | SineContext *sine = ctx->priv; |
| 211 | 212 | AVFrame *frame; |
| 212 | 213 | double values[VAR_VARS_NB] = { |
| 213 | − [VAR_N] = outlink->frame_count_in, | |
| 214 | + [VAR_N] = outl->frame_count_in, | |
| 214 | 215 | [VAR_PTS] = sine->pts, |
| 215 | 216 | [VAR_T] = sine->pts * av_q2d(outlink->time_base), |
| 216 | 217 | [VAR_TB] = av_q2d(outlink->time_base), |
| @@ -298,6 +298,7 @@ static inline void plot_freq(ShowFreqsContext *s, int ch, · 297 unmodified lines | ||
| 298 | 298 | double a, int f, uint8_t fg[4], int *prev_y, |
| 299 | 299 | AVFrame *out, AVFilterLink *outlink) |
| 300 | 300 | { |
| 301 | + FilterLink *outl = ff_filter_link(outlink); | |
| 301 | 302 | const int w = s->w; |
| 302 | 303 | const float min = s->minamp; |
| 303 | 304 | const float avg = s->avg_data[ch][f]; |
| @@ -337,12 +338,12 @@ static inline void plot_freq(ShowFreqsContext *s, int ch, · 33 unmodified lines | ||
| 337 | 338 | |
| 338 | 339 | switch (s->avg) { |
| 339 | 340 | case 0: |
| 340 | − y = s->avg_data[ch][f] = !outlink->frame_count_in ? y : FFMIN(0, y); | |
| 341 | + y = s->avg_data[ch][f] = !outl->frame_count_in ? y : FFMIN(0, y); | |
| 341 | 342 | break; |
| 342 | 343 | case 1: |
| 343 | 344 | break; |
| 344 | 345 | default: |
| 345 | − s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count_in + 1, s->avg) * (float)y); | |
| 346 | + s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outl->frame_count_in + 1, s->avg) * (float)y); | |
| 346 | 347 | y = av_clip(s->avg_data[ch][f], 0, outlink->h - 1); |
| 347 | 348 | break; |
| 348 | 349 | } |
| @@ -991,6 +991,7 @@ static int default_filter_frame(AVFilterLink *link, AVFrame *frame) · 990 unmodified lines | ||
| 991 | 991 | |
| 992 | 992 | static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) |
| 993 | 993 | { |
| 994 | + FilterLink *l = ff_filter_link(link); | |
| 994 | 995 | int (*filter_frame)(AVFilterLink *, AVFrame *); |
| 995 | 996 | AVFilterContext *dstctx = link->dst; |
| 996 | 997 | AVFilterPad *dst = link->dstpad; |
| @@ -1012,7 +1013,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) · 15 unmodified lines | ||
| 1012 | 1013 | (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC)) |
| 1013 | 1014 | filter_frame = default_filter_frame; |
| 1014 | 1015 | ret = filter_frame(link, frame); |
| 1015 | − link->frame_count_out++; | |
| 1016 | + l->frame_count_out++; | |
| 1016 | 1017 | return ret; |
| 1017 | 1018 | |
| 1018 | 1019 | fail: |
| @@ -1058,8 +1059,8 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) · 39 unmodified lines | ||
| 1058 | 1059 | } |
| 1059 | 1060 | |
| 1060 | 1061 | li->frame_blocked_in = link->frame_wanted_out = 0; |
| 1061 | − link->frame_count_in++; | |
| 1062 | − link->sample_count_in += frame->nb_samples; | |
| 1062 | + li->l.frame_count_in++; | |
| 1063 | + li->l.sample_count_in += frame->nb_samples; | |
| 1063 | 1064 | filter_unblock(link->dst); |
| 1064 | 1065 | ret = ff_framequeue_add(&li->fifo, frame); |
| 1065 | 1066 | if (ret < 0) { |
| @@ -1163,7 +1164,7 @@ static int ff_filter_frame_to_filter(AVFilterLink *link) · 97 unmodified lines | ||
| 1163 | 1164 | filter_unblock(dst); |
| 1164 | 1165 | /* AVFilterPad.filter_frame() expect frame_count_out to have the value |
| 1165 | 1166 | before the frame; ff_filter_frame_framed() will re-increment it. */ |
| 1166 | − link->frame_count_out--; | |
| 1167 | + li->l.frame_count_out--; | |
| 1167 | 1168 | ret = ff_filter_frame_framed(link, frame); |
| 1168 | 1169 | if (ret < 0 && ret != li->status_out) { |
| 1169 | 1170 | link_set_out_status(link, ret, AV_NOPTS_VALUE); |
| @@ -1444,8 +1445,8 @@ static void consume_update(FilterLinkInternal *li, const AVFrame *frame) · 274 unmodified lines | ||
| 1444 | 1445 | ff_inlink_process_commands(link, frame); |
| 1445 | 1446 | if (link == link->dst->inputs[0]) |
| 1446 | 1447 | link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame); |
| 1447 | − link->frame_count_out++; | |
| 1448 | − link->sample_count_out += frame->nb_samples; | |
| 1448 | + li->l.frame_count_out++; | |
| 1449 | + li->l.sample_count_out += frame->nb_samples; | |
| 1449 | 1450 | } |
| 1450 | 1451 | |
| 1451 | 1452 | int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe) |
| @@ -1552,6 +1553,7 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) · 100 unmodified lines | ||
| 1552 | 1553 | |
| 1553 | 1554 | int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame) |
| 1554 | 1555 | { |
| 1556 | + FilterLink *l = ff_filter_link(link); | |
| 1555 | 1557 | AVFilterContext *dstctx = link->dst; |
| 1556 | 1558 | int64_t pts = frame->pts; |
| 1557 | 1559 | #if FF_API_FRAME_PKT |
| @@ -1563,7 +1565,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 5 unmodified lines | ||
| 1563 | 1565 | if (!dstctx->enable_str) |
| 1564 | 1566 | return 1; |
| 1565 | 1567 | |
| 1566 | − dstctx->var_values[VAR_N] = link->frame_count_out; | |
| 1568 | + dstctx->var_values[VAR_N] = l->frame_count_out; | |
| 1567 | 1569 | dstctx->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base); |
| 1568 | 1570 | dstctx->var_values[VAR_W] = link->w; |
| 1569 | 1571 | dstctx->var_values[VAR_H] = link->h; |
| @@ -600,16 +600,6 @@ struct AVFilterLink { · 599 unmodified lines | ||
| 600 | 600 | */ |
| 601 | 601 | struct AVFilterGraph *graph; |
| 602 | 602 | |
| 603 | − /** | |
| 604 | − * Number of past frames sent through the link. | |
| 605 | − */ | |
| 606 | − int64_t frame_count_in, frame_count_out; | |
| 607 | − | |
| 608 | − /** | |
| 609 | − * Number of past samples sent through the link. | |
| 610 | − */ | |
| 611 | − int64_t sample_count_in, sample_count_out; | |
| 612 | − | |
| 613 | 603 | /** |
| 614 | 604 | * True if a frame is currently wanted on the output of this filter. |
| 615 | 605 | * Set when ff_request_frame() is called by the output, |
| @@ -1402,8 +1402,8 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) · 1401 unmodified lines | ||
| 1402 | 1402 | return AVERROR_EOF; |
| 1403 | 1403 | av_assert1(!oldest->dst->filter->activate); |
| 1404 | 1404 | av_assert1(oldesti->age_index >= 0); |
| 1405 | − frame_count = oldest->frame_count_out; | |
| 1406 | − while (frame_count == oldest->frame_count_out) { | |
| 1405 | + frame_count = oldesti->l.frame_count_out; | |
| 1406 | + while (frame_count == oldesti->l.frame_count_out) { | |
| 1407 | 1407 | r = ff_filter_graph_run_once(graph); |
| 1408 | 1408 | if (r == AVERROR(EAGAIN) && |
| 1409 | 1409 | !oldest->frame_wanted_out && !oldesti->frame_blocked_in && |
| @@ -308,33 +308,33 @@ static int draw_items(AVFilterContext *ctx, · 307 unmodified lines | ||
| 308 | 308 | drawtext(out, xpos, ypos, buffer, len, frames > 0 ? frames >= 10 ? frames >= 50 ? s->red : s->yellow : s->green : s->white); |
| 309 | 309 | xpos += len * 8; |
| 310 | 310 | } |
| 311 | − if ((flags & FLAG_FCIN) && (!(mode & MODE_NOZERO) || l->frame_count_in)) { | |
| 312 | − len = snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, l->frame_count_in); | |
| 311 | + if ((flags & FLAG_FCIN) && (!(mode & MODE_NOZERO) || fl->frame_count_in)) { | |
| 312 | + len = snprintf(buffer, sizeof(buffer)-1, " | in: %"PRId64, fl->frame_count_in); | |
| 313 | 313 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 314 | 314 | xpos += len * 8; |
| 315 | 315 | } |
| 316 | − if ((flags & FLAG_FCOUT) && (!(mode & MODE_NOZERO) || l->frame_count_out)) { | |
| 317 | − len = snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, l->frame_count_out); | |
| 316 | + if ((flags & FLAG_FCOUT) && (!(mode & MODE_NOZERO) || fl->frame_count_out)) { | |
| 317 | + len = snprintf(buffer, sizeof(buffer)-1, " | out: %"PRId64, fl->frame_count_out); | |
| 318 | 318 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 319 | 319 | xpos += len * 8; |
| 320 | 320 | } |
| 321 | − if ((flags & FLAG_FC_DELTA) && (!(mode & MODE_NOZERO) || (l->frame_count_in - l->frame_count_out))) { | |
| 322 | − len = snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, l->frame_count_in - l->frame_count_out); | |
| 321 | + if ((flags & FLAG_FC_DELTA) && (!(mode & MODE_NOZERO) || (fl->frame_count_in - fl->frame_count_out))) { | |
| 322 | + len = snprintf(buffer, sizeof(buffer)-1, " | delta: %"PRId64, fl->frame_count_in - fl->frame_count_out); | |
| 323 | 323 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 324 | 324 | xpos += len * 8; |
| 325 | 325 | } |
| 326 | − if ((flags & FLAG_SCIN) && (!(mode & MODE_NOZERO) || l->sample_count_in)) { | |
| 327 | − len = snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, l->sample_count_in); | |
| 326 | + if ((flags & FLAG_SCIN) && (!(mode & MODE_NOZERO) || fl->sample_count_in)) { | |
| 327 | + len = snprintf(buffer, sizeof(buffer)-1, " | sin: %"PRId64, fl->sample_count_in); | |
| 328 | 328 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 329 | 329 | xpos += len * 8; |
| 330 | 330 | } |
| 331 | − if ((flags & FLAG_SCOUT) && (!(mode & MODE_NOZERO) || l->sample_count_out)) { | |
| 332 | − len = snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, l->sample_count_out); | |
| 331 | + if ((flags & FLAG_SCOUT) && (!(mode & MODE_NOZERO) || fl->sample_count_out)) { | |
| 332 | + len = snprintf(buffer, sizeof(buffer)-1, " | sout: %"PRId64, fl->sample_count_out); | |
| 333 | 333 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 334 | 334 | xpos += len * 8; |
| 335 | 335 | } |
| 336 | − if ((flags & FLAG_SC_DELTA) && (!(mode & MODE_NOZERO) || (l->sample_count_in - l->sample_count_out))) { | |
| 337 | − len = snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, l->sample_count_in - l->sample_count_out); | |
| 336 | + if ((flags & FLAG_SC_DELTA) && (!(mode & MODE_NOZERO) || (fl->sample_count_in - fl->sample_count_out))) { | |
| 337 | + len = snprintf(buffer, sizeof(buffer)-1, " | sdelta: %"PRId64, fl->sample_count_in - fl->sample_count_out); | |
| 338 | 338 | drawtext(out, xpos, ypos, buffer, len, s->white); |
| 339 | 339 | xpos += len * 8; |
| 340 | 340 | } |
| @@ -46,6 +46,7 @@ static int activate(AVFilterContext *ctx) · 45 unmodified lines | ||
| 46 | 46 | { |
| 47 | 47 | LatencyContext *s = ctx->priv; |
| 48 | 48 | AVFilterLink *inlink = ctx->inputs[0]; |
| 49 | + FilterLink *inl = ff_filter_link(inlink); | |
| 49 | 50 | AVFilterLink *outlink = ctx->outputs[0]; |
| 50 | 51 | |
| 51 | 52 | FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink); |
| @@ -53,14 +54,15 @@ static int activate(AVFilterContext *ctx) · 1 unmodified line | ||
| 53 | 54 | if (!ctx->is_disabled && ctx->inputs[0]->src && |
| 54 | 55 | ctx->inputs[0]->src->nb_inputs > 0) { |
| 55 | 56 | AVFilterLink *prevlink = ctx->inputs[0]->src->inputs[0]; |
| 57 | + FilterLink *prevl = ff_filter_link(prevlink); | |
| 56 | 58 | int64_t delta = 0; |
| 57 | 59 | |
| 58 | 60 | switch (prevlink->type) { |
| 59 | 61 | case AVMEDIA_TYPE_AUDIO: |
| 60 | − delta = prevlink->sample_count_in - inlink->sample_count_out; | |
| 62 | + delta = prevl->sample_count_in - inl->sample_count_out; | |
| 61 | 63 | break; |
| 62 | 64 | case AVMEDIA_TYPE_VIDEO: |
| 63 | − delta = prevlink->frame_count_in - inlink->frame_count_out; | |
| 65 | + delta = prevl->frame_count_in - inl->frame_count_out; | |
| 64 | 66 | break; |
| 65 | 67 | } |
| 66 | 68 | |
| @@ -144,6 +144,7 @@ static int push_samples(AVFilterContext *ctx, int nb_samples) · 143 unmodified lines | ||
| 144 | 144 | |
| 145 | 145 | static int afilter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 146 | 146 | { |
| 147 | + FilterLink *inl = ff_filter_link(inlink); | |
| 147 | 148 | AVFilterContext *ctx = inlink->dst; |
| 148 | 149 | AVFilterLink *outlink = ctx->outputs[0]; |
| 149 | 150 | LoopContext *s = ctx->priv; |
| @@ -158,7 +159,7 @@ static int afilter_frame(AVFilterLink *inlink, AVFrame *frame) · 8 unmodified lines | ||
| 158 | 159 | int drain = 0; |
| 159 | 160 | |
| 160 | 161 | if (s->start < 0) |
| 161 | − s->start = inlink->sample_count_out - written; | |
| 162 | + s->start = inl->sample_count_out - written; | |
| 162 | 163 | |
| 163 | 164 | ret = av_audio_fifo_write(s->fifo, (void **)frame->extended_data, written); |
| 164 | 165 | if (ret < 0) |
| @@ -374,6 +375,7 @@ static int push_frame(AVFilterContext *ctx) · 209 unmodified lines | ||
| 374 | 375 | |
| 375 | 376 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 376 | 377 | { |
| 378 | + FilterLink *inl = ff_filter_link(inlink); | |
| 377 | 379 | AVFilterContext *ctx = inlink->dst; |
| 378 | 380 | AVFilterLink *outlink = ctx->outputs[0]; |
| 379 | 381 | FilterLink *outl = ff_filter_link(outlink); |
| @@ -381,7 +383,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 1 unmodified line | ||
| 381 | 383 | int64_t duration; |
| 382 | 384 | int ret = 0; |
| 383 | 385 | |
| 384 | − if (((s->start >= 0 && inlink->frame_count_out >= s->start) || | |
| 386 | + if (((s->start >= 0 && inl->frame_count_out >= s->start) || | |
| 385 | 387 | (s->time_pts != AV_NOPTS_VALUE && |
| 386 | 388 | frame->pts >= s->time_pts)) && |
| 387 | 389 | s->size > 0 && s->loop != 0) { |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "libavformat/avio.h" |
| 37 | 37 | #include "avfilter.h" |
| 38 | 38 | #include "audio.h" |
| 39 | +#include "filters.h" | |
| 39 | 40 | #include "internal.h" |
| 40 | 41 | #include "video.h" |
| 41 | 42 | |
| @@ -303,6 +304,7 @@ static av_cold void uninit(AVFilterContext *ctx) · 261 unmodified lines | ||
| 303 | 304 | |
| 304 | 305 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 305 | 306 | { |
| 307 | + FilterLink *inl = ff_filter_link(inlink); | |
| 306 | 308 | AVFilterContext *ctx = inlink->dst; |
| 307 | 309 | AVFilterLink *outlink = ctx->outputs[0]; |
| 308 | 310 | MetadataContext *s = ctx->priv; |
| @@ -336,14 +338,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 27 unmodified lines | ||
| 336 | 338 | case METADATA_PRINT: |
| 337 | 339 | if (!s->key && e) { |
| 338 | 340 | s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%s\n", |
| 339 | − inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base)); | |
| 341 | + inl->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base)); | |
| 340 | 342 | s->print(ctx, "%s=%s\n", e->key, e->value); |
| 341 | 343 | while ((e = av_dict_iterate(*metadata, e)) != NULL) { |
| 342 | 344 | s->print(ctx, "%s=%s\n", e->key, e->value); |
| 343 | 345 | } |
| 344 | 346 | } else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) { |
| 345 | 347 | s->print(ctx, "frame:%-4"PRId64" pts:%-7s pts_time:%s\n", |
| 346 | − inlink->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base)); | |
| 348 | + inl->frame_count_out, av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base)); | |
| 347 | 349 | s->print(ctx, "%s=%s\n", s->key, e->value); |
| 348 | 350 | } |
| 349 | 351 | return ff_filter_frame(outlink, frame); |
| @@ -162,6 +162,7 @@ static int current_segment_finished(AVFilterContext *ctx, AVFrame *frame) · 161 unmodified lines | ||
| 162 | 162 | { |
| 163 | 163 | SegmentContext *s = ctx->priv; |
| 164 | 164 | AVFilterLink *inlink = ctx->inputs[0]; |
| 165 | + FilterLink *inl = ff_filter_link(inlink); | |
| 165 | 166 | int ret = 0; |
| 166 | 167 | |
| 167 | 168 | if (s->use_timestamps) { |
| @@ -169,10 +170,10 @@ static int current_segment_finished(AVFilterContext *ctx, AVFrame *frame) · 1 unmodified line | ||
| 169 | 170 | } else { |
| 170 | 171 | switch (inlink->type) { |
| 171 | 172 | case AVMEDIA_TYPE_VIDEO: |
| 172 | − ret = inlink->frame_count_out - 1 >= s->points[s->current_point]; | |
| 173 | + ret = inl->frame_count_out - 1 >= s->points[s->current_point]; | |
| 173 | 174 | break; |
| 174 | 175 | case AVMEDIA_TYPE_AUDIO: |
| 175 | − ret = inlink->sample_count_out - frame->nb_samples >= s->points[s->current_point]; | |
| 176 | + ret = inl->sample_count_out - frame->nb_samples >= s->points[s->current_point]; | |
| 176 | 177 | break; |
| 177 | 178 | } |
| 178 | 179 | } |
| @@ -183,6 +184,7 @@ static int current_segment_finished(AVFilterContext *ctx, AVFrame *frame) · 4 unmodified lines | ||
| 183 | 184 | static int activate(AVFilterContext *ctx) |
| 184 | 185 | { |
| 185 | 186 | AVFilterLink *inlink = ctx->inputs[0]; |
| 187 | + FilterLink *inl = ff_filter_link(inlink); | |
| 186 | 188 | SegmentContext *s = ctx->priv; |
| 187 | 189 | AVFrame *frame = NULL; |
| 188 | 190 | int ret, status; |
| @@ -199,14 +201,14 @@ static int activate(AVFilterContext *ctx) · 10 unmodified lines | ||
| 199 | 201 | ret = ff_inlink_consume_frame(inlink, &frame); |
| 200 | 202 | break; |
| 201 | 203 | case AVMEDIA_TYPE_AUDIO: |
| 202 | − diff = s->points[s->current_point] - inlink->sample_count_out; | |
| 204 | + diff = s->points[s->current_point] - inl->sample_count_out; | |
| 203 | 205 | while (diff <= 0) { |
| 204 | 206 | ff_outlink_set_status(ctx->outputs[s->current_point], AVERROR_EOF, s->last_pts); |
| 205 | 207 | s->current_point++; |
| 206 | 208 | if (s->current_point >= s->nb_points) |
| 207 | 209 | return AVERROR(EINVAL); |
| 208 | 210 | |
| 209 | − diff = s->points[s->current_point] - inlink->sample_count_out; | |
| 211 | + diff = s->points[s->current_point] - inl->sample_count_out; | |
| 210 | 212 | } |
| 211 | 213 | if (s->use_timestamps) { |
| 212 | 214 | max_samples = av_rescale_q(diff, av_make_q(1, inlink->sample_rate), inlink->time_base); |
| @@ -34,6 +34,7 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "libavutil/pixdesc.h" |
| 35 | 35 | #include "avfilter.h" |
| 36 | 36 | #include "audio.h" |
| 37 | +#include "filters.h" | |
| 37 | 38 | #include "formats.h" |
| 38 | 39 | #include "internal.h" |
| 39 | 40 | #include "video.h" |
| @@ -342,6 +343,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame) · 302 unmodified lines | ||
| 342 | 343 | { |
| 343 | 344 | SelectContext *select = ctx->priv; |
| 344 | 345 | AVFilterLink *inlink = ctx->inputs[0]; |
| 346 | + FilterLink *inl = ff_filter_link(inlink); | |
| 345 | 347 | double res; |
| 346 | 348 | |
| 347 | 349 | if (isnan(select->var_values[VAR_START_PTS])) |
| @@ -349,7 +351,7 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame) · 1 unmodified line | ||
| 349 | 351 | if (isnan(select->var_values[VAR_START_T])) |
| 350 | 352 | select->var_values[VAR_START_T] = TS2D(frame->pts) * av_q2d(inlink->time_base); |
| 351 | 353 | |
| 352 | − select->var_values[VAR_N ] = inlink->frame_count_out; | |
| 354 | + select->var_values[VAR_N ] = inl->frame_count_out; | |
| 353 | 355 | select->var_values[VAR_PTS] = TS2D(frame->pts); |
| 354 | 356 | select->var_values[VAR_T ] = TS2D(frame->pts) * av_q2d(inlink->time_base); |
| 355 | 357 | #if FF_API_FRAME_PKT |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include "libavutil/opt.h" |
| 34 | 34 | #include "libavutil/parseutils.h" |
| 35 | 35 | #include "avfilter.h" |
| 36 | +#include "filters.h" | |
| 36 | 37 | #include "internal.h" |
| 37 | 38 | #include "audio.h" |
| 38 | 39 | #include "video.h" |
| @@ -488,6 +489,7 @@ static av_cold void uninit(AVFilterContext *ctx) · 449 unmodified lines | ||
| 488 | 489 | |
| 489 | 490 | static int filter_frame(AVFilterLink *inlink, AVFrame *ref) |
| 490 | 491 | { |
| 492 | + FilterLink *inl = ff_filter_link(inlink); | |
| 491 | 493 | AVFilterContext *ctx = inlink->dst; |
| 492 | 494 | SendCmdContext *s = ctx->priv; |
| 493 | 495 | int64_t ts; |
| @@ -535,7 +537,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *ref) · 41 unmodified lines | ||
| 535 | 537 | double end = TS2T(interval->end_ts, AV_TIME_BASE_Q); |
| 536 | 538 | double current = TS2T(ref->pts, inlink->time_base); |
| 537 | 539 | |
| 538 | − var_values[VAR_N] = inlink->frame_count_in; | |
| 540 | + var_values[VAR_N] = inl->frame_count_in; | |
| 539 | 541 | #if FF_API_FRAME_PKT |
| 540 | 542 | FF_DISABLE_DEPRECATION_WARNINGS |
| 541 | 543 | var_values[VAR_POS] = ref->pkt_pos == -1 ? NAN : ref->pkt_pos; |
| @@ -65,11 +65,12 @@ static int process_frame(FFFrameSync *fs) · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | for (j = 0; j < ctx->nb_inputs; j++) { |
| 67 | 67 | for (i = 0; i < s->nb_map; i++) { |
| 68 | + FilterLink *outl = ff_filter_link(ctx->outputs[i]); | |
| 68 | 69 | if (s->map[i] == j) { |
| 69 | 70 | AVFrame *out; |
| 70 | 71 | |
| 71 | 72 | if (s->is_audio && s->last_pts[j] == in[j]->pts && |
| 72 | − ctx->outputs[i]->frame_count_in > 0) | |
| 73 | + outl->frame_count_in > 0) | |
| 73 | 74 | continue; |
| 74 | 75 | out = av_frame_clone(in[j]); |
| 75 | 76 | if (!out) |
| @@ -70,6 +70,16 @@ typedef struct FilterLink { · 69 unmodified lines | ||
| 70 | 70 | */ |
| 71 | 71 | int max_samples; |
| 72 | 72 | |
| 73 | + /** | |
| 74 | + * Number of past frames sent through the link. | |
| 75 | + */ | |
| 76 | + int64_t frame_count_in, frame_count_out; | |
| 77 | + | |
| 78 | + /** | |
| 79 | + * Number of past samples sent through the link. | |
| 80 | + */ | |
| 81 | + int64_t sample_count_in, sample_count_out; | |
| 82 | + | |
| 73 | 83 | /** |
| 74 | 84 | * Frame rate of the stream on the link, or 1/0 if unknown or variable. |
| 75 | 85 | * |
| @@ -780,12 +780,13 @@ static int qrencode_query_formats(AVFilterContext *ctx) · 779 unmodified lines | ||
| 780 | 780 | |
| 781 | 781 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 782 | 782 | { |
| 783 | + FilterLink *inl = ff_filter_link(inlink); | |
| 783 | 784 | AVFilterContext *ctx = inlink->dst; |
| 784 | 785 | AVFilterLink *outlink = ctx->outputs[0]; |
| 785 | 786 | QREncodeContext *qr = ctx->priv; |
| 786 | 787 | int ret; |
| 787 | 788 | |
| 788 | − V(n) = inlink->frame_count_out; | |
| 789 | + V(n) = inl->frame_count_out; | |
| 789 | 790 | V(t) = frame->pts == AV_NOPTS_VALUE ? |
| 790 | 791 | NAN : frame->pts * av_q2d(inlink->time_base); |
| 791 | 792 | V(pict_type) = frame->pict_type; |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | #include "libavutil/timestamp.h" |
| 29 | 29 | #include "avfilter.h" |
| 30 | 30 | #include "bbox.h" |
| 31 | +#include "filters.h" | |
| 31 | 32 | #include "internal.h" |
| 32 | 33 | |
| 33 | 34 | typedef struct BBoxContext { |
| @@ -75,6 +76,7 @@ static const enum AVPixelFormat pix_fmts[] = { · 41 unmodified lines | ||
| 75 | 76 | |
| 76 | 77 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 77 | 78 | { |
| 79 | + FilterLink *inl = ff_filter_link(inlink); | |
| 78 | 80 | AVFilterContext *ctx = inlink->dst; |
| 79 | 81 | BBoxContext *bbox = ctx->priv; |
| 80 | 82 | FFBoundingBox box; |
| @@ -88,7 +90,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 7 unmodified lines | ||
| 88 | 90 | h = box.y2 - box.y1 + 1; |
| 89 | 91 | |
| 90 | 92 | av_log(ctx, AV_LOG_INFO, |
| 91 | − "n:%"PRId64" pts:%s pts_time:%s", inlink->frame_count_out, | |
| 93 | + "n:%"PRId64" pts:%s pts_time:%s", inl->frame_count_out, | |
| 92 | 94 | av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base)); |
| 93 | 95 | |
| 94 | 96 | if (has_bbox) { |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | #include "libavutil/pixdesc.h" |
| 31 | 31 | #include "libavutil/timestamp.h" |
| 32 | 32 | #include "avfilter.h" |
| 33 | +#include "filters.h" | |
| 33 | 34 | #include "internal.h" |
| 34 | 35 | #include "video.h" |
| 35 | 36 | |
| @@ -173,6 +174,7 @@ static int black_counter(AVFilterContext *ctx, void *arg, · 137 unmodified lines | ||
| 173 | 174 | |
| 174 | 175 | static int filter_frame(AVFilterLink *inlink, AVFrame *picref) |
| 175 | 176 | { |
| 177 | + FilterLink *inl = ff_filter_link(inlink); | |
| 176 | 178 | AVFilterContext *ctx = inlink->dst; |
| 177 | 179 | BlackDetectContext *s = ctx->priv; |
| 178 | 180 | double picture_black_ratio = 0; |
| @@ -195,7 +197,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref) · 16 unmodified lines | ||
| 195 | 197 | |
| 196 | 198 | av_log(ctx, AV_LOG_DEBUG, |
| 197 | 199 | "frame:%"PRId64" picture_black_ratio:%f pts:%s t:%s type:%c\n", |
| 198 | − inlink->frame_count_out, picture_black_ratio, | |
| 200 | + inl->frame_count_out, picture_black_ratio, | |
| 199 | 201 | av_ts2str(picref->pts), av_ts2timestr(picref->pts, &s->time_base), |
| 200 | 202 | av_get_picture_type_char(picref->pict_type)); |
| 201 | 203 | |
| @@ -174,10 +174,11 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) · 173 unmodified lines | ||
| 174 | 174 | const uint8_t *top = td->top->data[td->plane]; |
| 175 | 175 | const uint8_t *bottom = td->bottom->data[td->plane]; |
| 176 | 176 | uint8_t *dst = td->dst->data[td->plane]; |
| 177 | + FilterLink *inl = ff_filter_link(td->inlink); | |
| 177 | 178 | double values[VAR_VARS_NB]; |
| 178 | 179 | SliceParams sliceparam = {.values = &values[0], .starty = slice_start, .e = td->param->e ? td->param->e[jobnr] : NULL}; |
| 179 | 180 | |
| 180 | − values[VAR_N] = td->inlink->frame_count_out; | |
| 181 | + values[VAR_N] = inl->frame_count_out; | |
| 181 | 182 | values[VAR_T] = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * av_q2d(td->inlink->time_base); |
| 182 | 183 | values[VAR_W] = td->w; |
| 183 | 184 | values[VAR_H] = td->h; |
| @@ -32,6 +32,8 @@ · 31 unmodified lines | ||
| 32 | 32 | #include "libavutil/mem.h" |
| 33 | 33 | #include "libavutil/opt.h" |
| 34 | 34 | #include "libavutil/pixdesc.h" |
| 35 | + | |
| 36 | +#include "filters.h" | |
| 35 | 37 | #include "internal.h" |
| 36 | 38 | #include "video.h" |
| 37 | 39 | |
| @@ -198,6 +200,7 @@ static void set_meta(AVDictionary **metadata, const char *key, float d) · 160 unmodified lines | ||
| 198 | 200 | |
| 199 | 201 | static int blockdetect_filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 200 | 202 | { |
| 203 | + FilterLink *inl = ff_filter_link(inlink); | |
| 201 | 204 | AVFilterContext *ctx = inlink->dst; |
| 202 | 205 | BLKContext *s = ctx->priv; |
| 203 | 206 | AVFilterLink *outlink = ctx->outputs[0]; |
| @@ -236,7 +239,7 @@ static int blockdetect_filter_frame(AVFilterLink *inlink, AVFrame *in) · 32 unmodified lines | ||
| 236 | 239 | |
| 237 | 240 | set_meta(metadata, "lavfi.block", block); |
| 238 | 241 | |
| 239 | − s->nb_frames = inlink->frame_count_in; | |
| 242 | + s->nb_frames = inl->frame_count_in; | |
| 240 | 243 | |
| 241 | 244 | return ff_filter_frame(outlink, in); |
| 242 | 245 | } |
| @@ -34,6 +34,8 @@ · 33 unmodified lines | ||
| 34 | 34 | #include "libavutil/opt.h" |
| 35 | 35 | #include "libavutil/pixdesc.h" |
| 36 | 36 | #include "libavutil/qsort.h" |
| 37 | + | |
| 38 | +#include "filters.h" | |
| 37 | 39 | #include "internal.h" |
| 38 | 40 | #include "edge_common.h" |
| 39 | 41 | #include "video.h" |
| @@ -256,6 +258,7 @@ static void set_meta(AVDictionary **metadata, const char *key, float d) · 216 unmodified lines | ||
| 256 | 258 | |
| 257 | 259 | static int blurdetect_filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 258 | 260 | { |
| 261 | + FilterLink *inl = ff_filter_link(inlink); | |
| 259 | 262 | AVFilterContext *ctx = inlink->dst; |
| 260 | 263 | BLRContext *s = ctx->priv; |
| 261 | 264 | AVFilterLink *outlink = ctx->outputs[0]; |
| @@ -316,7 +319,7 @@ static int blurdetect_filter_frame(AVFilterLink *inlink, AVFrame *in) · 54 unmodified lines | ||
| 316 | 319 | |
| 317 | 320 | set_meta(metadata, "lavfi.blur", blur); |
| 318 | 321 | |
| 319 | − s->nb_frames = inlink->frame_count_in; | |
| 322 | + s->nb_frames = inl->frame_count_in; | |
| 320 | 323 | |
| 321 | 324 | return ff_filter_frame(outlink, in); |
| 322 | 325 | } |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <stdio.h> |
| 27 | 27 | |
| 28 | 28 | #include "avfilter.h" |
| 29 | +#include "filters.h" | |
| 29 | 30 | #include "formats.h" |
| 30 | 31 | #include "internal.h" |
| 31 | 32 | #include "video.h" |
| @@ -255,12 +256,13 @@ static int config_output(AVFilterLink *link) · 223 unmodified lines | ||
| 255 | 256 | |
| 256 | 257 | static int filter_frame(AVFilterLink *link, AVFrame *frame) |
| 257 | 258 | { |
| 259 | + FilterLink *l = ff_filter_link(link); | |
| 258 | 260 | AVFilterContext *ctx = link->dst; |
| 259 | 261 | CropContext *s = ctx->priv; |
| 260 | 262 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); |
| 261 | 263 | int i; |
| 262 | 264 | |
| 263 | − s->var_values[VAR_N] = link->frame_count_out; | |
| 265 | + s->var_values[VAR_N] = l->frame_count_out; | |
| 264 | 266 | s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ? |
| 265 | 267 | NAN : frame->pts * av_q2d(link->time_base); |
| 266 | 268 | #if FF_API_FRAME_PKT |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "libavutil/xga_font_data.h" |
| 26 | 26 | #include "avfilter.h" |
| 27 | 27 | #include "drawutils.h" |
| 28 | +#include "filters.h" | |
| 28 | 29 | #include "formats.h" |
| 29 | 30 | #include "internal.h" |
| 30 | 31 | #include "video.h" |
| @@ -1038,6 +1039,7 @@ static void draw_scope(OscilloscopeContext *s, int x0, int y0, int x1, int y1, · 1007 unmodified lines | ||
| 1038 | 1039 | |
| 1039 | 1040 | static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 1040 | 1041 | { |
| 1042 | + FilterLink *inl = ff_filter_link(inlink); | |
| 1041 | 1043 | AVFilterContext *ctx = inlink->dst; |
| 1042 | 1044 | OscilloscopeContext *s = ctx->priv; |
| 1043 | 1045 | AVFilterLink *outlink = ctx->outputs[0]; |
| @@ -1047,7 +1049,7 @@ static int oscilloscope_filter_frame(AVFilterLink *inlink, AVFrame *frame) · 3 unmodified lines | ||
| 1047 | 1049 | int i, c; |
| 1048 | 1050 | |
| 1049 | 1051 | s->nb_values = 0; |
| 1050 | − draw_scope(s, s->x1, s->y1, s->x2, s->y2, frame, s->values, inlink->frame_count_in & 1); | |
| 1052 | + draw_scope(s, s->x1, s->y1, s->x2, s->y2, frame, s->values, inl->frame_count_in & 1); | |
| 1051 | 1053 | ff_blend_rectangle(&s->draw, &s->dark, frame->data, frame->linesize, |
| 1052 | 1054 | frame->width, frame->height, |
| 1053 | 1055 | s->ox, s->oy, s->width, s->height + 20 * s->statistics); |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include "libavutil/pixdesc.h" |
| 34 | 34 | #include "libavutil/eval.h" |
| 35 | 35 | #include "avfilter.h" |
| 36 | +#include "filters.h" | |
| 36 | 37 | #include "internal.h" |
| 37 | 38 | #include "video.h" |
| 38 | 39 | static const char * const var_names[] = { |
| @@ -286,6 +287,7 @@ static int config_input(AVFilterLink *inlink) · 247 unmodified lines | ||
| 286 | 287 | |
| 287 | 288 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 288 | 289 | { |
| 290 | + FilterLink *inl = ff_filter_link(inlink); | |
| 289 | 291 | DelogoContext *s = inlink->dst->priv; |
| 290 | 292 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 291 | 293 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
| @@ -297,7 +299,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 5 unmodified lines | ||
| 297 | 299 | AVRational sar; |
| 298 | 300 | int ret; |
| 299 | 301 | |
| 300 | − s->var_values[VAR_N] = inlink->frame_count_out; | |
| 302 | + s->var_values[VAR_N] = inl->frame_count_out; | |
| 301 | 303 | s->var_values[VAR_T] = TS2T(in->pts, inlink->time_base); |
| 302 | 304 | s->x = av_expr_eval(s->x_pexpr, s->var_values, s); |
| 303 | 305 | s->y = av_expr_eval(s->y_pexpr, s->var_values, s); |
| @@ -193,6 +193,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) · 192 unmodified lines | ||
| 193 | 193 | { |
| 194 | 194 | AVFilterContext *ctx = inlink->dst; |
| 195 | 195 | AVFilterLink *outlink = ctx->outputs[0]; |
| 196 | + FilterLink *outl = ff_filter_link(outlink); | |
| 196 | 197 | DetelecineContext *s = ctx->priv; |
| 197 | 198 | int i, len = 0, ret = 0, out = 0; |
| 198 | 199 | |
| @@ -332,7 +333,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) · 133 unmodified lines | ||
| 332 | 333 | |
| 333 | 334 | av_frame_copy_props(frame, inpicref); |
| 334 | 335 | frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) + |
| 335 | − av_rescale(outlink->frame_count_in, s->ts_unit.num, | |
| 336 | + av_rescale(outl->frame_count_in, s->ts_unit.num, | |
| 336 | 337 | s->ts_unit.den); |
| 337 | 338 | ret = ff_filter_frame(outlink, frame); |
| 338 | 339 | } |
| @@ -60,6 +60,7 @@ · 59 unmodified lines | ||
| 60 | 60 | #include "libavutil/detection_bbox.h" |
| 61 | 61 | #include "avfilter.h" |
| 62 | 62 | #include "drawutils.h" |
| 63 | +#include "filters.h" | |
| 63 | 64 | #include "formats.h" |
| 64 | 65 | #include "internal.h" |
| 65 | 66 | #include "textutils.h" |
| @@ -1553,6 +1554,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame) · 1487 unmodified lines | ||
| 1553 | 1554 | { |
| 1554 | 1555 | DrawTextContext *s = ctx->priv; |
| 1555 | 1556 | AVFilterLink *inlink = ctx->inputs[0]; |
| 1557 | + FilterLink *inl = ff_filter_link(inlink); | |
| 1556 | 1558 | int x = 0, y = 0, ret; |
| 1557 | 1559 | int shift_x64, shift_y64; |
| 1558 | 1560 | int x64, y64; |
| @@ -1596,7 +1598,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame) · 37 unmodified lines | ||
| 1596 | 1598 | |
| 1597 | 1599 | if (s->tc_opt_string) { |
| 1598 | 1600 | char tcbuf[AV_TIMECODE_STR_SIZE]; |
| 1599 | − av_timecode_make_string(&s->tc, tcbuf, inlink->frame_count_out); | |
| 1601 | + av_timecode_make_string(&s->tc, tcbuf, inl->frame_count_out); | |
| 1600 | 1602 | av_bprint_clear(bp); |
| 1601 | 1603 | av_bprintf(bp, "%s%s", s->text, tcbuf); |
| 1602 | 1604 | } |
| @@ -1828,6 +1830,7 @@ static int draw_text(AVFilterContext *ctx, AVFrame *frame) · 225 unmodified lines | ||
| 1828 | 1830 | |
| 1829 | 1831 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 1830 | 1832 | { |
| 1833 | + FilterLink *inl = ff_filter_link(inlink); | |
| 1831 | 1834 | AVFilterContext *ctx = inlink->dst; |
| 1832 | 1835 | AVFilterLink *outlink = ctx->outputs[0]; |
| 1833 | 1836 | DrawTextContext *s = ctx->priv; |
| @@ -1848,7 +1851,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 14 unmodified lines | ||
| 1848 | 1851 | } |
| 1849 | 1852 | } |
| 1850 | 1853 | |
| 1851 | − if (s->reload && !(inlink->frame_count_out % s->reload)) { | |
| 1854 | + if (s->reload && !(inl->frame_count_out % s->reload)) { | |
| 1852 | 1855 | if ((ret = ff_load_textfile(ctx, (const char *)s->textfile, &s->text, NULL)) < 0) { |
| 1853 | 1856 | av_frame_free(&frame); |
| 1854 | 1857 | return ret; |
| @@ -1862,7 +1865,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 7 unmodified lines | ||
| 1862 | 1865 | #endif |
| 1863 | 1866 | } |
| 1864 | 1867 | |
| 1865 | − s->var_values[VAR_N] = inlink->frame_count_out + s->start_number; | |
| 1868 | + s->var_values[VAR_N] = inl->frame_count_out + s->start_number; | |
| 1866 | 1869 | s->var_values[VAR_T] = frame->pts == AV_NOPTS_VALUE ? |
| 1867 | 1870 | NAN : frame->pts * av_q2d(inlink->time_base); |
| 1868 | 1871 | |
| @@ -221,6 +221,7 @@ static const enum AVPixelFormat pixel_fmts_eq[] = { · 220 unmodified lines | ||
| 221 | 221 | |
| 222 | 222 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 223 | 223 | { |
| 224 | + FilterLink *inl = ff_filter_link(inlink); | |
| 224 | 225 | AVFilterContext *ctx = inlink->dst; |
| 225 | 226 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 226 | 227 | EQContext *eq = ctx->priv; |
| @@ -237,7 +238,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 10 unmodified lines | ||
| 237 | 238 | av_frame_copy_props(out, in); |
| 238 | 239 | desc = av_pix_fmt_desc_get(inlink->format); |
| 239 | 240 | |
| 240 | − eq->var_values[VAR_N] = inlink->frame_count_out; | |
| 241 | + eq->var_values[VAR_N] = inl->frame_count_out; | |
| 241 | 242 | #if FF_API_FRAME_PKT |
| 242 | 243 | FF_DISABLE_DEPRECATION_WARNINGS |
| 243 | 244 | { |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | #include "libavutil/pixdesc.h" |
| 34 | 34 | #include "avfilter.h" |
| 35 | 35 | #include "drawutils.h" |
| 36 | +#include "filters.h" | |
| 36 | 37 | #include "formats.h" |
| 37 | 38 | #include "internal.h" |
| 38 | 39 | #include "video.h" |
| @@ -442,6 +443,7 @@ static int config_input(AVFilterLink *inlink) · 403 unmodified lines | ||
| 442 | 443 | |
| 443 | 444 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 444 | 445 | { |
| 446 | + FilterLink *inl = ff_filter_link(inlink); | |
| 445 | 447 | AVFilterContext *ctx = inlink->dst; |
| 446 | 448 | FadeContext *s = ctx->priv; |
| 447 | 449 | |
| @@ -449,7 +451,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 1 unmodified line | ||
| 449 | 451 | if (s->fade_state == VF_FADE_WAITING) { |
| 450 | 452 | s->factor=0; |
| 451 | 453 | if (frame->pts >= s->start_time_pts |
| 452 | − && inlink->frame_count_out >= s->start_frame) { | |
| 454 | + && inl->frame_count_out >= s->start_frame) { | |
| 453 | 455 | // Time to start fading |
| 454 | 456 | s->fade_state = VF_FADE_FADING; |
| 455 | 457 | |
| @@ -460,15 +462,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 4 unmodified lines | ||
| 460 | 462 | |
| 461 | 463 | // Save start frame in case we are starting based on time and fading based on frames |
| 462 | 464 | if (s->start_time_pts != 0 && s->start_frame == 0) { |
| 463 | − s->start_frame = inlink->frame_count_out; | |
| 465 | + s->start_frame = inl->frame_count_out; | |
| 464 | 466 | } |
| 465 | 467 | } |
| 466 | 468 | } |
| 467 | 469 | if (s->fade_state == VF_FADE_FADING) { |
| 468 | 470 | if (s->duration_pts == 0) { |
| 469 | 471 | // Fading based on frame count |
| 470 | − s->factor = (inlink->frame_count_out - s->start_frame) * s->fade_per_frame; | |
| 471 | − if (inlink->frame_count_out > s->start_frame + s->nb_frames) { | |
| 472 | + s->factor = (inl->frame_count_out - s->start_frame) * s->fade_per_frame; | |
| 473 | + if (inl->frame_count_out > s->start_frame + s->nb_frames) { | |
| 472 | 474 | s->fade_state = VF_FADE_DONE; |
| 473 | 475 | } |
| 474 | 476 | |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | * FFT domain filtering. |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | +#include "filters.h" | |
| 27 | 28 | #include "internal.h" |
| 28 | 29 | #include "video.h" |
| 29 | 30 | #include "libavutil/common.h" |
| @@ -284,10 +285,11 @@ static av_cold int initialize(AVFilterContext *ctx) · 254 unmodified lines | ||
| 284 | 285 | |
| 285 | 286 | static void do_eval(FFTFILTContext *s, AVFilterLink *inlink, int plane) |
| 286 | 287 | { |
| 288 | + FilterLink *l = ff_filter_link(inlink); | |
| 287 | 289 | double values[VAR_VARS_NB]; |
| 288 | 290 | int i, j; |
| 289 | 291 | |
| 290 | − values[VAR_N] = inlink->frame_count_out; | |
| 292 | + values[VAR_N] = l->frame_count_out; | |
| 291 | 293 | values[VAR_W] = s->planewidth[plane]; |
| 292 | 294 | values[VAR_H] = s->planeheight[plane]; |
| 293 | 295 | values[VAR_WS] = s->rdft_hlen[plane]; |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "libavutil/opt.h" |
| 26 | 26 | #include "libavutil/pixdesc.h" |
| 27 | 27 | #include "avfilter.h" |
| 28 | +#include "filters.h" | |
| 28 | 29 | #include "formats.h" |
| 29 | 30 | #include "internal.h" |
| 30 | 31 | #include "video.h" |
| @@ -113,8 +114,10 @@ static int config_input(AVFilterLink *inlink) · 82 unmodified lines | ||
| 113 | 114 | |
| 114 | 115 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 115 | 116 | { |
| 117 | + FilterLink *inl = ff_filter_link(inlink); | |
| 116 | 118 | AVFilterContext *ctx = inlink->dst; |
| 117 | 119 | AVFilterLink *outlink = ctx->outputs[0]; |
| 120 | + FilterLink *outl = ff_filter_link(outlink); | |
| 118 | 121 | FieldHintContext *s = ctx->priv; |
| 119 | 122 | AVFrame *out, *top, *bottom; |
| 120 | 123 | char buf[1024] = { 0 }; |
| @@ -152,9 +155,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 31 unmodified lines | ||
| 152 | 155 | } |
| 153 | 156 | switch (s->mode) { |
| 154 | 157 | case ABSOLUTE_HINT: |
| 155 | − if (tf > outlink->frame_count_in + 1 || tf < FFMAX(0, outlink->frame_count_in - 1) || | |
| 156 | − bf > outlink->frame_count_in + 1 || bf < FFMAX(0, outlink->frame_count_in - 1)) { | |
| 157 | − av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out); | |
| 158 | + if (tf > outl->frame_count_in + 1 || tf < FFMAX(0, outl->frame_count_in - 1) || | |
| 159 | + bf > outl->frame_count_in + 1 || bf < FFMAX(0, outl->frame_count_in - 1)) { | |
| 160 | + av_log(ctx, AV_LOG_ERROR, "Out of range frames %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inl->frame_count_out); | |
| 158 | 161 | return AVERROR_INVALIDDATA; |
| 159 | 162 | } |
| 160 | 163 | break; |
| @@ -162,7 +165,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line | ||
| 162 | 165 | case RELATIVE_HINT: |
| 163 | 166 | if (tf > 1 || tf < -1 || |
| 164 | 167 | bf > 1 || bf < -1) { |
| 165 | − av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inlink->frame_count_out); | |
| 168 | + av_log(ctx, AV_LOG_ERROR, "Out of range %"PRId64" and/or %"PRId64" on line %"PRId64" for %"PRId64". input frame.\n", tf, bf, s->line, inl->frame_count_out); | |
| 166 | 169 | return AVERROR_INVALIDDATA; |
| 167 | 170 | } |
| 168 | 171 | break; |
| @@ -175,7 +178,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 6 unmodified lines | ||
| 175 | 178 | fseek(s->hint, 0, SEEK_SET); |
| 176 | 179 | continue; |
| 177 | 180 | } |
| 178 | − av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inlink->frame_count_out); | |
| 181 | + av_log(ctx, AV_LOG_ERROR, "Missing entry for %"PRId64". input frame.\n", inl->frame_count_out); | |
| 179 | 182 | return AVERROR_INVALIDDATA; |
| 180 | 183 | } |
| 181 | 184 | } |
| @@ -187,8 +190,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 5 unmodified lines | ||
| 187 | 190 | |
| 188 | 191 | switch (s->mode) { |
| 189 | 192 | case ABSOLUTE_HINT: |
| 190 | − top = s->frame[tf - outlink->frame_count_in + 1]; | |
| 191 | − bottom = s->frame[bf - outlink->frame_count_in + 1]; | |
| 193 | + top = s->frame[tf - outl->frame_count_in + 1]; | |
| 194 | + bottom = s->frame[bf - outl->frame_count_in + 1]; | |
| 192 | 195 | break; |
| 193 | 196 | case PATTERN_HINT: |
| 194 | 197 | case RELATIVE_HINT: |
| @@ -681,6 +681,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 680 unmodified lines | ||
| 681 | 681 | { |
| 682 | 682 | AVFilterContext *ctx = inlink->dst; |
| 683 | 683 | AVFilterLink *outlink = ctx->outputs[0]; |
| 684 | + FilterLink *outl = ff_filter_link(outlink); | |
| 684 | 685 | FieldMatchContext *fm = ctx->priv; |
| 685 | 686 | int combs[] = { -1, -1, -1, -1, -1 }; |
| 686 | 687 | int order, field, i, match, interlaced_frame, sc = 0, ret = 0; |
| @@ -753,7 +754,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 66 unmodified lines | ||
| 753 | 754 | |
| 754 | 755 | /* scene change check */ |
| 755 | 756 | if (fm->combmatch == COMBMATCH_SC) { |
| 756 | − if (fm->lastn == outlink->frame_count_in - 1) { | |
| 757 | + if (fm->lastn == outl->frame_count_in - 1) { | |
| 757 | 758 | if (fm->lastscdiff > fm->scthresh) |
| 758 | 759 | sc = 1; |
| 759 | 760 | } else if (luma_abs_diff(fm->prv, fm->src) > fm->scthresh) { |
| @@ -761,7 +762,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line | ||
| 761 | 762 | } |
| 762 | 763 | |
| 763 | 764 | if (!sc) { |
| 764 | − fm->lastn = outlink->frame_count_in; | |
| 765 | + fm->lastn = outl->frame_count_in; | |
| 765 | 766 | fm->lastscdiff = luma_abs_diff(fm->src, fm->nxt); |
| 766 | 767 | sc = fm->lastscdiff > fm->scthresh; |
| 767 | 768 | } |
| @@ -831,7 +832,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 63 unmodified lines | ||
| 831 | 832 | if (interlaced_frame) { |
| 832 | 833 | dst->flags |= AV_FRAME_FLAG_INTERLACED; |
| 833 | 834 | av_log(ctx, AV_LOG_WARNING, "Frame #%"PRId64" at %s is still interlaced\n", |
| 834 | − outlink->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base)); | |
| 835 | + outl->frame_count_in, av_ts2timestr(in->pts, &inlink->time_base)); | |
| 835 | 836 | #if FF_API_INTERLACED_FRAME |
| 836 | 837 | FF_DISABLE_DEPRECATION_WARNINGS |
| 837 | 838 | dst->top_field_first = field; |
| @@ -24,6 +24,8 @@ · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | #include "libavutil/mem.h" |
| 26 | 26 | #include "libavutil/opt.h" |
| 27 | + | |
| 28 | +#include "filters.h" | |
| 27 | 29 | #include "internal.h" |
| 28 | 30 | #include "video.h" |
| 29 | 31 | |
| @@ -172,6 +174,7 @@ static float search(FOCContext *foc, int pass, int maxpass, int xmin, int xmax, · 142 unmodified lines | ||
| 172 | 174 | |
| 173 | 175 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 174 | 176 | { |
| 177 | + FilterLink *inl = ff_filter_link(inlink); | |
| 175 | 178 | AVFilterContext *ctx = inlink->dst; |
| 176 | 179 | FOCContext *foc = ctx->priv; |
| 177 | 180 | float best_score; |
| @@ -208,7 +211,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 30 unmodified lines | ||
| 208 | 211 | } |
| 209 | 212 | |
| 210 | 213 | av_log(ctx, AV_LOG_INFO, "Found at n=%"PRId64" pts_time=%f x=%d y=%d with score=%f\n", |
| 211 | − inlink->frame_count_out, TS2D(in->pts) * av_q2d(inlink->time_base), | |
| 214 | + inl->frame_count_out, TS2D(in->pts) * av_q2d(inlink->time_base), | |
| 212 | 215 | best_x, best_y, best_score); |
| 213 | 216 | foc->last_x = best_x; |
| 214 | 217 | foc->last_y = best_y; |
| @@ -64,9 +64,10 @@ static int config_output_props(AVFilterLink *outlink) · 63 unmodified lines | ||
| 64 | 64 | |
| 65 | 65 | static int filter_frame(AVFilterLink *inlink, AVFrame *ref) |
| 66 | 66 | { |
| 67 | + FilterLink *inl = ff_filter_link(inlink); | |
| 67 | 68 | FrameStepContext *framestep = inlink->dst->priv; |
| 68 | 69 | |
| 69 | − if (!(inlink->frame_count_out % framestep->frame_step)) { | |
| 70 | + if (!(inl->frame_count_out % framestep->frame_step)) { | |
| 70 | 71 | return ff_filter_frame(inlink->dst->outputs[0], ref); |
| 71 | 72 | } else { |
| 72 | 73 | av_frame_free(&ref); |
| @@ -74,12 +74,14 @@ static int config_output(AVFilterLink *outlink) · 73 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | static int activate(AVFilterContext *ctx) |
| 76 | 76 | { |
| 77 | + FilterLink *inl0 = ff_filter_link(ctx->inputs[0]); | |
| 78 | + FilterLink *inl1 = ff_filter_link(ctx->inputs[1]); | |
| 77 | 79 | AVFilterLink *outlink = ctx->outputs[0]; |
| 78 | 80 | FreezeFramesContext *s = ctx->priv; |
| 79 | 81 | AVFrame *frame = NULL; |
| 80 | − int drop = ctx->inputs[0]->frame_count_out >= s->first && | |
| 81 | − ctx->inputs[0]->frame_count_out <= s->last; | |
| 82 | − int replace = ctx->inputs[1]->frame_count_out == s->replace; | |
| 82 | + int drop = inl0->frame_count_out >= s->first && | |
| 83 | + inl0->frame_count_out <= s->last; | |
| 84 | + int replace = inl1->frame_count_out == s->replace; | |
| 83 | 85 | int ret; |
| 84 | 86 | |
| 85 | 87 | FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx); |
| @@ -32,6 +32,8 @@ · 31 unmodified lines | ||
| 32 | 32 | #include "libavutil/mem.h" |
| 33 | 33 | #include "libavutil/opt.h" |
| 34 | 34 | #include "libavutil/pixdesc.h" |
| 35 | + | |
| 36 | +#include "filters.h" | |
| 35 | 37 | #include "formats.h" |
| 36 | 38 | #include "internal.h" |
| 37 | 39 | #include "video.h" |
| @@ -453,13 +455,14 @@ static int slice_geq_filter(AVFilterContext *ctx, void *arg, int jobnr, int nb_j · 415 unmodified lines | ||
| 453 | 455 | static int geq_filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 454 | 456 | { |
| 455 | 457 | int plane; |
| 458 | + FilterLink *inl = ff_filter_link(inlink); | |
| 456 | 459 | AVFilterContext *ctx = inlink->dst; |
| 457 | 460 | const int nb_threads = FFMIN(MAX_NB_THREADS, ff_filter_get_nb_threads(ctx)); |
| 458 | 461 | GEQContext *geq = ctx->priv; |
| 459 | 462 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 460 | 463 | AVFrame *out; |
| 461 | 464 | |
| 462 | − geq->values[VAR_N] = inlink->frame_count_out, | |
| 465 | + geq->values[VAR_N] = inl->frame_count_out, | |
| 463 | 466 | geq->values[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base), |
| 464 | 467 | |
| 465 | 468 | geq->picref = in; |
| @@ -360,6 +360,7 @@ static void apply_lut10(HueContext *s, · 359 unmodified lines | ||
| 360 | 360 | |
| 361 | 361 | static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) |
| 362 | 362 | { |
| 363 | + FilterLink *inl = ff_filter_link(inlink); | |
| 363 | 364 | HueContext *hue = inlink->dst->priv; |
| 364 | 365 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 365 | 366 | AVFrame *outpic; |
| @@ -381,7 +382,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpic) · 15 unmodified lines | ||
| 381 | 382 | av_frame_copy_props(outpic, inpic); |
| 382 | 383 | } |
| 383 | 384 | |
| 384 | − hue->var_values[VAR_N] = inlink->frame_count_out; | |
| 385 | + hue->var_values[VAR_N] = inl->frame_count_out; | |
| 385 | 386 | hue->var_values[VAR_T] = TS2T(inpic->pts, inlink->time_base); |
| 386 | 387 | hue->var_values[VAR_PTS] = TS2D(inpic->pts); |
| 387 | 388 | |
| @@ -742,6 +742,7 @@ static const AVFrame *ref_frame(const struct pl_frame_mix *mix) · 741 unmodified lines | ||
| 742 | 742 | static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, |
| 743 | 743 | struct pl_frame *target, double target_pts) |
| 744 | 744 | { |
| 745 | + FilterLink *outl = ff_filter_link(ctx->outputs[0]); | |
| 745 | 746 | LibplaceboContext *s = ctx->priv; |
| 746 | 747 | const AVFrame *ref = ref_frame(&in->mix); |
| 747 | 748 | |
| @@ -761,7 +762,7 @@ static void update_crops(AVFilterContext *ctx, LibplaceboInput *in, · 13 unmodified lines | ||
| 761 | 762 | av_q2d(in->link->sample_aspect_ratio) : 1.0; |
| 762 | 763 | s->var_values[VAR_IN_T] = s->var_values[VAR_T] = image_pts; |
| 763 | 764 | s->var_values[VAR_OUT_T] = s->var_values[VAR_OT] = target_pts; |
| 764 | − s->var_values[VAR_N] = ctx->outputs[0]->frame_count_out; | |
| 765 | + s->var_values[VAR_N] = outl->frame_count_out; | |
| 765 | 766 | |
| 766 | 767 | /* Clear these explicitly to avoid leaking previous frames' state */ |
| 767 | 768 | s->var_values[VAR_CROP_W] = s->var_values[VAR_CW] = NAN; |
| @@ -1000,6 +1001,7 @@ static int libplacebo_activate(AVFilterContext *ctx) · 232 unmodified lines | ||
| 1000 | 1001 | int ret, ok = 0, retry = 0; |
| 1001 | 1002 | LibplaceboContext *s = ctx->priv; |
| 1002 | 1003 | AVFilterLink *outlink = ctx->outputs[0]; |
| 1004 | + FilterLink *outl = ff_filter_link(outlink); | |
| 1003 | 1005 | int64_t pts, out_pts; |
| 1004 | 1006 | |
| 1005 | 1007 | FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, ctx); |
| @@ -1012,7 +1014,7 @@ static int libplacebo_activate(AVFilterContext *ctx) · 6 unmodified lines | ||
| 1012 | 1014 | |
| 1013 | 1015 | if (ff_outlink_frame_wanted(outlink)) { |
| 1014 | 1016 | if (s->fps.num) { |
| 1015 | − out_pts = outlink->frame_count_out; | |
| 1017 | + out_pts = outl->frame_count_out; | |
| 1016 | 1018 | } else { |
| 1017 | 1019 | /* Determine the PTS of the next frame from any active input */ |
| 1018 | 1020 | out_pts = INT64_MAX; |
| @@ -36,6 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | #include "libavutil/opt.h" |
| 37 | 37 | #include "libavutil/timestamp.h" |
| 38 | 38 | #include "internal.h" |
| 39 | +#include "filters.h" | |
| 39 | 40 | #include "drawutils.h" |
| 40 | 41 | #include "framesync.h" |
| 41 | 42 | #include "video.h" |
| @@ -881,6 +882,7 @@ static int do_blend(FFFrameSync *fs) · 839 unmodified lines | ||
| 881 | 882 | AVFrame *mainpic, *second; |
| 882 | 883 | OverlayContext *s = ctx->priv; |
| 883 | 884 | AVFilterLink *inlink = ctx->inputs[0]; |
| 885 | + FilterLink *inl = ff_filter_link(inlink); | |
| 884 | 886 | int ret; |
| 885 | 887 | |
| 886 | 888 | ret = ff_framesync_dualinput_get_writable(fs, &mainpic, &second); |
| @@ -891,7 +893,7 @@ static int do_blend(FFFrameSync *fs) · 4 unmodified lines | ||
| 891 | 893 | |
| 892 | 894 | if (s->eval_mode == EVAL_MODE_FRAME) { |
| 893 | 895 | |
| 894 | − s->var_values[VAR_N] = inlink->frame_count_out; | |
| 896 | + s->var_values[VAR_N] = inl->frame_count_out; | |
| 895 | 897 | s->var_values[VAR_T] = mainpic->pts == AV_NOPTS_VALUE ? |
| 896 | 898 | NAN : mainpic->pts * av_q2d(inlink->time_base); |
| 897 | 899 | #if FF_API_FRAME_PKT |
| @@ -236,6 +236,7 @@ static int overlay_cuda_blend(FFFrameSync *fs) · 235 unmodified lines | ||
| 236 | 236 | OverlayCUDAContext *ctx = avctx->priv; |
| 237 | 237 | AVFilterLink *outlink = avctx->outputs[0]; |
| 238 | 238 | AVFilterLink *inlink = avctx->inputs[0]; |
| 239 | + FilterLink *inl = ff_filter_link(inlink); | |
| 239 | 240 | |
| 240 | 241 | CudaFunctions *cu = ctx->hwctx->internal->cuda_dl; |
| 241 | 242 | CUcontext dummy, cuda_ctx = ctx->hwctx->cuda_ctx; |
| @@ -270,7 +271,7 @@ static int overlay_cuda_blend(FFFrameSync *fs) · 28 unmodified lines | ||
| 270 | 271 | } |
| 271 | 272 | |
| 272 | 273 | if (ctx->eval_mode == EVAL_MODE_FRAME) { |
| 273 | − ctx->var_values[VAR_N] = inlink->frame_count_out; | |
| 274 | + ctx->var_values[VAR_N] = inl->frame_count_out; | |
| 274 | 275 | ctx->var_values[VAR_T] = input_main->pts == AV_NOPTS_VALUE ? |
| 275 | 276 | NAN : input_main->pts * av_q2d(inlink->time_base); |
| 276 | 277 | |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include "libavutil/pixdesc.h" |
| 27 | 27 | #include "libavutil/opt.h" |
| 28 | 28 | #include "avfilter.h" |
| 29 | +#include "filters.h" | |
| 29 | 30 | #include "internal.h" |
| 30 | 31 | #include "video.h" |
| 31 | 32 | |
| @@ -122,13 +123,15 @@ enum { VAR_W, VAR_H, VAR_IN, VAR_ON, VAR_VARS_ · 90 unmodified lines | ||
| 122 | 123 | |
| 123 | 124 | static int calc_persp_luts(AVFilterContext *ctx, AVFilterLink *inlink) |
| 124 | 125 | { |
| 126 | + FilterLink *inl = ff_filter_link(inlink); | |
| 125 | 127 | PerspectiveContext *s = ctx->priv; |
| 126 | 128 | AVFilterLink *outlink = ctx->outputs[0]; |
| 129 | + FilterLink *outl = ff_filter_link(outlink); | |
| 127 | 130 | double (*ref)[2] = s->ref; |
| 128 | 131 | |
| 129 | 132 | double values[VAR_VARS_NB] = { [VAR_W] = inlink->w, [VAR_H] = inlink->h, |
| 130 | − [VAR_IN] = inlink->frame_count_out + 1, | |
| 131 | − [VAR_ON] = outlink->frame_count_in + 1 }; | |
| 133 | + [VAR_IN] = inl->frame_count_out + 1, | |
| 134 | + [VAR_ON] = outl->frame_count_in + 1 }; | |
| 132 | 135 | const int h = values[VAR_H]; |
| 133 | 136 | const int w = values[VAR_W]; |
| 134 | 137 | double x0, x1, x2, x3, x4, x5, x6, x7, x8, q; |
| @@ -89,6 +89,7 @@ static int query_formats(AVFilterContext *ctx) · 88 unmodified lines | ||
| 89 | 89 | |
| 90 | 90 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 91 | 91 | { |
| 92 | + FilterLink *inl = ff_filter_link(inlink); | |
| 92 | 93 | AVFilterContext *ctx = inlink->dst; |
| 93 | 94 | AVFilterLink *outlink = ctx->outputs[0]; |
| 94 | 95 | QuircContext *quirc = ctx->priv; |
| @@ -104,7 +105,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 9 unmodified lines | ||
| 104 | 105 | |
| 105 | 106 | codes_count = quirc_count(quirc->quirc); |
| 106 | 107 | av_log(ctx, AV_LOG_VERBOSE, |
| 107 | − "Found count %d codes in image #%ld\n", codes_count, inlink->frame_count_out); | |
| 108 | + "Found count %d codes in image #%ld\n", codes_count, inl->frame_count_out); | |
| 108 | 109 | |
| 109 | 110 | if (codes_count) { |
| 110 | 111 | int i, j; |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | ||
| 33 | 33 | |
| 34 | 34 | #include "avfilter.h" |
| 35 | 35 | #include "drawutils.h" |
| 36 | +#include "filters.h" | |
| 36 | 37 | #include "internal.h" |
| 37 | 38 | #include "video.h" |
| 38 | 39 | |
| @@ -501,6 +502,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) · 462 unmodified lines | ||
| 501 | 502 | |
| 502 | 503 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 503 | 504 | { |
| 505 | + FilterLink *inl = ff_filter_link(inlink); | |
| 504 | 506 | AVFilterContext *ctx = inlink->dst; |
| 505 | 507 | AVFilterLink *outlink = ctx->outputs[0]; |
| 506 | 508 | AVFrame *out; |
| @@ -515,7 +517,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 8 unmodified lines | ||
| 515 | 517 | } |
| 516 | 518 | av_frame_copy_props(out, in); |
| 517 | 519 | |
| 518 | − rot->var_values[VAR_N] = inlink->frame_count_out; | |
| 520 | + rot->var_values[VAR_N] = inl->frame_count_out; | |
| 519 | 521 | rot->var_values[VAR_T] = TS2T(in->pts, inlink->time_base); |
| 520 | 522 | rot->angle = res = av_expr_eval(rot->angle_expr, rot->var_values, rot); |
| 521 | 523 | |
| @@ -879,6 +879,7 @@ static int scale_field(ScaleContext *scale, AVFrame *dst, AVFrame *src, · 878 unmodified lines | ||
| 879 | 879 | static int scale_frame(AVFilterLink *link, AVFrame **frame_in, |
| 880 | 880 | AVFrame **frame_out) |
| 881 | 881 | { |
| 882 | + FilterLink *inl = ff_filter_link(link); | |
| 882 | 883 | AVFilterContext *ctx = link->dst; |
| 883 | 884 | ScaleContext *scale = ctx->priv; |
| 884 | 885 | AVFilterLink *outlink = ctx->outputs[0]; |
| @@ -938,7 +939,7 @@ static int scale_frame(AVFilterLink *link, AVFrame **frame_in, · 53 unmodified lines | ||
| 938 | 939 | } |
| 939 | 940 | |
| 940 | 941 | if (ctx->filter == &ff_vf_scale2ref) { |
| 941 | − scale->var_values[VAR_S2R_MAIN_N] = link->frame_count_out; | |
| 942 | + scale->var_values[VAR_S2R_MAIN_N] = inl->frame_count_out; | |
| 942 | 943 | scale->var_values[VAR_S2R_MAIN_T] = TS2T(in->pts, link->time_base); |
| 943 | 944 | #if FF_API_FRAME_PKT |
| 944 | 945 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -946,7 +947,7 @@ FF_DISABLE_DEPRECATION_WARNINGS · 1 unmodified line | ||
| 946 | 947 | FF_ENABLE_DEPRECATION_WARNINGS |
| 947 | 948 | #endif |
| 948 | 949 | } else { |
| 949 | − scale->var_values[VAR_N] = link->frame_count_out; | |
| 950 | + scale->var_values[VAR_N] = inl->frame_count_out; | |
| 950 | 951 | scale->var_values[VAR_T] = TS2T(in->pts, link->time_base); |
| 951 | 952 | #if FF_API_FRAME_PKT |
| 952 | 953 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -1035,6 +1036,8 @@ static int do_scale(FFFrameSync *fs) · 82 unmodified lines | ||
| 1035 | 1036 | |
| 1036 | 1037 | if (ref) { |
| 1037 | 1038 | AVFilterLink *reflink = ctx->inputs[1]; |
| 1039 | + FilterLink *rl = ff_filter_link(reflink); | |
| 1040 | + | |
| 1038 | 1041 | frame_changed = ref->width != reflink->w || |
| 1039 | 1042 | ref->height != reflink->h || |
| 1040 | 1043 | ref->format != reflink->format || |
| @@ -1058,7 +1061,7 @@ static int do_scale(FFFrameSync *fs) · 17 unmodified lines | ||
| 1058 | 1061 | } |
| 1059 | 1062 | |
| 1060 | 1063 | if (scale->eval_mode == EVAL_MODE_FRAME) { |
| 1061 | − scale->var_values[VAR_REF_N] = reflink->frame_count_out; | |
| 1064 | + scale->var_values[VAR_REF_N] = rl->frame_count_out; | |
| 1062 | 1065 | scale->var_values[VAR_REF_T] = TS2T(ref->pts, reflink->time_base); |
| 1063 | 1066 | #if FF_API_FRAME_PKT |
| 1064 | 1067 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -1097,6 +1100,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) · 32 unmodified lines | ||
| 1097 | 1100 | |
| 1098 | 1101 | static int filter_frame_ref(AVFilterLink *link, AVFrame *in) |
| 1099 | 1102 | { |
| 1103 | + FilterLink *l = ff_filter_link(link); | |
| 1100 | 1104 | ScaleContext *scale = link->dst->priv; |
| 1101 | 1105 | AVFilterLink *outlink = link->dst->outputs[1]; |
| 1102 | 1106 | int frame_changed; |
| @@ -1122,7 +1126,7 @@ static int filter_frame_ref(AVFilterLink *link, AVFrame *in) · 19 unmodified lines | ||
| 1122 | 1126 | } |
| 1123 | 1127 | |
| 1124 | 1128 | if (scale->eval_mode == EVAL_MODE_FRAME) { |
| 1125 | − scale->var_values[VAR_N] = link->frame_count_out; | |
| 1129 | + scale->var_values[VAR_N] = l->frame_count_out; | |
| 1126 | 1130 | scale->var_values[VAR_T] = TS2T(in->pts, link->time_base); |
| 1127 | 1131 | #if FF_API_FRAME_PKT |
| 1128 | 1132 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -791,6 +791,7 @@ static int (*const nppscale_process[])(AVFilterContext *ctx, NPPScaleStageContex · 790 unmodified lines | ||
| 791 | 791 | |
| 792 | 792 | static int nppscale_scale(AVFilterLink *link, AVFrame *out, AVFrame *in) |
| 793 | 793 | { |
| 794 | + FilterLink *inl = ff_filter_link(link); | |
| 794 | 795 | AVFilterContext *ctx = link->dst; |
| 795 | 796 | NPPScaleContext *s = ctx->priv; |
| 796 | 797 | AVFilterLink *outlink = ctx->outputs[0]; |
| @@ -840,7 +841,7 @@ static int nppscale_scale(AVFilterLink *link, AVFrame *out, AVFrame *in) · 43 unmodified lines | ||
| 840 | 841 | } |
| 841 | 842 | |
| 842 | 843 | if (ctx->filter == &ff_vf_scale2ref_npp) { |
| 843 | − s->var_values[VAR_S2R_MAIN_N] = link->frame_count_out; | |
| 844 | + s->var_values[VAR_S2R_MAIN_N] = inl->frame_count_out; | |
| 844 | 845 | s->var_values[VAR_S2R_MAIN_T] = TS2T(in->pts, link->time_base); |
| 845 | 846 | #if FF_API_FRAME_PKT |
| 846 | 847 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -848,7 +849,7 @@ FF_DISABLE_DEPRECATION_WARNINGS · 1 unmodified line | ||
| 848 | 849 | FF_ENABLE_DEPRECATION_WARNINGS |
| 849 | 850 | #endif |
| 850 | 851 | } else { |
| 851 | − s->var_values[VAR_N] = link->frame_count_out; | |
| 852 | + s->var_values[VAR_N] = inl->frame_count_out; | |
| 852 | 853 | s->var_values[VAR_T] = TS2T(in->pts, link->time_base); |
| 853 | 854 | #if FF_API_FRAME_PKT |
| 854 | 855 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -947,6 +948,7 @@ fail: · 92 unmodified lines | ||
| 947 | 948 | |
| 948 | 949 | static int nppscale_filter_frame_ref(AVFilterLink *link, AVFrame *in) |
| 949 | 950 | { |
| 951 | + FilterLink *inl = ff_filter_link(link); | |
| 950 | 952 | NPPScaleContext *scale = link->dst->priv; |
| 951 | 953 | AVFilterLink *outlink = link->dst->outputs[1]; |
| 952 | 954 | int frame_changed; |
| @@ -968,7 +970,7 @@ static int nppscale_filter_frame_ref(AVFilterLink *link, AVFrame *in) · 15 unmodified lines | ||
| 968 | 970 | } |
| 969 | 971 | |
| 970 | 972 | if (scale->eval_mode == EVAL_MODE_FRAME) { |
| 971 | − scale->var_values[VAR_N] = link->frame_count_out; | |
| 973 | + scale->var_values[VAR_N] = inl->frame_count_out; | |
| 972 | 974 | scale->var_values[VAR_T] = TS2T(in->pts, link->time_base); |
| 973 | 975 | #if FF_API_FRAME_PKT |
| 974 | 976 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -728,6 +728,7 @@ static void update_sample_stats(int depth, int be, const uint8_t *src, int len, · 727 unmodified lines | ||
| 728 | 728 | |
| 729 | 729 | static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
| 730 | 730 | { |
| 731 | + FilterLink *inl = ff_filter_link(inlink); | |
| 731 | 732 | AVFilterContext *ctx = inlink->dst; |
| 732 | 733 | ShowInfoContext *s = ctx->priv; |
| 733 | 734 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); |
| @@ -761,7 +762,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) · 27 unmodified lines | ||
| 761 | 762 | "n:%4"PRId64" pts:%7s pts_time:%-7s duration:%7"PRId64 |
| 762 | 763 | " duration_time:%-7s " |
| 763 | 764 | "fmt:%s cl:%s sar:%d/%d s:%dx%d i:%c iskey:%d type:%c ", |
| 764 | − inlink->frame_count_out, | |
| 765 | + inl->frame_count_out, | |
| 765 | 766 | av_ts2str(frame->pts), av_ts2timestr(frame->pts, &inlink->time_base), |
| 766 | 767 | frame->duration, av_ts2timestr(frame->duration, &inlink->time_base), |
| 767 | 768 | desc->name, av_chroma_location_name(frame->chroma_location), |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | ||
| 25 | 25 | #include "libavutil/opt.h" |
| 26 | 26 | |
| 27 | 27 | #include "avfilter.h" |
| 28 | +#include "filters.h" | |
| 28 | 29 | #include "formats.h" |
| 29 | 30 | #include "internal.h" |
| 30 | 31 | #include "video.h" |
| @@ -78,6 +79,7 @@ enum { VAR_W, VAR_H, VAR_A, VAR_N, VAR_T, · 47 unmodified lines | ||
| 78 | 79 | |
| 79 | 80 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 80 | 81 | { |
| 82 | + FilterLink *inl = ff_filter_link(inlink); | |
| 81 | 83 | AVFilterContext *ctx = inlink->dst; |
| 82 | 84 | AVFilterLink *outlink = ctx->outputs[0]; |
| 83 | 85 | SwapRectContext *s = ctx->priv; |
| @@ -97,7 +99,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 13 unmodified lines | ||
| 97 | 99 | var_values[VAR_A] = (float) inlink->w / inlink->h; |
| 98 | 100 | var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ? av_q2d(inlink->sample_aspect_ratio) : 1; |
| 99 | 101 | var_values[VAR_DAR] = var_values[VAR_A] * var_values[VAR_SAR]; |
| 100 | − var_values[VAR_N] = inlink->frame_count_out; | |
| 102 | + var_values[VAR_N] = inl->frame_count_out; | |
| 101 | 103 | var_values[VAR_T] = in->pts == AV_NOPTS_VALUE ? NAN : in->pts * av_q2d(inlink->time_base); |
| 102 | 104 | #if FF_API_FRAME_PKT |
| 103 | 105 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -167,6 +167,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) · 166 unmodified lines | ||
| 167 | 167 | { |
| 168 | 168 | AVFilterContext *ctx = inlink->dst; |
| 169 | 169 | AVFilterLink *outlink = ctx->outputs[0]; |
| 170 | + FilterLink *outl = ff_filter_link(outlink); | |
| 170 | 171 | TelecineContext *s = ctx->priv; |
| 171 | 172 | int i, len, ret = 0, nout = 0; |
| 172 | 173 | |
| @@ -281,7 +282,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 108 unmodified lines | ||
| 281 | 282 | else |
| 282 | 283 | frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST; |
| 283 | 284 | frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) + |
| 284 | − av_rescale(outlink->frame_count_in, s->ts_unit.num, | |
| 285 | + av_rescale(outl->frame_count_in, s->ts_unit.num, | |
| 285 | 286 | s->ts_unit.den); |
| 286 | 287 | ret = ff_filter_frame(outlink, frame); |
| 287 | 288 | } |
| @@ -376,6 +376,7 @@ void copy_picture_field(TInterlaceContext *tinterlace, · 375 unmodified lines | ||
| 376 | 376 | |
| 377 | 377 | static int filter_frame(AVFilterLink *inlink, AVFrame *picref) |
| 378 | 378 | { |
| 379 | + FilterLink *inl = ff_filter_link(inlink); | |
| 379 | 380 | AVFilterContext *ctx = inlink->dst; |
| 380 | 381 | AVFilterLink *outlink = ctx->outputs[0]; |
| 381 | 382 | FilterLink *l = ff_filter_link(outlink); |
| @@ -418,12 +419,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 36 unmodified lines | ||
| 418 | 419 | copy_picture_field(tinterlace, out->data, out->linesize, |
| 419 | 420 | (const uint8_t **)cur->data, cur->linesize, |
| 420 | 421 | inlink->format, inlink->w, inlink->h, |
| 421 | − FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inlink->frame_count_out) & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags); | |
| 422 | + FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inl->frame_count_out) & 1 ? FIELD_LOWER : FIELD_UPPER : FIELD_UPPER, tinterlace->flags); | |
| 422 | 423 | /* write even frame lines into the lower field of the new frame */ |
| 423 | 424 | copy_picture_field(tinterlace, out->data, out->linesize, |
| 424 | 425 | (const uint8_t **)next->data, next->linesize, |
| 425 | 426 | inlink->format, inlink->w, inlink->h, |
| 426 | − FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inlink->frame_count_out) & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags); | |
| 427 | + FIELD_UPPER_AND_LOWER, 1, tinterlace->mode == MODE_MERGEX2 ? (1 + inl->frame_count_out) & 1 ? FIELD_UPPER : FIELD_LOWER : FIELD_LOWER, tinterlace->flags); | |
| 427 | 428 | if (tinterlace->mode != MODE_MERGEX2) |
| 428 | 429 | av_frame_free(&tinterlace->next); |
| 429 | 430 | break; |
| @@ -445,7 +446,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 15 unmodified lines | ||
| 445 | 446 | out->height = outlink->h; |
| 446 | 447 | out->sample_aspect_ratio = av_mul_q(cur->sample_aspect_ratio, av_make_q(2, 1)); |
| 447 | 448 | |
| 448 | − field = (1 + outlink->frame_count_in) & 1 ? FIELD_UPPER : FIELD_LOWER; | |
| 449 | + field = (1 + l->frame_count_in) & 1 ? FIELD_UPPER : FIELD_LOWER; | |
| 449 | 450 | full = out->color_range == AVCOL_RANGE_JPEG || ff_fmt_is_in(out->format, full_scale_yuvj_pix_fmts); |
| 450 | 451 | /* copy upper and lower fields */ |
| 451 | 452 | copy_picture_field(tinterlace, out->data, out->linesize, |
| @@ -150,12 +150,13 @@ static double get_natural_factor(const VignetteContext *s, int x, int y) · 149 unmodified lines | ||
| 150 | 150 | |
| 151 | 151 | static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *frame) |
| 152 | 152 | { |
| 153 | + FilterLink *inl = ff_filter_link(inlink); | |
| 153 | 154 | int x, y; |
| 154 | 155 | float *dst = s->fmap; |
| 155 | 156 | int dst_linesize = s->fmap_linesize; |
| 156 | 157 | |
| 157 | 158 | if (frame) { |
| 158 | − s->var_values[VAR_N] = inlink->frame_count_out; | |
| 159 | + s->var_values[VAR_N] = inl->frame_count_out; | |
| 159 | 160 | s->var_values[VAR_T] = TS2T(frame->pts, inlink->time_base); |
| 160 | 161 | s->var_values[VAR_PTS] = TS2D(frame->pts); |
| 161 | 162 | } else { |
| @@ -100,12 +100,13 @@ typedef struct ThreadData { · 99 unmodified lines | ||
| 100 | 100 | static int weave_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) |
| 101 | 101 | { |
| 102 | 102 | AVFilterLink *inlink = ctx->inputs[0]; |
| 103 | + FilterLink *inl = ff_filter_link(inlink); | |
| 103 | 104 | WeaveContext *s = ctx->priv; |
| 104 | 105 | ThreadData *td = arg; |
| 105 | 106 | AVFrame *in = td->in; |
| 106 | 107 | AVFrame *out = td->out; |
| 107 | 108 | |
| 108 | − const int weave = (s->double_weave && !(inlink->frame_count_out & 1)); | |
| 109 | + const int weave = (s->double_weave && !(inl->frame_count_out & 1)); | |
| 109 | 110 | const int field1 = weave ? s->first_field : (!s->first_field); |
| 110 | 111 | const int field2 = weave ? (!s->first_field) : s->first_field; |
| 111 | 112 | |
| @@ -156,6 +156,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va · 155 unmodified lines | ||
| 156 | 156 | { |
| 157 | 157 | ZPContext *s = ctx->priv; |
| 158 | 158 | AVFilterLink *outlink = ctx->outputs[0]; |
| 159 | + FilterLink *outl = ff_filter_link(outlink); | |
| 159 | 160 | AVFilterLink *inlink = ctx->inputs[0]; |
| 160 | 161 | int64_t pts = s->frame_count; |
| 161 | 162 | int k, x, y, w, h, ret = 0; |
| @@ -172,7 +173,7 @@ static int output_single_frame(AVFilterContext *ctx, AVFrame *in, double *var_va · 10 unmodified lines | ||
| 172 | 173 | var_values[VAR_OUT_TIME] = pts * av_q2d(outlink->time_base); |
| 173 | 174 | var_values[VAR_TIME] = var_values[VAR_OT] = var_values[VAR_OUT_TIME]; |
| 174 | 175 | var_values[VAR_FRAME] = i; |
| 175 | − var_values[VAR_ON] = outlink->frame_count_in; | |
| 176 | + var_values[VAR_ON] = outl->frame_count_in; | |
| 176 | 177 | |
| 177 | 178 | *zoom = av_expr_eval(s->zoom_expr, var_values, NULL); |
| 178 | 179 | |
| @@ -260,7 +261,9 @@ static int activate(AVFilterContext *ctx) · 81 unmodified lines | ||
| 260 | 261 | { |
| 261 | 262 | ZPContext *s = ctx->priv; |
| 262 | 263 | AVFilterLink *inlink = ctx->inputs[0]; |
| 264 | + FilterLink *inl = ff_filter_link(inlink); | |
| 263 | 265 | AVFilterLink *outlink = ctx->outputs[0]; |
| 266 | + FilterLink *outl = ff_filter_link(outlink); | |
| 264 | 267 | int status, ret = 0; |
| 265 | 268 | int64_t pts; |
| 266 | 269 | |
| @@ -283,8 +286,8 @@ static int activate(AVFilterContext *ctx) · 16 unmodified lines | ||
| 283 | 286 | s->var_values[VAR_IN_H] = s->var_values[VAR_IH] = s->in->height; |
| 284 | 287 | s->var_values[VAR_OUT_W] = s->var_values[VAR_OW] = s->w; |
| 285 | 288 | s->var_values[VAR_OUT_H] = s->var_values[VAR_OH] = s->h; |
| 286 | − s->var_values[VAR_IN] = inlink->frame_count_out - 1; | |
| 287 | − s->var_values[VAR_ON] = outlink->frame_count_in; | |
| 289 | + s->var_values[VAR_IN] = inl->frame_count_out - 1; | |
| 290 | + s->var_values[VAR_ON] = outl->frame_count_in; | |
| 288 | 291 | s->var_values[VAR_PX] = s->x; |
| 289 | 292 | s->var_values[VAR_PY] = s->y; |
| 290 | 293 | s->var_values[VAR_X] = 0; |
| @@ -292,12 +292,13 @@ static int config_props(AVFilterLink *outlink) · 291 unmodified lines | ||
| 292 | 292 | |
| 293 | 293 | static int request_frame(AVFilterLink *outlink) |
| 294 | 294 | { |
| 295 | + FilterLink *outl = ff_filter_link(outlink); | |
| 295 | 296 | MPTestContext *test = outlink->src->priv; |
| 296 | 297 | AVFrame *picref; |
| 297 | 298 | int w = WIDTH, h = HEIGHT, |
| 298 | 299 | cw = AV_CEIL_RSHIFT(w, test->hsub), ch = AV_CEIL_RSHIFT(h, test->vsub); |
| 299 | − uint64_t frame = outlink->frame_count_in / test->max_frames; | |
| 300 | − uint64_t mod = outlink->frame_count_in % test->max_frames; | |
| 300 | + uint64_t frame = outl->frame_count_in / test->max_frames; | |
| 301 | + uint64_t mod = outl->frame_count_in % test->max_frames; | |
| 301 | 302 | enum test_type tt = test->test; |
| 302 | 303 | int i; |
| 303 | 304 | |