@@ -14,6 +14,10 @@ libavutil: 2021-04-27
API changes, most recent first:
+2023-xx-xx - xxxxxxxxxx - lavu 58.0.100 - frame.h
+ AVFrame.coded_picture_number and AVFrame.display_picture_number was changed
+ to 64bit, make sure you update any printf() or other type sensitive code
+
2023-xx-xx - xxxxxxxxxx - lavc 60.0.100 - avcodec.h
AVCodecContext.frame_number was changed to 64bit, make sure you update any
printf() or other type sensitive code
@@ -73,7 +73,7 @@ static int output_video_frame(AVFrame *frame)
return -1;
}
- printf("video_frame n:%d coded_n:%d\n",
+ printf("video_frame n:%d coded_n:%"PRId64"\n",
video_frame_count++, frame->coded_picture_number);
/* copy decoded frame to destination buffer:
@@ -103,7 +103,7 @@ int ff_flv_decode_picture_header(MpegEncContext *s)
s->avctx->sample_aspect_ratio= (AVRational){1,2};
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
- av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%d\n",
+ av_log(s->avctx, AV_LOG_DEBUG, "%c esc_type:%d, qp:%d num:%"PRId64"\n",
s->droppable ? 'D' : av_get_picture_type_char(s->pict_type),
s->h263_flv - 1, s->qscale, s->picture_number);
}
@@ -354,7 +354,7 @@ typedef struct H264Context {
int chroma_x_shift, chroma_y_shift;
int droppable;
- int coded_picture_number;
+ int64_t coded_picture_number;
int context_initialized;
int flags;
@@ -76,7 +76,7 @@ typedef struct MPEG12EncContext {
AVRational frame_rate_ext;
unsigned frame_rate_index;
- int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num
+ int64_t gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num
int64_t timecode_frame_start; ///< GOP timecode frame start number, in non drop frame format
AVTimecode tc; ///< timecode context
@@ -114,9 +114,9 @@ typedef struct MpegEncContext {
/* sequence parameters */
int context_initialized;
- int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
- int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
- int picture_number; //FIXME remove, unclear definition
+ int64_t input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else
+ int64_t coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else
+ int64_t picture_number; //FIXME remove, unclear definition
int extradata_parsed;
int picture_in_gop_number; ///< 0-> first pic in gop, ...
int mb_width, mb_height; ///< number of MBs horizontally & vertically
@@ -1095,8 +1095,8 @@ static int alloc_picture(MpegEncContext *s, Picture *pic, int shared)
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
{
Picture *pic = NULL;
- int64_t pts;
- int i, display_picture_number = 0, ret;
+ int64_t pts, display_picture_number = 0;
+ int i, ret;
int encoding_delay = s->max_b_frames ? s->max_b_frames
: (s->low_delay ? 0 : 1);
int flush_offset = 1;
@@ -1484,7 +1484,7 @@ static int select_input_picture(MpegEncContext *s)
if (s->avctx->flags & AV_CODEC_FLAG_PASS2) {
for (i = 0; i < s->max_b_frames + 1; i++) {
- int pict_num = s->input_picture[0]->f->display_picture_number + i;
+ int64_t pict_num = s->input_picture[0]->f->display_picture_number + i;
if (pict_num >= s->rc_context.num_entries)
break;
@@ -37,7 +37,7 @@
void ff_write_pass1_stats(MpegEncContext *s)
{
snprintf(s->avctx->stats_out, 256,
- "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
+ "in:%"PRId64" out:%"PRId64" type:%d q:%d itex:%d ptex:%d mv:%d misc:%d "
"fcode:%d bcode:%d mc-var:%"PRId64" var:%"PRId64" icount:%d skipcount:%d hbits:%d;\n",
s->current_picture_ptr->f->display_picture_number,
s->current_picture_ptr->f->coded_picture_number,
@@ -571,7 +571,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
p = s->avctx->stats_in;
for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) {
RateControlEntry *rce;
- int picture_number;
+ int64_t picture_number;
int e;
char *next;
@@ -580,7 +580,7 @@ av_cold int ff_rate_control_init(MpegEncContext *s)
(*next) = 0; // sscanf is unbelievably slow on looong strings // FIXME copy / do not write
next++;
}
- e = sscanf(p, " in:%d ", &picture_number);
+ e = sscanf(p, " in:%"PRId64" ", &picture_number);
av_assert0(picture_number >= 0);
av_assert0(picture_number < rcc->num_entries);
@@ -454,11 +454,11 @@ typedef struct AVFrame {
/**
* picture number in bitstream order
*/
- int coded_picture_number;
+ int64_t coded_picture_number;
/**
* picture number in display order
*/
- int display_picture_number;
+ int64_t display_picture_number;
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
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. We also change MpegEncContext picture number members to 64 bit in this change, because mpeg(ish) decoding/encoding usually use and set AVFrame attributes based on the MpegEncContext picture number members, so it makes sense to use the same type. Same is true for H264Context.coded_picture_number. There are also a couple of printf() format string updates, which is the necessary evil of this change, because API users need to do this as well. The alternative would be to introduce separate 64-bit counters for the int64 type, and keep the two values in sync, but that would be also quite ugly. So let's do what we already did for AVFormatContext.bit_rate some years ago and simply change the type. Signed-off-by: Marton Balint <cus@passwd.hu> --- doc/APIchanges | 4 ++++ doc/examples/demuxing_decoding.c | 2 +- libavcodec/flvdec.c | 2 +- libavcodec/h264dec.h | 2 +- libavcodec/mpeg12enc.c | 2 +- libavcodec/mpegvideo.h | 6 +++--- libavcodec/mpegvideo_enc.c | 6 +++--- libavcodec/ratecontrol.c | 6 +++--- libavutil/frame.h | 4 ++-- 9 files changed, 19 insertions(+), 15 deletions(-)