[FFmpeg-cvslog] avformat/apngenc: Use UINT16_MAX instead of USHRT_MAX

Andreas Rheinhardt git at videolan.org
Tue Nov 9 17:14:12 EET 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Nov  7 11:55:51 2021 +0100| [e5199eebb44fa5b63dcec06d38cab515eaa52b6c] | committer: Andreas Rheinhardt

avformat/apngenc: Use UINT16_MAX instead of USHRT_MAX

The latter needn't be 16 bits.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e5199eebb44fa5b63dcec06d38cab515eaa52b6c
---

 libavformat/apngenc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libavformat/apngenc.c b/libavformat/apngenc.c
index c97c475274..767074ecf3 100644
--- a/libavformat/apngenc.c
+++ b/libavformat/apngenc.c
@@ -91,9 +91,9 @@ static int apng_write_header(AVFormatContext *format_context)
         return AVERROR(EINVAL);
     }
 
-    if (apng->last_delay.num > USHRT_MAX || apng->last_delay.den > USHRT_MAX) {
+    if (apng->last_delay.num > UINT16_MAX || apng->last_delay.den > UINT16_MAX) {
         av_reduce(&apng->last_delay.num, &apng->last_delay.den,
-                  apng->last_delay.num, apng->last_delay.den, USHRT_MAX);
+                  apng->last_delay.num, apng->last_delay.den, UINT16_MAX);
         av_log(format_context, AV_LOG_WARNING,
                "Last frame delay is too precise. Reducing to %d/%d (%f).\n",
                apng->last_delay.num, apng->last_delay.den, (double)apng->last_delay.num / apng->last_delay.den);
@@ -191,7 +191,7 @@ static int flush_packet(AVFormatContext *format_context, AVPacket *packet)
                 if (packet) {
                     int64_t delay_num_raw = (packet->dts - apng->prev_packet->dts) * codec_stream->time_base.num;
                     int64_t delay_den_raw = codec_stream->time_base.den;
-                    if (!av_reduce(&delay.num, &delay.den, delay_num_raw, delay_den_raw, USHRT_MAX) &&
+                    if (!av_reduce(&delay.num, &delay.den, delay_num_raw, delay_den_raw, UINT16_MAX) &&
                         !apng->framerate_warned) {
                         av_log(format_context, AV_LOG_WARNING,
                                "Frame rate is too high or specified too precisely. Unable to copy losslessly.\n");
@@ -281,9 +281,9 @@ static void apng_deinit(AVFormatContext *s)
 #define ENC AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
     { "plays", "Number of times to play the output: 0 - infinite loop, 1 - no loop", OFFSET(plays),
-      AV_OPT_TYPE_INT, { .i64 = 1 }, 0, UINT_MAX, ENC },
+      AV_OPT_TYPE_INT, { .i64 = 1 }, 0, UINT16_MAX, ENC },
     { "final_delay", "Force delay after the last frame", OFFSET(last_delay),
-      AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, USHRT_MAX, ENC },
+      AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, UINT16_MAX, ENC },
     { NULL },
 };
 



More information about the ffmpeg-cvslog mailing list