In preparation of using it in the encoders. --- libavcodec/avcodec.h | 3 ++- libavcodec/utils.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 7eaa0c9277..f86ae0b8d6 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -2638,7 +2638,8 @@ typedef struct AVCodecContext { * bitstream, the decoder may export it here. { 0, 1} when * unknown. * - encoding: May be used to signal the framerate of CFR content to an - * encoder. + * encoder or the target average framerate for rate-control + * tuning. */ AVRational framerate; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ba3457664a..887c5618e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -539,6 +539,11 @@ FF_ENABLE_DEPRECATION_WARNINGS goto free_and_end; } + if (avctx->framerate.num <= 0) { + avctx->framerate.num = avctx->time_base.den; + avctx->framerate.den = avctx->time_base.num; + } + if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) -- 2.12.2 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel