diff options
author | Timo Rothenpieler <timo@rothenpieler.org> | 2018-04-11 15:22:20 +0300 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2018-04-11 15:55:28 +0300 |
commit | 86e9dba8fa5be26e10a096b675616b9ddb950031 (patch) | |
tree | 41a4d90553ffd00b7a47676e5ed8a69c474596f8 /libavcodec/nvenc.c | |
parent | 3e9d676192fc6ef719a904f8a2d114efec03d7c1 (diff) |
avcodec/nvenc: add support for B frames as ref
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r-- | libavcodec/nvenc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c index 1f601a63bd..e2d1100cc8 100644 --- a/libavcodec/nvenc.c +++ b/libavcodec/nvenc.c @@ -370,6 +370,22 @@ static int nvenc_check_capabilities(AVCodecContext *avctx) return AVERROR(ENOSYS); } +#ifdef NVENC_HAVE_BFRAME_REF_MODE + ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_BFRAME_REF_MODE); + if (ctx->b_ref_mode == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1) { + av_log(avctx, AV_LOG_VERBOSE, "Each B frame as reference is not supported\n"); + return AVERROR(ENOSYS); + } else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) { + av_log(avctx, AV_LOG_VERBOSE, "B frames as references are not supported\n"); + return AVERROR(ENOSYS); + } +#else + if (ctx->b_ref_mode != 0) { + av_log(avctx, AV_LOG_VERBOSE, "B frames as references need SDK 8.1 at build time\n"); + return AVERROR(ENOSYS); + } +#endif + return 0; } @@ -988,6 +1004,10 @@ static av_cold int nvenc_setup_h264_config(AVCodecContext *avctx) if (ctx->coder >= 0) h264->entropyCodingMode = ctx->coder; +#ifdef NVENC_HAVE_BFRAME_REF_MODE + h264->useBFramesAsRef = ctx->b_ref_mode; +#endif + return 0; } |