From: Marton Balint <cus@passwd.hu> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Date: Sat, 11 Feb 2023 00:38:53 +0100 (CET) Message-ID: <605bc01f-a1d6-9462-aa58-78ae92b46195@passwd.hu> (raw) In-Reply-To: <20230210232913.8763-1-cus@passwd.hu> On Sat, 11 Feb 2023, Marton Balint wrote: > 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. Previous version of this patch series was on the mailing list for 2 weeks, and did not receive any objection (unlike the alternate version of this patchset earlier) so I plan to apply this version in a couple of days, if people still not raise any concern. Thanks, Marton > > Also deprecate the old 32 bit frame_number attribute. > > Signed-off-by: Marton Balint <cus@passwd.hu> > --- > doc/APIchanges | 4 ++++ > doc/examples/decode_video.c | 4 ++-- > fftools/ffmpeg.c | 2 +- > libavcodec/4xm.c | 8 ++++---- > libavcodec/8svx.c | 2 +- > libavcodec/aacenc.c | 4 ++-- > libavcodec/ansi.c | 2 +- > libavcodec/atrac3plus.c | 4 ++-- > libavcodec/avcodec.c | 7 ++++++- > libavcodec/avcodec.h | 15 +++++++++++++++ > libavcodec/bfi.c | 2 +- > libavcodec/cdgraphics.c | 2 +- > libavcodec/cljrenc.c | 2 +- > libavcodec/decode.c | 22 ++++++++++++++++------ > libavcodec/dvenc.c | 2 +- > libavcodec/eac3enc.c | 2 +- > libavcodec/encode.c | 14 ++++++++++++-- > libavcodec/evrcdec.c | 4 ++-- > libavcodec/flashsv2enc.c | 16 ++++++++-------- > libavcodec/flashsvenc.c | 8 ++++---- > libavcodec/g2meet.c | 4 ++-- > libavcodec/gif.c | 4 ++-- > libavcodec/h261dec.c | 2 +- > libavcodec/h264_slice.c | 2 +- > libavcodec/interplayvideo.c | 8 ++++---- > libavcodec/ituh263dec.c | 2 +- > libavcodec/libwebpenc_animencoder.c | 2 +- > libavcodec/mjpegdec.c | 2 +- > libavcodec/mlpenc.c | 6 +++--- > libavcodec/mpegutils.c | 2 +- > libavcodec/nuv.c | 2 +- > libavcodec/options_table.h | 2 +- > libavcodec/opusenc.c | 2 +- > libavcodec/pngenc.c | 8 ++++---- > libavcodec/pthread_frame.c | 5 +++++ > libavcodec/qcelpdec.c | 4 ++-- > libavcodec/qtrleenc.c | 2 +- > libavcodec/rv10.c | 2 +- > libavcodec/smcenc.c | 2 +- > libavcodec/snowenc.c | 12 ++++++------ > libavcodec/svq1enc.c | 6 +++--- > libavcodec/svq3.c | 4 ++-- > libavcodec/version.h | 2 +- > libavcodec/version_major.h | 1 + > libavcodec/vp3.c | 6 +++--- > libavcodec/wcmv.c | 2 +- > libavcodec/wmaprodec.c | 6 +++--- > libavcodec/yop.c | 2 +- > tools/decode_simple.c | 6 +++--- > tools/scale_slice_test.c | 4 ++-- > tools/venc_data_dump.c | 2 +- > 51 files changed, 146 insertions(+), 96 deletions(-) > > diff --git a/doc/APIchanges b/doc/APIchanges > index 810b8c0746..efaafbf864 100644 > --- a/doc/APIchanges > +++ b/doc/APIchanges > @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 > > API changes, most recent first: > > +2023-02-xx - xxxxxxxxxx - lavc 60.1.100 - avcodec.h > + Add AVCodecContext.frame_num as a 64bit version of frame_number. > + Deprecate AVCodecContext.frame_number. > + > 2023-02-xx - xxxxxxxxxx - lavu 58.0.100 - csp.h > Add av_csp_approximate_trc_gamma() and av_csp_trc_func_from_id(). > Add av_csp_trc_function. > diff --git a/doc/examples/decode_video.c b/doc/examples/decode_video.c > index 7238e38103..1a232ff877 100644 > --- a/doc/examples/decode_video.c > +++ b/doc/examples/decode_video.c > @@ -69,12 +69,12 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt, > exit(1); > } > > - printf("saving frame %3d\n", dec_ctx->frame_number); > + printf("saving frame %3"PRId64"\n", dec_ctx->frame_num); > fflush(stdout); > > /* the picture is allocated by the decoder. no need to > free it */ > - snprintf(buf, sizeof(buf), "%s-%d", filename, dec_ctx->frame_number); > + snprintf(buf, sizeof(buf), "%s-%"PRId64, filename, dec_ctx->frame_num); > pgm_save(frame->data[0], frame->linesize[0], > frame->width, frame->height, buf); > } > diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c > index 064ec6d4b3..d721a5e721 100644 > --- a/fftools/ffmpeg.c > +++ b/fftools/ffmpeg.c > @@ -2115,7 +2115,7 @@ static int decode(InputStream *ist, AVCodecContext *avctx, > fd = (FrameData*)frame->opaque_ref->data; > fd->pts = frame->pts; > fd->tb = avctx->pkt_timebase; > - fd->idx = avctx->frame_number - 1; > + fd->idx = avctx->frame_num - 1; > } > > *got_frame = 1; > diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c > index 5636fdef2d..fab3fb5b77 100644 > --- a/libavcodec/4xm.c > +++ b/libavcodec/4xm.c > @@ -875,7 +875,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, > } > > for (i = 0; i < CFRAME_BUFFER_COUNT; i++) > - if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) > + if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_num) > av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", > f->cfrm[i].id); > > @@ -910,9 +910,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, > buf = cfrm->data; > frame_size = cfrm->size; > > - if (id != avctx->frame_number) > - av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", > - id, avctx->frame_number); > + if (id != avctx->frame_num) > + av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %"PRId64"\n", > + id, avctx->frame_num); > > if (f->version <= 1) > return AVERROR_INVALIDDATA; > diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c > index ed635f9ede..0a6d311cf1 100644 > --- a/libavcodec/8svx.c > +++ b/libavcodec/8svx.c > @@ -151,7 +151,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame, > > *got_frame_ptr = 1; > > - return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels; > + return ((avctx->frame_num == 0) * hdr_size + buf_size) * channels; > } > > static av_cold int eightsvx_decode_init(AVCodecContext *avctx) > diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c > index 5bc60c7390..ed036209e9 100644 > --- a/libavcodec/aacenc.c > +++ b/libavcodec/aacenc.c > @@ -854,7 +854,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, > if (s->psypp) > ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); > > - if (!avctx->frame_number) > + if (!avctx->frame_num) > return 0; > > start_ch = 0; > @@ -958,7 +958,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, > do { > init_put_bits(&s->pb, avpkt->data, avpkt->size); > > - if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) > + if ((avctx->frame_num & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) > put_bitstream_info(s, LIBAVCODEC_IDENT); > start_ch = 0; > target_bits = 0; > diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c > index e15c1bb097..c1e31266ec 100644 > --- a/libavcodec/ansi.c > +++ b/libavcodec/ansi.c > @@ -364,7 +364,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, > > if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) > return ret; > - if (!avctx->frame_number) { > + if (!avctx->frame_num) { > for (i=0; i<avctx->height; i++) > memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width); > memset(s->frame->data[1], 0, AVPALETTE_SIZE); > diff --git a/libavcodec/atrac3plus.c b/libavcodec/atrac3plus.c > index a0836f1178..5661654ce3 100644 > --- a/libavcodec/atrac3plus.c > +++ b/libavcodec/atrac3plus.c > @@ -1391,9 +1391,9 @@ static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, > if (band_has_tones[sb]) { > if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) { > av_log(avctx, AV_LOG_ERROR, > - "Too many tones: %d (max. 48), frame: %d!\n", > + "Too many tones: %d (max. 48), frame: %"PRId64"!\n", > ctx->waves_info->tones_index + dst[sb].num_wavs, > - avctx->frame_number); > + avctx->frame_num); > return AVERROR_INVALIDDATA; > } > dst[sb].start_index = ctx->waves_info->tones_index; > 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) && > 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; > > /** > diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c > index 2b647419c7..c268272451 100644 > --- a/libavcodec/bfi.c > +++ b/libavcodec/bfi.c > @@ -66,7 +66,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame, > bytestream2_init(&g, avpkt->data, buf_size); > > /* Set frame parameters and palette, if necessary */ > - if (!avctx->frame_number) { > + if (!avctx->frame_num) { > frame->pict_type = AV_PICTURE_TYPE_I; > frame->key_frame = 1; > /* Setting the palette */ > diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c > index 51363b6be2..431e99cd76 100644 > --- a/libavcodec/cdgraphics.c > +++ b/libavcodec/cdgraphics.c > @@ -374,7 +374,7 @@ static void cdg_decode_flush(AVCodecContext *avctx) > return; > > memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height); > - if (!avctx->frame_number) > + if (!avctx->frame_num) > memset(cc->frame->data[1], 0, AVPALETTE_SIZE); > } > > diff --git a/libavcodec/cljrenc.c b/libavcodec/cljrenc.c > index d658931520..31ad5ce0cf 100644 > --- a/libavcodec/cljrenc.c > +++ b/libavcodec/cljrenc.c > @@ -42,7 +42,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, > CLJRContext *a = avctx->priv_data; > PutBitContext pb; > int x, y, ret; > - uint32_t dither= avctx->frame_number; > + uint32_t dither= avctx->frame_num; > static const uint32_t ordered_dither[2][2] = > { > { 0x10400000, 0x104F0000 }, > diff --git a/libavcodec/decode.c b/libavcodec/decode.c > index 93ecd36c2b..be2be81089 100644 > --- a/libavcodec/decode.c > +++ b/libavcodec/decode.c > @@ -711,11 +711,16 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > goto fail; > } > > - avctx->frame_number++; > + avctx->frame_num++; > +#if FF_API_AVCTX_FRAME_NUMBER > +FF_DISABLE_DEPRECATION_WARNINGS > + avctx->frame_number = avctx->frame_num; > +FF_ENABLE_DEPRECATION_WARNINGS > +#endif > > if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) { > > - if (avctx->frame_number == 1) { > + if (avctx->frame_num == 1) { > avci->initial_format = frame->format; > switch(avctx->codec_type) { > case AVMEDIA_TYPE_VIDEO: > @@ -732,7 +737,7 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > } > } > > - if (avctx->frame_number > 1) { > + if (avctx->frame_num > 1) { > changed = avci->initial_format != frame->format; > > switch(avctx->codec_type) { > @@ -749,9 +754,9 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) > > if (changed) { > avci->changed_frames_dropped++; > - av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64 > + av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64 > " drop count: %d \n", > - avctx->frame_number, frame->pts, > + avctx->frame_num, frame->pts, > avci->changed_frames_dropped); > ret = AVERROR_INPUT_CHANGED; > goto fail; > @@ -916,7 +921,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, > } > > if (*got_sub_ptr) > - avctx->frame_number++; > + avctx->frame_num++; > +#if FF_API_AVCTX_FRAME_NUMBER > +FF_DISABLE_DEPRECATION_WARNINGS > + avctx->frame_number = avctx->frame_num; > +FF_ENABLE_DEPRECATION_WARNINGS > +#endif > } > > return ret; > diff --git a/libavcodec/dvenc.c b/libavcodec/dvenc.c > index 8f5fa050b0..11dd5763af 100644 > --- a/libavcodec/dvenc.c > +++ b/libavcodec/dvenc.c > @@ -1144,7 +1144,7 @@ static void dv_format_frame(DVEncContext *c, uint8_t *buf) > { > int chan, i, j, k; > /* We work with 720p frames split in half. The odd half-frame is chan 2,3 */ > - int chan_offset = 2*(c->sys->height == 720 && c->avctx->frame_number & 1); > + int chan_offset = 2*(c->sys->height == 720 && c->avctx->frame_num & 1); > > for (chan = 0; chan < c->sys->n_difchan; chan++) { > for (i = 0; i < c->sys->difseg_size; i++) { > diff --git a/libavcodec/eac3enc.c b/libavcodec/eac3enc.c > index ab9eda261f..4b3236d4e5 100644 > --- a/libavcodec/eac3enc.c > +++ b/libavcodec/eac3enc.c > @@ -189,7 +189,7 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) > put_bits(&s->pb, 1, 0); > } > if (s->num_blocks != 6) > - put_bits(&s->pb, 1, !(s->avctx->frame_number % 6)); /* converter sync flag */ > + put_bits(&s->pb, 1, !(s->avctx->frame_num % 6)); /* converter sync flag */ > put_bits(&s->pb, 1, 0); /* no additional bit stream info */ > > /* frame header */ > diff --git a/libavcodec/encode.c b/libavcodec/encode.c > index 6499d962ca..041fc7670e 100644 > --- a/libavcodec/encode.c > +++ b/libavcodec/encode.c > @@ -171,7 +171,12 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, > } > > ret = ffcodec(avctx->codec)->cb.encode_sub(avctx, buf, buf_size, sub); > - avctx->frame_number++; > + avctx->frame_num++; > +#if FF_API_AVCTX_FRAME_NUMBER > +FF_DISABLE_DEPRECATION_WARNINGS > + avctx->frame_number = avctx->frame_num; > +FF_ENABLE_DEPRECATION_WARNINGS > +#endif > return ret; > } > > @@ -503,7 +508,12 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame > return ret; > } > > - avctx->frame_number++; > + avctx->frame_num++; > +#if FF_API_AVCTX_FRAME_NUMBER > +FF_DISABLE_DEPRECATION_WARNINGS > + avctx->frame_number = avctx->frame_num; > +FF_ENABLE_DEPRECATION_WARNINGS > +#endif > > return 0; > } > diff --git a/libavcodec/evrcdec.c b/libavcodec/evrcdec.c > index c4b0ad2957..af7640d7e1 100644 > --- a/libavcodec/evrcdec.c > +++ b/libavcodec/evrcdec.c > @@ -221,8 +221,8 @@ static evrc_packet_rate determine_bitrate(AVCodecContext *avctx, > static void warn_insufficient_frame_quality(AVCodecContext *avctx, > const char *message) > { > - av_log(avctx, AV_LOG_WARNING, "Frame #%d, %s\n", > - avctx->frame_number, message); > + av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", %s\n", > + avctx->frame_num, message); > } > > /** > diff --git a/libavcodec/flashsv2enc.c b/libavcodec/flashsv2enc.c > index 46e24a9c1e..75b48eb1fd 100644 > --- a/libavcodec/flashsv2enc.c > +++ b/libavcodec/flashsv2enc.c > @@ -105,7 +105,7 @@ typedef struct FlashSV2Context { > > int rows, cols; > > - int last_key_frame; > + int64_t last_key_frame; > > int image_width, image_height; > int block_width, block_height; > @@ -787,7 +787,7 @@ static int optimum_use15_7(FlashSV2Context * s) > { > #ifndef FLASHSV2_DUMB > double ideal = ((double)(s->avctx->bit_rate * s->avctx->time_base.den * s->avctx->ticks_per_frame)) / > - ((double) s->avctx->time_base.num) * s->avctx->frame_number; > + ((double) s->avctx->time_base.num) * s->avctx->frame_num; > if (ideal + use15_7_threshold < s->total_bits) { > return 1; > } else { > @@ -861,20 +861,20 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > return res; > > /* First frame needs to be a keyframe */ > - if (avctx->frame_number == 0) > + if (avctx->frame_num == 0) > keyframe = 1; > > /* Check the placement of keyframes */ > if (avctx->gop_size > 0) { > - if (avctx->frame_number >= s->last_key_frame + avctx->gop_size) > + if (avctx->frame_num >= s->last_key_frame + avctx->gop_size) > keyframe = 1; > } > > if (!keyframe > - && avctx->frame_number > s->last_key_frame + avctx->keyint_min) { > + && avctx->frame_num > s->last_key_frame + avctx->keyint_min) { > recommend_keyframe(s, &keyframe); > if (keyframe) > - av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %d\n", avctx->frame_number); > + av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %"PRId64"\n", avctx->frame_num); > } > > if (keyframe) { > @@ -890,9 +890,9 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > > if (keyframe) { > new_key_frame(s); > - s->last_key_frame = avctx->frame_number; > + s->last_key_frame = avctx->frame_num; > pkt->flags |= AV_PKT_FLAG_KEY; > - av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number); > + av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %"PRId64"\n", avctx->frame_num); > } > > pkt->size = res; > diff --git a/libavcodec/flashsvenc.c b/libavcodec/flashsvenc.c > index 6192bc25db..5cf0602f5d 100644 > --- a/libavcodec/flashsvenc.c > +++ b/libavcodec/flashsvenc.c > @@ -65,7 +65,7 @@ typedef struct FlashSVContext { > AVBufferRef *prev_frame_buf; > int image_width, image_height; > unsigned packet_size; > - int last_key_frame; > + int64_t last_key_frame; > uint8_t tmpblock[3 * 256 * 256]; > } FlashSVContext; > > @@ -215,7 +215,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > > /* Check the placement of keyframes */ > if (avctx->gop_size > 0 && > - avctx->frame_number >= s->last_key_frame + avctx->gop_size) { > + avctx->frame_num >= s->last_key_frame + avctx->gop_size) { > I_frame = 1; > } > > @@ -229,8 +229,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > > //mark the frame type so the muxer can mux it correctly > if (I_frame) { > - s->last_key_frame = avctx->frame_number; > - ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number); > + s->last_key_frame = avctx->frame_num; > + ff_dlog(avctx, "Inserting keyframe at frame %"PRId64"\n", avctx->frame_num); > } > > if (I_frame) > diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c > index 761fd22fc3..32b966e8ef 100644 > --- a/libavcodec/g2meet.c > +++ b/libavcodec/g2meet.c > @@ -931,8 +931,8 @@ static int epic_jb_decode_tile(G2MContext *c, int tile_x, int tile_y, > > if (ret) { > av_log(avctx, AV_LOG_ERROR, > - "ePIC: tile decoding failed, frame=%d, tile_x=%d, tile_y=%d\n", > - avctx->frame_number, tile_x, tile_y); > + "ePIC: tile decoding failed, frame=%"PRId64", tile_x=%d, tile_y=%d\n", > + avctx->frame_num, tile_x, tile_y); > return AVERROR_INVALIDDATA; > } > > diff --git a/libavcodec/gif.c b/libavcodec/gif.c > index e17ead0f82..131af6198a 100644 > --- a/libavcodec/gif.c > +++ b/libavcodec/gif.c > @@ -318,7 +318,7 @@ static int gif_image_write_image(AVCodecContext *avctx, > disposal = GCE_DISPOSAL_INPLACE; > } > > - if (s->image || !avctx->frame_number) { /* GIF header */ > + if (s->image || !avctx->frame_num) { /* GIF header */ > const uint32_t *global_palette = palette ? palette : s->palette; > const AVRational sar = avctx->sample_aspect_ratio; > int64_t aspect = 0; > @@ -510,7 +510,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > } > > pkt->size = outbuf_ptr - pkt->data; > - if (s->image || !avctx->frame_number) > + if (s->image || !avctx->frame_num) > pkt->flags |= AV_PKT_FLAG_KEY; > *got_packet = 1; > > diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c > index 57f7e8bf35..8496293964 100644 > --- a/libavcodec/h261dec.c > +++ b/libavcodec/h261dec.c > @@ -610,7 +610,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, > MpegEncContext *s = &h->s; > int ret; > > - ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); > + ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_num, buf_size); > ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); > > h->gob_start_code_skipped = 0; > diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c > index 6188c74632..97e66a2907 100644 > --- a/libavcodec/h264_slice.c > +++ b/libavcodec/h264_slice.c > @@ -1297,7 +1297,7 @@ static int h264_select_output_frame(H264Context *h) > h->last_pocs[0] = cur->poc; > cur->mmco_reset = 1; > } else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){ > - int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE; > + int loglevel = h->avctx->frame_num > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE; > av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order); > h->avctx->has_b_frames = out_of_order; > } > diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c > index 655326a7f1..1a3461bf10 100644 > --- a/libavcodec/interplayvideo.c > +++ b/libavcodec/interplayvideo.c > @@ -926,7 +926,7 @@ static void ipvideo_format_06_firstpass(IpvideoContext *s, AVFrame *frame, int16 > } > } else { > /* Don't try to copy second_last_frame data on the first frames */ > - if (s->avctx->frame_number > 2) > + if (s->avctx->frame_num > 2) > copy_from(s, s->second_last_frame, frame, 0, 0); > } > } > @@ -1085,7 +1085,7 @@ static void ipvideo_decode_format_10_opcodes(IpvideoContext *s, AVFrame *frame) > copy_from(s, s->cur_decode_frame, frame, 0, 0); > } else { > /* Don't try to copy last_frame data on the first frame */ > - if (s->avctx->frame_number) > + if (s->avctx->frame_num) > copy_from(s, s->last_frame, frame, 0, 0); > } > skip *= 2; > @@ -1144,8 +1144,8 @@ static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame) > ret = ipvideo_decode_block16[opcode](s, frame); > } > if (ret != 0) { > - av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n", > - s->avctx->frame_number, x, y); > + av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %"PRId64", @ block (%d, %d)\n", > + s->avctx->frame_num, x, y); > return; > } > } > diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c > index 2164cd7346..d4a07071ec 100644 > --- a/libavcodec/ituh263dec.c > +++ b/libavcodec/ituh263dec.c > @@ -1093,7 +1093,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s) > > align_get_bits(&s->gb); > > - if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) { > + if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_num == 0) { > av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); > } > > diff --git a/libavcodec/libwebpenc_animencoder.c b/libavcodec/libwebpenc_animencoder.c > index 72d704f490..8756231f23 100644 > --- a/libavcodec/libwebpenc_animencoder.c > +++ b/libavcodec/libwebpenc_animencoder.c > @@ -132,7 +132,7 @@ FF_ENABLE_DEPRECATION_WARNINGS > goto end; > } > > - if (!avctx->frame_number) { > + if (!avctx->frame_num) { > s->first_frame_pts = frame->pts; > #if FF_API_REORDERED_OPAQUE > FF_DISABLE_DEPRECATION_WARNINGS > diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c > index b2be55af4a..c833d66c4d 100644 > --- a/libavcodec/mjpegdec.c > +++ b/libavcodec/mjpegdec.c > @@ -2884,7 +2884,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) > MJpegDecodeContext *s = avctx->priv_data; > int i, j; > > - if (s->interlaced && s->bottom_field == !s->interlace_polarity && s->got_picture && !avctx->frame_number) { > + if (s->interlaced && s->bottom_field == !s->interlace_polarity && s->got_picture && !avctx->frame_num) { > av_log(avctx, AV_LOG_INFO, "Single field\n"); > } > > diff --git a/libavcodec/mlpenc.c b/libavcodec/mlpenc.c > index 1bc8995c58..5995a6b51c 100644 > --- a/libavcodec/mlpenc.c > +++ b/libavcodec/mlpenc.c > @@ -2118,7 +2118,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, > > data = frame ? frame->data[0] : NULL; > > - ctx->frame_index = avctx->frame_number % ctx->max_restart_interval; > + ctx->frame_index = avctx->frame_num % ctx->max_restart_interval; > > ctx->inout_buffer = ctx->major_inout_buffer > + ctx->frame_index * ctx->one_sample_buffer_size; > @@ -2128,7 +2128,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, > > ctx->write_buffer = ctx->inout_buffer; > > - if (avctx->frame_number < ctx->max_restart_interval) { > + if (avctx->frame_num < ctx->max_restart_interval) { > if (data) > goto input_and_return; > } > @@ -2199,7 +2199,7 @@ input_and_return: > } > > if (!frame && ctx->last_frames < ctx->max_restart_interval - 1) > - avctx->frame_number++; > + avctx->frame_num++; > > if (bytes_written > 0) { > ff_af_queue_remove(&ctx->afq, > diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c > index 36d75b9633..2d812a25be 100644 > --- a/libavcodec/mpegutils.c > +++ b/libavcodec/mpegutils.c > @@ -230,7 +230,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, > if (mbcount) { > AVFrameSideData *sd; > > - av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %d\n", mbcount, avctx->frame_number); > + av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %"PRId64"\n", mbcount, avctx->frame_num); > sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MOTION_VECTORS, mbcount * sizeof(AVMotionVector)); > if (!sd) { > av_freep(&mvs); > diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c > index 1d4f02217c..d5391eee54 100644 > --- a/libavcodec/nuv.c > +++ b/libavcodec/nuv.c > @@ -139,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, > int size_change = 0; > int minsize = 0; > int flags = 0; > - int result, init_frame = !avctx->frame_number; > + int result, init_frame = !avctx->frame_num; > enum { > NUV_UNCOMPRESSED = '0', > NUV_RTJPEG = '1', > diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h > index bcd6f38191..4fea57673a 100644 > --- a/libavcodec/options_table.h > +++ b/libavcodec/options_table.h > @@ -97,7 +97,7 @@ static const AVOption avcodec_options[] = { > #endif > {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E}, > {"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E}, > -{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, > +{"frame_number", NULL, OFFSET(frame_num), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, > {"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, > {"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. " > "Recommended range for default rc_eq: 0.0-1.0", > diff --git a/libavcodec/opusenc.c b/libavcodec/opusenc.c > index 8b86aa7a35..a2f74a347b 100644 > --- a/libavcodec/opusenc.c > +++ b/libavcodec/opusenc.c > @@ -554,7 +554,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, > ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame)); > } else { > ff_opus_psy_signal_eof(&s->psyctx); > - if (!s->afq.remaining_samples || !avctx->frame_number) > + if (!s->afq.remaining_samples || !avctx->frame_num) > return 0; /* We've been flushed and there's nothing left to encode */ > } > > 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); > > diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c > index 71edd6b3ec..d9d5afaa82 100644 > --- a/libavcodec/pthread_frame.c > +++ b/libavcodec/pthread_frame.c > @@ -362,7 +362,12 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src) > dst->skip_idct = src->skip_idct; > dst->skip_frame = src->skip_frame; > > + dst->frame_num = src->frame_num; > +#if FF_API_AVCTX_FRAME_NUMBER > +FF_DISABLE_DEPRECATION_WARNINGS > dst->frame_number = src->frame_number; > +FF_ENABLE_DEPRECATION_WARNINGS > +#endif > #if FF_API_REORDERED_OPAQUE > FF_DISABLE_DEPRECATION_WARNINGS > dst->reordered_opaque = src->reordered_opaque; > diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c > index 277c55100a..1435fecc2e 100644 > --- a/libavcodec/qcelpdec.c > +++ b/libavcodec/qcelpdec.c > @@ -646,8 +646,8 @@ static qcelp_packet_rate determine_bitrate(AVCodecContext *avctx, > static void warn_insufficient_frame_quality(AVCodecContext *avctx, > const char *message) > { > - av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", > - avctx->frame_number, message); > + av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", IFQ: %s\n", > + avctx->frame_num, message); > } > > static void postfilter(QCELPContext *q, float *samples, float *lpc) > diff --git a/libavcodec/qtrleenc.c b/libavcodec/qtrleenc.c > index 3d51fcf843..3846762745 100644 > --- a/libavcodec/qtrleenc.c > +++ b/libavcodec/qtrleenc.c > @@ -374,7 +374,7 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > return ret; > > if (avctx->gop_size == 0 || !s->previous_frame->data[0] || > - (s->avctx->frame_number % avctx->gop_size) == 0) { > + (s->avctx->frame_num % avctx->gop_size) == 0) { > /* I-Frame */ > s->key_frame = 1; > } else { > diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c > index a45683228e..2233edfca5 100644 > --- a/libavcodec/rv10.c > +++ b/libavcodec/rv10.c > @@ -603,7 +603,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, > int slice_count; > const uint8_t *slices_hdr = NULL; > > - ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size); > + ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_num, buf_size); > > /* no supplementary picture */ > if (buf_size == 0) { > diff --git a/libavcodec/smcenc.c b/libavcodec/smcenc.c > index 3e8b5afcf6..40b53c40ee 100644 > --- a/libavcodec/smcenc.c > +++ b/libavcodec/smcenc.c > @@ -542,7 +542,7 @@ static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > return ret; > > if (avctx->gop_size == 0 || !s->prev_frame->data[0] || > - (avctx->frame_number % avctx->gop_size) == 0) { > + (avctx->frame_num % avctx->gop_size) == 0) { > s->key_frame = 1; > } else { > s->key_frame = 0; > diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c > index 749c8067d2..17c704716d 100644 > --- a/libavcodec/snowenc.c > +++ b/libavcodec/snowenc.c > @@ -1607,9 +1607,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, > pic->pict_type = pict->pict_type; > pic->quality = pict->quality; > > - s->m.picture_number= avctx->frame_number; > + s->m.picture_number= avctx->frame_num; > if(avctx->flags&AV_CODEC_FLAG_PASS2){ > - s->m.pict_type = pic->pict_type = s->m.rc_context.entry[avctx->frame_number].new_pict_type; > + s->m.pict_type = pic->pict_type = s->m.rc_context.entry[avctx->frame_num].new_pict_type; > s->keyframe = pic->pict_type == AV_PICTURE_TYPE_I; > if(!(avctx->flags&AV_CODEC_FLAG_QSCALE)) { > pic->quality = ff_rate_estimate_qscale(&s->m, 0); > @@ -1617,11 +1617,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, > return -1; > } > }else{ > - s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0; > + s->keyframe= avctx->gop_size==0 || avctx->frame_num % avctx->gop_size == 0; > s->m.pict_type = pic->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; > } > > - if(s->pass1_rc && avctx->frame_number == 0) > + if(s->pass1_rc && avctx->frame_num == 0) > pic->quality = 2*FF_QP2LAMBDA; > if (pic->quality) { > s->qlog = qscale2qlog(pic->quality); > @@ -1856,13 +1856,13 @@ redo_frame: > > ff_snow_release_buffer(avctx); > > - s->current_picture->coded_picture_number = avctx->frame_number; > + s->current_picture->coded_picture_number = avctx->frame_num; > s->current_picture->pict_type = pic->pict_type; > s->current_picture->quality = pic->quality; > s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start); > s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits; > s->m.current_picture.f->display_picture_number = > - s->m.current_picture.f->coded_picture_number = avctx->frame_number; > + s->m.current_picture.f->coded_picture_number = avctx->frame_num; > s->m.current_picture.f->quality = pic->quality; > s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start); > if(s->pass1_rc) > diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c > index e3ea0c1e47..4651e01ae8 100644 > --- a/libavcodec/svq1enc.c > +++ b/libavcodec/svq1enc.c > @@ -548,10 +548,10 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) > SVQ1EncContext *const s = avctx->priv_data; > int i; > > - if (avctx->frame_number) > + if (avctx->frame_num) > av_log(avctx, AV_LOG_DEBUG, "RD: %f\n", > s->rd_total / (double)(avctx->width * avctx->height * > - avctx->frame_number)); > + avctx->frame_num)); > > s->m.mb_type = NULL; > ff_mpv_common_end(&s->m); > @@ -684,7 +684,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, > > FFSWAP(AVFrame*, s->current_picture, s->last_picture); > > - if (avctx->gop_size && (avctx->frame_number % avctx->gop_size)) > + if (avctx->gop_size && (avctx->frame_num % avctx->gop_size)) > s->pict_type = AV_PICTURE_TYPE_P; > else > s->pict_type = AV_PICTURE_TYPE_I; > diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c > index b96c4f61f6..df514030b9 100644 > --- a/libavcodec/svq3.c > +++ b/libavcodec/svq3.c > @@ -1542,12 +1542,12 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe, > left = buf_size*8 - get_bits_count(&s->gb_slice); > > if (s->mb_y != s->mb_height || s->mb_x != s->mb_width) { > - av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, s->mb_y, s->mb_x, left); > + av_log(avctx, AV_LOG_INFO, "frame num %"PRId64" incomplete pic x %d y %d left %d\n", avctx->frame_num, s->mb_y, s->mb_x, left); > //av_hex_dump(stderr, buf+buf_size-8, 8); > } > > if (left < 0) { > - av_log(avctx, AV_LOG_ERROR, "frame num %d left %d\n", avctx->frame_number, left); > + av_log(avctx, AV_LOG_ERROR, "frame num %"PRId64" left %d\n", avctx->frame_num, left); > return -1; > } > > diff --git a/libavcodec/version.h b/libavcodec/version.h > index 8c3d476003..5957009457 100644 > --- a/libavcodec/version.h > +++ b/libavcodec/version.h > @@ -29,7 +29,7 @@ > > #include "version_major.h" > > -#define LIBAVCODEC_VERSION_MINOR 0 > +#define LIBAVCODEC_VERSION_MINOR 1 > #define LIBAVCODEC_VERSION_MICRO 100 > > #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ > diff --git a/libavcodec/version_major.h b/libavcodec/version_major.h > index ae7cba45f3..c2f118b262 100644 > --- a/libavcodec/version_major.h > +++ b/libavcodec/version_major.h > @@ -44,6 +44,7 @@ > #define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61) > #define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61) > #define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61) > +#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61) > > // reminder to remove CrystalHD decoders on next major bump > #define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61) > diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c > index b731bc0669..9660def675 100644 > --- a/libavcodec/vp3.c > +++ b/libavcodec/vp3.c > @@ -2654,8 +2654,8 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame, > s->qps[i] = -1; > > if (s->avctx->debug & FF_DEBUG_PICT_INFO) > - av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", > - s->keyframe ? "key" : "", avctx->frame_number + 1, s->qps[0]); > + av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%"PRId64": Q index = %d\n", > + s->keyframe ? "key" : "", avctx->frame_num + 1, s->qps[0]); > > s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || > avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL > @@ -2701,7 +2701,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame, > } > #endif > s->version = version; > - if (avctx->frame_number == 0) > + if (avctx->frame_num == 0) > av_log(s->avctx, AV_LOG_DEBUG, > "VP version: %d\n", s->version); > } > diff --git a/libavcodec/wcmv.c b/libavcodec/wcmv.c > index 2f1d22bc24..097ac8b8e9 100644 > --- a/libavcodec/wcmv.c > +++ b/libavcodec/wcmv.c > @@ -156,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, > if (bytestream2_get_bytes_left(&gb) < 8LL * blocks) > return AVERROR_INVALIDDATA; > > - if (!avctx->frame_number) { > + if (!avctx->frame_num) { > ptrdiff_t linesize[4] = { s->prev_frame->linesize[0], 0, 0, 0 }; > av_image_fill_black(s->prev_frame->data, linesize, avctx->pix_fmt, 0, > avctx->width, avctx->height); > diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c > index 7f7357836a..35e9caec56 100644 > --- a/libavcodec/wmaprodec.c > +++ b/libavcodec/wmaprodec.c > @@ -1678,7 +1678,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, > skip_bits(gb, 2); > } else { > int num_frames = get_bits(gb, 6); > - ff_dlog(avctx, "packet[%d]: number of frames %d\n", avctx->frame_number, num_frames); > + ff_dlog(avctx, "packet[%"PRId64"]: number of frames %d\n", avctx->frame_num, num_frames); > packet_sequence_number = 0; > } > > @@ -1687,10 +1687,10 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, > if (avctx->codec_id != AV_CODEC_ID_WMAPRO) { > skip_bits(gb, 3); > s->skip_packets = get_bits(gb, 8); > - ff_dlog(avctx, "packet[%d]: skip packets %d\n", avctx->frame_number, s->skip_packets); > + ff_dlog(avctx, "packet[%"PRId64"]: skip packets %d\n", avctx->frame_num, s->skip_packets); > } > > - ff_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, > + ff_dlog(avctx, "packet[%"PRId64"]: nbpf %x\n", avctx->frame_num, > num_bits_prev_frame); > > /** check for packet loss */ > diff --git a/libavcodec/yop.c b/libavcodec/yop.c > index 816fe8bdc8..14244c942a 100644 > --- a/libavcodec/yop.c > +++ b/libavcodec/yop.c > @@ -207,7 +207,7 @@ static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe, > if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0) > return ret; > > - if (!avctx->frame_number) > + if (!avctx->frame_num) > memset(frame->data[1], 0, AVPALETTE_SIZE); > > s->dstbuf = frame->data[0]; > 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) { > -- > 2.35.3 > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2023-02-10 23:39 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-28 18:15 [FFmpeg-devel] [PATCH " Marton Balint 2023-01-28 18:15 ` [FFmpeg-devel] [PATCH 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding Marton Balint 2023-01-28 18:15 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding Marton Balint 2023-01-28 18:15 ` [FFmpeg-devel] [PATCH 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding Marton Balint 2023-02-10 23:29 ` [FFmpeg-devel] [PATCH v2 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number Marton Balint 2023-02-10 23:38 ` Marton Balint [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=605bc01f-a1d6-9462-aa58-78ae92b46195@passwd.hu \ --to=cus@passwd.hu \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git