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

Steve Borho steve at borho.org
Fri May 1 20:06:37 CEST 2015


On 04/30, deepthi at multicorewareinc.com wrote:
> # 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

ok

> 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;
> +        }

we should probably also be validating the api->max_bit_depth that is
returned from the bound function to make sure it matches the requested
bit depth (checking that the user did not build an 8bpp DLL and call it
libx265_main10.dll, or vice-versa)

>  #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;
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list