History

lavfi/avfilter: make ff_inlink_evaluate_timeline_at_frame() static

It is not used outside of avfilter.c

Anton Khirnov committed 2 years ago

Commit d3739dc1 parent 6647e572 files · +34 −36Browse files

Unified · Split

2 files
  1. libavfilter/avfilter.c +34 −28
  2. libavfilter/avfilter_internal.h +0 −8
libavfilter/avfilter.c+34−28
@@ -995,6 +995,38 @@ static int default_filter_frame(AVFilterLink *link, AVFrame *frame) · 994 unmodified lines
995 return ff_filter_frame(link->dst->outputs[0], frame);995 return ff_filter_frame(link->dst->outputs[0], frame);
996}996}
997 997
998/**
999 * Evaluate the timeline expression of the link for the time and properties
1000 * of the frame.
1001 * @return >0 if enabled, 0 if disabled
1002 * @note It does not update link->dst->is_disabled.
1003 */
1004static int evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
1005{
1006 FilterLink *l = ff_filter_link(link);
1007 AVFilterContext *dstctx = link->dst;
1008 FFFilterContext *dsti = fffilterctx(dstctx);
1009 int64_t pts = frame->pts;
1010#if FF_API_FRAME_PKT
1011FF_DISABLE_DEPRECATION_WARNINGS
1012 int64_t pos = frame->pkt_pos;
1013FF_ENABLE_DEPRECATION_WARNINGS
1014#endif
1015
1016 if (!dstctx->enable_str)
1017 return 1;
1018
1019 dsti->var_values[VAR_N] = l->frame_count_out;
1020 dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
1021 dsti->var_values[VAR_W] = link->w;
1022 dsti->var_values[VAR_H] = link->h;
1023#if FF_API_FRAME_PKT
1024 dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos;
1025#endif
1026
1027 return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5;
1028}
1029
998static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)1030static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
999{1031{
1000 FilterLink *l = ff_filter_link(link);1032 FilterLink *l = ff_filter_link(link);
@@ -1013,7 +1045,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) · 12 unmodified lines
1013 }1045 }
1014 1046
1015 ff_inlink_process_commands(link, frame);1047 ff_inlink_process_commands(link, frame);
1016 dstctx->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);1048 dstctx->is_disabled = !evaluate_timeline_at_frame(link, frame);
1017 1049
1018 if (dstctx->is_disabled &&1050 if (dstctx->is_disabled &&
1019 (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC))1051 (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC))
@@ -1451,7 +1483,7 @@ static void consume_update(FilterLinkInternal *li, const AVFrame *frame) · 431 unmodified lines
1451 update_link_current_pts(li, frame->pts);1483 update_link_current_pts(li, frame->pts);
1452 ff_inlink_process_commands(link, frame);1484 ff_inlink_process_commands(link, frame);
1453 if (link == link->dst->inputs[0])1485 if (link == link->dst->inputs[0])
1454 link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);1486 link->dst->is_disabled = !evaluate_timeline_at_frame(link, frame);
1455 li->l.frame_count_out++;1487 li->l.frame_count_out++;
1456 li->l.sample_count_out += frame->nb_samples;1488 li->l.sample_count_out += frame->nb_samples;
1457}1489}
@@ -1559,32 +1591,6 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) · 101 unmodified lines
1559 return 0;1591 return 0;
1560}1592}
1561 1593
1562int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
1563{
1564 FilterLink *l = ff_filter_link(link);
1565 AVFilterContext *dstctx = link->dst;
1566 FFFilterContext *dsti = fffilterctx(dstctx);
1567 int64_t pts = frame->pts;
1568#if FF_API_FRAME_PKT
1569FF_DISABLE_DEPRECATION_WARNINGS
1570 int64_t pos = frame->pkt_pos;
1571FF_ENABLE_DEPRECATION_WARNINGS
1572#endif
1573
1574 if (!dstctx->enable_str)
1575 return 1;
1576
1577 dsti->var_values[VAR_N] = l->frame_count_out;
1578 dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
1579 dsti->var_values[VAR_W] = link->w;
1580 dsti->var_values[VAR_H] = link->h;
1581#if FF_API_FRAME_PKT
1582 dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos;
1583#endif
1584
1585 return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5;
1586}
1587
1588void ff_inlink_request_frame(AVFilterLink *link)1594void ff_inlink_request_frame(AVFilterLink *link)
1589{1595{
1590 av_unused FilterLinkInternal *li = ff_link_internal(link);1596 av_unused FilterLinkInternal *li = ff_link_internal(link);
libavfilter/avfilter_internal.h+0−8
@@ -222,12 +222,4 @@ int ff_filter_graph_run_once(AVFilterGraph *graph); · 221 unmodified lines
222 */222 */
223int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);223int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);
224 224
225/**
226 * Evaluate the timeline expression of the link for the time and properties
227 * of the frame.
228 * @return >0 if enabled, 0 if disabled
229 * @note It does not update link->dst->is_disabled.
230 */
231int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame);
232
233#endif /* AVFILTER_AVFILTER_INTERNAL_H */225#endif /* AVFILTER_AVFILTER_INTERNAL_H */

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