[x265] [PATCH 4 of 4 RFC] multilib: add shim implementations of API introspection functions

Steve Borho steve at borho.org
Fri Jun 5 20:28:05 CEST 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1433526474 18000
#      Fri Jun 05 12:47:54 2015 -0500
# Node ID dce61553dc96cf16e7d44bd22f279b27065e4b75
# Parent  278269d260a3d62530995d167310eb79bba4009f
multilib: add shim implementations of API introspection functions

These implement the public C APIs which just reflect into the namespaced
API functions. It is hard-coded to expect x265_8bpp and x265_10bpp namespaces.

diff -r 278269d260a3 -r dce61553dc96 source/encoder/api.cpp
--- a/source/encoder/api.cpp	Fri Jun 05 12:37:28 2015 -0500
+++ b/source/encoder/api.cpp	Fri Jun 05 12:47:54 2015 -0500
@@ -413,3 +413,33 @@
 }
 
 } /* end namespace or extern "C" */
+
+
+/* multilib namespace reflectors */
+#if X265_DEPTH == 8 && !EXPORT_C_API
+
+namespace x265_10bpp {
+const x265_api* x265_api_get(int bitDepth);
+const x265_api* x265_api_query(int bitDepth, int apiVersion, int* err);
+}
+
+extern "C"
+const x265_api* x265_api_get(int bitDepth)
+{
+    if (!bitDepth || bitDepth == 8)
+        return x265_8bpp::x265_api_get(0);
+    else if (bitDepth == 10)
+        return x265_10bpp::x265_api_get(0);
+    return NULL;
+}
+
+extern "C"
+const x265_api* x265_api_query(int bitDepth, int apiVersion, int* err)
+{
+    if (!bitDepth || bitDepth == 8)
+        return x265_8bpp::x265_api_query(0, apiVersion, err);
+    else if (bitDepth == 10)
+        return x265_10bpp::x265_api_query(0, apiVersion, err);
+    return NULL;
+}
+#endif


More information about the x265-devel mailing list