[FFmpeg-cvslog] avformat/imf: refactor to use ff_rescale_interval()
Pierre-Anthony Lemieux
git at videolan.org
Sat Mar 19 13:41:04 EET 2022
ffmpeg | branch: master | Pierre-Anthony Lemieux <pal at palemieux.com> | Fri Mar 11 09:16:52 2022 -0800| [f409c785172fc359e4f00a8afb140873fa4dfb0e] | committer: Zane van Iperen
avformat/imf: refactor to use ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane at zanevaniperen.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f409c785172fc359e4f00a8afb140873fa4dfb0e
---
libavformat/imfdec.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c
index 7e1007e89d..2fe79dfbad 100644
--- a/libavformat/imfdec.c
+++ b/libavformat/imfdec.c
@@ -904,14 +904,6 @@ static int imf_probe(const AVProbeData *p)
return AVPROBE_SCORE_MAX;
}
-static void 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);
-}
-
static int coherent_ts(int64_t ts, AVRational in_tb, AVRational out_tb)
{
int dst_num;
@@ -937,13 +929,13 @@ static int imf_seek(AVFormatContext *s, int stream_index, int64_t min_ts,
/* rescale timestamps to Composition edit units */
if (stream_index < 0)
- rescale_interval(AV_TIME_BASE_Q,
- av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
- &min_ts, &ts, &max_ts);
+ ff_rescale_interval(AV_TIME_BASE_Q,
+ av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
+ &min_ts, &ts, &max_ts);
else
- rescale_interval(s->streams[stream_index]->time_base,
- av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
- &min_ts, &ts, &max_ts);
+ ff_rescale_interval(s->streams[stream_index]->time_base,
+ av_make_q(c->cpl->edit_rate.den, c->cpl->edit_rate.num),
+ &min_ts, &ts, &max_ts);
/* requested timestamp bounds are too close */
if (max_ts < min_ts)
More information about the ffmpeg-cvslog
mailing list