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.
Unified · Split
| @@ -2,6 +2,10 @@ The last version increases of all libraries were on 2023-02-09 · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | API changes, most recent first: |
| 4 | 4 | |
| 5 | +2023-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 | + | |
| 5 | 9 | 2023-02-12 - xxxxxxxxxx - lavfi 9.1.100 - avfilter.h |
| 6 | 10 | Add filtergraph segment parsing API. |
| 7 | 11 | New structs: |
| @@ -70,12 +70,12 @@ static void decode(AVCodecContext *dec_ctx, AVFrame *frame, AVPacket *pkt, · 69 unmodified lines | ||
| 70 | 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 | 74 | fflush(stdout); |
| 75 | 75 | |
| 76 | 76 | /* the picture is allocated by the decoder. no need to |
| 77 | 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 | 79 | pgm_save(frame->data[0], frame->linesize[0], |
| 80 | 80 | frame->width, frame->height, buf); |
| 81 | 81 | } |
| @@ -2115,7 +2115,7 @@ static int decode(InputStream *ist, AVCodecContext *avctx, · 2114 unmodified lines | ||
| 2115 | 2115 | fd = (FrameData*)frame->opaque_ref->data; |
| 2116 | 2116 | fd->pts = frame->pts; |
| 2117 | 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 | 2121 | *got_frame = 1; |
| @@ -875,7 +875,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 874 unmodified lines | ||
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 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 | 879 | av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", |
| 880 | 880 | f->cfrm[i].id); |
| 881 | 881 | |
| @@ -910,9 +910,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 28 unmodified lines | ||
| 910 | 910 | buf = cfrm->data; |
| 911 | 911 | frame_size = cfrm->size; |
| 912 | 912 | |
| 913 | − if (id != avctx->frame_number) | |
| 914 | − av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", | |
| 915 | − id, avctx->frame_number); | |
| 913 | + if (id != avctx->frame_num) | |
| 914 | + av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %"PRId64"\n", | |
| 915 | + id, avctx->frame_num); | |
| 916 | 916 | |
| 917 | 917 | if (f->version <= 1) |
| 918 | 918 | return AVERROR_INVALIDDATA; |
| @@ -151,7 +151,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 150 unmodified lines | ||
| 151 | 151 | |
| 152 | 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 | |
| 157 | 157 | static av_cold int eightsvx_decode_init(AVCodecContext *avctx) |
| @@ -854,7 +854,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 853 unmodified lines | ||
| 854 | 854 | if (s->psypp) |
| 855 | 855 | ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); |
| 856 | 856 | |
| 857 | − if (!avctx->frame_number) | |
| 857 | + if (!avctx->frame_num) | |
| 858 | 858 | return 0; |
| 859 | 859 | |
| 860 | 860 | start_ch = 0; |
| @@ -958,7 +958,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 97 unmodified lines | ||
| 958 | 958 | do { |
| 959 | 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 | 962 | put_bitstream_info(s, LIBAVCODEC_IDENT); |
| 963 | 963 | start_ch = 0; |
| 964 | 964 | target_bits = 0; |
| @@ -364,7 +364,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 363 unmodified lines | ||
| 364 | 364 | |
| 365 | 365 | if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) |
| 366 | 366 | return ret; |
| 367 | − if (!avctx->frame_number) { | |
| 367 | + if (!avctx->frame_num) { | |
| 368 | 368 | for (i=0; i<avctx->height; i++) |
| 369 | 369 | memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width); |
| 370 | 370 | memset(s->frame->data[1], 0, AVPALETTE_SIZE); |
| @@ -1391,9 +1391,9 @@ static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, · 1390 unmodified lines | ||
| 1391 | 1391 | if (band_has_tones[sb]) { |
| 1392 | 1392 | if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) { |
| 1393 | 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 | 1395 | ctx->waves_info->tones_index + dst[sb].num_wavs, |
| 1396 | − avctx->frame_number); | |
| 1396 | + avctx->frame_num); | |
| 1397 | 1397 | return AVERROR_INVALIDDATA; |
| 1398 | 1398 | } |
| 1399 | 1399 | dst[sb].start_index = ctx->waves_info->tones_index; |
| @@ -266,7 +266,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 265 unmodified lines | ||
| 266 | 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 | |
| 271 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 272 | + avctx->frame_number = avctx->frame_num; | |
| 273 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 274 | +#endif | |
| 270 | 275 | avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); |
| 271 | 276 | |
| 272 | 277 | if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && |
| @@ -1061,6 +1061,7 @@ typedef struct AVCodecContext { · 1060 unmodified lines | ||
| 1061 | 1061 | */ |
| 1062 | 1062 | int frame_size; |
| 1063 | 1063 | |
| 1064 | +#if FF_API_AVCTX_FRAME_NUMBER | |
| 1064 | 1065 | /** |
| 1065 | 1066 | * Frame counter, set by libavcodec. |
| 1066 | 1067 | * |
| @@ -1069,8 +1070,11 @@ typedef struct AVCodecContext { · 2 unmodified lines | ||
| 1069 | 1070 | * |
| 1070 | 1071 | * @note the counter is not incremented if encoding/decoding resulted in |
| 1071 | 1072 | * an error. |
| 1073 | + * @deprecated use frame_num instead | |
| 1072 | 1074 | */ |
| 1075 | + attribute_deprecated | |
| 1073 | 1076 | int frame_number; |
| 1077 | +#endif | |
| 1074 | 1078 | |
| 1075 | 1079 | /** |
| 1076 | 1080 | * number of bytes per packet if constant and known or 0 |
| @@ -2048,6 +2052,17 @@ typedef struct AVCodecContext { · 971 unmodified lines | ||
| 2048 | 2052 | * The decoder can then override during decoding as needed. |
| 2049 | 2053 | */ |
| 2050 | 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 | 2066 | } AVCodecContext; |
| 2052 | 2067 | |
| 2053 | 2068 | /** |
| @@ -66,7 +66,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 65 unmodified lines | ||
| 66 | 66 | bytestream2_init(&g, avpkt->data, buf_size); |
| 67 | 67 | |
| 68 | 68 | /* Set frame parameters and palette, if necessary */ |
| 69 | − if (!avctx->frame_number) { | |
| 69 | + if (!avctx->frame_num) { | |
| 70 | 70 | frame->pict_type = AV_PICTURE_TYPE_I; |
| 71 | 71 | frame->key_frame = 1; |
| 72 | 72 | /* Setting the palette */ |
| @@ -374,7 +374,7 @@ static void cdg_decode_flush(AVCodecContext *avctx) · 373 unmodified lines | ||
| 374 | 374 | return; |
| 375 | 375 | |
| 376 | 376 | memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height); |
| 377 | − if (!avctx->frame_number) | |
| 377 | + if (!avctx->frame_num) | |
| 378 | 378 | memset(cc->frame->data[1], 0, AVPALETTE_SIZE); |
| 379 | 379 | } |
| 380 | 380 | |
| @@ -42,7 +42,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 41 unmodified lines | ||
| 42 | 42 | CLJRContext *a = avctx->priv_data; |
| 43 | 43 | PutBitContext pb; |
| 44 | 44 | int x, y, ret; |
| 45 | − uint32_t dither= avctx->frame_number; | |
| 45 | + uint32_t dither= avctx->frame_num; | |
| 46 | 46 | static const uint32_t ordered_dither[2][2] = |
| 47 | 47 | { |
| 48 | 48 | { 0x10400000, 0x104F0000 }, |
| @@ -711,11 +711,16 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 710 unmodified lines | ||
| 711 | 711 | goto fail; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | − avctx->frame_number++; | |
| 714 | + avctx->frame_num++; | |
| 715 | +#if FF_API_AVCTX_FRAME_NUMBER | |
| 716 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 717 | + avctx->frame_number = avctx->frame_num; | |
| 718 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 719 | +#endif | |
| 715 | 720 | |
| 716 | 721 | if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) { |
| 717 | 722 | |
| 718 | − if (avctx->frame_number == 1) { | |
| 723 | + if (avctx->frame_num == 1) { | |
| 719 | 724 | avci->initial_format = frame->format; |
| 720 | 725 | switch(avctx->codec_type) { |
| 721 | 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 | 741 | changed = avci->initial_format != frame->format; |
| 737 | 742 | |
| 738 | 743 | switch(avctx->codec_type) { |
| @@ -749,9 +754,9 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) · 10 unmodified lines | ||
| 749 | 754 | |
| 750 | 755 | if (changed) { |
| 751 | 756 | avci->changed_frames_dropped++; |
| 752 | − av_log(avctx, AV_LOG_INFO, "dropped changed frame #%d pts %"PRId64 | |
| 757 | + av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64 | |
| 753 | 758 | " drop count: %d \n", |
| 754 | − avctx->frame_number, frame->pts, | |
| 759 | + avctx->frame_num, frame->pts, | |
| 755 | 760 | avci->changed_frames_dropped); |
| 756 | 761 | ret = AVERROR_INPUT_CHANGED; |
| 757 | 762 | goto fail; |
| @@ -916,7 +921,12 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, · 158 unmodified lines | ||
| 916 | 921 | } |
| 917 | 922 | |
| 918 | 923 | if (*got_sub_ptr) |
| 919 | − avctx->frame_number++; | |
| 924 | + avctx->frame_num++; | |
| 925 | +#if FF_API_AVCTX_FRAME_NUMBER | |
| 926 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 927 | + avctx->frame_number = avctx->frame_num; | |
| 928 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 929 | +#endif | |
| 920 | 930 | } |
| 921 | 931 | |
| 922 | 932 | return ret; |
| @@ -1144,7 +1144,7 @@ static void dv_format_frame(DVEncContext *c, uint8_t *buf) · 1143 unmodified lines | ||
| 1144 | 1144 | { |
| 1145 | 1145 | int chan, i, j, k; |
| 1146 | 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 | 1149 | for (chan = 0; chan < c->sys->n_difchan; chan++) { |
| 1150 | 1150 | for (i = 0; i < c->sys->difseg_size; i++) { |
| @@ -189,7 +189,7 @@ void ff_eac3_output_frame_header(AC3EncodeContext *s) · 188 unmodified lines | ||
| 189 | 189 | put_bits(&s->pb, 1, 0); |
| 190 | 190 | } |
| 191 | 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 | 193 | put_bits(&s->pb, 1, 0); /* no additional bit stream info */ |
| 194 | 194 | |
| 195 | 195 | /* frame header */ |
| @@ -171,7 +171,12 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, · 170 unmodified lines | ||
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 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 | |
| 176 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 177 | + avctx->frame_number = avctx->frame_num; | |
| 178 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 179 | +#endif | |
| 175 | 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 | 508 | return ret; |
| 504 | 509 | } |
| 505 | 510 | |
| 506 | − avctx->frame_number++; | |
| 511 | + avctx->frame_num++; | |
| 512 | +#if FF_API_AVCTX_FRAME_NUMBER | |
| 513 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 514 | + avctx->frame_number = avctx->frame_num; | |
| 515 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 516 | +#endif | |
| 507 | 517 | |
| 508 | 518 | return 0; |
| 509 | 519 | } |
| @@ -221,8 +221,8 @@ static evrc_packet_rate determine_bitrate(AVCodecContext *avctx, · 220 unmodified lines | ||
| 221 | 221 | static void warn_insufficient_frame_quality(AVCodecContext *avctx, |
| 222 | 222 | const char *message) |
| 223 | 223 | { |
| 224 | − av_log(avctx, AV_LOG_WARNING, "Frame #%d, %s\n", | |
| 225 | − avctx->frame_number, message); | |
| 224 | + av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", %s\n", | |
| 225 | + avctx->frame_num, message); | |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | /** |
| @@ -105,7 +105,7 @@ typedef struct FlashSV2Context { · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | int rows, cols; |
| 107 | 107 | |
| 108 | − int last_key_frame; | |
| 108 | + int64_t last_key_frame; | |
| 109 | 109 | |
| 110 | 110 | int image_width, image_height; |
| 111 | 111 | int block_width, block_height; |
| @@ -787,7 +787,7 @@ static int optimum_use15_7(FlashSV2Context * s) · 675 unmodified lines | ||
| 787 | 787 | { |
| 788 | 788 | #ifndef FLASHSV2_DUMB |
| 789 | 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 | 791 | if (ideal + use15_7_threshold < s->total_bits) { |
| 792 | 792 | return 1; |
| 793 | 793 | } else { |
| @@ -861,20 +861,20 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 67 unmodified lines | ||
| 861 | 861 | return res; |
| 862 | 862 | |
| 863 | 863 | /* First frame needs to be a keyframe */ |
| 864 | − if (avctx->frame_number == 0) | |
| 864 | + if (avctx->frame_num == 0) | |
| 865 | 865 | keyframe = 1; |
| 866 | 866 | |
| 867 | 867 | /* Check the placement of keyframes */ |
| 868 | 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 | 870 | keyframe = 1; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | 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 | 875 | recommend_keyframe(s, &keyframe); |
| 876 | 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 | 880 | if (keyframe) { |
| @@ -890,9 +890,9 @@ static int flashsv2_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 9 unmodified lines | ||
| 890 | 890 | |
| 891 | 891 | if (keyframe) { |
| 892 | 892 | new_key_frame(s); |
| 893 | − s->last_key_frame = avctx->frame_number; | |
| 893 | + s->last_key_frame = avctx->frame_num; | |
| 894 | 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 | 898 | pkt->size = res; |
| @@ -65,7 +65,7 @@ typedef struct FlashSVContext { · 64 unmodified lines | ||
| 65 | 65 | AVBufferRef *prev_frame_buf; |
| 66 | 66 | int image_width, image_height; |
| 67 | 67 | unsigned packet_size; |
| 68 | − int last_key_frame; | |
| 68 | + int64_t last_key_frame; | |
| 69 | 69 | uint8_t tmpblock[3 * 256 * 256]; |
| 70 | 70 | } FlashSVContext; |
| 71 | 71 | |
| @@ -215,7 +215,7 @@ static int flashsv_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 143 unmodified lines | ||
| 215 | 215 | |
| 216 | 216 | /* Check the placement of keyframes */ |
| 217 | 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 | 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 | 230 | //mark the frame type so the muxer can mux it correctly |
| 231 | 231 | if (I_frame) { |
| 232 | − s->last_key_frame = avctx->frame_number; | |
| 233 | − ff_dlog(avctx, "Inserting keyframe at frame %d\n", avctx->frame_number); | |
| 232 | + s->last_key_frame = avctx->frame_num; | |
| 233 | + ff_dlog(avctx, "Inserting keyframe at frame %"PRId64"\n", avctx->frame_num); | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if (I_frame) |
| @@ -931,8 +931,8 @@ static int epic_jb_decode_tile(G2MContext *c, int tile_x, int tile_y, · 930 unmodified lines | ||
| 931 | 931 | |
| 932 | 932 | if (ret) { |
| 933 | 933 | av_log(avctx, AV_LOG_ERROR, |
| 934 | − "ePIC: tile decoding failed, frame=%d, tile_x=%d, tile_y=%d\n", | |
| 935 | − avctx->frame_number, tile_x, tile_y); | |
| 934 | + "ePIC: tile decoding failed, frame=%"PRId64", tile_x=%d, tile_y=%d\n", | |
| 935 | + avctx->frame_num, tile_x, tile_y); | |
| 936 | 936 | return AVERROR_INVALIDDATA; |
| 937 | 937 | } |
| 938 | 938 | |
| @@ -318,7 +318,7 @@ static int gif_image_write_image(AVCodecContext *avctx, · 317 unmodified lines | ||
| 318 | 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 | 322 | const uint32_t *global_palette = palette ? palette : s->palette; |
| 323 | 323 | const AVRational sar = avctx->sample_aspect_ratio; |
| 324 | 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 | 512 | pkt->size = outbuf_ptr - pkt->data; |
| 513 | − if (s->image || !avctx->frame_number) | |
| 513 | + if (s->image || !avctx->frame_num) | |
| 514 | 514 | pkt->flags |= AV_PKT_FLAG_KEY; |
| 515 | 515 | *got_packet = 1; |
| 516 | 516 | |
| @@ -610,7 +610,7 @@ static int h261_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 609 unmodified lines | ||
| 610 | 610 | MpegEncContext *s = &h->s; |
| 611 | 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 | 614 | ff_dlog(avctx, "bytes=%x %x %x %x\n", buf[0], buf[1], buf[2], buf[3]); |
| 615 | 615 | |
| 616 | 616 | h->gob_start_code_skipped = 0; |
| @@ -1297,7 +1297,7 @@ static int h264_select_output_frame(H264Context *h) · 1296 unmodified lines | ||
| 1297 | 1297 | h->last_pocs[0] = cur->poc; |
| 1298 | 1298 | cur->mmco_reset = 1; |
| 1299 | 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 | 1301 | av_log(h->avctx, loglevel, "Increasing reorder buffer to %d\n", out_of_order); |
| 1302 | 1302 | h->avctx->has_b_frames = out_of_order; |
| 1303 | 1303 | } |
| @@ -926,7 +926,7 @@ static void ipvideo_format_06_firstpass(IpvideoContext *s, AVFrame *frame, int16 · 925 unmodified lines | ||
| 926 | 926 | } |
| 927 | 927 | } else { |
| 928 | 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 | 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 | 1085 | copy_from(s, s->cur_decode_frame, frame, 0, 0); |
| 1086 | 1086 | } else { |
| 1087 | 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 | 1089 | copy_from(s, s->last_frame, frame, 0, 0); |
| 1090 | 1090 | } |
| 1091 | 1091 | skip *= 2; |
| @@ -1144,8 +1144,8 @@ static void ipvideo_decode_format_11_opcodes(IpvideoContext *s, AVFrame *frame) · 52 unmodified lines | ||
| 1144 | 1144 | ret = ipvideo_decode_block16[opcode](s, frame); |
| 1145 | 1145 | } |
| 1146 | 1146 | if (ret != 0) { |
| 1147 | − av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n", | |
| 1148 | − s->avctx->frame_number, x, y); | |
| 1147 | + av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %"PRId64", @ block (%d, %d)\n", | |
| 1148 | + s->avctx->frame_num, x, y); | |
| 1149 | 1149 | return; |
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| @@ -1093,7 +1093,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s) · 1092 unmodified lines | ||
| 1093 | 1093 | |
| 1094 | 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 | 1097 | av_log(s->avctx, AV_LOG_WARNING, "Header looks like RTP instead of H.263\n"); |
| 1098 | 1098 | } |
| 1099 | 1099 | |
| @@ -132,7 +132,7 @@ FF_ENABLE_DEPRECATION_WARNINGS · 131 unmodified lines | ||
| 132 | 132 | goto end; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | − if (!avctx->frame_number) { | |
| 135 | + if (!avctx->frame_num) { | |
| 136 | 136 | s->first_frame_pts = frame->pts; |
| 137 | 137 | #if FF_API_REORDERED_OPAQUE |
| 138 | 138 | FF_DISABLE_DEPRECATION_WARNINGS |
| @@ -2884,7 +2884,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx) · 2883 unmodified lines | ||
| 2884 | 2884 | MJpegDecodeContext *s = avctx->priv_data; |
| 2885 | 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 | 2888 | av_log(avctx, AV_LOG_INFO, "Single field\n"); |
| 2889 | 2889 | } |
| 2890 | 2890 | |
| @@ -2118,7 +2118,7 @@ static int mlp_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 2117 unmodified lines | ||
| 2118 | 2118 | |
| 2119 | 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 | 2123 | ctx->inout_buffer = ctx->major_inout_buffer |
| 2124 | 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 | 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 | 2132 | if (data) |
| 2133 | 2133 | goto input_and_return; |
| 2134 | 2134 | } |
| @@ -2199,7 +2199,7 @@ input_and_return: · 64 unmodified lines | ||
| 2199 | 2199 | } |
| 2200 | 2200 | |
| 2201 | 2201 | if (!frame && ctx->last_frames < ctx->max_restart_interval - 1) |
| 2202 | − avctx->frame_number++; | |
| 2202 | + avctx->frame_num++; | |
| 2203 | 2203 | |
| 2204 | 2204 | if (bytes_written > 0) { |
| 2205 | 2205 | ff_af_queue_remove(&ctx->afq, |
| @@ -230,7 +230,7 @@ void ff_print_debug_info2(AVCodecContext *avctx, AVFrame *pict, · 229 unmodified lines | ||
| 230 | 230 | if (mbcount) { |
| 231 | 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 | 234 | sd = av_frame_new_side_data(pict, AV_FRAME_DATA_MOTION_VECTORS, mbcount * sizeof(AVMotionVector)); |
| 235 | 235 | if (!sd) { |
| 236 | 236 | av_freep(&mvs); |
| @@ -139,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, · 138 unmodified lines | ||
| 139 | 139 | int size_change = 0; |
| 140 | 140 | int minsize = 0; |
| 141 | 141 | int flags = 0; |
| 142 | − int result, init_frame = !avctx->frame_number; | |
| 142 | + int result, init_frame = !avctx->frame_num; | |
| 143 | 143 | enum { |
| 144 | 144 | NUV_UNCOMPRESSED = '0', |
| 145 | 145 | NUV_RTJPEG = '1', |
| @@ -97,7 +97,7 @@ static const AVOption avcodec_options[] = { · 96 unmodified lines | ||
| 97 | 97 | #endif |
| 98 | 98 | {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E}, |
| 99 | 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 | 101 | {"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, |
| 102 | 102 | {"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. " |
| 103 | 103 | "Recommended range for default rc_eq: 0.0-1.0", |
| @@ -554,7 +554,7 @@ static int opus_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, · 553 unmodified lines | ||
| 554 | 554 | ff_bufqueue_add(avctx, &s->bufqueue, av_frame_clone(frame)); |
| 555 | 555 | } else { |
| 556 | 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 | 558 | return 0; /* We've been flushed and there's nothing left to encode */ |
| 559 | 559 | } |
| 560 | 560 | |
| @@ -251,7 +251,7 @@ static void png_write_image_data(AVCodecContext *avctx, · 250 unmodified lines | ||
| 251 | 251 | const AVCRC *crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); |
| 252 | 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 | 255 | png_write_chunk(&s->bytestream, MKTAG('I', 'D', 'A', 'T'), buf, length); |
| 256 | 256 | return; |
| 257 | 257 | } |
| @@ -799,7 +799,7 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, · 541 unmodified lines | ||
| 799 | 799 | APNGFctlChunk last_fctl_chunk = *best_last_fctl_chunk; |
| 800 | 800 | APNGFctlChunk fctl_chunk = *best_fctl_chunk; |
| 801 | 801 | |
| 802 | − if (avctx->frame_number == 0) { | |
| 802 | + if (avctx->frame_num == 0) { | |
| 803 | 803 | best_fctl_chunk->width = pict->width; |
| 804 | 804 | best_fctl_chunk->height = pict->height; |
| 805 | 805 | best_fctl_chunk->x_offset = 0; |
| @@ -924,7 +924,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, · 118 unmodified lines | ||
| 924 | 924 | if (pict && s->color_type == PNG_COLOR_TYPE_PALETTE) { |
| 925 | 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 | 928 | s->palette_checksum = checksum; |
| 929 | 929 | } else if (checksum != s->palette_checksum) { |
| 930 | 930 | av_log(avctx, AV_LOG_ERROR, |
| @@ -946,7 +946,7 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt, · 15 unmodified lines | ||
| 946 | 946 | if (max_packet_size > INT_MAX) |
| 947 | 947 | return AVERROR(ENOMEM); |
| 948 | 948 | |
| 949 | − if (avctx->frame_number == 0) { | |
| 949 | + if (avctx->frame_num == 0) { | |
| 950 | 950 | if (!pict) |
| 951 | 951 | return AVERROR(EINVAL); |
| 952 | 952 | |
| @@ -362,7 +362,12 @@ static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src) · 361 unmodified lines | ||
| 362 | 362 | dst->skip_idct = src->skip_idct; |
| 363 | 363 | dst->skip_frame = src->skip_frame; |
| 364 | 364 | |
| 365 | + dst->frame_num = src->frame_num; | |
| 366 | +#if FF_API_AVCTX_FRAME_NUMBER | |
| 367 | +FF_DISABLE_DEPRECATION_WARNINGS | |
| 365 | 368 | dst->frame_number = src->frame_number; |
| 369 | +FF_ENABLE_DEPRECATION_WARNINGS | |
| 370 | +#endif | |
| 366 | 371 | #if FF_API_REORDERED_OPAQUE |
| 367 | 372 | FF_DISABLE_DEPRECATION_WARNINGS |
| 368 | 373 | dst->reordered_opaque = src->reordered_opaque; |
| @@ -646,8 +646,8 @@ static qcelp_packet_rate determine_bitrate(AVCodecContext *avctx, · 645 unmodified lines | ||
| 646 | 646 | static void warn_insufficient_frame_quality(AVCodecContext *avctx, |
| 647 | 647 | const char *message) |
| 648 | 648 | { |
| 649 | − av_log(avctx, AV_LOG_WARNING, "Frame #%d, IFQ: %s\n", | |
| 650 | − avctx->frame_number, message); | |
| 649 | + av_log(avctx, AV_LOG_WARNING, "Frame #%"PRId64", IFQ: %s\n", | |
| 650 | + avctx->frame_num, message); | |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | static void postfilter(QCELPContext *q, float *samples, float *lpc) |
| @@ -374,7 +374,7 @@ static int qtrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 373 unmodified lines | ||
| 374 | 374 | return ret; |
| 375 | 375 | |
| 376 | 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 | 378 | /* I-Frame */ |
| 379 | 379 | s->key_frame = 1; |
| 380 | 380 | } else { |
| @@ -603,7 +603,7 @@ static int rv10_decode_frame(AVCodecContext *avctx, AVFrame *pict, · 602 unmodified lines | ||
| 603 | 603 | int slice_count; |
| 604 | 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 | 608 | /* no supplementary picture */ |
| 609 | 609 | if (buf_size == 0) { |
| @@ -542,7 +542,7 @@ static int smc_encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 541 unmodified lines | ||
| 542 | 542 | return ret; |
| 543 | 543 | |
| 544 | 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 | 546 | s->key_frame = 1; |
| 547 | 547 | } else { |
| 548 | 548 | s->key_frame = 0; |
| @@ -1607,9 +1607,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 1606 unmodified lines | ||
| 1607 | 1607 | pic->pict_type = pict->pict_type; |
| 1608 | 1608 | pic->quality = pict->quality; |
| 1609 | 1609 | |
| 1610 | − s->m.picture_number= avctx->frame_number; | |
| 1610 | + s->m.picture_number= avctx->frame_num; | |
| 1611 | 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 | 1613 | s->keyframe = pic->pict_type == AV_PICTURE_TYPE_I; |
| 1614 | 1614 | if(!(avctx->flags&AV_CODEC_FLAG_QSCALE)) { |
| 1615 | 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 | 1617 | return -1; |
| 1618 | 1618 | } |
| 1619 | 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 | 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 | 1625 | pic->quality = 2*FF_QP2LAMBDA; |
| 1626 | 1626 | if (pic->quality) { |
| 1627 | 1627 | s->qlog = qscale2qlog(pic->quality); |
| @@ -1856,13 +1856,13 @@ redo_frame: · 228 unmodified lines | ||
| 1856 | 1856 | |
| 1857 | 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 | 1860 | s->current_picture->pict_type = pic->pict_type; |
| 1861 | 1861 | s->current_picture->quality = pic->quality; |
| 1862 | 1862 | s->m.frame_bits = 8*(s->c.bytestream - s->c.bytestream_start); |
| 1863 | 1863 | s->m.p_tex_bits = s->m.frame_bits - s->m.misc_bits - s->m.mv_bits; |
| 1864 | 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 | 1866 | s->m.current_picture.f->quality = pic->quality; |
| 1867 | 1867 | s->m.total_bits += 8*(s->c.bytestream - s->c.bytestream_start); |
| 1868 | 1868 | if(s->pass1_rc) |
| @@ -548,10 +548,10 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) · 547 unmodified lines | ||
| 548 | 548 | SVQ1EncContext *const s = avctx->priv_data; |
| 549 | 549 | int i; |
| 550 | 550 | |
| 551 | − if (avctx->frame_number) | |
| 551 | + if (avctx->frame_num) | |
| 552 | 552 | av_log(avctx, AV_LOG_DEBUG, "RD: %f\n", |
| 553 | 553 | s->rd_total / (double)(avctx->width * avctx->height * |
| 554 | − avctx->frame_number)); | |
| 554 | + avctx->frame_num)); | |
| 555 | 555 | |
| 556 | 556 | s->m.mb_type = NULL; |
| 557 | 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 | 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 | 688 | s->pict_type = AV_PICTURE_TYPE_P; |
| 689 | 689 | else |
| 690 | 690 | s->pict_type = AV_PICTURE_TYPE_I; |
| @@ -1542,12 +1542,12 @@ static int svq3_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 1541 unmodified lines | ||
| 1542 | 1542 | left = buf_size*8 - get_bits_count(&s->gb_slice); |
| 1543 | 1543 | |
| 1544 | 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 | 1546 | //av_hex_dump(stderr, buf+buf_size-8, 8); |
| 1547 | 1547 | } |
| 1548 | 1548 | |
| 1549 | 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 | 1551 | return -1; |
| 1552 | 1552 | } |
| 1553 | 1553 | |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #include "version_major.h" |
| 31 | 31 | |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 1 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 2 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 100 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -44,6 +44,7 @@ · 43 unmodified lines | ||
| 44 | 44 | #define FF_API_VT_OUTPUT_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 61) |
| 45 | 45 | #define FF_API_AVCODEC_CHROMA_POS (LIBAVCODEC_VERSION_MAJOR < 61) |
| 46 | 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 | 49 | // reminder to remove CrystalHD decoders on next major bump |
| 49 | 50 | #define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61) |
| @@ -2654,8 +2654,8 @@ static int vp3_decode_frame(AVCodecContext *avctx, AVFrame *frame, · 2653 unmodified lines | ||
| 2654 | 2654 | s->qps[i] = -1; |
| 2655 | 2655 | |
| 2656 | 2656 | if (s->avctx->debug & FF_DEBUG_PICT_INFO) |
| 2657 | − av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", | |
| 2658 | − s->keyframe ? "key" : "", avctx->frame_number + 1, s->qps[0]); | |
| 2657 | + av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%"PRId64": Q index = %d\n", | |
| 2658 | + s->keyframe ? "key" : "", avctx->frame_num + 1, s->qps[0]); | |
| 2659 | 2659 | |
| 2660 | 2660 | s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || |
| 2661 | 2661 | 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 | 2702 | #endif |
| 2703 | 2703 | s->version = version; |
| 2704 | − if (avctx->frame_number == 0) | |
| 2704 | + if (avctx->frame_num == 0) | |
| 2705 | 2705 | av_log(s->avctx, AV_LOG_DEBUG, |
| 2706 | 2706 | "VP version: %d\n", s->version); |
| 2707 | 2707 | } |
| @@ -156,7 +156,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, · 155 unmodified lines | ||
| 156 | 156 | if (bytestream2_get_bytes_left(&gb) < 8LL * blocks) |
| 157 | 157 | return AVERROR_INVALIDDATA; |
| 158 | 158 | |
| 159 | − if (!avctx->frame_number) { | |
| 159 | + if (!avctx->frame_num) { | |
| 160 | 160 | ptrdiff_t linesize[4] = { s->prev_frame->linesize[0], 0, 0, 0 }; |
| 161 | 161 | av_image_fill_black(s->prev_frame->data, linesize, avctx->pix_fmt, 0, |
| 162 | 162 | avctx->width, avctx->height); |
| @@ -1678,7 +1678,7 @@ static int decode_packet(AVCodecContext *avctx, WMAProDecodeCtx *s, · 1677 unmodified lines | ||
| 1678 | 1678 | skip_bits(gb, 2); |
| 1679 | 1679 | } else { |
| 1680 | 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 | 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 | 1687 | if (avctx->codec_id != AV_CODEC_ID_WMAPRO) { |
| 1688 | 1688 | skip_bits(gb, 3); |
| 1689 | 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 | 1694 | num_bits_prev_frame); |
| 1695 | 1695 | |
| 1696 | 1696 | /** check for packet loss */ |
| @@ -207,7 +207,7 @@ static int yop_decode_frame(AVCodecContext *avctx, AVFrame *rframe, · 206 unmodified lines | ||
| 207 | 207 | if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0) |
| 208 | 208 | return ret; |
| 209 | 209 | |
| 210 | − if (!avctx->frame_number) | |
| 210 | + if (!avctx->frame_num) | |
| 211 | 211 | memset(frame->data[1], 0, AVPALETTE_SIZE); |
| 212 | 212 | |
| 213 | 213 | s->dstbuf = frame->data[0]; |
| @@ -38,7 +38,7 @@ static int decode_read(DecodeContext *dc, int flush) · 37 unmodified lines | ||
| 38 | 38 | int ret = 0; |
| 39 | 39 | |
| 40 | 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 | 42 | ret = avcodec_receive_frame(dc->decoder, dc->frame); |
| 43 | 43 | if (ret < 0) { |
| 44 | 44 | if (ret == AVERROR_EOF) { |
| @@ -55,11 +55,11 @@ static int decode_read(DecodeContext *dc, int flush) · 10 unmodified lines | ||
| 55 | 55 | if (ret < 0) |
| 56 | 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 | 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 | |
| 65 | 65 | int ds_run(DecodeContext *dc) |
| @@ -100,8 +100,8 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) · 99 unmodified lines | ||
| 100 | 100 | |
| 101 | 101 | if (memcmp(pd->frame_ref->data[i], pd->frame_dst->data[i], |
| 102 | 102 | pd->frame_ref->linesize[i] * (pd->frame_ref->height >> shift))) { |
| 103 | − fprintf(stderr, "mismatch frame %d seed %u\n", | |
| 104 | − dc->decoder->frame_number - 1, pd->random_seed); | |
| 103 | + fprintf(stderr, "mismatch frame %"PRId64" seed %u\n", | |
| 104 | + dc->decoder->frame_num - 1, pd->random_seed); | |
| 105 | 105 | return AVERROR(EINVAL); |
| 106 | 106 | } |
| 107 | 107 | } |
| @@ -38,7 +38,7 @@ static int process_frame(DecodeContext *dc, AVFrame *frame) · 37 unmodified lines | ||
| 38 | 38 | if (!frame) |
| 39 | 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 | 43 | sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS); |
| 44 | 44 | if (sd) { |