History

lavfi: move AVFilterLink.{frame,sample}_count_{in,out} to FilterLink

Anton Khirnov committed 2 years ago

Commit 42cbf661 parent a23d56556 files · +209 −116Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t