History

avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_number

Frame counters can overflow relatively easily (INT_MAX number of frames is slightly more than 1 year for 60 fps content), so make sure we use 64 bit values for them. Also deprecate the old 32 bit frame_number attribute.

Marton Balint committed 3 years ago

Commit 6b6f7db1 parent e506ea351 files · +146 −96Browse files

Unified · Split

51 files
  1. doc/APIchanges +4 −0
  2. doc/examples/decode_video.c +2 −2
  3. fftools/ffmpeg.c +1 −1
  4. libavcodec/4xm.c +4 −4
  5. libavcodec/8svx.c +1 −1
  6. libavcodec/aacenc.c +2 −2
  7. libavcodec/ansi.c +1 −1
  8. libavcodec/atrac3plus.c +2 −2
  9. libavcodec/avcodec.c +6 −1
  10. libavcodec/avcodec.h +15 −0
  11. libavcodec/bfi.c +1 −1
  12. libavcodec/cdgraphics.c +1 −1
  13. libavcodec/cljrenc.c +1 −1
  14. libavcodec/decode.c +16 −6
  15. libavcodec/dvenc.c +1 −1
  16. libavcodec/eac3enc.c +1 −1
  17. libavcodec/encode.c +12 −2
  18. libavcodec/evrcdec.c +2 −2
  19. libavcodec/flashsv2enc.c +8 −8
  20. libavcodec/flashsvenc.c +4 −4
  21. libavcodec/g2meet.c +2 −2
  22. libavcodec/gif.c +2 −2
  23. libavcodec/h261dec.c +1 −1
  24. libavcodec/h264_slice.c +1 −1
  25. libavcodec/interplayvideo.c +4 −4
  26. libavcodec/ituh263dec.c +1 −1
  27. libavcodec/libwebpenc_animencoder.c +1 −1
  28. libavcodec/mjpegdec.c +1 −1
  29. libavcodec/mlpenc.c +3 −3
  30. libavcodec/mpegutils.c +1 −1
  31. libavcodec/nuv.c +1 −1
  32. libavcodec/options_table.h +1 −1
  33. libavcodec/opusenc.c +1 −1
  34. libavcodec/pngenc.c +4 −4
  35. libavcodec/pthread_frame.c +5 −0
  36. libavcodec/qcelpdec.c +2 −2
  37. libavcodec/qtrleenc.c +1 −1
  38. libavcodec/rv10.c +1 −1
  39. libavcodec/smcenc.c +1 −1
  40. libavcodec/snowenc.c +6 −6
  41. libavcodec/svq1enc.c +3 −3
  42. libavcodec/svq3.c +2 −2
  43. libavcodec/version.h +1 −1
  44. libavcodec/version_major.h +1 −0
  45. libavcodec/vp3.c +3 −3
  46. libavcodec/wcmv.c +1 −1
  47. libavcodec/wmaprodec.c +3 −3
  48. libavcodec/yop.c +1 −1
  49. tools/decode_simple.c +3 −3
  50. tools/scale_slice_test.c +2 −2
  51. tools/venc_data_dump.c +1 −1
doc/APIchanges+4−0
@@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 · 1 unmodified line
2 2
3API changes, most recent first:3API changes, most recent first:
4 4
52023-02-13 - xxxxxxxxxx - lavc 60.2.100 - avcodec.h
6 Add AVCodecContext.frame_num as a 64bit version of frame_number.
7 Deprecate AVCodecContext.frame_number.
8
52023-02-12 - xxxxxxxxxx - lavfi 9.1.100 - avfilter.h92023-02-12 - xxxxxxxxxx - lavfi 9.1.100 - avfilter.h
6 Add filtergraph segment parsing API.10 Add filtergraph segment parsing API.
7 New structs:11 New structs:
doc/examples/decode_video.c+2−2
@@ -70,12 +70,12 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt, · 69 unmodified lines
70 exit(1);70 exit(1);
71 }71 }
72 72
73 printf("saving frame %3d\n", dec_ctx->frame_number);73 printf("saving frame %3"PRId64"\n", dec_ctx->frame_num);
74 fflush(stdout);74 fflush(stdout);
75 75
76 /* the picture is allocated by the decoder. no need to76 /* the picture is allocated by the decoder. no need to
77 free it */77 free it */
78 snprintf(buf, sizeof(buf), "%s-%d", filename, dec_ctx->frame_number);78 snprintf(buf, sizeof(buf), "%s-%"PRId64, filename, dec_ctx->frame_num);
79 pgm_save(frame->data[0], frame->linesize[0],79 pgm_save(frame->data[0], frame->linesize[0],
80 frame->width, frame->height, buf);80 frame->width, frame->height, buf);
81 }81 }
fftools/ffmpeg.c+1−1
@@ -2115,7 +2115,7 @@ static int decode(InputStream *ist, AVCodecContext *avctx, · 2114 unmodified lines
2115 fd = (FrameData*)frame->opaque_ref->data;2115 fd = (FrameData*)frame->opaque_ref->data;
2116 fd->pts = frame->pts;2116 fd->pts = frame->pts;
2117 fd->tb = avctx->pkt_timebase;2117 fd->tb = avctx->pkt_timebase;
2118 fd->idx = avctx->frame_number - 1;2118 fd->idx = avctx->frame_num - 1;
2119 }2119 }
2120 2120
2121 *got_frame = 1;2121 *got_frame = 1;
libavcodec/4xm.c+4−4
@@ -875,7 +875,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 874 unmodified lines
875 }875 }
876 876
877 for (i = 0; i < CFRAME_BUFFER_COUNT; i++)877 for (i = 0; i < CFRAME_BUFFER_COUNT; i++)
878 if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)878 if (f->cfrm[i].id && f->cfrm[i].id < avctx->frame_num)
879 av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n",879 av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n",
880 f->cfrm[i].id);880 f->cfrm[i].id);
881 881
@@ -910,9 +910,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 28 unmodified lines
910 buf = cfrm->data;910 buf = cfrm->data;
911 frame_size = cfrm->size;911 frame_size = cfrm->size;
912 912
913 if (id != avctx->frame_number)913 if (id != avctx->frame_num)
914 av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n",914 av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %"PRId64"\n",
915 id, avctx->frame_number);915 id, avctx->frame_num);
916 916
917 if (f->version <= 1)917 if (f->version <= 1)
918 return AVERROR_INVALIDDATA;918 return AVERROR_INVALIDDATA;
libavcodec/8svx.c+1−1
@@ -151,7 +151,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 150 unmodified lines
151 151
152 *got_frame_ptr = 1;152 *got_frame_ptr = 1;
153 153
154 return ((avctx->frame_number == 0) * hdr_size + buf_size) * channels;154 return ((avctx->frame_num == 0) * hdr_size + buf_size) * channels;
155}155}
156 156
157static av_cold int eightsvx_decode_init(AVCodecContext *avctx)157static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
libavcodec/aacenc.c+2−2
@@ -854,7 +854,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 853 unmodified lines
854 if (s->psypp)854 if (s->psypp)
855 ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);855 ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
856 856
857 if (!avctx->frame_number)857 if (!avctx->frame_num)
858 return 0;858 return 0;
859 859
860 start_ch = 0;860 start_ch = 0;
@@ -958,7 +958,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 97 unmodified lines
958 do {958 do {
959 init_put_bits(&s->pb, avpkt->data, avpkt->size);959 init_put_bits(&s->pb, avpkt->data, avpkt->size);
960 960
961 if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT))961 if ((avctx->frame_num & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT))
962 put_bitstream_info(s, LIBAVCODEC_IDENT);962 put_bitstream_info(s, LIBAVCODEC_IDENT);
963 start_ch = 0;963 start_ch = 0;
964 target_bits = 0;964 target_bits = 0;
libavcodec/ansi.c+1−1
@@ -364,7 +364,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 363 unmodified lines
364 364
365 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)365 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
366 return ret;366 return ret;
367 if (!avctx->frame_number) {367 if (!avctx->frame_num) {
368 for (i=0; i<avctx->height; i++)368 for (i=0; i<avctx->height; i++)
369 memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width);369 memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width);
370 memset(s->frame->data[1], 0, AVPALETTE_SIZE);370 memset(s->frame->data[1], 0, AVPALETTE_SIZE);
libavcodec/atrac3plus.c+2−2
@@ -1391,9 +1391,9 @@ static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, · 1390 unmodified lines
1391 if (band_has_tones[sb]) {1391 if (band_has_tones[sb]) {
1392 if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) {1392 if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) {
1393 av_log(avctx, AV_LOG_ERROR,1393 av_log(avctx, AV_LOG_ERROR,
1394 "Too many tones: %d (max. 48), frame: %d!\n",1394 "Too many tones: %d (max. 48), frame: %"PRId64"!\n",
1395 ctx->waves_info->tones_index + dst[sb].num_wavs,1395 ctx->waves_info->tones_index + dst[sb].num_wavs,
1396 avctx->frame_number);1396 avctx->frame_num);
1397 return AVERROR_INVALIDDATA;1397 return AVERROR_INVALIDDATA;
1398 }1398 }
1399 dst[sb].start_index = ctx->waves_info->tones_index;1399 dst[sb].start_index = ctx->waves_info->tones_index;
libavcodec/avcodec.c+6−1
@@ -266,7 +266,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 265 unmodified lines
266 goto free_and_end;266 goto free_and_end;
267 }267 }
268 268
269 avctx->frame_number = 0;269 avctx->frame_num = 0;
270#if FF_API_AVCTX_FRAME_NUMBER
271FF_DISABLE_DEPRECATION_WARNINGS
272 avctx->frame_number = avctx->frame_num;
273FF_ENABLE_DEPRECATION_WARNINGS
274#endif
270 avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);275 avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id);
271 276
272 if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&277 if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
libavcodec/avcodec.h+15−0
@@ -1061,6 +1061,7 @@ typedef struct AVCodecContext { · 1060 unmodified lines
1061 */1061 */
1062 int frame_size;1062 int frame_size;
1063 1063
1064#if FF_API_AVCTX_FRAME_NUMBER
1064 /**1065 /**
1065 * Frame counter, set by libavcodec.1066 * Frame counter, set by libavcodec.
1066 *1067 *
@@ -1069,8 +1070,11 @@ typedef struct AVCodecContext { · 2 unmodified lines
1069 *1070 *
1070 * @note the counter is not incremented if encoding/decoding resulted in1071 * @note the counter is not incremented if encoding/decoding resulted in
1071 * an error.1072 * an error.
1073 * @deprecated use frame_num instead
1072 */1074 */
1075 attribute_deprecated
1073 int frame_number;1076 int frame_number;
1077#endif
1074 1078
1075 /**1079 /**
1076 * number of bytes per packet if constant and known or 01080 * number of bytes per packet if constant and known or 0
@@ -2048,6 +2052,17 @@ typedef struct AVCodecContext { · 971 unmodified lines
2048 * The decoder can then override during decoding as needed.2052 * The decoder can then override during decoding as needed.
2049 */2053 */
2050 AVChannelLayout ch_layout;2054 AVChannelLayout ch_layout;
2055
2056 /**
2057 * Frame counter, set by libavcodec.
2058 *
2059 * - decoding: total number of frames returned from the decoder so far.
2060 * - encoding: total number of frames passed to the encoder so far.
2061 *
2062 * @note the counter is not incremented if encoding/decoding resulted in
2063 * an error.
2064 */
2065 int64_t frame_num;
2051} AVCodecContext;2066} AVCodecContext;
2052 2067
2053/**2068/**
libavcodec/bfi.c+1−1
@@ -66,7 +66,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 65 unmodified lines
66 bytestream2_init(&g, avpkt->data, buf_size);66 bytestream2_init(&g, avpkt->data, buf_size);
67 67
68 /* Set frame parameters and palette, if necessary */68 /* Set frame parameters and palette, if necessary */
69 if (!avctx->frame_number) {69 if (!avctx->frame_num) {
70 frame->pict_type = AV_PICTURE_TYPE_I;70 frame->pict_type = AV_PICTURE_TYPE_I;
71 frame->key_frame = 1;71 frame->key_frame = 1;
72 /* Setting the palette */72 /* Setting the palette */
libavcodec/cdgraphics.c+1−1
@@ -374,7 +374,7 @@ static void cdg_decode_flush(AVCodecContext *avctx) · 373 unmodified lines
374 return;374 return;
375 375
376 memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);376 memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height);
377 if (!avctx->frame_number)377 if (!avctx->frame_num)
378 memset(cc->frame->data[1], 0, AVPALETTE_SIZE);378 memset(cc->frame->data[1], 0, AVPALETTE_SIZE);
379}379}
380 380
libavcodec/cljrenc.c+1−1
@@ -42,7 +42,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 41 unmodified lines
42 CLJRContext *a = avctx->priv_data;42 CLJRContext *a = avctx->priv_data;
43 PutBitContext pb;43 PutBitContext pb;
44 int x, y, ret;44 int x, y, ret;
45 uint32_t dither= avctx->frame_number;45 uint32_t dither= avctx->frame_num;
46 static const uint32_t ordered_dither[2][2] =46 static const uint32_t ordered_dither[2][2] =
47 {47 {
48 { 0x10400000, 0x104F0000 },48 { 0x10400000, 0x104F0000 },
libavcodec/decode.c+16−6
@@ -711,11 +711,16 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 710 unmodified lines
711 goto fail;711 goto fail;
712 }712 }
713 713
714 avctx->frame_number++;714 avctx->frame_num++;
715#if FF_API_AVCTX_FRAME_NUMBER
716FF_DISABLE_DEPRECATION_WARNINGS
717 avctx->frame_number = avctx->frame_num;
718FF_ENABLE_DEPRECATION_WARNINGS
719#endif
715 720
716 if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) {721 if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) {
717 722
718 if (avctx->frame_number == 1) {723 if (avctx->frame_num == 1) {
719 avci->initial_format = frame->format;724 avci->initial_format = frame->format;
720 switch(avctx->codec_type) {725 switch(avctx->codec_type) {
721 case AVMEDIA_TYPE_VIDEO:726 case AVMEDIA_TYPE_VIDEO:
@@ -732,7 +737,7 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 10 unmodified lines
732 }737 }
733 }738 }
734 739
735 if (avctx->frame_number > 1) {740 if (avctx->frame_num > 1) {
736 changed = avci->initial_format != frame->format;741 changed = avci->initial_format != frame->format;
737 742
738 switch(avctx->codec_type) {743 switch(avctx->codec_type) {
@@ -749,9 +754,9 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 10 unmodified lines
749 754
750 if (changed) {755 if (changed) {
751 avci->changed_frames_dropped++;756 avci->changed_frames_dropped++;
752 av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64757 av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64
753 " drop count: %d \n",758 " drop count: %d \n",
754 avctx->frame_number, frame->pts,759 avctx->frame_num, frame->pts,
755 avci->changed_frames_dropped);760 avci->changed_frames_dropped);
756 ret = AVERROR_INPUT_CHANGED;761 ret = AVERROR_INPUT_CHANGED;
757 goto fail;762 goto fail;
@@ -916,7 +921,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, · 158 unmodified lines
916 }921 }
917 922
918 if (*got_sub_ptr)923 if (*got_sub_ptr)
919 avctx->frame_number++;924 avctx->frame_num++;
925#if FF_API_AVCTX_FRAME_NUMBER
926FF_DISABLE_DEPRECATION_WARNINGS
927 avctx->frame_number = avctx->frame_num;
928FF_ENABLE_DEPRECATION_WARNINGS
929#endif
920 }930 }
921 931
922 return ret;932 return ret;
libavcodec/dvenc.c+1−1
@@ -1144,7 +1144,7 @@ static void dv_format_frame(DVEncContext *c, uint8_t *buf) · 1143 unmodified lines
1144{1144{
1145 int chan, i, j, k;1145 int chan, i, j, k;
1146 /* We work with 720p frames split in half. The odd half-frame is chan 2,3 */1146 /* We work with 720p frames split in half. The odd half-frame is chan 2,3 */
1147 int chan_offset = 2*(c->sys->height == 720 && c->avctx->frame_number & 1);1147 int chan_offset = 2*(c->sys->height == 720 && c->avctx->frame_num & 1);
1148 1148
1149 for (chan = 0; chan < c->sys->n_difchan; chan++) {1149 for (chan = 0; chan < c->sys->n_difchan; chan++) {
1150 for (i = 0; i < c->sys->difseg_size; i++) {1150 for (i = 0; i < c->sys->difseg_size; i++) {
libavcodec/eac3enc.c+1−1
@@ -189,7 +189,7 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) · 188 unmodified lines
189 put_bits(&s->pb, 1, 0);189 put_bits(&s->pb, 1, 0);
190 }190 }
191 if (s->num_blocks != 6)191 if (s->num_blocks != 6)
192 put_bits(&s->pb, 1, !(s->avctx->frame_number % 6)); /* converter sync flag */192 put_bits(&s->pb, 1, !(s->avctx->frame_num % 6)); /* converter sync flag */
193 put_bits(&s->pb, 1, 0); /* no additional bit stream info */193 put_bits(&s->pb, 1, 0); /* no additional bit stream info */
194 194
195 /* frame header */195 /* frame header */
libavcodec/encode.c+12−2
@@ -171,7 +171,12 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, · 170 unmodified lines
171 }171 }
172 172
173 ret = ffcodec(avctx->codec)->cb.encode_sub(avctx, buf, buf_size, sub);173 ret = ffcodec(avctx->codec)->cb.encode_sub(avctx, buf, buf_size, sub);
174 avctx->frame_number++;174 avctx->frame_num++;
175#if FF_API_AVCTX_FRAME_NUMBER
176FF_DISABLE_DEPRECATION_WARNINGS
177 avctx->frame_number = avctx->frame_num;
178FF_ENABLE_DEPRECATION_WARNINGS
179#endif
175 return ret;180 return ret;
176}181}
177 182
@@ -503,7 +508,12 @@ int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame · 325 unmodified lines
503 return ret;508 return ret;
504 }509 }
505 510
506 avctx->frame_number++;511 avctx->frame_num++;
512#if FF_API_AVCTX_FRAME_NUMBER
513FF_DISABLE_DEPRECATION_WARNINGS
514 avctx->frame_number = avctx->frame_num;
515FF_ENABLE_DEPRECATION_WARNINGS
516#endif
507 517
508 return 0;518 return 0;
509}519}
libavcodec/evrcdec.c+2−2
@@ -221,8 +221,8 @@ static evrc_packet_rate determine_bitrate(AVCodecContext *avctx, · 220 unmodified lines
221static void warn_insufficient_frame_quality(AVCodecContext *avctx,221static void warn_insufficient_frame_quality(AVCodecContext *avctx,
222 const char *message)222 const char *message)
223{223{
224 av_log(avctx, AV_LOG_WARNING, "Frame #%d, %s\n",224 av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", %s\n",
225 avctx->frame_number, message);225 avctx->frame_num, message);
226}226}
227 227
228/**228/**
libavcodec/flashsv2enc.c+8−8
@@ -105,7 +105,7 @@ typedef struct FlashSV2Context { · 104 unmodified lines
105 105
106 int rows, cols;106 int rows, cols;
107 107
108 int last_key_frame;108 int64_t last_key_frame;
109 109
110 int image_width, image_height;110 int image_width, image_height;
111 int block_width, block_height;111 int block_width, block_height;
@@ -787,7 +787,7 @@ static int optimum_use15_7(FlashSV2Context * s) · 675 unmodified lines
787{787{
788#ifndef FLASHSV2_DUMB788#ifndef FLASHSV2_DUMB
789 double ideal = ((double)(s->avctx->bit_rate * s->avctx->time_base.den * s->avctx->ticks_per_frame)) /789 double ideal = ((double)(s->avctx->bit_rate * s->avctx->time_base.den * s->avctx->ticks_per_frame)) /
790 ((double) s->avctx->time_base.num) * s->avctx->frame_number;790 ((double) s->avctx->time_base.num) * s->avctx->frame_num;
791 if (ideal + use15_7_threshold < s->total_bits) {791 if (ideal + use15_7_threshold < s->total_bits) {
792 return 1;792 return 1;
793 } else {793 } else {
@@ -861,20 +861,20 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 67 unmodified lines
861 return res;861 return res;
862 862
863 /* First frame needs to be a keyframe */863 /* First frame needs to be a keyframe */
864 if (avctx->frame_number == 0)864 if (avctx->frame_num == 0)
865 keyframe = 1;865 keyframe = 1;
866 866
867 /* Check the placement of keyframes */867 /* Check the placement of keyframes */
868 if (avctx->gop_size > 0) {868 if (avctx->gop_size > 0) {
869 if (avctx->frame_number >= s->last_key_frame + avctx->gop_size)869 if (avctx->frame_num >= s->last_key_frame + avctx->gop_size)
870 keyframe = 1;870 keyframe = 1;
871 }871 }
872 872
873 if (!keyframe873 if (!keyframe
874 && avctx->frame_number > s->last_key_frame + avctx->keyint_min) {874 && avctx->frame_num > s->last_key_frame + avctx->keyint_min) {
875 recommend_keyframe(s, &keyframe);875 recommend_keyframe(s, &keyframe);
876 if (keyframe)876 if (keyframe)
877 av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %d\n", avctx->frame_number);877 av_log(avctx, AV_LOG_DEBUG, "Recommending key frame at frame %"PRId64"\n", avctx->frame_num);
878 }878 }
879 879
880 if (keyframe) {880 if (keyframe) {
@@ -890,9 +890,9 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 9 unmodified lines
890 890
891 if (keyframe) {891 if (keyframe) {
892 new_key_frame(s);892 new_key_frame(s);
893 s->last_key_frame = avctx->frame_number;893 s->last_key_frame = avctx->frame_num;
894 pkt->flags |= AV_PKT_FLAG_KEY;894 pkt->flags |= AV_PKT_FLAG_KEY;
895 av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %d\n", avctx->frame_number);895 av_log(avctx, AV_LOG_DEBUG, "Inserting key frame at frame %"PRId64"\n", avctx->frame_num);
896 }896 }
897 897
898 pkt->size = res;898 pkt->size = res;
libavcodec/flashsvenc.c+4−4
@@ -65,7 +65,7 @@ typedef struct FlashSVContext { · 64 unmodified lines
65 AVBufferRef *prev_frame_buf;65 AVBufferRef *prev_frame_buf;
66 int image_width, image_height;66 int image_width, image_height;
67 unsigned packet_size;67 unsigned packet_size;
68 int last_key_frame;68 int64_t last_key_frame;
69 uint8_t tmpblock[3 * 256 * 256];69 uint8_t tmpblock[3 * 256 * 256];
70} FlashSVContext;70} FlashSVContext;
71 71
@@ -215,7 +215,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 143 unmodified lines
215 215
216 /* Check the placement of keyframes */216 /* Check the placement of keyframes */
217 if (avctx->gop_size > 0 &&217 if (avctx->gop_size > 0 &&
218 avctx->frame_number >= s->last_key_frame + avctx->gop_size) {218 avctx->frame_num >= s->last_key_frame + avctx->gop_size) {
219 I_frame = 1;219 I_frame = 1;
220 }220 }
221 221
@@ -229,8 +229,8 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 7 unmodified lines
229 229
230 //mark the frame type so the muxer can mux it correctly230 //mark the frame type so the muxer can mux it correctly
231 if (I_frame) {231 if (I_frame) {
232 s->last_key_frame = avctx->frame_number;232 s->last_key_frame = avctx->frame_num;
233 ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number);233 ff_dlog(avctx, "Inserting keyframe at frame %"PRId64"\n", avctx->frame_num);
234 }234 }
235 235
236 if (I_frame)236 if (I_frame)
libavcodec/g2meet.c+2−2
@@ -931,8 +931,8 @@ static int epic_jb_decode_tile(G2MContext *c, int tile_x, int tile_y, · 930 unmodified lines
931 931
932 if (ret) {932 if (ret) {
933 av_log(avctx, AV_LOG_ERROR,933 av_log(avctx, AV_LOG_ERROR,
934 "ePIC: tile decoding failed, frame=%d, tile_x=%d, tile_y=%d\n",934 "ePIC: tile decoding failed, frame=%"PRId64", tile_x=%d, tile_y=%d\n",
935 avctx->frame_number, tile_x, tile_y);935 avctx->frame_num, tile_x, tile_y);
936 return AVERROR_INVALIDDATA;936 return AVERROR_INVALIDDATA;
937 }937 }
938 938
libavcodec/gif.c+2−2
@@ -318,7 +318,7 @@ static int gif_image_write_image(AVCodecContext *avctx, · 317 unmodified lines
318 disposal = GCE_DISPOSAL_INPLACE;318 disposal = GCE_DISPOSAL_INPLACE;
319 }319 }
320 320
321 if (s->image || !avctx->frame_number) { /* GIF header */321 if (s->image || !avctx->frame_num) { /* GIF header */
322 const uint32_t *global_palette = palette ? palette : s->palette;322 const uint32_t *global_palette = palette ? palette : s->palette;
323 const AVRational sar = avctx->sample_aspect_ratio;323 const AVRational sar = avctx->sample_aspect_ratio;
324 int64_t aspect = 0;324 int64_t aspect = 0;
@@ -510,7 +510,7 @@ static int gif_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 185 unmodified lines
510 }510 }
511 511
512 pkt->size = outbuf_ptr - pkt->data;512 pkt->size = outbuf_ptr - pkt->data;
513 if (s->image || !avctx->frame_number)513 if (s->image || !avctx->frame_num)
514 pkt->flags |= AV_PKT_FLAG_KEY;514 pkt->flags |= AV_PKT_FLAG_KEY;
515 *got_packet = 1;515 *got_packet = 1;
516 516
libavcodec/h261dec.c+1−1
@@ -610,7 +610,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 609 unmodified lines
610 MpegEncContext *s = &h->s;610 MpegEncContext *s = &h->s;
611 int ret;611 int ret;
612 612
613 ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);613 ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_num, buf_size);
614 ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);614 ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]);
615 615
616 h->gob_start_code_skipped = 0;616 h->gob_start_code_skipped = 0;
libavcodec/h264_slice.c+1−1
@@ -1297,7 +1297,7 @@ static int h264_select_output_frame(H264Context *h) · 1296 unmodified lines
1297 h->last_pocs[0] = cur->poc;1297 h->last_pocs[0] = cur->poc;
1298 cur->mmco_reset = 1;1298 cur->mmco_reset = 1;
1299 } else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){1299 } else if(h->avctx->has_b_frames < out_of_order && !sps->bitstream_restriction_flag){
1300 int loglevel = h->avctx->frame_number > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE;1300 int loglevel = h->avctx->frame_num > 1 ? AV_LOG_WARNING : AV_LOG_VERBOSE;
1301 av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order);1301 av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order);
1302 h->avctx->has_b_frames = out_of_order;1302 h->avctx->has_b_frames = out_of_order;
1303 }1303 }
libavcodec/interplayvideo.c+4−4
@@ -926,7 +926,7 @@ static void ipvideo_format_06_firstpass(IpvideoContext *s, AVFrame *frame, int16 · 925 unmodified lines
926 }926 }
927 } else {927 } else {
928 /* Don't try to copy second_last_frame data on the first frames */928 /* Don't try to copy second_last_frame data on the first frames */
929 if (s->avctx->frame_number > 2)929 if (s->avctx->frame_num > 2)
930 copy_from(s, s->second_last_frame, frame, 0, 0);930 copy_from(s, s->second_last_frame, frame, 0, 0);
931 }931 }
932}932}
@@ -1085,7 +1085,7 @@ static void ipvideo_decode_format_10_opcodes(IpvideoContext *s, AVFrame *frame) · 152 unmodified lines
1085 copy_from(s, s->cur_decode_frame, frame, 0, 0);1085 copy_from(s, s->cur_decode_frame, frame, 0, 0);
1086 } else {1086 } else {
1087 /* Don't try to copy last_frame data on the first frame */1087 /* Don't try to copy last_frame data on the first frame */
1088 if (s->avctx->frame_number)1088 if (s->avctx->frame_num)
1089 copy_from(s, s->last_frame, frame, 0, 0);1089 copy_from(s, s->last_frame, frame, 0, 0);
1090 }1090 }
1091 skip *= 2;1091 skip *= 2;
@@ -1144,8 +1144,8 @@ static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame) · 52 unmodified lines
1144 ret = ipvideo_decode_block16[opcode](s, frame);1144 ret = ipvideo_decode_block16[opcode](s, frame);
1145 }1145 }
1146 if (ret != 0) {1146 if (ret != 0) {
1147 av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n",1147 av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %"PRId64", @ block (%d, %d)\n",
1148 s->avctx->frame_number, x, y);1148 s->avctx->frame_num, x, y);
1149 return;1149 return;
1150 }1150 }
1151 }1151 }
libavcodec/ituh263dec.c+1−1
@@ -1093,7 +1093,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s) · 1092 unmodified lines
1093 1093
1094 align_get_bits(&s->gb);1094 align_get_bits(&s->gb);
1095 1095
1096 if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_number == 0) {1096 if (show_bits(&s->gb, 2) == 2 && s->avctx->frame_num == 0) {
1097 av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n");1097 av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n");
1098 }1098 }
1099 1099
libavcodec/libwebpenc_animencoder.c+1−1
@@ -132,7 +132,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 131 unmodified lines
132 goto end;132 goto end;
133 }133 }
134 134
135 if (!avctx->frame_number) {135 if (!avctx->frame_num) {
136 s->first_frame_pts = frame->pts;136 s->first_frame_pts = frame->pts;
137#if FF_API_REORDERED_OPAQUE137#if FF_API_REORDERED_OPAQUE
138FF_DISABLE_DEPRECATION_WARNINGS138FF_DISABLE_DEPRECATION_WARNINGS
libavcodec/mjpegdec.c+1−1
@@ -2884,7 +2884,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) · 2883 unmodified lines
2884 MJpegDecodeContext *s = avctx->priv_data;2884 MJpegDecodeContext *s = avctx->priv_data;
2885 int i, j;2885 int i, j;
2886 2886
2887 if (s->interlaced && s->bottom_field == !s->interlace_polarity && s->got_picture && !avctx->frame_number) {2887 if (s->interlaced && s->bottom_field == !s->interlace_polarity && s->got_picture && !avctx->frame_num) {
2888 av_log(avctx, AV_LOG_INFO, "Single field\n");2888 av_log(avctx, AV_LOG_INFO, "Single field\n");
2889 }2889 }
2890 2890
libavcodec/mlpenc.c+3−3
@@ -2118,7 +2118,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 2117 unmodified lines
2118 2118
2119 data = frame ? frame->data[0] : NULL;2119 data = frame ? frame->data[0] : NULL;
2120 2120
2121 ctx->frame_index = avctx->frame_number % ctx->max_restart_interval;2121 ctx->frame_index = avctx->frame_num % ctx->max_restart_interval;
2122 2122
2123 ctx->inout_buffer = ctx->major_inout_buffer2123 ctx->inout_buffer = ctx->major_inout_buffer
2124 + ctx->frame_index * ctx->one_sample_buffer_size;2124 + ctx->frame_index * ctx->one_sample_buffer_size;
@@ -2128,7 +2128,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 3 unmodified lines
2128 2128
2129 ctx->write_buffer = ctx->inout_buffer;2129 ctx->write_buffer = ctx->inout_buffer;
2130 2130
2131 if (avctx->frame_number < ctx->max_restart_interval) {2131 if (avctx->frame_num < ctx->max_restart_interval) {
2132 if (data)2132 if (data)
2133 goto input_and_return;2133 goto input_and_return;
2134 }2134 }
@@ -2199,7 +2199,7 @@ input_and_return: · 64 unmodified lines
2199 }2199 }
2200 2200
2201 if (!frame && ctx->last_frames < ctx->max_restart_interval - 1)2201 if (!frame && ctx->last_frames < ctx->max_restart_interval - 1)
2202 avctx->frame_number++;2202 avctx->frame_num++;
2203 2203
2204 if (bytes_written > 0) {2204 if (bytes_written > 0) {
2205 ff_af_queue_remove(&ctx->afq,2205 ff_af_queue_remove(&ctx->afq,
libavcodec/mpegutils.c+1−1
@@ -230,7 +230,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, · 229 unmodified lines
230 if (mbcount) {230 if (mbcount) {
231 AVFrameSideData *sd;231 AVFrameSideData *sd;
232 232
233 av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %d\n", mbcount, avctx->frame_number);233 av_log(avctx, AV_LOG_DEBUG, "Adding %d MVs info to frame %"PRId64"\n", mbcount, avctx->frame_num);
234 sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MOTION_VECTORS, mbcount * sizeof(AVMotionVector));234 sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MOTION_VECTORS, mbcount * sizeof(AVMotionVector));
235 if (!sd) {235 if (!sd) {
236 av_freep(&mvs);236 av_freep(&mvs);
libavcodec/nuv.c+1−1
@@ -139,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 138 unmodified lines
139 int size_change = 0;139 int size_change = 0;
140 int minsize = 0;140 int minsize = 0;
141 int flags = 0;141 int flags = 0;
142 int result, init_frame = !avctx->frame_number;142 int result, init_frame = !avctx->frame_num;
143 enum {143 enum {
144 NUV_UNCOMPRESSED = '0',144 NUV_UNCOMPRESSED = '0',
145 NUV_RTJPEG = '1',145 NUV_RTJPEG = '1',
libavcodec/options_table.h+1−1
@@ -97,7 +97,7 @@ static const AVOption avcodec_options[] = { · 96 unmodified lines
97#endif97#endif
98{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},98{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
99{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},99{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},
100{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},100{"frame_number", NULL, OFFSET(frame_num), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
101{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},101{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
102{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "102{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "
103 "Recommended range for default rc_eq: 0.0-1.0",103 "Recommended range for default rc_eq: 0.0-1.0",
libavcodec/opusenc.c+1−1
@@ -554,7 +554,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 553 unmodified lines
554 ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));554 ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame));
555 } else {555 } else {
556 ff_opus_psy_signal_eof(&s->psyctx);556 ff_opus_psy_signal_eof(&s->psyctx);
557 if (!s->afq.remaining_samples || !avctx->frame_number)557 if (!s->afq.remaining_samples || !avctx->frame_num)
558 return 0; /* We've been flushed and there's nothing left to encode */558 return 0; /* We've been flushed and there's nothing left to encode */
559 }559 }
560 560
libavcodec/pngenc.c+4−4
@@ -251,7 +251,7 @@ static void png_write_image_data(AVCodecContext *avctx, · 250 unmodified lines
251 const AVCRC *crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);251 const AVCRC *crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
252 uint32_t crc = ~0U;252 uint32_t crc = ~0U;
253 253
254 if (avctx->codec_id == AV_CODEC_ID_PNG || avctx->frame_number == 0) {254 if (avctx->codec_id == AV_CODEC_ID_PNG || avctx->frame_num == 0) {
255 png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), buf, length);255 png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), buf, length);
256 return;256 return;
257 }257 }
@@ -799,7 +799,7 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, · 541 unmodified lines
799 APNGFctlChunk last_fctl_chunk = *best_last_fctl_chunk;799 APNGFctlChunk last_fctl_chunk = *best_last_fctl_chunk;
800 APNGFctlChunk fctl_chunk = *best_fctl_chunk;800 APNGFctlChunk fctl_chunk = *best_fctl_chunk;
801 801
802 if (avctx->frame_number == 0) {802 if (avctx->frame_num == 0) {
803 best_fctl_chunk->width = pict->width;803 best_fctl_chunk->width = pict->width;
804 best_fctl_chunk->height = pict->height;804 best_fctl_chunk->height = pict->height;
805 best_fctl_chunk->x_offset = 0;805 best_fctl_chunk->x_offset = 0;
@@ -924,7 +924,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, · 118 unmodified lines
924 if (pict && s->color_type == PNG_COLOR_TYPE_PALETTE) {924 if (pict && s->color_type == PNG_COLOR_TYPE_PALETTE) {
925 uint32_t checksum = ~av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), ~0U, pict->data[1], 256 * sizeof(uint32_t));925 uint32_t checksum = ~av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), ~0U, pict->data[1], 256 * sizeof(uint32_t));
926 926
927 if (avctx->frame_number == 0) {927 if (avctx->frame_num == 0) {
928 s->palette_checksum = checksum;928 s->palette_checksum = checksum;
929 } else if (checksum != s->palette_checksum) {929 } else if (checksum != s->palette_checksum) {
930 av_log(avctx, AV_LOG_ERROR,930 av_log(avctx, AV_LOG_ERROR,
@@ -946,7 +946,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, · 15 unmodified lines
946 if (max_packet_size > INT_MAX)946 if (max_packet_size > INT_MAX)
947 return AVERROR(ENOMEM);947 return AVERROR(ENOMEM);
948 948
949 if (avctx->frame_number == 0) {949 if (avctx->frame_num == 0) {
950 if (!pict)950 if (!pict)
951 return AVERROR(EINVAL);951 return AVERROR(EINVAL);
952 952
libavcodec/pthread_frame.c+5−0
@@ -362,7 +362,12 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src) · 361 unmodified lines
362 dst->skip_idct = src->skip_idct;362 dst->skip_idct = src->skip_idct;
363 dst->skip_frame = src->skip_frame;363 dst->skip_frame = src->skip_frame;
364 364
365 dst->frame_num = src->frame_num;
366#if FF_API_AVCTX_FRAME_NUMBER
367FF_DISABLE_DEPRECATION_WARNINGS
365 dst->frame_number = src->frame_number;368 dst->frame_number = src->frame_number;
369FF_ENABLE_DEPRECATION_WARNINGS
370#endif
366#if FF_API_REORDERED_OPAQUE371#if FF_API_REORDERED_OPAQUE
367FF_DISABLE_DEPRECATION_WARNINGS372FF_DISABLE_DEPRECATION_WARNINGS
368 dst->reordered_opaque = src->reordered_opaque;373 dst->reordered_opaque = src->reordered_opaque;
libavcodec/qcelpdec.c+2−2
@@ -646,8 +646,8 @@ static qcelp_packet_rate determine_bitrate(AVCodecContext *avctx, · 645 unmodified lines
646static void warn_insufficient_frame_quality(AVCodecContext *avctx,646static void warn_insufficient_frame_quality(AVCodecContext *avctx,
647 const char *message)647 const char *message)
648{648{
649 av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n",649 av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", IFQ: %s\n",
650 avctx->frame_number, message);650 avctx->frame_num, message);
651}651}
652 652
653static void postfilter(QCELPContext *q, float *samples, float *lpc)653static void postfilter(QCELPContext *q, float *samples, float *lpc)
libavcodec/qtrleenc.c+1−1
@@ -374,7 +374,7 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 373 unmodified lines
374 return ret;374 return ret;
375 375
376 if (avctx->gop_size == 0 || !s->previous_frame->data[0] ||376 if (avctx->gop_size == 0 || !s->previous_frame->data[0] ||
377 (s->avctx->frame_number % avctx->gop_size) == 0) {377 (s->avctx->frame_num % avctx->gop_size) == 0) {
378 /* I-Frame */378 /* I-Frame */
379 s->key_frame = 1;379 s->key_frame = 1;
380 } else {380 } else {
libavcodec/rv10.c+1−1
@@ -603,7 +603,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 602 unmodified lines
603 int slice_count;603 int slice_count;
604 const uint8_t *slices_hdr = NULL;604 const uint8_t *slices_hdr = NULL;
605 605
606 ff_dlog(avctx, "*****frame %d size=%d\n", avctx->frame_number, buf_size);606 ff_dlog(avctx, "*****frame %"PRId64" size=%d\n", avctx->frame_num, buf_size);
607 607
608 /* no supplementary picture */608 /* no supplementary picture */
609 if (buf_size == 0) {609 if (buf_size == 0) {
libavcodec/smcenc.c+1−1
@@ -542,7 +542,7 @@ static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 541 unmodified lines
542 return ret;542 return ret;
543 543
544 if (avctx->gop_size == 0 || !s->prev_frame->data[0] ||544 if (avctx->gop_size == 0 || !s->prev_frame->data[0] ||
545 (avctx->frame_number % avctx->gop_size) == 0) {545 (avctx->frame_num % avctx->gop_size) == 0) {
546 s->key_frame = 1;546 s->key_frame = 1;
547 } else {547 } else {
548 s->key_frame = 0;548 s->key_frame = 0;
libavcodec/snowenc.c+6−6
@@ -1607,9 +1607,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 1606 unmodified lines
1607 pic->pict_type = pict->pict_type;1607 pic->pict_type = pict->pict_type;
1608 pic->quality = pict->quality;1608 pic->quality = pict->quality;
1609 1609
1610 s->m.picture_number= avctx->frame_number;1610 s->m.picture_number= avctx->frame_num;
1611 if(avctx->flags&AV_CODEC_FLAG_PASS2){1611 if(avctx->flags&AV_CODEC_FLAG_PASS2){
1612 s->m.pict_type = pic->pict_type = s->m.rc_context.entry[avctx->frame_number].new_pict_type;1612 s->m.pict_type = pic->pict_type = s->m.rc_context.entry[avctx->frame_num].new_pict_type;
1613 s->keyframe = pic->pict_type == AV_PICTURE_TYPE_I;1613 s->keyframe = pic->pict_type == AV_PICTURE_TYPE_I;
1614 if(!(avctx->flags&AV_CODEC_FLAG_QSCALE)) {1614 if(!(avctx->flags&AV_CODEC_FLAG_QSCALE)) {
1615 pic->quality = ff_rate_estimate_qscale(&s->m, 0);1615 pic->quality = ff_rate_estimate_qscale(&s->m, 0);
@@ -1617,11 +1617,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 1 unmodified line
1617 return -1;1617 return -1;
1618 }1618 }
1619 }else{1619 }else{
1620 s->keyframe= avctx->gop_size==0 || avctx->frame_number % avctx->gop_size == 0;1620 s->keyframe= avctx->gop_size==0 || avctx->frame_num % avctx->gop_size == 0;
1621 s->m.pict_type = pic->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;1621 s->m.pict_type = pic->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
1622 }1622 }
1623 1623
1624 if(s->pass1_rc && avctx->frame_number == 0)1624 if(s->pass1_rc && avctx->frame_num == 0)
1625 pic->quality = 2*FF_QP2LAMBDA;1625 pic->quality = 2*FF_QP2LAMBDA;
1626 if (pic->quality) {1626 if (pic->quality) {
1627 s->qlog = qscale2qlog(pic->quality);1627 s->qlog = qscale2qlog(pic->quality);
@@ -1856,13 +1856,13 @@ redo_frame: · 228 unmodified lines
1856 1856
1857 ff_snow_release_buffer(avctx);1857 ff_snow_release_buffer(avctx);
1858 1858
1859 s->current_picture->coded_picture_number = avctx->frame_number;1859 s->current_picture->coded_picture_number = avctx->frame_num;
1860 s->current_picture->pict_type = pic->pict_type;1860 s->current_picture->pict_type = pic->pict_type;
1861 s->current_picture->quality = pic->quality;1861 s->current_picture->quality = pic->quality;
1862 s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start);1862 s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start);
1863 s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits;1863 s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits;
1864 s->m.current_picture.f->display_picture_number =1864 s->m.current_picture.f->display_picture_number =
1865 s->m.current_picture.f->coded_picture_number = avctx->frame_number;1865 s->m.current_picture.f->coded_picture_number = avctx->frame_num;
1866 s->m.current_picture.f->quality = pic->quality;1866 s->m.current_picture.f->quality = pic->quality;
1867 s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);1867 s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start);
1868 if(s->pass1_rc)1868 if(s->pass1_rc)
libavcodec/svq1enc.c+3−3
@@ -548,10 +548,10 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) · 547 unmodified lines
548 SVQ1EncContext *const s = avctx->priv_data;548 SVQ1EncContext *const s = avctx->priv_data;
549 int i;549 int i;
550 550
551 if (avctx->frame_number)551 if (avctx->frame_num)
552 av_log(avctx, AV_LOG_DEBUG, "RD: %f\n",552 av_log(avctx, AV_LOG_DEBUG, "RD: %f\n",
553 s->rd_total / (double)(avctx->width * avctx->height *553 s->rd_total / (double)(avctx->width * avctx->height *
554 avctx->frame_number));554 avctx->frame_num));
555 555
556 s->m.mb_type = NULL;556 s->m.mb_type = NULL;
557 ff_mpv_common_end(&s->m);557 ff_mpv_common_end(&s->m);
@@ -684,7 +684,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 126 unmodified lines
684 684
685 FFSWAP(AVFrame*, s->current_picture, s->last_picture);685 FFSWAP(AVFrame*, s->current_picture, s->last_picture);
686 686
687 if (avctx->gop_size && (avctx->frame_number % avctx->gop_size))687 if (avctx->gop_size && (avctx->frame_num % avctx->gop_size))
688 s->pict_type = AV_PICTURE_TYPE_P;688 s->pict_type = AV_PICTURE_TYPE_P;
689 else689 else
690 s->pict_type = AV_PICTURE_TYPE_I;690 s->pict_type = AV_PICTURE_TYPE_I;
libavcodec/svq3.c+2−2
@@ -1542,12 +1542,12 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 1541 unmodified lines
1542 left = buf_size*8 - get_bits_count(&s->gb_slice);1542 left = buf_size*8 - get_bits_count(&s->gb_slice);
1543 1543
1544 if (s->mb_y != s->mb_height || s->mb_x != s->mb_width) {1544 if (s->mb_y != s->mb_height || s->mb_x != s->mb_width) {
1545 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);1545 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);
1546 //av_hex_dump(stderr, buf+buf_size-8, 8);1546 //av_hex_dump(stderr, buf+buf_size-8, 8);
1547 }1547 }
1548 1548
1549 if (left < 0) {1549 if (left < 0) {
1550 av_log(avctx, AV_LOG_ERROR, "frame num %d left %d\n", avctx->frame_number, left);1550 av_log(avctx, AV_LOG_ERROR, "frame num %"PRId64" left %d\n", avctx->frame_num, left);
1551 return -1;1551 return -1;
1552 }1552 }
1553 1553
libavcodec/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
29 29
30#include "version_major.h"30#include "version_major.h"
31 31
32#define LIBAVCODEC_VERSION_MINOR 132#define LIBAVCODEC_VERSION_MINOR 2
33#define LIBAVCODEC_VERSION_MICRO 10033#define LIBAVCODEC_VERSION_MICRO 100
34 34
35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \35#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
libavcodec/version_major.h+1−0
@@ -44,6 +44,7 @@ · 43 unmodified lines
44#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61)44#define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61)
45#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61)45#define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61)
46#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61)46#define FF_API_VT_HWACCEL_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 61)
47#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
47 48
48// reminder to remove CrystalHD decoders on next major bump49// reminder to remove CrystalHD decoders on next major bump
49#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61)50#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61)
libavcodec/vp3.c+3−3
@@ -2654,8 +2654,8 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 2653 unmodified lines
2654 s->qps[i] = -1;2654 s->qps[i] = -1;
2655 2655
2656 if (s->avctx->debug & FF_DEBUG_PICT_INFO)2656 if (s->avctx->debug & FF_DEBUG_PICT_INFO)
2657 av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",2657 av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%"PRId64": Q index = %d\n",
2658 s->keyframe ? "key" : "", avctx->frame_number + 1, s->qps[0]);2658 s->keyframe ? "key" : "", avctx->frame_num + 1, s->qps[0]);
2659 2659
2660 s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] ||2660 s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] ||
2661 avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL2661 avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL
@@ -2701,7 +2701,7 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 39 unmodified lines
2701 }2701 }
2702#endif2702#endif
2703 s->version = version;2703 s->version = version;
2704 if (avctx->frame_number == 0)2704 if (avctx->frame_num == 0)
2705 av_log(s->avctx, AV_LOG_DEBUG,2705 av_log(s->avctx, AV_LOG_DEBUG,
2706 "VP version: %d\n", s->version);2706 "VP version: %d\n", s->version);
2707 }2707 }
libavcodec/wcmv.c+1−1
@@ -156,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, · 155 unmodified lines
156 if (bytestream2_get_bytes_left(&gb) < 8LL * blocks)156 if (bytestream2_get_bytes_left(&gb) < 8LL * blocks)
157 return AVERROR_INVALIDDATA;157 return AVERROR_INVALIDDATA;
158 158
159 if (!avctx->frame_number) {159 if (!avctx->frame_num) {
160 ptrdiff_t linesize[4] = { s->prev_frame->linesize[0], 0, 0, 0 };160 ptrdiff_t linesize[4] = { s->prev_frame->linesize[0], 0, 0, 0 };
161 av_image_fill_black(s->prev_frame->data, linesize, avctx->pix_fmt, 0,161 av_image_fill_black(s->prev_frame->data, linesize, avctx->pix_fmt, 0,
162 avctx->width, avctx->height);162 avctx->width, avctx->height);
libavcodec/wmaprodec.c+3−3
@@ -1678,7 +1678,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, · 1677 unmodified lines
1678 skip_bits(gb, 2);1678 skip_bits(gb, 2);
1679 } else {1679 } else {
1680 int num_frames = get_bits(gb, 6);1680 int num_frames = get_bits(gb, 6);
1681 ff_dlog(avctx, "packet[%d]: number of frames %d\n", avctx->frame_number, num_frames);1681 ff_dlog(avctx, "packet[%"PRId64"]: number of frames %d\n", avctx->frame_num, num_frames);
1682 packet_sequence_number = 0;1682 packet_sequence_number = 0;
1683 }1683 }
1684 1684
@@ -1687,10 +1687,10 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, · 2 unmodified lines
1687 if (avctx->codec_id != AV_CODEC_ID_WMAPRO) {1687 if (avctx->codec_id != AV_CODEC_ID_WMAPRO) {
1688 skip_bits(gb, 3);1688 skip_bits(gb, 3);
1689 s->skip_packets = get_bits(gb, 8);1689 s->skip_packets = get_bits(gb, 8);
1690 ff_dlog(avctx, "packet[%d]: skip packets %d\n", avctx->frame_number, s->skip_packets);1690 ff_dlog(avctx, "packet[%"PRId64"]: skip packets %d\n", avctx->frame_num, s->skip_packets);
1691 }1691 }
1692 1692
1693 ff_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,1693 ff_dlog(avctx, "packet[%"PRId64"]: nbpf %x\n", avctx->frame_num,
1694 num_bits_prev_frame);1694 num_bits_prev_frame);
1695 1695
1696 /** check for packet loss */1696 /** check for packet loss */
libavcodec/yop.c+1−1
@@ -207,7 +207,7 @@ static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 206 unmodified lines
207 if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)207 if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
208 return ret;208 return ret;
209 209
210 if (!avctx->frame_number)210 if (!avctx->frame_num)
211 memset(frame->data[1], 0, AVPALETTE_SIZE);211 memset(frame->data[1], 0, AVPALETTE_SIZE);
212 212
213 s->dstbuf = frame->data[0];213 s->dstbuf = frame->data[0];
tools/decode_simple.c+3−3
@@ -38,7 +38,7 @@ static int decode_read(DecodeContext *dc, int flush) · 37 unmodified lines
38 int ret = 0;38 int ret = 0;
39 39
40 while (ret >= 0 &&40 while (ret >= 0 &&
41 (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames)) {41 (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames)) {
42 ret = avcodec_receive_frame(dc->decoder, dc->frame);42 ret = avcodec_receive_frame(dc->decoder, dc->frame);
43 if (ret < 0) {43 if (ret < 0) {
44 if (ret == AVERROR_EOF) {44 if (ret == AVERROR_EOF) {
@@ -55,11 +55,11 @@ static int decode_read(DecodeContext *dc, int flush) · 10 unmodified lines
55 if (ret < 0)55 if (ret < 0)
56 return ret;56 return ret;
57 57
58 if (dc->max_frames && dc->decoder->frame_number == dc->max_frames)58 if (dc->max_frames && dc->decoder->frame_num == dc->max_frames)
59 return 1;59 return 1;
60 }60 }
61 61
62 return (dc->max_frames == 0 || dc->decoder->frame_number < dc->max_frames) ? 0 : 1;62 return (dc->max_frames == 0 || dc->decoder->frame_num < dc->max_frames) ? 0 : 1;
63}63}
64 64
65int ds_run(DecodeContext *dc)65int ds_run(DecodeContext *dc)
tools/scale_slice_test.c+2−2
@@ -100,8 +100,8 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) · 99 unmodified lines
100 100
101 if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i],101 if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i],
102 pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) {102 pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) {
103 fprintf(stderr, "mismatch frame %d seed %u\n",103 fprintf(stderr, "mismatch frame %"PRId64" seed %u\n",
104 dc->decoder->frame_number - 1, pd->random_seed);104 dc->decoder->frame_num - 1, pd->random_seed);
105 return AVERROR(EINVAL);105 return AVERROR(EINVAL);
106 }106 }
107 }107 }
tools/venc_data_dump.c+1−1
@@ -38,7 +38,7 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) · 37 unmodified lines
38 if (!frame)38 if (!frame)
39 return 0;39 return 0;
40 40
41 fprintf(stdout, "frame %d\n", dc->decoder->frame_number - 1);41 fprintf(stdout, "frame %"PRId64"\n", dc->decoder->frame_num - 1);
42 42
43 sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);43 sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
44 if (sd) {44 if (sd) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t