History

lavfi: move AVFilterLink.frame_wanted_out to FilterLinkInternal

Anton Khirnov committed 2 years ago

Commit fb3efef1 parent 42cbf666 files · +25 −21Browse files

Unified · Split

6 files
  1. libavfilter/avfilter.c +14 −8
  2. libavfilter/avfilter.h +0 −7
  3. libavfilter/avfilter_internal.h +7 −0
  4. libavfilter/avfiltergraph.c +1 −1
  5. libavfilter/buffersink.c +2 −1
  6. libavfilter/filters.h +1 −4
libavfilter/avfilter.c+14−8
@@ -264,7 +264,7 @@ void ff_avfilter_link_set_in_status(AVFilterLink *link, int status, int64_t pts) · 263 unmodified lines
264264 av_assert0(!li->status_in);
265265 li->status_in = status;
266266 li->status_in_pts = pts;
267− link->frame_wanted_out = 0;
267+ li->frame_wanted_out = 0;
268268 li->frame_blocked_in = 0;
269269 filter_unblock(link->dst);
270270 ff_filter_set_ready(link->dst, 200);
@@ -278,7 +278,7 @@ static void link_set_out_status(AVFilterLink *link, int status, int64_t pts) · 7 unmodified lines
278278 {
279279 FilterLinkInternal * const li = ff_link_internal(link);
280280
281− av_assert0(!link->frame_wanted_out);
281+ av_assert0(!li->frame_wanted_out);
282282 av_assert0(!li->status_out);
283283 li->status_out = status;
284284 if (pts != AV_NOPTS_VALUE)
@@ -481,7 +481,7 @@ int ff_request_frame(AVFilterLink *link) · 196 unmodified lines
481481 return li->status_out;
482482 if (li->status_in) {
483483 if (ff_framequeue_queued_frames(&li->fifo)) {
484− av_assert1(!link->frame_wanted_out);
484+ av_assert1(!li->frame_wanted_out);
485485 av_assert1(link->dst->ready >= 300);
486486 return 0;
487487 } else {
@@ -492,7 +492,7 @@ int ff_request_frame(AVFilterLink *link) · 4 unmodified lines
492492 return li->status_out;
493493 }
494494 }
495− link->frame_wanted_out = 1;
495+ li->frame_wanted_out = 1;
496496 ff_filter_set_ready(link->src, 100);
497497 return 0;
498498 }
@@ -1058,7 +1058,7 @@ int ff_filter_frame(AVFilterLink *link, AVFrame *frame) · 559 unmodified lines
10581058 link->time_base);
10591059 }
10601060
1061− li->frame_blocked_in = link->frame_wanted_out = 0;
1061+ li->frame_blocked_in = li->frame_wanted_out = 0;
10621062 li->l.frame_count_in++;
10631063 li->l.sample_count_in += frame->nb_samples;
10641064 filter_unblock(link->dst);
@@ -1241,7 +1241,7 @@ static int ff_filter_activate_default(AVFilterContext *filter) · 176 unmodified lines
12411241 }
12421242 for (i = 0; i < filter->nb_outputs; i++) {
12431243 FilterLinkInternal * const li = ff_link_internal(filter->outputs[i]);
1244− if (filter->outputs[i]->frame_wanted_out &&
1244+ if (li->frame_wanted_out &&
12451245 !li->frame_blocked_in) {
12461246 return ff_request_frame_to_filter(filter->outputs[i]);
12471247 }
@@ -1581,7 +1581,7 @@ void ff_inlink_request_frame(AVFilterLink *link) · 333 unmodified lines
15811581 av_unused FilterLinkInternal *li = ff_link_internal(link);
15821582 av_assert1(!li->status_in);
15831583 av_assert1(!li->status_out);
1584− link->frame_wanted_out = 1;
1584+ li->frame_wanted_out = 1;
15851585 ff_filter_set_ready(link->src, 100);
15861586 }
15871587
@@ -1590,7 +1590,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status) · 2 unmodified lines
15901590 FilterLinkInternal * const li = ff_link_internal(link);
15911591 if (li->status_out)
15921592 return;
1593− link->frame_wanted_out = 0;
1593+ li->frame_wanted_out = 0;
15941594 li->frame_blocked_in = 0;
15951595 link_set_out_status(link, status, AV_NOPTS_VALUE);
15961596 while (ff_framequeue_queued_frames(&li->fifo)) {
@@ -1642,3 +1642,9 @@ int ff_filter_init_hw_frames(AVFilterContext *avctx, AVFilterLink *link, · 45 unmodified lines
16421642
16431643 return 0;
16441644 }
1645+
1646+int ff_outlink_frame_wanted(AVFilterLink *link)
1647+{
1648+ FilterLinkInternal * const li = ff_link_internal(link);
1649+ return li->frame_wanted_out;
1650+}
libavfilter/avfilter.h+0−7
@@ -599,13 +599,6 @@ struct AVFilterLink { · 598 unmodified lines
599599 * Graph the filter belongs to.
600600 */
601601 struct AVFilterGraph *graph;
602−
603− /**
604− * True if a frame is currently wanted on the output of this filter.
605− * Set when ff_request_frame() is called by the output,
606− * cleared when a frame is filtered.
607− */
608− int frame_wanted_out;
609602 };
610603
611604 /**
libavfilter/avfilter_internal.h+7−0
@@ -67,6 +67,13 @@ typedef struct FilterLinkInternal { · 66 unmodified lines
6767 */
6868 int status_out;
6969
70+ /**
71+ * True if a frame is currently wanted on the output of this filter.
72+ * Set when ff_request_frame() is called by the output,
73+ * cleared when a frame is filtered.
74+ */
75+ int frame_wanted_out;
76+
7077 /**
7178 * Index in the age array.
7279 */
libavfilter/avfiltergraph.c+1−1
@@ -1406,7 +1406,7 @@ int avfilter_graph_request_oldest(AVFilterGraph *graph) · 1405 unmodified lines
14061406 while (frame_count == oldesti->l.frame_count_out) {
14071407 r = ff_filter_graph_run_once(graph);
14081408 if (r == AVERROR(EAGAIN) &&
1409− !oldest->frame_wanted_out && !oldesti->frame_blocked_in &&
1409+ !oldesti->frame_wanted_out && !oldesti->frame_blocked_in &&
14101410 !oldesti->status_in)
14111411 (void)ff_request_frame(oldest);
14121412 else if (r < 0)
libavfilter/buffersink.c+2−1
@@ -88,6 +88,7 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i · 87 unmodified lines
8888 {
8989 BufferSinkContext *buf = ctx->priv;
9090 AVFilterLink *inlink = ctx->inputs[0];
91+ FilterLinkInternal *li = ff_link_internal(inlink);
9192 int status, ret;
9293 AVFrame *cur_frame;
9394 int64_t pts;
@@ -107,7 +108,7 @@ static int get_frame_internal(AVFilterContext *ctx, AVFrame *frame, int flags, i · 13 unmodified lines
107108 return status;
108109 } else if ((flags & AV_BUFFERSINK_FLAG_NO_REQUEST)) {
109110 return AVERROR(EAGAIN);
110− } else if (inlink->frame_wanted_out) {
111+ } else if (li->frame_wanted_out) {
111112 ret = ff_filter_graph_run_once(ctx->graph);
112113 if (ret < 0)
113114 return ret;
libavfilter/filters.h+1−4
@@ -245,10 +245,7 @@ void ff_inlink_set_status(AVFilterLink *link, int status); · 244 unmodified lines
245245 /**
246246 * Test if a frame is wanted on an output link.
247247 */
248−static inline int ff_outlink_frame_wanted(AVFilterLink *link)
249−{
250− return link->frame_wanted_out;
251−}
248+int ff_outlink_frame_wanted(AVFilterLink *link);
252249
253250 /**
254251 * Get the status on an output link.

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