aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/avcodec.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2023-01-24 00:35:54 +0100
committerMarton Balint <cus@passwd.hu>2023-02-13 00:36:46 +0100
commit6b6f7db81932f94876ff4bcfd2da0582b8ab897e (patch)
tree6aaa307f71042d91c6b19736f1cdc6498fd794e5 /libavcodec/avcodec.c
parente506ea3ce1de0c782b2b833398240c8e19a02bb4 (diff)
downloadffmpeg-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/avcodec.c')
-rw-r--r--libavcodec/avcodec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 00a5851807..fb1362290f 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -266,7 +266,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto free_and_end;
}
- avctx->frame_number = 0;
+ avctx->frame_num = 0;
+#if FF_API_AVCTX_FRAME_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
+ avctx->frame_number = avctx->frame_num;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);
if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&