When decoding, this field holds the inverse of the framerate that can be written in the headers for some codecs. Using a field called 'time_base' for this is very misleading, as there are no timestamps associated with it. Furthermore, this field is used for a very different purpose during encoding. Add a new field, called 'framerate', to replace the use of time_base for decoding.
Unified · Split
| @@ -13,6 +13,10 @@ libavutil: 2014-08-09 · 12 unmodified lines | ||
| 13 | 13 | |
| 14 | 14 | API changes, most recent first: |
| 15 | 15 | |
| 16 | +2014-10-xx - xxxxxxx - lavc 56.5.0 - avcodec.h | |
| 17 | + Replace AVCodecContext.time_base used for decoding | |
| 18 | + with AVCodecContext.framerate. | |
| 19 | + | |
| 16 | 20 | 2014-10-xx - xxxxxxx - lavc 56.4.0 - avcodec.h |
| 17 | 21 | Add AV_HWACCEL_FLAG_IGNORE_LEVEL flag to av_vdpau_bind_context(). |
| 18 | 22 | |
| @@ -1170,7 +1170,8 @@ typedef struct AVCodecContext { · 1169 unmodified lines | ||
| 1170 | 1170 | * timebase should be 1/framerate and timestamp increments should be |
| 1171 | 1171 | * identically 1. |
| 1172 | 1172 | * - encoding: MUST be set by user. |
| 1173 | − * - decoding: Set by libavcodec. | |
| 1173 | + * - decoding: the use of this field for decoding is deprecated. | |
| 1174 | + * Use framerate instead. | |
| 1174 | 1175 | */ |
| 1175 | 1176 | AVRational time_base; |
| 1176 | 1177 | |
| @@ -2788,6 +2789,14 @@ typedef struct AVCodecContext { · 1611 unmodified lines | ||
| 2788 | 2789 | * -initial_padding. |
| 2789 | 2790 | */ |
| 2790 | 2791 | int initial_padding; |
| 2792 | + | |
| 2793 | + /* | |
| 2794 | + * - decoding: For codecs that store a framerate value in the compressed | |
| 2795 | + * bitstream, the decoder may export it here. { 0, 1} when | |
| 2796 | + * unknown. | |
| 2797 | + * - encoding: unused | |
| 2798 | + */ | |
| 2799 | + AVRational framerate; | |
| 2791 | 2800 | } AVCodecContext; |
| 2792 | 2801 | |
| 2793 | 2802 | /** |
| @@ -1106,8 +1106,7 @@ static int decode_seq_header(AVSContext *h) · 1105 unmodified lines | ||
| 1106 | 1106 | h->low_delay = get_bits1(&h->gb); |
| 1107 | 1107 | h->mb_width = (h->width + 15) >> 4; |
| 1108 | 1108 | h->mb_height = (h->height + 15) >> 4; |
| 1109 | − h->avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_code].num; | |
| 1110 | − h->avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_code].den; | |
| 1109 | + h->avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_code]; | |
| 1111 | 1110 | h->avctx->width = h->width; |
| 1112 | 1111 | h->avctx->height = h->height; |
| 1113 | 1112 | if (!h->top_qp) |
| @@ -172,8 +172,7 @@ static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, · 171 unmodified lines | ||
| 172 | 172 | /* [DIRAC_STD] Table 10.3 values 9-10 */ |
| 173 | 173 | frame_rate = dirac_frame_rate[source->frame_rate_index - 9]; |
| 174 | 174 | } |
| 175 | − av_reduce(&avctx->time_base.num, &avctx->time_base.den, | |
| 176 | − frame_rate.den, frame_rate.num, 1 << 30); | |
| 175 | + avctx->framerate = frame_rate; | |
| 177 | 176 | |
| 178 | 177 | /* [DIRAC_STD] 10.3.6 Pixel Aspect Ratio. |
| 179 | 178 | * pixel_aspect_ratio(video_params) */ |
| @@ -373,7 +373,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, void *data, · 372 unmodified lines | ||
| 373 | 373 | s->frame->key_frame = 1; |
| 374 | 374 | s->frame->pict_type = AV_PICTURE_TYPE_I; |
| 375 | 375 | avctx->pix_fmt = s->sys->pix_fmt; |
| 376 | − avctx->time_base = s->sys->time_base; | |
| 376 | + avctx->framerate = av_inv_q(s->sys->time_base); | |
| 377 | 377 | |
| 378 | 378 | ret = ff_set_dimensions(avctx, s->sys->width, s->sys->height); |
| 379 | 379 | if (ret < 0) |
| @@ -153,7 +153,7 @@ static int cmv_process_header(CmvContext *s, const uint8_t *buf, const uint8_t * · 152 unmodified lines | ||
| 153 | 153 | |
| 154 | 154 | fps = AV_RL16(&buf[10]); |
| 155 | 155 | if (fps > 0) |
| 156 | − s->avctx->time_base = (AVRational){ 1, fps }; | |
| 156 | + s->avctx->framerate = (AVRational){ fps, 1 }; | |
| 157 | 157 | |
| 158 | 158 | pal_start = AV_RL16(&buf[12]); |
| 159 | 159 | pal_count = AV_RL16(&buf[14]); |
| @@ -249,7 +249,7 @@ static int decode_frame(AVCodecContext *avctx, · 248 unmodified lines | ||
| 249 | 249 | inter = (chunk_type == MADm_TAG || chunk_type == MADe_TAG); |
| 250 | 250 | bytestream2_skip(&gb, 10); |
| 251 | 251 | |
| 252 | − av_reduce(&avctx->time_base.num, &avctx->time_base.den, | |
| 252 | + av_reduce(&avctx->framerate.den, &avctx->framerate.num, | |
| 253 | 253 | bytestream2_get_le16(&gb), 1000, 1<<30); |
| 254 | 254 | |
| 255 | 255 | width = bytestream2_get_le16(&gb); |
| @@ -53,7 +53,7 @@ static av_cold int tgq_decode_init(AVCodecContext *avctx) · 52 unmodified lines | ||
| 53 | 53 | s->avctx = avctx; |
| 54 | 54 | ff_init_scantable_permutation(idct_permutation, FF_IDCT_PERM_NONE); |
| 55 | 55 | ff_init_scantable(idct_permutation, &s->scantable, ff_zigzag_direct); |
| 56 | − avctx->time_base = (AVRational){1, 15}; | |
| 56 | + avctx->framerate = (AVRational){ 15, 1 }; | |
| 57 | 57 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 58 | 58 | return 0; |
| 59 | 59 | } |
| @@ -55,7 +55,7 @@ static av_cold int tgv_decode_init(AVCodecContext *avctx) · 54 unmodified lines | ||
| 55 | 55 | { |
| 56 | 56 | TgvContext *s = avctx->priv_data; |
| 57 | 57 | s->avctx = avctx; |
| 58 | − avctx->time_base = (AVRational){1, 15}; | |
| 58 | + avctx->framerate = (AVRational){ 15, 1 }; | |
| 59 | 59 | avctx->pix_fmt = AV_PIX_FMT_PAL8; |
| 60 | 60 | |
| 61 | 61 | s->last_frame = av_frame_alloc(); |
| @@ -56,7 +56,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx) · 55 unmodified lines | ||
| 56 | 56 | ff_init_scantable_permutation(s->idsp.idct_permutation, FF_IDCT_PERM_NONE); |
| 57 | 57 | ff_init_scantable(s->idsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); |
| 58 | 58 | s->qscale = 1; |
| 59 | − avctx->time_base = (AVRational){1, 15}; | |
| 59 | + avctx->framerate = (AVRational){ 15, 1 }; | |
| 60 | 60 | avctx->pix_fmt = AV_PIX_FMT_YUV420P; |
| 61 | 61 | ff_mpeg12_init_vlcs(); |
| 62 | 62 | return 0; |
| @@ -478,7 +478,7 @@ static int h261_decode_picture_header(H261Context *h) · 477 unmodified lines | ||
| 478 | 478 | i += 32; |
| 479 | 479 | s->picture_number = (s->picture_number & ~31) + i; |
| 480 | 480 | |
| 481 | − s->avctx->time_base = (AVRational) { 1001, 30000 }; | |
| 481 | + s->avctx->framerate = (AVRational) { 30000, 1001 }; | |
| 482 | 482 | |
| 483 | 483 | /* PTYPE starts here */ |
| 484 | 484 | skip_bits1(&s->gb); /* split screen off */ |
| @@ -656,7 +656,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx) · 655 unmodified lines | ||
| 656 | 656 | h->frame_recovered = 0; |
| 657 | 657 | if (avctx->codec_id == AV_CODEC_ID_H264) { |
| 658 | 658 | if (avctx->ticks_per_frame == 1) |
| 659 | − h->avctx->time_base.den *= 2; | |
| 659 | + h->avctx->framerate.num *= 2; | |
| 660 | 660 | avctx->ticks_per_frame = 2; |
| 661 | 661 | } |
| 662 | 662 | |
| @@ -1090,7 +1090,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) · 1089 unmodified lines | ||
| 1090 | 1090 | int64_t den = h->sps.time_scale; |
| 1091 | 1091 | if (h->x264_build < 44U) |
| 1092 | 1092 | den *= 2; |
| 1093 | − av_reduce(&h->avctx->time_base.num, &h->avctx->time_base.den, | |
| 1093 | + av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num, | |
| 1094 | 1094 | h->sps.num_units_in_tick, den, 1 << 30); |
| 1095 | 1095 | } |
| 1096 | 1096 | |
| @@ -442,7 +442,7 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps) · 441 unmodified lines | ||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | if (num != 0 && den != 0) |
| 445 | − av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den, | |
| 445 | + av_reduce(&s->avctx->framerate.den, &s->avctx->framerate.num, | |
| 446 | 446 | num, den, 1 << 30); |
| 447 | 447 | |
| 448 | 448 | return 0; |
| @@ -81,7 +81,7 @@ void ff_h263_show_pict_info(MpegEncContext *s){ · 80 unmodified lines | ||
| 81 | 81 | s->modified_quant ? " MQ" : "", |
| 82 | 82 | s->loop_filter ? " LOOP" : "", |
| 83 | 83 | s->h263_slice_structured ? " SS" : "", |
| 84 | − s->avctx->time_base.den, s->avctx->time_base.num | |
| 84 | + s->avctx->framerate.num, s->avctx->framerate.den | |
| 85 | 85 | ); |
| 86 | 86 | } |
| 87 | 87 | } |
| @@ -938,7 +938,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s) · 850 unmodified lines | ||
| 938 | 938 | s->width = width; |
| 939 | 939 | s->height = height; |
| 940 | 940 | s->avctx->sample_aspect_ratio= (AVRational){12,11}; |
| 941 | − s->avctx->time_base= (AVRational){1001, 30000}; | |
| 941 | + s->avctx->framerate = (AVRational){ 30000, 1001 }; | |
| 942 | 942 | } else { |
| 943 | 943 | int ufep; |
| 944 | 944 | |
| @@ -1034,18 +1034,18 @@ int ff_h263_decode_picture_header(MpegEncContext *s) · 89 unmodified lines | ||
| 1034 | 1034 | |
| 1035 | 1035 | if(s->custom_pcf){ |
| 1036 | 1036 | int gcd; |
| 1037 | − s->avctx->time_base.den= 1800000; | |
| 1038 | − s->avctx->time_base.num= 1000 + get_bits1(&s->gb); | |
| 1039 | − s->avctx->time_base.num*= get_bits(&s->gb, 7); | |
| 1040 | − if(s->avctx->time_base.num == 0){ | |
| 1037 | + s->avctx->framerate.num = 1800000; | |
| 1038 | + s->avctx->framerate.den = 1000 + get_bits1(&s->gb); | |
| 1039 | + s->avctx->framerate.den *= get_bits(&s->gb, 7); | |
| 1040 | + if(s->avctx->framerate.den == 0){ | |
| 1041 | 1041 | av_log(s, AV_LOG_ERROR, "zero framerate\n"); |
| 1042 | 1042 | return -1; |
| 1043 | 1043 | } |
| 1044 | − gcd= av_gcd(s->avctx->time_base.den, s->avctx->time_base.num); | |
| 1045 | − s->avctx->time_base.den /= gcd; | |
| 1046 | − s->avctx->time_base.num /= gcd; | |
| 1044 | + gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num); | |
| 1045 | + s->avctx->framerate.den /= gcd; | |
| 1046 | + s->avctx->framerate.num /= gcd; | |
| 1047 | 1047 | }else{ |
| 1048 | − s->avctx->time_base= (AVRational){1001, 30000}; | |
| 1048 | + s->avctx->framerate = (AVRational){ 30000, 1001 }; | |
| 1049 | 1049 | } |
| 1050 | 1050 | } |
| 1051 | 1051 | |
| @@ -199,8 +199,8 @@ static void libschroedinger_handle_first_access_unit(AVCodecContext *avctx) · 198 unmodified lines | ||
| 199 | 199 | return; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | − avctx->time_base.den = p_schro_params->format->frame_rate_numerator; | |
| 203 | − avctx->time_base.num = p_schro_params->format->frame_rate_denominator; | |
| 202 | + avctx->framerate.num = p_schro_params->format->frame_rate_numerator; | |
| 203 | + avctx->framerate.den = p_schro_params->format->frame_rate_denominator; | |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | static int libschroedinger_decode_frame(AVCodecContext *avctx, |
| @@ -1257,15 +1257,14 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) · 1256 unmodified lines | ||
| 1257 | 1257 | |
| 1258 | 1258 | if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) { |
| 1259 | 1259 | // MPEG-1 fps |
| 1260 | − avctx->time_base.den = ff_mpeg12_frame_rate_tab[s->frame_rate_index].num; | |
| 1261 | − avctx->time_base.num = ff_mpeg12_frame_rate_tab[s->frame_rate_index].den; | |
| 1260 | + avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; | |
| 1262 | 1261 | // MPEG-1 aspect |
| 1263 | 1262 | avctx->sample_aspect_ratio = av_d2q(1.0 / ff_mpeg1_aspect[s->aspect_ratio_info], 255); |
| 1264 | 1263 | avctx->ticks_per_frame = 1; |
| 1265 | 1264 | } else { // MPEG-2 |
| 1266 | 1265 | // MPEG-2 fps |
| 1267 | − av_reduce(&s->avctx->time_base.den, | |
| 1268 | − &s->avctx->time_base.num, | |
| 1266 | + av_reduce(&s->avctx->framerate.num, | |
| 1267 | + &s->avctx->framerate.den, | |
| 1269 | 1268 | ff_mpeg12_frame_rate_tab[s->frame_rate_index].num * s1->frame_rate_ext.num * 2, |
| 1270 | 1269 | ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, |
| 1271 | 1270 | 1 << 30); |
| @@ -1722,23 +1722,22 @@ static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 1721 unmodified lines | ||
| 1722 | 1722 | |
| 1723 | 1723 | check_marker(gb, "before time_increment_resolution"); |
| 1724 | 1724 | |
| 1725 | − s->avctx->time_base.den = get_bits(gb, 16); | |
| 1726 | − if (!s->avctx->time_base.den) { | |
| 1727 | − av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n"); | |
| 1728 | − s->avctx->time_base.num = 0; | |
| 1725 | + s->avctx->framerate.num = get_bits(gb, 16); | |
| 1726 | + if (!s->avctx->framerate.num) { | |
| 1727 | + av_log(s->avctx, AV_LOG_ERROR, "framerate==0\n"); | |
| 1729 | 1728 | return -1; |
| 1730 | 1729 | } |
| 1731 | 1730 | |
| 1732 | − ctx->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; | |
| 1731 | + ctx->time_increment_bits = av_log2(s->avctx->framerate.num - 1) + 1; | |
| 1733 | 1732 | if (ctx->time_increment_bits < 1) |
| 1734 | 1733 | ctx->time_increment_bits = 1; |
| 1735 | 1734 | |
| 1736 | 1735 | check_marker(gb, "before fixed_vop_rate"); |
| 1737 | 1736 | |
| 1738 | 1737 | if (get_bits1(gb) != 0) /* fixed_vop_rate */ |
| 1739 | − s->avctx->time_base.num = get_bits(gb, ctx->time_increment_bits); | |
| 1738 | + s->avctx->framerate.den = get_bits(gb, ctx->time_increment_bits); | |
| 1740 | 1739 | else |
| 1741 | − s->avctx->time_base.num = 1; | |
| 1740 | + s->avctx->framerate.den = 1; | |
| 1742 | 1741 | |
| 1743 | 1742 | ctx->t_frame = 0; |
| 1744 | 1743 | |
| @@ -2126,19 +2125,19 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb) · 381 unmodified lines | ||
| 2126 | 2125 | if (s->pict_type != AV_PICTURE_TYPE_B) { |
| 2127 | 2126 | s->last_time_base = s->time_base; |
| 2128 | 2127 | s->time_base += time_incr; |
| 2129 | − s->time = s->time_base * s->avctx->time_base.den + time_increment; | |
| 2128 | + s->time = s->time_base * s->avctx->framerate.num + time_increment; | |
| 2130 | 2129 | if (s->workaround_bugs & FF_BUG_UMP4) { |
| 2131 | 2130 | if (s->time < s->last_non_b_time) { |
| 2132 | 2131 | /* header is not mpeg-4-compatible, broken encoder, |
| 2133 | 2132 | * trying to workaround */ |
| 2134 | 2133 | s->time_base++; |
| 2135 | − s->time += s->avctx->time_base.den; | |
| 2134 | + s->time += s->avctx->framerate.num; | |
| 2136 | 2135 | } |
| 2137 | 2136 | } |
| 2138 | 2137 | s->pp_time = s->time - s->last_non_b_time; |
| 2139 | 2138 | s->last_non_b_time = s->time; |
| 2140 | 2139 | } else { |
| 2141 | − s->time = (s->last_time_base + time_incr) * s->avctx->time_base.den + time_increment; | |
| 2140 | + s->time = (s->last_time_base + time_incr) * s->avctx->framerate.num + time_increment; | |
| 2142 | 2141 | s->pb_time = s->pp_time - (s->last_non_b_time - s->time); |
| 2143 | 2142 | if (s->pp_time <= s->pb_time || |
| 2144 | 2143 | s->pp_time <= s->pp_time - s->pb_time || |
| @@ -66,8 +66,7 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 65 unmodified lines | ||
| 66 | 66 | did_set_size=1; |
| 67 | 67 | } |
| 68 | 68 | frame_rate_index = buf[3] & 0xf; |
| 69 | − pc->frame_rate.den = avctx->time_base.den = ff_mpeg12_frame_rate_tab[frame_rate_index].num; | |
| 70 | − pc->frame_rate.num = avctx->time_base.num = ff_mpeg12_frame_rate_tab[frame_rate_index].den; | |
| 69 | + pc->frame_rate = avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_index]; | |
| 71 | 70 | avctx->bit_rate = ((buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6))*400; |
| 72 | 71 | avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO; |
| 73 | 72 | } |
| @@ -91,8 +90,8 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 17 unmodified lines | ||
| 91 | 90 | avctx->bit_rate += (bit_rate_ext << 18) * 400; |
| 92 | 91 | if(did_set_size) |
| 93 | 92 | ff_set_dimensions(avctx, pc->width, pc->height); |
| 94 | − avctx->time_base.den = pc->frame_rate.den * (frame_rate_ext_n + 1) * 2; | |
| 95 | − avctx->time_base.num = pc->frame_rate.num * (frame_rate_ext_d + 1); | |
| 93 | + avctx->framerate.num = pc->frame_rate.num * (frame_rate_ext_n + 1) * 2; | |
| 94 | + avctx->framerate.den = pc->frame_rate.den * (frame_rate_ext_d + 1); | |
| 96 | 95 | avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO; |
| 97 | 96 | } |
| 98 | 97 | break; |
| @@ -139,6 +138,10 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s, · 40 unmodified lines | ||
| 139 | 138 | } |
| 140 | 139 | } |
| 141 | 140 | the_end: ; |
| 141 | +#if FF_API_AVCTX_TIMEBASE | |
| 142 | + if (avctx->framerate.num) | |
| 143 | + avctx->time_base = av_inv_q(avctx->framerate); | |
| 144 | +#endif | |
| 142 | 145 | } |
| 143 | 146 | |
| 144 | 147 | static int mpegvideo_parse(AVCodecParserContext *s, |
| @@ -88,6 +88,7 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) · 87 unmodified lines | ||
| 88 | 88 | av_opt_set_defaults(s); |
| 89 | 89 | |
| 90 | 90 | s->time_base = (AVRational){0,1}; |
| 91 | + s->framerate = (AVRational){ 0, 1 }; | |
| 91 | 92 | s->get_buffer2 = avcodec_default_get_buffer2; |
| 92 | 93 | s->get_format = avcodec_default_get_format; |
| 93 | 94 | s->execute = avcodec_default_execute; |
| @@ -178,6 +178,7 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, · 177 unmodified lines | ||
| 178 | 178 | |
| 179 | 179 | if (dst != src) { |
| 180 | 180 | dst->time_base = src->time_base; |
| 181 | + dst->framerate = src->framerate; | |
| 181 | 182 | dst->width = src->width; |
| 182 | 183 | dst->height = src->height; |
| 183 | 184 | dst->pix_fmt = src->pix_fmt; |
| @@ -1262,6 +1262,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code · 1261 unmodified lines | ||
| 1262 | 1262 | ret = AVERROR(EINVAL); |
| 1263 | 1263 | goto free_and_end; |
| 1264 | 1264 | } |
| 1265 | + | |
| 1266 | +#if FF_API_AVCTX_TIMEBASE | |
| 1267 | + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) | |
| 1268 | + avctx->time_base = av_inv_q(avctx->framerate); | |
| 1269 | +#endif | |
| 1265 | 1270 | } |
| 1266 | 1271 | end: |
| 1267 | 1272 | entangled_thread_counter--; |
| @@ -1674,6 +1679,11 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 406 unmodified lines | ||
| 1674 | 1679 | } else |
| 1675 | 1680 | ret = 0; |
| 1676 | 1681 | |
| 1682 | +#if FF_API_AVCTX_TIMEBASE | |
| 1683 | + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) | |
| 1684 | + avctx->time_base = av_inv_q(avctx->framerate); | |
| 1685 | +#endif | |
| 1686 | + | |
| 1677 | 1687 | return ret; |
| 1678 | 1688 | } |
| 1679 | 1689 | |
| @@ -88,7 +88,7 @@ static int vaapi_mpeg4_start_frame(AVCodecContext *avctx, av_unused const uint8_ · 87 unmodified lines | ||
| 88 | 88 | pic_param->vop_fields.bits.alternate_vertical_scan_flag = s->alternate_scan; |
| 89 | 89 | pic_param->vop_fcode_forward = s->f_code; |
| 90 | 90 | pic_param->vop_fcode_backward = s->b_code; |
| 91 | − pic_param->vop_time_increment_resolution = avctx->time_base.den; | |
| 91 | + pic_param->vop_time_increment_resolution = avctx->framerate.num; | |
| 92 | 92 | pic_param->num_macroblocks_in_gob = s->mb_width * ff_h263_get_gob_height(s); |
| 93 | 93 | pic_param->num_gobs_in_vop = (s->mb_width * s->mb_height) / pic_param->num_macroblocks_in_gob; |
| 94 | 94 | pic_param->TRB = s->pb_time; |
| @@ -485,19 +485,19 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) · 484 unmodified lines | ||
| 485 | 485 | |
| 486 | 486 | if (get_bits1(gb)) { //framerate stuff |
| 487 | 487 | if (get_bits1(gb)) { |
| 488 | − v->s.avctx->time_base.num = 32; | |
| 489 | − v->s.avctx->time_base.den = get_bits(gb, 16) + 1; | |
| 488 | + v->s.avctx->framerate.den = 32; | |
| 489 | + v->s.avctx->framerate.num = get_bits(gb, 16) + 1; | |
| 490 | 490 | } else { |
| 491 | 491 | int nr, dr; |
| 492 | 492 | nr = get_bits(gb, 8); |
| 493 | 493 | dr = get_bits(gb, 4); |
| 494 | 494 | if (nr > 0 && nr < 8 && dr > 0 && dr < 3) { |
| 495 | − v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1]; | |
| 496 | − v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000; | |
| 495 | + v->s.avctx->framerate.den = ff_vc1_fps_dr[dr - 1]; | |
| 496 | + v->s.avctx->framerate.num = ff_vc1_fps_nr[nr - 1] * 1000; | |
| 497 | 497 | } |
| 498 | 498 | } |
| 499 | 499 | if (v->broadcast) { // Pulldown may be present |
| 500 | − v->s.avctx->time_base.den *= 2; | |
| 500 | + v->s.avctx->framerate.num *= 2; | |
| 501 | 501 | v->s.avctx->ticks_per_frame = 2; |
| 502 | 502 | } |
| 503 | 503 | } |
| @@ -61,7 +61,7 @@ static int vdpau_mpeg4_start_frame(AVCodecContext *avctx, · 60 unmodified lines | ||
| 61 | 61 | info->trb[0] = s->pb_time; |
| 62 | 62 | info->trd[1] = s->pp_field_time >> 1; |
| 63 | 63 | info->trb[1] = s->pb_field_time >> 1; |
| 64 | − info->vop_time_increment_resolution = s->avctx->time_base.den; | |
| 64 | + info->vop_time_increment_resolution = s->avctx->framerate.num; | |
| 65 | 65 | info->vop_fcode_forward = s->f_code; |
| 66 | 66 | info->vop_fcode_backward = s->b_code; |
| 67 | 67 | info->resync_marker_disable = !ctx->resync_marker; |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | #include "libavutil/version.h" |
| 30 | 30 | |
| 31 | 31 | #define LIBAVCODEC_VERSION_MAJOR 56 |
| 32 | −#define LIBAVCODEC_VERSION_MINOR 4 | |
| 32 | +#define LIBAVCODEC_VERSION_MINOR 5 | |
| 33 | 33 | #define LIBAVCODEC_VERSION_MICRO 0 |
| 34 | 34 | |
| 35 | 35 | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ |
| @@ -156,5 +156,8 @@ · 120 unmodified lines | ||
| 156 | 156 | #ifndef FF_API_AUDIOENC_DELAY |
| 157 | 157 | #define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) |
| 158 | 158 | #endif |
| 159 | +#ifndef FF_API_AVCTX_TIMEBASE | |
| 160 | +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) | |
| 161 | +#endif | |
| 159 | 162 | |
| 160 | 163 | #endif /* AVCODEC_VERSION_H */ |
| @@ -2233,7 +2233,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb) · 2232 unmodified lines | ||
| 2233 | 2233 | av_log(avctx, AV_LOG_ERROR, "Invalid framerate\n"); |
| 2234 | 2234 | return AVERROR_INVALIDDATA; |
| 2235 | 2235 | } |
| 2236 | − av_reduce(&avctx->time_base.num, &avctx->time_base.den, | |
| 2236 | + av_reduce(&avctx->framerate.den, &avctx->framerate.num, | |
| 2237 | 2237 | fps.den, fps.num, 1 << 30); |
| 2238 | 2238 | } |
| 2239 | 2239 | |