<div dir="ltr">Ok, makes sense. Sending another patch which adds failures to api_get as well as clarifies usage. <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 1, 2015 at 11:37 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 04/30, <a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Deepthi Nandakumar <<a href="mailto:deepthi@multicorewareinc.com">deepthi@multicorewareinc.com</a>><br>
> # Date 1430367247 -19800<br>
> #      Thu Apr 30 09:44:07 2015 +0530<br>
> # Node ID a3ba8c92dcea057f2c5210d48d455691cc0c3e65<br>
> # Parent  74d7fe7a81ad773c8ae66f076c4e319b253d94ab<br>
> api: clarify docs and use of x265_api_get()<br>
><br>
> diff -r 74d7fe7a81ad -r a3ba8c92dcea doc/reST/api.rst<br>
> --- a/doc/reST/api.rst        Wed Apr 29 11:08:44 2015 -0500<br>
> +++ b/doc/reST/api.rst        Thu Apr 30 09:44:07 2015 +0530<br>
> @@ -352,7 +352,7 @@<br>
>  Multi-library Interface<br>
>  =======================<br>
><br>
> -If your application might want to make a runtime selection between among<br>
> +If your application might want to make a runtime selection between<br>
>  a number of libx265 libraries (perhaps 8bpp and 16bpp), then you will<br>
>  want to use the multi-library interface.<br>
><br>
> @@ -370,16 +370,20 @@<br>
>       *   libx265 */<br>
>      const x265_api* x265_api_get(int bitDepth);<br>
><br>
> -The general idea is to request the API for the bitDepth you would prefer<br>
> -the encoder to use (8 or 10), and if that returns NULL you request the<br>
> -API for bitDepth=0, which returns the system default libx265.<br>
> +Note that using this multi-library API in your application is only the<br>
> +first step.<br>
><br>
> -Note that using this multi-library API in your application is only the<br>
> -first step.  Your application must link to one build of libx265<br>
> -(statically or dynamically) and this linked version of libx265 will<br>
> -support one bit-depth (8 or 10 bits). If you request a different<br>
> -bit-depth, the linked libx265 will attempt to dynamically bind a shared<br>
> -library libx265 with a name appropriate for the requested bit-depth:<br>
> +Your application must link to one build of libx265 (statically or<br>
> +dynamically) and this linked version of libx265 will support one<br>
> +bit-depth (8 or 10 bits).<br>
> +<br>
> +Your application must now request the API for the bitDepth you would<br>
> +prefer the encoder to use (8 or 10). If the requested bitdepth is zero,<br>
> +or if it matches the bitdepth of the system default libx265 (the<br>
> +currently linked library), then this library will be used for encode.<br>
> +If you request a different bit-depth, the linked libx265 will attempt<br>
> +to dynamically bind a shared library with a name appropriate for the<br>
> +requested bit-depth:<br>
><br>
>      8-bit:  libx265_main.dll<br>
>      10-bit: libx265_main10.dll<br>
> @@ -390,7 +394,7 @@<br>
>  For example on Windows, one could package together an x265.exe<br>
>  statically linked against the 8bpp libx265 together with a<br>
>  libx265_main10.dll in the same folder, and this executable would be able<br>
> -to encode 10bit bitstreams by specifying -P main10 on the command line.<br>
> +to encode main and main10 bitstreams.<br>
><br>
>  On Linux, x265 packagers could install 8bpp static and shared libraries<br>
>  under the name libx265 (so all applications link against 8bpp libx265)<br>
> diff -r 74d7fe7a81ad -r a3ba8c92dcea source/x265.cpp<br>
> --- a/source/x265.cpp Wed Apr 29 11:08:44 2015 -0500<br>
> +++ b/source/x265.cpp Thu Apr 30 09:44:07 2015 +0530<br>
> @@ -458,9 +458,7 @@<br>
>      GetConsoleTitle(orgConsoleTitle, CONSOLE_TITLE_SIZE);<br>
>      SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_AWAYMODE_REQUIRED);<br>
><br>
> -    const x265_api* api = x265_api_get(X265_DEPTH); /* prefer what the cli was compiled against */<br>
> -    if (!api)<br>
> -        api = x265_api_get(0);<br>
> +    const x265_api* api = x265_api_get(X265_DEPTH); /* Use 0 or X265_DEPTH to get what the cli was compiled against */<br>
<br>
</div></div>this comment is not actually true.  Passing X265_DEPTH will prefer the<br>
bit depth the CLI was compiled against. Passing 0 will prefer the bit<br>
depth of the library the CLI linked to.  Particularly on Linux where the<br>
CLI can used shared-library versions of libx265, the compiled bit-depth<br>
can be different from the linked bit-depth.<br>
<br>
This is why it first tries X265_DEPTH, then tries 0.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Steve Borho<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</font></span></blockquote></div><br></div>