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
995995 return ff_filter_frame(link->dst->outputs[0], frame);
996996 }
997997
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+ */
1004+static 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
1011+FF_DISABLE_DEPRECATION_WARNINGS
1012+ int64_t pos = frame->pkt_pos;
1013+FF_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+
9981030 static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
9991031 {
10001032 FilterLink *l = ff_filter_link(link);
@@ -1013,7 +1045,7 @@ static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame) · 12 unmodified lines
10131045 }
10141046
10151047 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);
10171049
10181050 if (dstctx->is_disabled &&
10191051 (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC))
@@ -1451,7 +1483,7 @@ static void consume_update(FilterLinkInternal *li, const AVFrame *frame) · 431 unmodified lines
14511483 update_link_current_pts(li, frame->pts);
14521484 ff_inlink_process_commands(link, frame);
14531485 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);
14551487 li->l.frame_count_out++;
14561488 li->l.sample_count_out += frame->nb_samples;
14571489 }
@@ -1559,32 +1591,6 @@ int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame) · 101 unmodified lines
15591591 return 0;
15601592 }
15611593
1562−int 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
1569−FF_DISABLE_DEPRECATION_WARNINGS
1570− int64_t pos = frame->pkt_pos;
1571−FF_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−
15881594 void ff_inlink_request_frame(AVFilterLink *link)
15891595 {
15901596 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
222222 */
223223 int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);
224224
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− */
231−int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame);
232−
233225 #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