You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/nvenc: avoid failing b_ref_mode check when unset
This commit is contained in:
@@ -459,7 +459,7 @@ static int nvenc_check_cap(AVCodecContext *avctx, NV_ENC_CAPS cap)
|
|||||||
static int nvenc_check_capabilities(AVCodecContext *avctx)
|
static int nvenc_check_capabilities(AVCodecContext *avctx)
|
||||||
{
|
{
|
||||||
NvencContext *ctx = avctx->priv_data;
|
NvencContext *ctx = avctx->priv_data;
|
||||||
int ret;
|
int tmp, ret;
|
||||||
|
|
||||||
ret = nvenc_check_codec_support(avctx);
|
ret = nvenc_check_codec_support(avctx);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@@ -540,16 +540,18 @@ static int nvenc_check_capabilities(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NVENC_HAVE_BFRAME_REF_MODE
|
#ifdef NVENC_HAVE_BFRAME_REF_MODE
|
||||||
|
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : NV_ENC_BFRAME_REF_MODE_DISABLED;
|
||||||
ret = nvenc_check_cap(avctx, NV_ENC_CAPS_SUPPORT_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 && ret != 3) {
|
if (tmp == NV_ENC_BFRAME_REF_MODE_EACH && ret != 1 && ret != 3) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n");
|
av_log(avctx, AV_LOG_WARNING, "Each B frame as reference is not supported\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
} else if (ctx->b_ref_mode != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) {
|
} else if (tmp != NV_ENC_BFRAME_REF_MODE_DISABLED && ret == 0) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n");
|
av_log(avctx, AV_LOG_WARNING, "B frames as references are not supported\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (ctx->b_ref_mode != 0) {
|
tmp = (ctx->b_ref_mode >= 0) ? ctx->b_ref_mode : 0;
|
||||||
|
if (tmp > 0) {
|
||||||
av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n");
|
av_log(avctx, AV_LOG_WARNING, "B frames as references need SDK 8.1 at build time\n");
|
||||||
return AVERROR(ENOSYS);
|
return AVERROR(ENOSYS);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user