diff options
author | Marton Balint <cus@passwd.hu> | 2023-01-24 00:35:54 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2023-02-13 00:36:46 +0100 |
commit | 6b6f7db81932f94876ff4bcfd2da0582b8ab897e (patch) | |
tree | 6aaa307f71042d91c6b19736f1cdc6498fd794e5 /libavcodec/pngenc.c | |
parent | e506ea3ce1de0c782b2b833398240c8e19a02bb4 (diff) | |
download | ffmpeg-6b6f7db81932f94876ff4bcfd2da0582b8ab897e.tar.gz |
avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
Frame counters can overflow relatively easily (INT_MAX number of frames is
slightly more than 1 year for 60 fps content), so make sure we use 64 bit
values for them.
Also deprecate the old 32 bit frame_number attribute.
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec/pngenc.c')
-rw-r--r-- | libavcodec/pngenc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 43bf2039ff..1489256d00 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -251,7 +251,7 @@ static void png_write_image_data(AVCodecContext *avctx, const AVCRC *crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); uint32_t crc = ~0U; - if (avctx->codec_id == AV_CODEC_ID_PNG || avctx->frame_number == 0) { + if (avctx->codec_id == AV_CODEC_ID_PNG || avctx->frame_num == 0) { png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), buf, length); return; } @@ -799,7 +799,7 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, APNGFctlChunk last_fctl_chunk = *best_last_fctl_chunk; APNGFctlChunk fctl_chunk = *best_fctl_chunk; - if (avctx->frame_number == 0) { + if (avctx->frame_num == 0) { best_fctl_chunk->width = pict->width; best_fctl_chunk->height = pict->height; best_fctl_chunk->x_offset = 0; @@ -924,7 +924,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, if (pict && s->color_type == PNG_COLOR_TYPE_PALETTE) { uint32_t checksum = ~av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), ~0U, pict->data[1], 256 * sizeof(uint32_t)); - if (avctx->frame_number == 0) { + if (avctx->frame_num == 0) { s->palette_checksum = checksum; } else if (checksum != s->palette_checksum) { av_log(avctx, AV_LOG_ERROR, @@ -946,7 +946,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, if (max_packet_size > INT_MAX) return AVERROR(ENOMEM); - if (avctx->frame_number == 0) { + if (avctx->frame_num == 0) { if (!pict) return AVERROR(EINVAL); |