avcodec/nvdec: Fix capability check with old drivers.
authorJacob Trimble <modmaker-at-google.com@ffmpeg.org>
Thu, 30 Nov 2017 20:35:50 +0000 (12:35 -0800)
committerTimo Rothenpieler <timo@rothenpieler.org>
Fri, 8 Dec 2017 16:56:38 +0000 (17:56 +0100)
Copied the check from cuviddec.c (*_cuvid decoders) to allow the
capability check to be optional for older drivers.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
libavcodec/nvdec.c

index c7a02ff..e9e6ea0 100644 (file)
@@ -91,6 +91,18 @@ static int nvdec_test_capabilities(NVDECDecoder *decoder,
     caps.eChromaFormat   = params->ChromaFormat;
     caps.nBitDepthMinus8 = params->bitDepthMinus8;
 
+    if (!decoder->cvdl->cuvidGetDecoderCaps) {
+        av_log(logctx, AV_LOG_WARNING, "Used Nvidia driver is too old to perform a capability check.\n");
+        av_log(logctx, AV_LOG_WARNING, "The minimum required version is "
+#if defined(_WIN32) || defined(__CYGWIN__)
+            "378.66"
+#else
+            "378.13"
+#endif
+            ". Continuing blind.\n");
+        return 0;
+    }
+
     err = decoder->cvdl->cuvidGetDecoderCaps(&caps);
     if (err != CUDA_SUCCESS) {
         av_log(logctx, AV_LOG_ERROR, "Failed querying decoder capabilities\n");