* [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
@ 2023-01-28 18:15 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
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Marton Balint @ 2023-01-28 18:15 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
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>
---
doc/APIchanges | 4 ++++
doc/examples/decode_video.c | 4 ++--
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 +-
50 files changed, 145 insertions(+), 95 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index a11acadecd..2de7174556 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
API changes, most recent first:
+2023-xx-xx - xxxxxxxxxx - lavc 59.59.100 - avcodec.h
+ Add AVCodecContext.frame_num as a 64bit version of frame_number.
+ Deprecate AVCodecContext.frame_number.
+
2023-01-13 - xxxxxxxxxx - lavu 57.44.100 - ambient_viewing_environment.h frame.h
Adds a new structure for holding H.274 Ambient Viewing Environment metadata,
AVAmbientViewingEnvironment.
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/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 efa76d2740..406d365883 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 0ac581d660..1e52ac1db8 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1034,6 +1034,7 @@ typedef struct AVCodecContext {
*/
int frame_size;
+#if FF_API_AVCTX_FRAME_NUMBER
/**
* Frame counter, set by libavcodec.
*
@@ -1042,8 +1043,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
@@ -2057,6 +2061,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 c1f8810a5a..57aaac11de 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 0abc88737b..d84d1bbc50 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -720,11 +720,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:
@@ -741,7 +746,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) {
@@ -758,9 +763,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;
@@ -926,7 +931,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 4c747ef71f..efab6a30bf 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 78d4f1399a..31d79a9888 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 fbe2c97cd6..efbfd598d9 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;
}
@@ -473,7 +478,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 668ca6a85f..193226a4f1 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 3a35876d9c..5dc11a9aa3 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 7e717d8220..fdf3b92091 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 0f2c190c8c..c3dfa400fd 100644
--- a/libavcodec/libwebpenc_animencoder.c
+++ b/libavcodec/libwebpenc_animencoder.c
@@ -107,7 +107,7 @@ static int libwebp_anim_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
goto end;
}
- if (!avctx->frame_number)
+ if (!avctx->frame_num)
s->first_frame_pts = frame->pts;
ret = 0;
*got_packet = 0;
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index f33911e1a8..d215323e53 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 7924ca6144..84caba5264 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -98,7 +98,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 0ce684342e..ebe18d6d17 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -252,7 +252,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;
}
@@ -793,7 +793,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;
@@ -918,7 +918,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,
@@ -940,7 +940,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 62a0b18a8a..c36cd004c3 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -389,7 +389,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
dst->reordered_opaque = src->reordered_opaque;
#if FF_API_THREAD_SAFE_CALLBACKS
FF_DISABLE_DEPRECATION_WARNINGS
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 855494d3df..85f5d72e63 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 e3ea7e5e9f..25af84de42 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 7fad95b69a..171a36ba00 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 8f09e634a5..456a87a5d2 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 7ac8d2b2fe..752adc81f8 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#include "version_major.h"
-#define LIBAVCODEC_VERSION_MINOR 58
+#define LIBAVCODEC_VERSION_MINOR 59
#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 2c0443c4c8..8c122c3f68 100644
--- a/libavcodec/version_major.h
+++ b/libavcodec/version_major.h
@@ -54,5 +54,6 @@
#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 60)
#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 60)
#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 60)
+#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
#endif /* AVCODEC_VERSION_MAJOR_H */
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding
2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
@ 2023-01-28 18:15 ` 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
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-01-28 18:15 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/diracdec.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index a5cad29597..22a2925188 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -77,6 +77,7 @@ typedef struct {
uint8_t *hpel[3][4];
uint8_t *hpel_base[3][4];
int reference;
+ unsigned picture_number;
} DiracFrame;
typedef struct {
@@ -252,13 +253,13 @@ static inline int divide3(int x)
return (int)((x+1U)*21845 + 10922) >> 16;
}
-static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)
+static DiracFrame *remove_frame(DiracFrame *framelist[], unsigned picnum)
{
DiracFrame *remove_pic = NULL;
int i, remove_idx = -1;
for (i = 0; framelist[i]; i++)
- if (framelist[i]->avframe->display_picture_number == picnum) {
+ if (framelist[i]->picture_number == picnum) {
remove_pic = framelist[i];
remove_idx = i;
}
@@ -2002,7 +2003,7 @@ static int dirac_decode_picture_header(DiracContext *s)
GetBitContext *gb = &s->gb;
/* [DIRAC_STD] 11.1.1 Picture Header. picture_header() PICTURE_NUM */
- picnum = s->current_picture->avframe->display_picture_number = get_bits_long(gb, 32);
+ picnum = s->current_picture->picture_number = get_bits_long(gb, 32);
av_log(s->avctx,AV_LOG_DEBUG,"PICTURE_NUM: %d\n",picnum);
@@ -2021,9 +2022,9 @@ static int dirac_decode_picture_header(DiracContext *s)
/* Jordi: this is needed if the referenced picture hasn't yet arrived */
for (j = 0; j < MAX_REFERENCE_FRAMES && refdist; j++)
if (s->ref_frames[j]
- && FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum) < refdist) {
+ && FFABS(s->ref_frames[j]->picture_number - refnum) < refdist) {
s->ref_pics[i] = s->ref_frames[j];
- refdist = FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum);
+ refdist = FFABS(s->ref_frames[j]->picture_number - refnum);
}
if (!s->ref_pics[i] || refdist)
@@ -2062,7 +2063,7 @@ static int dirac_decode_picture_header(DiracContext *s)
/* if reference array is full, remove the oldest as per the spec */
while (add_frame(s->ref_frames, MAX_REFERENCE_FRAMES, s->current_picture)) {
av_log(s->avctx, AV_LOG_ERROR, "Reference frame overflow\n");
- remove_frame(s->ref_frames, s->ref_frames[0]->avframe->display_picture_number)->reference &= DELAYED_PIC_REF;
+ remove_frame(s->ref_frames, s->ref_frames[0]->picture_number)->reference &= DELAYED_PIC_REF;
}
}
@@ -2090,7 +2091,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
/* find frame with lowest picture number */
for (i = 1; s->delay_frames[i]; i++)
- if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {
+ if (s->delay_frames[i]->picture_number < out->picture_number) {
out = s->delay_frames[i];
out_idx = i;
}
@@ -2102,6 +2103,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
out->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, out->avframe)) < 0)
return ret;
+ picture->display_picture_number = out->picture_number;
*got_frame = 1;
}
@@ -2318,19 +2320,19 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (!s->current_picture)
return buf_size;
- if (s->current_picture->avframe->display_picture_number > s->frame_number) {
+ if (s->current_picture->picture_number > s->frame_number) {
DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number);
s->current_picture->reference |= DELAYED_PIC_REF;
if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) {
- int min_num = s->delay_frames[0]->avframe->display_picture_number;
+ unsigned min_num = s->delay_frames[0]->picture_number;
/* Too many delayed frames, so we display the frame with the lowest pts */
av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n");
for (i = 1; s->delay_frames[i]; i++)
- if (s->delay_frames[i]->avframe->display_picture_number < min_num)
- min_num = s->delay_frames[i]->avframe->display_picture_number;
+ if (s->delay_frames[i]->picture_number < min_num)
+ min_num = s->delay_frames[i]->picture_number;
delayed_frame = remove_frame(s->delay_frames, min_num);
add_frame(s->delay_frames, MAX_DELAY, s->current_picture);
@@ -2340,18 +2342,19 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
delayed_frame->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0)
return ret;
+ s->frame_number = delayed_frame->picture_number + 1LL;
+ picture->display_picture_number = delayed_frame->picture_number;
*got_frame = 1;
}
- } else if (s->current_picture->avframe->display_picture_number == s->frame_number) {
+ } else if (s->current_picture->picture_number == s->frame_number) {
/* The right frame at the right time :-) */
if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0)
return ret;
+ s->frame_number = s->current_picture->picture_number + 1LL;
+ picture->display_picture_number = s->current_picture->picture_number;
*got_frame = 1;
}
- if (*got_frame)
- s->frame_number = picture->display_picture_number + 1LL;
-
return buf_idx;
}
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding
2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number 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 ` 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
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-01-28 18:15 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Move these fields to MPEGPicture instead and use that.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/mpeg12enc.c | 4 ++--
libavcodec/mpegpicture.c | 4 ++++
libavcodec/mpegpicture.h | 3 +++
libavcodec/mpegvideo_enc.c | 17 ++++++++++-------
libavcodec/ratecontrol.c | 4 ++--
libavcodec/snowenc.c | 5 ++---
6 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index a6663a158b..00a8085d12 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -420,10 +420,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
/* time code: we must convert from the real frame rate to a
* fake MPEG frame rate in case of low frame rate */
fps = (framerate.num + framerate.den / 2) / framerate.den;
- time_code = s->current_picture_ptr->f->coded_picture_number +
+ time_code = s->current_picture_ptr->coded_picture_number +
mpeg12->timecode_frame_start;
- mpeg12->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
+ mpeg12->gop_picture_number = s->current_picture_ptr->coded_picture_number;
av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME));
if (mpeg12->drop_frame_timecode)
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 977bc65191..3204a70578 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -332,6 +332,8 @@ void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic)
pic->needs_realloc = 0;
pic->reference = 0;
pic->shared = 0;
+ pic->display_picture_number = 0;
+ pic->coded_picture_number = 0;
}
int ff_update_picture_tables(Picture *dst, const Picture *src)
@@ -397,6 +399,8 @@ int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
dst->needs_realloc = src->needs_realloc;
dst->reference = src->reference;
dst->shared = src->shared;
+ dst->display_picture_number = src->display_picture_number;
+ dst->coded_picture_number = src->coded_picture_number;
return 0;
fail:
diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index a1455ee13c..7919aa402c 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -76,6 +76,9 @@ typedef struct Picture {
int reference;
int shared;
+
+ int display_picture_number;
+ int coded_picture_number;
} Picture;
/**
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index bb101612e5..4e49a103e1 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1219,7 +1219,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
if (ret < 0)
return ret;
- pic->f->display_picture_number = display_picture_number;
+ pic->display_picture_number = display_picture_number;
pic->f->pts = pts; // we set this here to avoid modifying pic_arg
} else {
/* Flushing: When we have not received enough input frames,
@@ -1477,14 +1477,14 @@ static int select_input_picture(MpegEncContext *s)
!s->next_picture_ptr || s->intra_only) {
s->reordered_input_picture[0] = s->input_picture[0];
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I;
- s->reordered_input_picture[0]->f->coded_picture_number =
+ s->reordered_input_picture[0]->coded_picture_number =
s->coded_picture_number++;
} else {
int b_frames = 0;
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;
+ int pict_num = s->input_picture[0]->display_picture_number + i;
if (pict_num >= s->rc_context.num_entries)
break;
@@ -1563,13 +1563,13 @@ static int select_input_picture(MpegEncContext *s)
s->reordered_input_picture[0] = s->input_picture[b_frames];
if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I)
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P;
- s->reordered_input_picture[0]->f->coded_picture_number =
+ s->reordered_input_picture[0]->coded_picture_number =
s->coded_picture_number++;
for (i = 0; i < b_frames; i++) {
s->reordered_input_picture[i + 1] = s->input_picture[i];
s->reordered_input_picture[i + 1]->f->pict_type =
AV_PICTURE_TYPE_B;
- s->reordered_input_picture[i + 1]->f->coded_picture_number =
+ s->reordered_input_picture[i + 1]->coded_picture_number =
s->coded_picture_number++;
}
}
@@ -1604,6 +1604,8 @@ no_output_pic:
ret = av_frame_copy_props(pic->f, s->reordered_input_picture[0]->f);
if (ret < 0)
return ret;
+ pic->coded_picture_number = s->reordered_input_picture[0]->coded_picture_number;
+ pic->display_picture_number = s->reordered_input_picture[0]->display_picture_number;
/* mark us unused / free shared pic */
av_frame_unref(s->reordered_input_picture[0]->f);
@@ -1618,7 +1620,8 @@ no_output_pic:
s->new_picture->data[i] += INPLACE_OFFSET;
}
}
- s->picture_number = s->new_picture->display_picture_number;
+ s->picture_number = s->current_picture_ptr->display_picture_number;
+
}
return 0;
}
@@ -1953,7 +1956,7 @@ vbv_retry:
pkt->pts = s->current_picture.f->pts;
if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) {
- if (!s->current_picture.f->coded_picture_number)
+ if (!s->current_picture.coded_picture_number)
pkt->dts = pkt->pts - s->dts_delta;
else
pkt->dts = s->reordered_pts;
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 4829172c2c..6a40f9cbdc 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -39,8 +39,8 @@ 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 "
"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,
+ s->current_picture_ptr->display_picture_number,
+ s->current_picture_ptr->coded_picture_number,
s->pict_type,
s->current_picture.f->quality,
s->i_tex_bits,
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 171a36ba00..d37c7fdb5a 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1856,13 +1856,12 @@ redo_frame:
ff_snow_release_buffer(avctx);
- 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_num;
+ s->m.current_picture.display_picture_number =
+ s->m.current_picture.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)
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number
2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number 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 ` 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
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-01-28 18:15 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Their usefulness are questionable, very few decoders set them, and their type
should have been int64_t. A replacement field can be added later if a valid use
case is found.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
doc/APIchanges | 4 ++++
doc/examples/demuxing_decoding.c | 4 ++--
fftools/ffprobe.c | 4 ++++
libavcodec/diracdec.c | 12 ++++++++++++
libavcodec/h264_slice.c | 4 ++++
libavcodec/libuavs3d.c | 4 ++++
libavcodec/mpegvideo_dec.c | 4 ++++
libavutil/frame.c | 4 ++++
libavutil/frame.h | 4 ++++
libavutil/version.h | 3 ++-
10 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 2de7174556..191071b0ce 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,10 @@ libavutil: 2021-04-27
API changes, most recent first:
+2023-xx-xx - xxxxxxxxxx - lavu 57.45.100 - frame.h
+ Deprecated AVFrame.coded_picture_number and display_picture_number.
+ Their usefulness are questionable and very few decoders set them.
+
2023-xx-xx - xxxxxxxxxx - lavc 59.59.100 - avcodec.h
Add AVCodecContext.frame_num as a 64bit version of frame_number.
Deprecate AVCodecContext.frame_number.
diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c
index 999a78db0d..54a82751e5 100644
--- a/doc/examples/demuxing_decoding.c
+++ b/doc/examples/demuxing_decoding.c
@@ -73,8 +73,8 @@ static int output_video_frame(AVFrame *frame)
return -1;
}
- printf("video_frame n:%d coded_n:%d\n",
- video_frame_count++, frame->coded_picture_number);
+ printf("video_frame n:%d\n",
+ video_frame_count++);
/* copy decoded frame to destination buffer:
* this is required since rawvideo expects non aligned data */
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index dfa7ff1b24..d6740ae400 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2617,8 +2617,12 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
print_str_opt("sample_aspect_ratio", "N/A");
}
print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
+#if LIBAVUTIL_VERSION_MAJOR < 59
+ AV_NOWARN_DEPRECATED(
print_int("coded_picture_number", frame->coded_picture_number);
print_int("display_picture_number", frame->display_picture_number);
+ )
+#endif
print_int("interlaced_frame", frame->interlaced_frame);
print_int("top_field_first", frame->top_field_first);
print_int("repeat_pict", frame->repeat_pict);
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 22a2925188..0ae582befe 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -2103,7 +2103,11 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
out->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, out->avframe)) < 0)
return ret;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = out->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
@@ -2343,7 +2347,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0)
return ret;
s->frame_number = delayed_frame->picture_number + 1LL;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = delayed_frame->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
} else if (s->current_picture->picture_number == s->frame_number) {
@@ -2351,7 +2359,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0)
return ret;
s->frame_number = s->current_picture->picture_number + 1LL;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = s->current_picture->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 97e66a2907..7767e16cf1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -489,7 +489,11 @@ static int h264_frame_start(H264Context *h)
pic = &h->DPB[i];
pic->reference = h->droppable ? 0 : h->picture_structure;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
pic->f->coded_picture_number = h->coded_picture_number++;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
pic->field_picture = h->picture_structure != PICT_FRAME;
pic->frame_num = h->poc.frame_num;
/*
diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index f5a6e59496..b1ccb151e6 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -81,8 +81,12 @@ static void uavs3d_output_callback(uavs3d_io_frm_t *dec_frame) {
frm->pkt_dts = dec_frame->dts;
frm->pkt_pos = dec_frame->pkt_pos;
frm->pkt_size = dec_frame->pkt_size;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
frm->coded_picture_number = dec_frame->dtr;
frm->display_picture_number = dec_frame->ptr;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (dec_frame->type < 0 || dec_frame->type >= FF_ARRAY_ELEMS(ff_avs3_image_type)) {
av_log(NULL, AV_LOG_WARNING, "Error frame type in uavs3d: %d.\n", dec_frame->type);
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 12c7144ffb..7008a600a7 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -320,7 +320,11 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic->reference = 3;
}
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
pic->f->coded_picture_number = s->coded_picture_number++;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (alloc_picture(s, pic) < 0)
return -1;
diff --git a/libavutil/frame.c b/libavutil/frame.c
index fa9b11aa54..25f1f76bbc 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -307,8 +307,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
dst->reordered_opaque = src->reordered_opaque;
dst->quality = src->quality;
dst->best_effort_timestamp = src->best_effort_timestamp;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
dst->coded_picture_number = src->coded_picture_number;
dst->display_picture_number = src->display_picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
dst->flags = src->flags;
dst->decode_error_flags = src->decode_error_flags;
dst->color_primaries = src->color_primaries;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index bbe909ee2d..ca7fd680ac 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -451,14 +451,18 @@ typedef struct AVFrame {
*/
AVRational time_base;
+#if FF_API_FRAME_PICTURE_NUMBER
/**
* picture number in bitstream order
*/
+ attribute_deprecated
int coded_picture_number;
/**
* picture number in display order
*/
+ attribute_deprecated
int display_picture_number;
+#endif
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
diff --git a/libavutil/version.h b/libavutil/version.h
index 60f96af5df..2ae4ce5683 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 57
-#define LIBAVUTIL_VERSION_MINOR 44
+#define LIBAVUTIL_VERSION_MINOR 45
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -115,6 +115,7 @@
#define FF_API_OLD_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_MAJOR < 58)
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 58)
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 58)
+#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
` (2 preceding siblings ...)
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 ` 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
` (3 more replies)
3 siblings, 4 replies; 9+ messages in thread
From: Marton Balint @ 2023-02-10 23:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
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>
---
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 2/4] avcodec/diracdec: do not use AVFrame.display_picture_number for decoding
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 ` 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
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-02-10 23:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/diracdec.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index a5cad29597..22a2925188 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -77,6 +77,7 @@ typedef struct {
uint8_t *hpel[3][4];
uint8_t *hpel_base[3][4];
int reference;
+ unsigned picture_number;
} DiracFrame;
typedef struct {
@@ -252,13 +253,13 @@ static inline int divide3(int x)
return (int)((x+1U)*21845 + 10922) >> 16;
}
-static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum)
+static DiracFrame *remove_frame(DiracFrame *framelist[], unsigned picnum)
{
DiracFrame *remove_pic = NULL;
int i, remove_idx = -1;
for (i = 0; framelist[i]; i++)
- if (framelist[i]->avframe->display_picture_number == picnum) {
+ if (framelist[i]->picture_number == picnum) {
remove_pic = framelist[i];
remove_idx = i;
}
@@ -2002,7 +2003,7 @@ static int dirac_decode_picture_header(DiracContext *s)
GetBitContext *gb = &s->gb;
/* [DIRAC_STD] 11.1.1 Picture Header. picture_header() PICTURE_NUM */
- picnum = s->current_picture->avframe->display_picture_number = get_bits_long(gb, 32);
+ picnum = s->current_picture->picture_number = get_bits_long(gb, 32);
av_log(s->avctx,AV_LOG_DEBUG,"PICTURE_NUM: %d\n",picnum);
@@ -2021,9 +2022,9 @@ static int dirac_decode_picture_header(DiracContext *s)
/* Jordi: this is needed if the referenced picture hasn't yet arrived */
for (j = 0; j < MAX_REFERENCE_FRAMES && refdist; j++)
if (s->ref_frames[j]
- && FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum) < refdist) {
+ && FFABS(s->ref_frames[j]->picture_number - refnum) < refdist) {
s->ref_pics[i] = s->ref_frames[j];
- refdist = FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum);
+ refdist = FFABS(s->ref_frames[j]->picture_number - refnum);
}
if (!s->ref_pics[i] || refdist)
@@ -2062,7 +2063,7 @@ static int dirac_decode_picture_header(DiracContext *s)
/* if reference array is full, remove the oldest as per the spec */
while (add_frame(s->ref_frames, MAX_REFERENCE_FRAMES, s->current_picture)) {
av_log(s->avctx, AV_LOG_ERROR, "Reference frame overflow\n");
- remove_frame(s->ref_frames, s->ref_frames[0]->avframe->display_picture_number)->reference &= DELAYED_PIC_REF;
+ remove_frame(s->ref_frames, s->ref_frames[0]->picture_number)->reference &= DELAYED_PIC_REF;
}
}
@@ -2090,7 +2091,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
/* find frame with lowest picture number */
for (i = 1; s->delay_frames[i]; i++)
- if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) {
+ if (s->delay_frames[i]->picture_number < out->picture_number) {
out = s->delay_frames[i];
out_idx = i;
}
@@ -2102,6 +2103,7 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
out->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, out->avframe)) < 0)
return ret;
+ picture->display_picture_number = out->picture_number;
*got_frame = 1;
}
@@ -2318,19 +2320,19 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (!s->current_picture)
return buf_size;
- if (s->current_picture->avframe->display_picture_number > s->frame_number) {
+ if (s->current_picture->picture_number > s->frame_number) {
DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number);
s->current_picture->reference |= DELAYED_PIC_REF;
if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) {
- int min_num = s->delay_frames[0]->avframe->display_picture_number;
+ unsigned min_num = s->delay_frames[0]->picture_number;
/* Too many delayed frames, so we display the frame with the lowest pts */
av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n");
for (i = 1; s->delay_frames[i]; i++)
- if (s->delay_frames[i]->avframe->display_picture_number < min_num)
- min_num = s->delay_frames[i]->avframe->display_picture_number;
+ if (s->delay_frames[i]->picture_number < min_num)
+ min_num = s->delay_frames[i]->picture_number;
delayed_frame = remove_frame(s->delay_frames, min_num);
add_frame(s->delay_frames, MAX_DELAY, s->current_picture);
@@ -2340,18 +2342,19 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
delayed_frame->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0)
return ret;
+ s->frame_number = delayed_frame->picture_number + 1LL;
+ picture->display_picture_number = delayed_frame->picture_number;
*got_frame = 1;
}
- } else if (s->current_picture->avframe->display_picture_number == s->frame_number) {
+ } else if (s->current_picture->picture_number == s->frame_number) {
/* The right frame at the right time :-) */
if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0)
return ret;
+ s->frame_number = s->current_picture->picture_number + 1LL;
+ picture->display_picture_number = s->current_picture->picture_number;
*got_frame = 1;
}
- if (*got_frame)
- s->frame_number = picture->display_picture_number + 1LL;
-
return buf_idx;
}
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 3/4] avcodec/mpegvideo_enc: do not use AVFrame.*_picture_number for encoding
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 ` 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 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-02-10 23:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Move these fields to MPEGPicture instead and use that.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
libavcodec/mpeg12enc.c | 4 ++--
libavcodec/mpegpicture.c | 4 ++++
libavcodec/mpegpicture.h | 3 +++
libavcodec/mpegvideo_enc.c | 17 ++++++++++-------
libavcodec/ratecontrol.c | 4 ++--
libavcodec/snowenc.c | 5 ++---
6 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 26cf33a3c6..a932b59678 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -419,10 +419,10 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
/* time code: we must convert from the real frame rate to a
* fake MPEG frame rate in case of low frame rate */
fps = (framerate.num + framerate.den / 2) / framerate.den;
- time_code = s->current_picture_ptr->f->coded_picture_number +
+ time_code = s->current_picture_ptr->coded_picture_number +
mpeg12->timecode_frame_start;
- mpeg12->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
+ mpeg12->gop_picture_number = s->current_picture_ptr->coded_picture_number;
av_assert0(mpeg12->drop_frame_timecode == !!(mpeg12->tc.flags & AV_TIMECODE_FLAG_DROPFRAME));
if (mpeg12->drop_frame_timecode)
diff --git a/libavcodec/mpegpicture.c b/libavcodec/mpegpicture.c
index 977bc65191..3204a70578 100644
--- a/libavcodec/mpegpicture.c
+++ b/libavcodec/mpegpicture.c
@@ -332,6 +332,8 @@ void ff_mpeg_unref_picture(AVCodecContext *avctx, Picture *pic)
pic->needs_realloc = 0;
pic->reference = 0;
pic->shared = 0;
+ pic->display_picture_number = 0;
+ pic->coded_picture_number = 0;
}
int ff_update_picture_tables(Picture *dst, const Picture *src)
@@ -397,6 +399,8 @@ int ff_mpeg_ref_picture(AVCodecContext *avctx, Picture *dst, Picture *src)
dst->needs_realloc = src->needs_realloc;
dst->reference = src->reference;
dst->shared = src->shared;
+ dst->display_picture_number = src->display_picture_number;
+ dst->coded_picture_number = src->coded_picture_number;
return 0;
fail:
diff --git a/libavcodec/mpegpicture.h b/libavcodec/mpegpicture.h
index a1455ee13c..7919aa402c 100644
--- a/libavcodec/mpegpicture.h
+++ b/libavcodec/mpegpicture.h
@@ -76,6 +76,9 @@ typedef struct Picture {
int reference;
int shared;
+
+ int display_picture_number;
+ int coded_picture_number;
} Picture;
/**
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 0e6a4c4ec5..7d3c8875f2 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1219,7 +1219,7 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
if (ret < 0)
return ret;
- pic->f->display_picture_number = display_picture_number;
+ pic->display_picture_number = display_picture_number;
pic->f->pts = pts; // we set this here to avoid modifying pic_arg
} else {
/* Flushing: When we have not received enough input frames,
@@ -1477,14 +1477,14 @@ static int select_input_picture(MpegEncContext *s)
!s->next_picture_ptr || s->intra_only) {
s->reordered_input_picture[0] = s->input_picture[0];
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_I;
- s->reordered_input_picture[0]->f->coded_picture_number =
+ s->reordered_input_picture[0]->coded_picture_number =
s->coded_picture_number++;
} else {
int b_frames = 0;
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;
+ int pict_num = s->input_picture[0]->display_picture_number + i;
if (pict_num >= s->rc_context.num_entries)
break;
@@ -1563,13 +1563,13 @@ static int select_input_picture(MpegEncContext *s)
s->reordered_input_picture[0] = s->input_picture[b_frames];
if (s->reordered_input_picture[0]->f->pict_type != AV_PICTURE_TYPE_I)
s->reordered_input_picture[0]->f->pict_type = AV_PICTURE_TYPE_P;
- s->reordered_input_picture[0]->f->coded_picture_number =
+ s->reordered_input_picture[0]->coded_picture_number =
s->coded_picture_number++;
for (i = 0; i < b_frames; i++) {
s->reordered_input_picture[i + 1] = s->input_picture[i];
s->reordered_input_picture[i + 1]->f->pict_type =
AV_PICTURE_TYPE_B;
- s->reordered_input_picture[i + 1]->f->coded_picture_number =
+ s->reordered_input_picture[i + 1]->coded_picture_number =
s->coded_picture_number++;
}
}
@@ -1604,6 +1604,8 @@ no_output_pic:
ret = av_frame_copy_props(pic->f, s->reordered_input_picture[0]->f);
if (ret < 0)
return ret;
+ pic->coded_picture_number = s->reordered_input_picture[0]->coded_picture_number;
+ pic->display_picture_number = s->reordered_input_picture[0]->display_picture_number;
/* mark us unused / free shared pic */
av_frame_unref(s->reordered_input_picture[0]->f);
@@ -1618,7 +1620,8 @@ no_output_pic:
s->new_picture->data[i] += INPLACE_OFFSET;
}
}
- s->picture_number = s->new_picture->display_picture_number;
+ s->picture_number = s->current_picture_ptr->display_picture_number;
+
}
return 0;
}
@@ -1954,7 +1957,7 @@ vbv_retry:
pkt->pts = s->current_picture.f->pts;
pkt->duration = s->current_picture.f->duration;
if (!s->low_delay && s->pict_type != AV_PICTURE_TYPE_B) {
- if (!s->current_picture.f->coded_picture_number)
+ if (!s->current_picture.coded_picture_number)
pkt->dts = pkt->pts - s->dts_delta;
else
pkt->dts = s->reordered_pts;
diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c
index 4829172c2c..6a40f9cbdc 100644
--- a/libavcodec/ratecontrol.c
+++ b/libavcodec/ratecontrol.c
@@ -39,8 +39,8 @@ 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 "
"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,
+ s->current_picture_ptr->display_picture_number,
+ s->current_picture_ptr->coded_picture_number,
s->pict_type,
s->current_picture.f->quality,
s->i_tex_bits,
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 17c704716d..658684c575 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1856,13 +1856,12 @@ redo_frame:
ff_snow_release_buffer(avctx);
- 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_num;
+ s->m.current_picture.display_picture_number =
+ s->m.current_picture.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)
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* [FFmpeg-devel] [PATCH v2 4/4] avutil/frame: deprecate AVFrame.coded_picture_number and display_picture_number
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 ` Marton Balint
2023-02-10 23:38 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-02-10 23:29 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Marton Balint
Their usefulness is questionable, very few decoders set them, and their type
should have been int64_t. A replacement field can be added later if a valid use
case is found.
Signed-off-by: Marton Balint <cus@passwd.hu>
---
doc/APIchanges | 4 ++++
doc/examples/demuxing_decoding.c | 4 ++--
fftools/ffprobe.c | 4 ++++
libavcodec/diracdec.c | 12 ++++++++++++
libavcodec/h264_slice.c | 4 ++++
libavcodec/libuavs3d.c | 4 ++++
libavcodec/mpegvideo_dec.c | 4 ++++
libavutil/frame.c | 4 ++++
libavutil/frame.h | 4 ++++
libavutil/version.h | 3 ++-
10 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index efaafbf864..9f37c870f1 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-xx-xx - xxxxxxxxxx - lavu 58.1.100 - frame.h
+ Deprecate AVFrame.coded_picture_number and display_picture_number.
+ Their usefulness are questionable and very few decoders set them.
+
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.
diff --git a/doc/examples/demuxing_decoding.c b/doc/examples/demuxing_decoding.c
index 999a78db0d..54a82751e5 100644
--- a/doc/examples/demuxing_decoding.c
+++ b/doc/examples/demuxing_decoding.c
@@ -73,8 +73,8 @@ static int output_video_frame(AVFrame *frame)
return -1;
}
- printf("video_frame n:%d coded_n:%d\n",
- video_frame_count++, frame->coded_picture_number);
+ printf("video_frame n:%d\n",
+ video_frame_count++);
/* copy decoded frame to destination buffer:
* this is required since rawvideo expects non aligned data */
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index f5ac5c1554..af927cb084 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2618,8 +2618,12 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
print_str_opt("sample_aspect_ratio", "N/A");
}
print_fmt("pict_type", "%c", av_get_picture_type_char(frame->pict_type));
+#if LIBAVUTIL_VERSION_MAJOR < 59
+ AV_NOWARN_DEPRECATED(
print_int("coded_picture_number", frame->coded_picture_number);
print_int("display_picture_number", frame->display_picture_number);
+ )
+#endif
print_int("interlaced_frame", frame->interlaced_frame);
print_int("top_field_first", frame->top_field_first);
print_int("repeat_pict", frame->repeat_pict);
diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 22a2925188..0ae582befe 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -2103,7 +2103,11 @@ static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame)
out->reference ^= DELAYED_PIC_REF;
if((ret = av_frame_ref(picture, out->avframe)) < 0)
return ret;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = out->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
@@ -2343,7 +2347,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if((ret = av_frame_ref(picture, delayed_frame->avframe)) < 0)
return ret;
s->frame_number = delayed_frame->picture_number + 1LL;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = delayed_frame->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
} else if (s->current_picture->picture_number == s->frame_number) {
@@ -2351,7 +2359,11 @@ static int dirac_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if((ret = av_frame_ref(picture, s->current_picture->avframe)) < 0)
return ret;
s->frame_number = s->current_picture->picture_number + 1LL;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
picture->display_picture_number = s->current_picture->picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
*got_frame = 1;
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 97e66a2907..7767e16cf1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -489,7 +489,11 @@ static int h264_frame_start(H264Context *h)
pic = &h->DPB[i];
pic->reference = h->droppable ? 0 : h->picture_structure;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
pic->f->coded_picture_number = h->coded_picture_number++;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
pic->field_picture = h->picture_structure != PICT_FRAME;
pic->frame_num = h->poc.frame_num;
/*
diff --git a/libavcodec/libuavs3d.c b/libavcodec/libuavs3d.c
index f5a6e59496..b1ccb151e6 100644
--- a/libavcodec/libuavs3d.c
+++ b/libavcodec/libuavs3d.c
@@ -81,8 +81,12 @@ static void uavs3d_output_callback(uavs3d_io_frm_t *dec_frame) {
frm->pkt_dts = dec_frame->dts;
frm->pkt_pos = dec_frame->pkt_pos;
frm->pkt_size = dec_frame->pkt_size;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
frm->coded_picture_number = dec_frame->dtr;
frm->display_picture_number = dec_frame->ptr;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (dec_frame->type < 0 || dec_frame->type >= FF_ARRAY_ELEMS(ff_avs3_image_type)) {
av_log(NULL, AV_LOG_WARNING, "Error frame type in uavs3d: %d.\n", dec_frame->type);
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 7a0c51e53d..522a0aada5 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -320,7 +320,11 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx)
pic->reference = 3;
}
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
pic->f->coded_picture_number = s->coded_picture_number++;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
if (alloc_picture(s, pic) < 0)
return -1;
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 4d89c75dc8..9545477acc 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -294,8 +294,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
#endif
dst->quality = src->quality;
dst->best_effort_timestamp = src->best_effort_timestamp;
+#if FF_API_FRAME_PICTURE_NUMBER
+FF_DISABLE_DEPRECATION_WARNINGS
dst->coded_picture_number = src->coded_picture_number;
dst->display_picture_number = src->display_picture_number;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
dst->flags = src->flags;
dst->decode_error_flags = src->decode_error_flags;
dst->color_primaries = src->color_primaries;
diff --git a/libavutil/frame.h b/libavutil/frame.h
index e5c92a0ca8..2580269549 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -451,14 +451,18 @@ typedef struct AVFrame {
*/
AVRational time_base;
+#if FF_API_FRAME_PICTURE_NUMBER
/**
* picture number in bitstream order
*/
+ attribute_deprecated
int coded_picture_number;
/**
* picture number in display order
*/
+ attribute_deprecated
int display_picture_number;
+#endif
/**
* quality (between 1 (good) and FF_LAMBDA_MAX (bad))
diff --git a/libavutil/version.h b/libavutil/version.h
index 3ad38110c1..11b4387f64 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 58
-#define LIBAVUTIL_VERSION_MINOR 0
+#define LIBAVUTIL_VERSION_MINOR 1
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -112,6 +112,7 @@
#define FF_API_AV_FOPEN_UTF8 (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_PKT_DURATION (LIBAVUTIL_VERSION_MAJOR < 59)
#define FF_API_REORDERED_OPAQUE (LIBAVUTIL_VERSION_MAJOR < 59)
+#define FF_API_FRAME_PICTURE_NUMBER (LIBAVUTIL_VERSION_MAJOR < 59)
/**
* @}
--
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number
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
` (2 preceding siblings ...)
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
3 siblings, 0 replies; 9+ messages in thread
From: Marton Balint @ 2023-02-10 23:38 UTC (permalink / raw)
To: FFmpeg development discussions and patches
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".
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-02-10 23:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-28 18:15 [FFmpeg-devel] [PATCH 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number 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 ` [FFmpeg-devel] [PATCH v2 1/4] avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number Marton Balint
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