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 /tools | |
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 'tools')
-rw-r--r-- | tools/decode_simple.c | 6 | ||||
-rw-r--r-- | tools/scale_slice_test.c | 4 | ||||
-rw-r--r-- | tools/venc_data_dump.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/tools/decode_simple.c b/tools/decode_simple.c index b679fd7ce6..e02323064d 100644 --- a/tools/decode_simple.c +++ b/tools/decode_simple.c @@ -38,7 +38,7 @@ static int decode_read(DecodeContext *dc, int flush) int ret = 0; while (ret >= 0 && - (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames)) { + (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames)) { ret = avcodec_receive_frame(dc->decoder, dc->frame); if (ret < 0) { if (ret == AVERROR_EOF) { @@ -55,11 +55,11 @@ static int decode_read(DecodeContext *dc, int flush) if (ret < 0) return ret; - if (dc->max_frames && dc->decoder->frame_number == dc->max_frames) + if (dc->max_frames && dc->decoder->frame_num == dc->max_frames) return 1; } - return (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames) ? 0 : 1; + return (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames) ? 0 : 1; } int ds_run(DecodeContext *dc) diff --git a/tools/scale_slice_test.c b/tools/scale_slice_test.c index d869eaae74..4480bf8569 100644 --- a/tools/scale_slice_test.c +++ b/tools/scale_slice_test.c @@ -100,8 +100,8 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i], pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) { - fprintf(stderr, "mismatch frame %d seed %u\n", - dc->decoder->frame_number - 1, pd->random_seed); + fprintf(stderr, "mismatch frame %"PRId64" seed %u\n", + dc->decoder->frame_num - 1, pd->random_seed); return AVERROR(EINVAL); } } diff --git a/tools/venc_data_dump.c b/tools/venc_data_dump.c index 3a3543f80f..1401f06c73 100644 --- a/tools/venc_data_dump.c +++ b/tools/venc_data_dump.c @@ -38,7 +38,7 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) if (!frame) return 0; - fprintf(stdout, "frame %d\n", dc->decoder->frame_number - 1); + fprintf(stdout, "frame %"PRId64"\n", dc->decoder->frame_num - 1); sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS); if (sd) { |