diff mbox series

[FFmpeg-devel,v2,7/7] avformat/concat: refactor to use av_rescale_interval()

Message ID 20220221060230.6665-7-pal@sandflow.com
State New
Headers show
Series [FFmpeg-devel,v2,1/7] avformat/imf: relocate static function imf_time_to_ts() | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_aarch64_jetson success Make finished
andriy/make_fate_aarch64_jetson success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Pierre-Anthony Lemieux Feb. 21, 2022, 6:02 a.m. UTC
From: Pierre-Anthony Lemieux <pal@palemieux.com>

---
 libavformat/concatdec.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

Comments

Nicolas George Feb. 21, 2022, 10:30 a.m. UTC | #1
pal@sandflow.com (12022-02-20):
> From: Pierre-Anthony Lemieux <pal@palemieux.com>
> 
> ---
>  libavformat/concatdec.c | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)

LGTM.

Regards,
Pierre-Anthony Lemieux March 4, 2022, 4:20 p.m. UTC | #2
Hi all,

Just a quick note to check if additional work is needed on this
patchset that has been LGTMed?

The patchset is intended to address https://trac.ffmpeg.org/ticket/9648 .

Best,

-- Pierre

On Mon, Feb 21, 2022 at 2:30 AM Nicolas George <george@nsup.org> wrote:
>
> pal@sandflow.com (12022-02-20):
> > From: Pierre-Anthony Lemieux <pal@palemieux.com>
> >
> > ---
> >  libavformat/concatdec.c | 19 +++++--------------
> >  1 file changed, 5 insertions(+), 14 deletions(-)
>
> LGTM.
>
> Regards,
>
> --
>   Nicolas George
diff mbox series

Patch

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index 0603c6e254..3ddbe833c9 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -22,6 +22,7 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/bprint.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timestamp.h"
@@ -816,16 +817,6 @@  static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
     return 0;
 }
 
-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 try_seek(AVFormatContext *avf, int stream,
                     int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
 {
@@ -838,8 +829,8 @@  static int try_seek(AVFormatContext *avf, int stream,
     if (stream >= 0) {
         if (stream >= cat->avf->nb_streams)
             return AVERROR(EIO);
-        rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base,
-                         &min_ts, &ts, &max_ts);
+        av_rescale_interval(AV_TIME_BASE_Q, cat->avf->streams[stream]->time_base,
+                            &min_ts, &ts, &max_ts);
     }
     return avformat_seek_file(cat->avf, stream, min_ts, ts, max_ts, flags);
 }
@@ -853,8 +844,8 @@  static int real_seek(AVFormatContext *avf, int stream,
     if (stream >= 0) {
         if (stream >= avf->nb_streams)
             return AVERROR(EINVAL);
-        rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q,
-                         &min_ts, &ts, &max_ts);
+        av_rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q,
+                            &min_ts, &ts, &max_ts);
     }
 
     left  = 0;