mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavc: deprecate AVCodecContext.ticks_per_frame
For encoding, this field is entirely redundant with AVCodecContext.framerate. For decoding, this field is entirely redundant with AV_CODEC_PROP_FIELDS.
This commit is contained in:
parent
2953ebe7b6
commit
7d1d61cc5f
@ -2,6 +2,11 @@ The last version increases of all libraries were on 2023-02-09
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2023-05-xx - xxxxxxxxxx - lavc 60 - avcodec.h
|
||||
Depreate AVCodecContext.ticks_per_frame in favor of
|
||||
AVCodecContext.framerate (encoding) and
|
||||
AV_CODEC_PROP_FIELDS (decoding).
|
||||
|
||||
2023-05-xx - xxxxxxxxxx - lavc 60.12.100 - codec_desc.h
|
||||
Add AV_CODEC_PROP_FIELDS.
|
||||
|
||||
|
@ -775,7 +775,6 @@ Possible values:
|
||||
@end table
|
||||
@item rc_max_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item rc_min_vbv_use @var{float} (@emph{encoding,video})
|
||||
@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
|
||||
|
||||
@item color_primaries @var{integer} (@emph{decoding/encoding,video})
|
||||
Possible values:
|
||||
|
@ -117,7 +117,13 @@ static av_cold int amf_encode_init_av1(AVCodecContext* avctx)
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
}
|
||||
else {
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num * avctx->ticks_per_frame);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if ((ret = ff_amf_encode_init(avctx)) < 0)
|
||||
|
@ -142,7 +142,13 @@ static av_cold int amf_encode_init_h264(AVCodecContext *avctx)
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
} else {
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num * avctx->ticks_per_frame);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if ((ret = ff_amf_encode_init(avctx)) != 0)
|
||||
|
@ -109,7 +109,13 @@ static av_cold int amf_encode_init_hevc(AVCodecContext *avctx)
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
framerate = AMFConstructRate(avctx->framerate.num, avctx->framerate.den);
|
||||
} else {
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num * avctx->ticks_per_frame);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
framerate = AMFConstructRate(avctx->time_base.den, avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if ((ret = ff_amf_encode_init(avctx)) < 0)
|
||||
|
@ -556,14 +556,22 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
AVRational time_base;
|
||||
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
/**
|
||||
* For some codecs, the time base is closer to the field rate than the frame rate.
|
||||
* Most notably, H.264 and MPEG-2 specify time_base as half of frame duration
|
||||
* if no telecine is used ...
|
||||
*
|
||||
* Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2.
|
||||
*
|
||||
* @deprecated
|
||||
* - decoding: Use AVCodecDescriptor.props & AV_CODEC_PROP_FIELDS
|
||||
* - encoding: Set AVCodecContext.framerate instead
|
||||
*
|
||||
*/
|
||||
attribute_deprecated
|
||||
int ticks_per_frame;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Codec delay.
|
||||
|
@ -582,6 +582,8 @@ static int encode_preinit_video(AVCodecContext *avctx)
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (avctx->ticks_per_frame && avctx->time_base.num &&
|
||||
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
@ -591,6 +593,8 @@ static int encode_preinit_video(AVCodecContext *avctx)
|
||||
avctx->time_base.den);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (avctx->hw_frames_ctx) {
|
||||
AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
|
||||
|
@ -957,7 +957,7 @@ static int h264_slice_header_init(H264Context *h)
|
||||
if (h->x264_build < 44U)
|
||||
den *= 2;
|
||||
av_reduce(&h->avctx->framerate.den, &h->avctx->framerate.num,
|
||||
sps->num_units_in_tick * h->avctx->ticks_per_frame, den, 1 << 30);
|
||||
sps->num_units_in_tick * 2, den, 1 << 30);
|
||||
}
|
||||
|
||||
ff_h264_free_tables(h);
|
||||
|
@ -382,7 +382,11 @@ static av_cold int h264_decode_init(AVCodecContext *avctx)
|
||||
return AVERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ticks_per_frame = 2;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
if (!avctx->internal->is_copy) {
|
||||
if (avctx->extradata_size > 0 && avctx->extradata) {
|
||||
|
@ -1300,7 +1300,13 @@ static int aom_encode(AVCodecContext *avctx, AVPacket *pkt,
|
||||
else if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
|
||||
duration = av_rescale_q(1, av_inv_q(avctx->framerate), avctx->time_base);
|
||||
else
|
||||
duration = avctx->ticks_per_frame ? avctx->ticks_per_frame : 1;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
duration =
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
avctx->ticks_per_frame ? avctx->ticks_per_frame :
|
||||
#endif
|
||||
1;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
switch (frame->color_range) {
|
||||
case AVCOL_RANGE_MPEG:
|
||||
|
@ -86,7 +86,13 @@ static av_cold int libkvazaar_init(AVCodecContext *avctx)
|
||||
cfg->framerate_denom = avctx->framerate.den;
|
||||
} else {
|
||||
cfg->framerate_num = avctx->time_base.den;
|
||||
cfg->framerate_denom = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
cfg->framerate_denom = avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
cfg->target_bitrate = avctx->bit_rate;
|
||||
cfg->vui.sar_width = avctx->sample_aspect_ratio.num;
|
||||
|
@ -139,7 +139,13 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0) {
|
||||
param.fMaxFrameRate = av_q2d(avctx->framerate);
|
||||
} else {
|
||||
param.fMaxFrameRate = 1.0 / av_q2d(avctx->time_base) / FFMAX(avctx->ticks_per_frame, 1);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
param.fMaxFrameRate = 1.0 / av_q2d(avctx->time_base)
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
/ FFMAX(avctx->ticks_per_frame, 1)
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
param.iPicWidth = avctx->width;
|
||||
param.iPicHeight = avctx->height;
|
||||
|
@ -219,10 +219,15 @@ static av_cold int librav1e_encode_init(AVCodecContext *avctx)
|
||||
avctx->framerate.den, avctx->framerate.num
|
||||
});
|
||||
} else {
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
rav1e_config_set_time_base(cfg, (RaRational) {
|
||||
avctx->time_base.num * avctx->ticks_per_frame,
|
||||
avctx->time_base.den
|
||||
avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
, avctx->time_base.den
|
||||
});
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
if ((avctx->flags & AV_CODEC_FLAG_PASS1 || avctx->flags & AV_CODEC_FLAG_PASS2) && !avctx->bit_rate) {
|
||||
|
@ -250,7 +250,13 @@ static int config_enc_params(EbSvtAv1EncConfiguration *param,
|
||||
param->frame_rate_denominator = avctx->framerate.den;
|
||||
} else {
|
||||
param->frame_rate_numerator = avctx->time_base.den;
|
||||
param->frame_rate_denominator = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
param->frame_rate_denominator = avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
/* 2 = IDR, closed GOP, 1 = CRA, open GOP */
|
||||
|
@ -1829,7 +1829,13 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
|
||||
else if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
|
||||
duration = av_rescale_q(1, av_inv_q(avctx->framerate), avctx->time_base);
|
||||
else
|
||||
duration = avctx->ticks_per_frame ? avctx->ticks_per_frame : 1;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
duration =
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
avctx->ticks_per_frame ? avctx->ticks_per_frame :
|
||||
#endif
|
||||
1;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
|
||||
duration, flags, ctx->deadline);
|
||||
|
@ -1018,7 +1018,13 @@ static av_cold int X264_init(AVCodecContext *avctx)
|
||||
x4->params.i_fps_den = avctx->framerate.den;
|
||||
} else {
|
||||
x4->params.i_fps_num = avctx->time_base.den;
|
||||
x4->params.i_fps_den = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
x4->params.i_fps_den = avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;
|
||||
|
@ -220,7 +220,13 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
|
||||
ctx->params->fpsDenom = avctx->framerate.den;
|
||||
} else {
|
||||
ctx->params->fpsNum = avctx->time_base.den;
|
||||
ctx->params->fpsDenom = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
ctx->params->fpsDenom = avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
ctx->params->sourceWidth = avctx->width;
|
||||
ctx->params->sourceHeight = avctx->height;
|
||||
|
@ -659,7 +659,11 @@ static int mf_encv_output_adjust(AVCodecContext *avctx, IMFMediaType *type)
|
||||
framerate = avctx->framerate;
|
||||
} else {
|
||||
framerate = av_inv_q(avctx->time_base);
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
framerate.den *= avctx->ticks_per_frame;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
|
||||
ff_MFSetAttributeRatio((IMFAttributes *)type, &MF_MT_FRAME_RATE, framerate.num, framerate.den);
|
||||
|
@ -1265,7 +1265,11 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
||||
if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
|
||||
// MPEG-1 fps
|
||||
avctx->framerate = ff_mpeg12_frame_rate_tab[s1->frame_rate_index];
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ticks_per_frame = 1;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
|
||||
} else { // MPEG-2
|
||||
@ -1275,7 +1279,11 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
|
||||
ff_mpeg12_frame_rate_tab[s1->frame_rate_index].num * s1->frame_rate_ext.num,
|
||||
ff_mpeg12_frame_rate_tab[s1->frame_rate_index].den * s1->frame_rate_ext.den,
|
||||
1 << 30);
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ticks_per_frame = 2;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
switch (s->chroma_format) {
|
||||
case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
|
||||
|
@ -145,7 +145,11 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
|
||||
pc->frame_rate = avctx->framerate = ff_mpeg12_frame_rate_tab[frame_rate_index];
|
||||
bit_rate = (buf[4]<<10) | (buf[5]<<2) | (buf[6]>>6);
|
||||
avctx->codec_id = AV_CODEC_ID_MPEG1VIDEO;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ticks_per_frame = 1;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case EXT_START_CODE:
|
||||
@ -177,7 +181,11 @@ static void mpegvideo_extract_headers(AVCodecParserContext *s,
|
||||
avctx->framerate.num = pc->frame_rate.num * (frame_rate_ext_n + 1);
|
||||
avctx->framerate.den = pc->frame_rate.den * (frame_rate_ext_d + 1);
|
||||
avctx->codec_id = AV_CODEC_ID_MPEG2VIDEO;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
avctx->ticks_per_frame = 2;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 0x8: /* picture coding extension */
|
||||
|
@ -285,7 +285,13 @@ void ff_msmpeg4_encode_ext_header(MpegEncContext * s)
|
||||
if (s->avctx->framerate.num > 0 && s->avctx->framerate.den > 0)
|
||||
fps = s->avctx->framerate.num / s->avctx->framerate.den;
|
||||
else
|
||||
fps = s->avctx->time_base.den / s->avctx->time_base.num / FFMAX(s->avctx->ticks_per_frame, 1);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
fps = s->avctx->time_base.den / s->avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
/ FFMAX(s->avctx->ticks_per_frame, 1)
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
|
||||
put_bits(&s->pb, 5, FFMIN(fps, 31)); //yes 29.97 -> 29
|
||||
|
||||
|
@ -1571,7 +1571,13 @@ static av_cold int nvenc_setup_encoder(AVCodecContext *avctx)
|
||||
ctx->init_encode_params.frameRateDen = avctx->framerate.den;
|
||||
} else {
|
||||
ctx->init_encode_params.frameRateNum = avctx->time_base.den;
|
||||
ctx->init_encode_params.frameRateDen = avctx->time_base.num * avctx->ticks_per_frame;
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
ctx->init_encode_params.frameRateDen = avctx->time_base.num
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* avctx->ticks_per_frame
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
ctx->init_encode_params.enableEncodeAsync = 0;
|
||||
@ -2266,8 +2272,14 @@ static int nvenc_set_timestamp(AVCodecContext *avctx,
|
||||
dts = reorder_queue_dequeue(ctx->reorder_queue, avctx, pkt);
|
||||
|
||||
if (avctx->codec_descriptor->props & AV_CODEC_PROP_REORDER) {
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
pkt->dts = dts -
|
||||
FFMAX(ctx->encode_config.frameIntervalP - 1, 0) * FFMAX(avctx->ticks_per_frame, 1) * FFMAX(avctx->time_base.num, 1);
|
||||
FFMAX(ctx->encode_config.frameIntervalP - 1, 0)
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
* FFMAX(avctx->ticks_per_frame, 1)
|
||||
#endif
|
||||
* FFMAX(avctx->time_base.num, 1);
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
} else {
|
||||
pkt->dts = pkt->pts;
|
||||
}
|
||||
|
@ -276,7 +276,9 @@ static const AVOption avcodec_options[] = {
|
||||
#endif
|
||||
{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E},
|
||||
{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E},
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, INT_MAX, A|V|E|D},
|
||||
#endif
|
||||
{"color_primaries", "color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64 = AVCOL_PRI_UNSPECIFIED }, 1, INT_MAX, V|E|D, "color_primaries_type"},
|
||||
{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT709 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
|
||||
{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
|
||||
|
@ -286,7 +286,11 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
|
||||
dst->level = src->level;
|
||||
|
||||
dst->bits_per_raw_sample = src->bits_per_raw_sample;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
dst->ticks_per_frame = src->ticks_per_frame;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
dst->color_primaries = src->color_primaries;
|
||||
|
||||
dst->color_trc = src->color_trc;
|
||||
|
@ -60,7 +60,13 @@ static double get_fps(AVCodecContext *avctx)
|
||||
if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
|
||||
return av_q2d(avctx->framerate);
|
||||
|
||||
return 1.0 / av_q2d(avctx->time_base) / FFMAX(avctx->ticks_per_frame, 1);
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
return 1.0 / av_q2d(avctx->time_base)
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
/ FFMAX(avctx->ticks_per_frame, 1)
|
||||
#endif
|
||||
;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
}
|
||||
|
||||
static inline double qp2bits(RateControlEntry *rce, double qp)
|
||||
|
@ -418,6 +418,14 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
|
||||
v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace,
|
||||
v->tfcntrflag, v->finterpflag);
|
||||
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
if (v->broadcast) { // Pulldown may be present
|
||||
v->s.avctx->ticks_per_frame = 2;
|
||||
}
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
|
||||
v->psf = get_bits1(gb);
|
||||
if (v->psf) { //PsF, 6.1.13
|
||||
av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
|
||||
@ -467,9 +475,6 @@ static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
|
||||
v->s.avctx->framerate.num = ff_vc1_fps_nr[nr - 1] * 1000;
|
||||
}
|
||||
}
|
||||
if (v->broadcast) { // Pulldown may be present
|
||||
v->s.avctx->ticks_per_frame = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
|
@ -89,11 +89,10 @@ static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx,
|
||||
else
|
||||
s->pict_type = vpc->v.s.pict_type;
|
||||
|
||||
if (avctx->ticks_per_frame > 1){
|
||||
if (vpc->v.broadcast){
|
||||
// process pulldown flags
|
||||
s->repeat_pict = 1;
|
||||
// Pulldown flags are only valid when 'broadcast' has been set.
|
||||
// So ticks_per_frame will be 2
|
||||
if (vpc->v.rff){
|
||||
// repeat field
|
||||
s->repeat_pict = 2;
|
||||
|
@ -1087,7 +1087,6 @@ static int vc1_decode_frame(AVCodecContext *avctx, AVFrame *pict,
|
||||
// process pulldown flags
|
||||
s->current_picture_ptr->f->repeat_pict = 0;
|
||||
// Pulldown flags are only valid when 'broadcast' has been set.
|
||||
// So ticks_per_frame will be 2
|
||||
if (v->rff) {
|
||||
// repeat field
|
||||
s->current_picture_ptr->f->repeat_pict = 1;
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define FF_API_AVCTX_FRAME_NUMBER (LIBAVCODEC_VERSION_MAJOR < 61)
|
||||
#define FF_API_SLICE_OFFSET (LIBAVCODEC_VERSION_MAJOR < 61)
|
||||
#define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 61)
|
||||
#define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 61)
|
||||
|
||||
// reminder to remove CrystalHD decoders on next major bump
|
||||
#define FF_CODEC_CRYSTAL_HD (LIBAVCODEC_VERSION_MAJOR < 61)
|
||||
|
@ -710,7 +710,6 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
||||
AVRational dec_ctx_tb = dec_ctx->framerate.num ? av_inv_q(av_mul_q(dec_ctx->framerate, mul))
|
||||
: (ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO ? (AVRational){0, 1}
|
||||
: ist->time_base);
|
||||
|
||||
enc_ctx->time_base = ist->time_base;
|
||||
/*
|
||||
* Avi is a special case here because it supports variable fps but
|
||||
@ -727,7 +726,11 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
||||
|| copy_tb == AVFMT_TBCF_R_FRAMERATE) {
|
||||
enc_ctx->time_base.num = ist->r_frame_rate.den;
|
||||
enc_ctx->time_base.den = 2*ist->r_frame_rate.num;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
enc_ctx->ticks_per_frame = 2;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
} else
|
||||
#endif
|
||||
if (copy_tb == AVFMT_TBCF_AUTO && dec_ctx->framerate.num &&
|
||||
@ -736,9 +739,13 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
||||
|| (copy_tb == AVFMT_TBCF_DECODER &&
|
||||
(dec_ctx->framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
|
||||
enc_ctx->time_base = dec_ctx_tb;
|
||||
enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
|
||||
enc_ctx->time_base.den *= 2;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
|
||||
enc_ctx->ticks_per_frame = 2;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
} else if (!(ofmt->flags & AVFMT_VARIABLE_FPS)
|
||||
&& !av_match_name(ofmt->name, "mov,mp4,3gp,3g2,psp,ipod,ismv,f4v")) {
|
||||
@ -748,7 +755,11 @@ int avformat_transfer_internal_stream_timing_info(const AVOutputFormat *ofmt,
|
||||
|| (copy_tb == AVFMT_TBCF_DECODER &&
|
||||
(dec_ctx->framerate.num || ist->codecpar->codec_type == AVMEDIA_TYPE_AUDIO))) {
|
||||
enc_ctx->time_base = dec_ctx_tb;
|
||||
#if FF_API_TICKS_PER_FRAME
|
||||
FF_DISABLE_DEPRECATION_WARNINGS
|
||||
enc_ctx->time_base.num *= dec_ctx->ticks_per_frame;
|
||||
FF_ENABLE_DEPRECATION_WARNINGS
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user