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/avcodec.h | |
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/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 17416791a6..39881a1d2b 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1061,6 +1061,7 @@ typedef struct AVCodecContext { */ int frame_size; +#if FF_API_AVCTX_FRAME_NUMBER /** * Frame counter, set by libavcodec. * @@ -1069,8 +1070,11 @@ typedef struct AVCodecContext { * * @note the counter is not incremented if encoding/decoding resulted in * an error. + * @deprecated use frame_num instead */ + attribute_deprecated int frame_number; +#endif /** * number of bytes per packet if constant and known or 0 @@ -2048,6 +2052,17 @@ typedef struct AVCodecContext { * The decoder can then override during decoding as needed. */ AVChannelLayout ch_layout; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int64_t frame_num; } AVCodecContext; /** |