summaryrefslogtreecommitdiff
path: root/libavcodec/nvenc.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2019-09-27 19:09:11 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2019-09-27 20:00:59 +0200
commitab0ef1abdf53e257f7628f2d264adc80038f3bcb (patch)
treedd7bb459480b0e670ee5fbc54c1422ec30bee22d /libavcodec/nvenc.c
parent51a23343d9c736217d8845b7442fafc373726433 (diff)
avcodec/nvenc: make use of new GetLastErrorString function
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/nvenc.c')
-rw-r--r--libavcodec/nvenc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 2de2bfdacb..bbb43ddad8 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -110,13 +110,23 @@ static int nvenc_map_error(NVENCSTATUS err, const char **desc)
return AVERROR_UNKNOWN;
}
-static int nvenc_print_error(void *log_ctx, NVENCSTATUS err,
+static int nvenc_print_error(AVCodecContext *avctx, NVENCSTATUS err,
const char *error_string)
{
const char *desc;
- int ret;
- ret = nvenc_map_error(err, &desc);
- av_log(log_ctx, AV_LOG_ERROR, "%s: %s (%d)\n", error_string, desc, err);
+ const char *details = "(no details)";
+ int ret = nvenc_map_error(err, &desc);
+
+#ifdef NVENC_HAVE_GETLASTERRORSTRING
+ NvencContext *ctx = avctx->priv_data;
+ NV_ENCODE_API_FUNCTION_LIST *p_nvenc = &ctx->nvenc_dload_funcs.nvenc_funcs;
+
+ if (p_nvenc && ctx->nvencoder)
+ details = p_nvenc->nvEncGetLastErrorString(ctx->nvencoder);
+#endif
+
+ av_log(avctx, AV_LOG_ERROR, "%s: %s (%d): %s\n", error_string, desc, err, details);
+
return ret;
}