diff mbox series

[FFmpeg-devel,5/7] lavfi/avfilter: make ff_inlink_evaluate_timeline_at_frame() static

Message ID 20241003193127.15818-5-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/7] lavfi/avfilter: move AVFilterContext.ready to FFFilterContext | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Oct. 3, 2024, 7:31 p.m. UTC
It is not used outside of avfilter.c
---
 libavfilter/avfilter.c          | 62 ++++++++++++++++++---------------
 libavfilter/avfilter_internal.h |  8 -----
 2 files changed, 34 insertions(+), 36 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 86bf7773e1..3295ffb18c 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -995,6 +995,38 @@  static int default_filter_frame(AVFilterLink *link, AVFrame *frame)
     return ff_filter_frame(link->dst->outputs[0], frame);
 }
 
+/**
+ * Evaluate the timeline expression of the link for the time and properties
+ * of the frame.
+ * @return  >0 if enabled, 0 if disabled
+ * @note  It does not update link->dst->is_disabled.
+ */
+static int evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
+{
+    FilterLink *l = ff_filter_link(link);
+    AVFilterContext *dstctx = link->dst;
+    FFFilterContext *dsti = fffilterctx(dstctx);
+    int64_t pts = frame->pts;
+#if FF_API_FRAME_PKT
+FF_DISABLE_DEPRECATION_WARNINGS
+    int64_t pos = frame->pkt_pos;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+    if (!dstctx->enable_str)
+        return 1;
+
+    dsti->var_values[VAR_N] = l->frame_count_out;
+    dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
+    dsti->var_values[VAR_W] = link->w;
+    dsti->var_values[VAR_H] = link->h;
+#if FF_API_FRAME_PKT
+    dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos;
+#endif
+
+    return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5;
+}
+
 static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
 {
     FilterLink *l = ff_filter_link(link);
@@ -1013,7 +1045,7 @@  static int ff_filter_frame_framed(AVFilterLink *link, AVFrame *frame)
     }
 
     ff_inlink_process_commands(link, frame);
-    dstctx->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
+    dstctx->is_disabled = !evaluate_timeline_at_frame(link, frame);
 
     if (dstctx->is_disabled &&
         (dstctx->filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC))
@@ -1451,7 +1483,7 @@  static void consume_update(FilterLinkInternal *li, const AVFrame *frame)
     update_link_current_pts(li, frame->pts);
     ff_inlink_process_commands(link, frame);
     if (link == link->dst->inputs[0])
-        link->dst->is_disabled = !ff_inlink_evaluate_timeline_at_frame(link, frame);
+        link->dst->is_disabled = !evaluate_timeline_at_frame(link, frame);
     li->l.frame_count_out++;
     li->l.sample_count_out += frame->nb_samples;
 }
@@ -1559,32 +1591,6 @@  int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame)
     return 0;
 }
 
-int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame)
-{
-    FilterLink *l = ff_filter_link(link);
-    AVFilterContext *dstctx = link->dst;
-    FFFilterContext *dsti = fffilterctx(dstctx);
-    int64_t pts = frame->pts;
-#if FF_API_FRAME_PKT
-FF_DISABLE_DEPRECATION_WARNINGS
-    int64_t pos = frame->pkt_pos;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
-    if (!dstctx->enable_str)
-        return 1;
-
-    dsti->var_values[VAR_N] = l->frame_count_out;
-    dsti->var_values[VAR_T] = pts == AV_NOPTS_VALUE ? NAN : pts * av_q2d(link->time_base);
-    dsti->var_values[VAR_W] = link->w;
-    dsti->var_values[VAR_H] = link->h;
-#if FF_API_FRAME_PKT
-    dsti->var_values[VAR_POS] = pos == -1 ? NAN : pos;
-#endif
-
-    return fabs(av_expr_eval(dsti->enable, dsti->var_values, NULL)) >= 0.5;
-}
-
 void ff_inlink_request_frame(AVFilterLink *link)
 {
     av_unused FilterLinkInternal *li = ff_link_internal(link);
diff --git a/libavfilter/avfilter_internal.h b/libavfilter/avfilter_internal.h
index c2a2378d61..e0aee20a32 100644
--- a/libavfilter/avfilter_internal.h
+++ b/libavfilter/avfilter_internal.h
@@ -222,12 +222,4 @@  int ff_filter_graph_run_once(AVFilterGraph *graph);
  */
 int ff_inlink_process_commands(AVFilterLink *link, const AVFrame *frame);
 
-/**
- * Evaluate the timeline expression of the link for the time and properties
- * of the frame.
- * @return  >0 if enabled, 0 if disabled
- * @note  It does not update link->dst->is_disabled.
- */
-int ff_inlink_evaluate_timeline_at_frame(AVFilterLink *link, const AVFrame *frame);
-
 #endif /* AVFILTER_AVFILTER_INTERNAL_H */