aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/seek.c
diff options
context:
space:
mode:
authorPierre-Anthony Lemieux <pal@palemieux.com>2022-03-11 09:16:50 -0800
committerZane van Iperen <zane@zanevaniperen.com>2022-03-19 21:34:00 +1000
commitb172c0f8c59c1d2921d6d1348ea2a5ae45b2288b (patch)
tree29c86c65632f3952fb285a544c3c8751583b5cfa /libavformat/seek.c
parent22e1175e391dd70a2b954475a96b53e6687c332f (diff)
downloadffmpeg-b172c0f8c59c1d2921d6d1348ea2a5ae45b2288b.tar.gz
avformat/seek: add ff_rescale_interval() function
Refactors a function used by avformat/concat and avformat/imf. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
Diffstat (limited to 'libavformat/seek.c')
-rw-r--r--libavformat/seek.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/seek.c b/libavformat/seek.c
index 405ca316b3..890aea7f8a 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -751,3 +751,13 @@ int avformat_flush(AVFormatContext *s)
ff_read_frame_flush(s);
return 0;
}
+
+void ff_rescale_interval(AVRational tb_in, AVRational tb_out,
+ int64_t *min_ts, int64_t *ts, int64_t *max_ts)
+{
+ *ts = av_rescale_q (* ts, tb_in, tb_out);
+ *min_ts = av_rescale_q_rnd(*min_ts, tb_in, tb_out,
+ AV_ROUND_UP | AV_ROUND_PASS_MINMAX);
+ *max_ts = av_rescale_q_rnd(*max_ts, tb_in, tb_out,
+ AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX);
+}