[x265] [PATCH] api: add an error message for an api_get() failure

deepthi at multicorewareinc.com deepthi at multicorewareinc.com
Thu Apr 30 10:28:34 CEST 2015


# HG changeset patch
# User Deepthi Nandakumar <deepthi at multicorewareinc.com>
# Date 1430382464 -19800
#      Thu Apr 30 13:57:44 2015 +0530
# Node ID 44a6e19fb812c0e81193a7bd114f3f9d1ba2fba7
# Parent  5c9b9856de29c079c268dfe070dd9ece8fd96f56
api: add an error message for an api_get() failure

diff -r 5c9b9856de29 -r 44a6e19fb812 source/encoder/api.cpp
--- a/source/encoder/api.cpp	Wed Apr 29 17:11:03 2015 +0530
+++ b/source/encoder/api.cpp	Thu Apr 30 13:57:44 2015 +0530
@@ -281,7 +281,10 @@
         else if (bitDepth == 8)
             libname = "libx265_main" ext;
         else
+        {
+            x265_log(NULL, X265_LOG_WARNING, "bitdepth %d not supported\n", bitDepth);
             return NULL;
+        }
 
 #if _WIN32
         HMODULE h = LoadLibraryA(libname);
diff -r 5c9b9856de29 -r 44a6e19fb812 source/x265.cpp
--- a/source/x265.cpp	Wed Apr 29 17:11:03 2015 +0530
+++ b/source/x265.cpp	Thu Apr 30 13:57:44 2015 +0530
@@ -459,7 +459,11 @@
     SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);
 
     const x265_api* api = x265_api_get(X265_DEPTH); /* Use 0 or X265_DEPTH to get what the cli was compiled against */
-
+    if (!api)
+    {
+        /* The appropriate error message has been displayed by x265_api_get() already */
+        exit(1);
+    }
     ReconPlay* reconPlay = NULL;
     x265_param* param = api->param_alloc();
     CLIOptions cliopt;


More information about the x265-devel mailing list