From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 06/10] lavfi: move AVFilterLink.current_pts(_us) to FilterLink
Date: Sun, 11 Aug 2024 16:42:07 +0200
Message-ID: <20240811144211.5712-6-anton@khirnov.net> (raw)
In-Reply-To: <20240811144211.5712-1-anton@khirnov.net>
---
libavfilter/avfilter.c | 14 +++++++-------
libavfilter/avfilter.h | 12 ------------
libavfilter/avfiltergraph.c | 6 +++---
libavfilter/f_graphmonitor.c | 5 +++--
libavfilter/filters.h | 12 ++++++++++++
5 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index de74fc2abf..9b72b6162f 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -228,8 +228,8 @@ static void update_link_current_pts(FilterLinkInternal *li, int64_t pts)
if (pts == AV_NOPTS_VALUE)
return;
- link->current_pts = pts;
- link->current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
+ li->l.current_pts = pts;
+ li->l.current_pts_us = av_rescale_q(pts, link->time_base, AV_TIME_BASE_Q);
/* TODO use duration */
if (link->graph && li->age_index >= 0)
ff_avfilter_graph_update_heap(link->graph, li);
@@ -349,8 +349,8 @@ int ff_filter_config_links(AVFilterContext *filter)
}
inlink = link->src->nb_inputs ? link->src->inputs[0] : NULL;
- link->current_pts =
- link->current_pts_us = AV_NOPTS_VALUE;
+ li->l.current_pts =
+ li->l.current_pts_us = AV_NOPTS_VALUE;
switch (li->init_state) {
case AVLINK_INIT:
@@ -503,7 +503,7 @@ static int64_t guess_status_pts(AVFilterContext *ctx, int status, AVRational lin
for (i = 0; i < ctx->nb_inputs; i++) {
FilterLinkInternal * const li = ff_link_internal(ctx->inputs[i]);
if (li->status_out == status)
- r = FFMIN(r, av_rescale_q(ctx->inputs[i]->current_pts, ctx->inputs[i]->time_base, link_time_base));
+ r = FFMIN(r, av_rescale_q(li->l.current_pts, ctx->inputs[i]->time_base, link_time_base));
}
if (r < INT64_MAX)
return r;
@@ -1396,7 +1396,7 @@ int ff_filter_activate(AVFilterContext *filter)
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
{
FilterLinkInternal * const li = ff_link_internal(link);
- *rpts = link->current_pts;
+ *rpts = li->l.current_pts;
if (ff_framequeue_queued_frames(&li->fifo))
return *rstatus = 0;
if (li->status_out)
@@ -1405,7 +1405,7 @@ int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts
return *rstatus = 0;
*rstatus = li->status_out = li->status_in;
update_link_current_pts(li, li->status_in_pts);
- *rpts = link->current_pts;
+ *rpts = li->l.current_pts;
return 1;
}
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index bf9a682bb7..0d1fdf980b 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -600,18 +600,6 @@ struct AVFilterLink {
*/
struct AVFilterGraph *graph;
- /**
- * Current timestamp of the link, as defined by the most recent
- * frame(s), in link time_base units.
- */
- int64_t current_pts;
-
- /**
- * Current timestamp of the link, as defined by the most recent
- * frame(s), in AV_TIME_BASE units.
- */
- int64_t current_pts_us;
-
/**
* Frame rate of the stream on the link, or 1/0 if unknown or variable;
* if left to 0/0, will be automatically copied from the first input
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c
index 47655703cd..e589ac2415 100644
--- a/libavfilter/avfiltergraph.c
+++ b/libavfilter/avfiltergraph.c
@@ -1326,7 +1326,7 @@ static void heap_bubble_up(FFFilterGraph *graph,
while (index) {
int parent = (index - 1) >> 1;
- if (links[parent]->l.pub.current_pts_us >= li->l.pub.current_pts_us)
+ if (links[parent]->l.current_pts_us >= li->l.current_pts_us)
break;
links[index] = links[parent];
links[index]->age_index = index;
@@ -1348,9 +1348,9 @@ static void heap_bubble_down(FFFilterGraph *graph,
if (child >= graph->sink_links_count)
break;
if (child + 1 < graph->sink_links_count &&
- links[child + 1]->l.pub.current_pts_us < links[child]->l.pub.current_pts_us)
+ links[child + 1]->l.current_pts_us < links[child]->l.current_pts_us)
child++;
- if (li->l.pub.current_pts_us < links[child]->l.pub.current_pts_us)
+ if (li->l.current_pts_us < links[child]->l.current_pts_us)
break;
links[index] = links[child];
links[index]->age_index = index;
diff --git a/libavfilter/f_graphmonitor.c b/libavfilter/f_graphmonitor.c
index 3996261318..06573dbb96 100644
--- a/libavfilter/f_graphmonitor.c
+++ b/libavfilter/f_graphmonitor.c
@@ -258,8 +258,9 @@ static int draw_items(AVFilterContext *ctx,
size_t frames)
{
GraphMonitorContext *s = ctx->priv;
+ FilterLink *fl = ff_filter_link(l);
int64_t previous_pts_us = s->cache[s->cache_index].previous_pts_us;
- int64_t current_pts_us = l->current_pts_us;
+ int64_t current_pts_us = fl->current_pts_us;
const int flags = s->flags;
const int mode = s->mode;
char buffer[1024] = { 0 };
@@ -368,7 +369,7 @@ static int draw_items(AVFilterContext *ctx,
xpos += len * 8;
}
- s->cache[s->cache_index].previous_pts_us = l->current_pts_us;
+ s->cache[s->cache_index].previous_pts_us = current_pts_us;
if (s->cache_index + 1 >= s->cache_size / sizeof(*(s->cache))) {
void *ptr = av_fast_realloc(s->cache, &s->cache_size, s->cache_size * 2);
diff --git a/libavfilter/filters.h b/libavfilter/filters.h
index 9e230dc987..98b2442389 100644
--- a/libavfilter/filters.h
+++ b/libavfilter/filters.h
@@ -42,6 +42,18 @@
typedef struct FilterLink {
AVFilterLink pub;
+ /**
+ * Current timestamp of the link, as defined by the most recent
+ * frame(s), in link time_base units.
+ */
+ int64_t current_pts;
+
+ /**
+ * Current timestamp of the link, as defined by the most recent
+ * frame(s), in AV_TIME_BASE units.
+ */
+ int64_t current_pts_us;
+
/**
* Minimum number of samples to filter at once.
*
--
2.43.0
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-08-11 14:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-11 14:42 [FFmpeg-devel] [PATCH 01/10] lavfi: set AVFilterLink.graph on link creation Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 02/10] lavfi: add a new struct for private link properties Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 03/10] lavfi: move AVFilterLink.m{ax, in}_samples to FilterLink Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 04/10] lavfi/vf_*_cuda: do not access hw contexts before checking they exist Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 05/10] lavfi: move AVFilterLink.hw_frames_ctx to FilterLink Anton Khirnov
2024-08-11 14:42 ` Anton Khirnov [this message]
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 07/10] lavfi: move AVFilterLink.frame_rate " Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 08/10] lavfi: move AVFilterLink.{frame, sample}_count_{in, out} " Anton Khirnov
2024-08-12 20:19 ` Michael Niedermayer
2024-08-13 8:28 ` Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 09/10] lavfi: move AVFilterLink.frame_wanted_out to FilterLinkInternal Anton Khirnov
2024-08-11 14:42 ` [FFmpeg-devel] [PATCH 10/10] lavfi: move AVFilterLink.graph to FilterLink Anton Khirnov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240811144211.5712-6-anton@khirnov.net \
--to=anton@khirnov.net \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git