diff options
author | Sven Gothel <[email protected]> | 2017-12-28 19:54:30 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2017-12-28 19:54:30 +0100 |
commit | 1d9e85ffa4703fb1f8973862eb9089ff696eba7c (patch) | |
tree | cfde5f6a0452c5072603d77fa4b5f2f4847f00e8 /libhb/encavcodec.c | |
parent | 354d84ff644ea0a223fe78ea122d6e30337bafba (diff) |
NVENC: Properly test whether encoder is available on platform
Proper availability tests requires to open the codec's context,
only if successful we can deem it available on the runtime platform.
Diffstat (limited to 'libhb/encavcodec.c')
-rw-r--r-- | libhb/encavcodec.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c index 07dc7914a..948454f40 100644 --- a/libhb/encavcodec.c +++ b/libhb/encavcodec.c @@ -894,16 +894,20 @@ const char* const* hb_av_level_get_names(int encoder) int hb_av_encoder_present(int encoder) { + int err; + AVCodec *codec = NULL; switch (encoder) { case HB_VCODEC_FFMPEG_H264_NVENC: - return NULL != avcodec_find_encoder_by_name("h264_nvenc"); + codec = avcodec_find_encoder_by_name("h264_nvenc"); + break; case HB_VCODEC_FFMPEG_H265_NVENC: - return NULL != avcodec_find_encoder_by_name("hevc_nvenc"); - - default: - return 0; + codec = avcodec_find_encoder_by_name("hevc_nvenc"); + break; } + err = hb_avcodec_test_encoder(codec); + hb_log("hb_av_encoder_present: test 0x%X, res %d", encoder, err); + return 0 == err; } |