[x265-commits] [x265] api: add API version to x265_encoder_open to prevent dyna...
Steve Borho
steve at borho.org
Thu Oct 10 07:40:47 CEST 2013
details: http://hg.videolan.org/x265/rev/52284d8d4dc1
branches:
changeset: 4342:52284d8d4dc1
user: Steve Borho <steve at borho.org>
date: Wed Oct 09 23:48:22 2013 -0500
description:
api: add API version to x265_encoder_open to prevent dynamic library link skew
Gratefully borrowed from x264
Subject: [x265] encoder: silence idiotic compiler warning from VC10
details: http://hg.videolan.org/x265/rev/4b84c969a079
branches:
changeset: 4343:4b84c969a079
user: Steve Borho <steve at borho.org>
date: Thu Oct 10 00:40:19 2013 -0500
description:
encoder: silence idiotic compiler warning from VC10
diffstat:
source/encoder/encoder.cpp | 1 +
source/x265.h | 9 +++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diffs (37 lines):
diff -r edcc92f2b2ab -r 4b84c969a079 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp Wed Oct 09 20:14:29 2013 -0500
+++ b/source/encoder/encoder.cpp Thu Oct 10 00:40:19 2013 -0500
@@ -656,6 +656,7 @@ uint64_t Encoder::calculateHashAndPSNR(T
#if defined(_MSC_VER)
#pragma warning(disable: 4800) // forcing int to bool
+#pragma warning(disable: 4127) // conditional expression is constant
#endif
void Encoder::initSPS(TComSPS *sps)
diff -r edcc92f2b2ab -r 4b84c969a079 source/x265.h
--- a/source/x265.h Wed Oct 09 20:14:29 2013 -0500
+++ b/source/x265.h Thu Oct 10 00:40:19 2013 -0500
@@ -30,6 +30,8 @@
extern "C" {
#endif
+#define X265_BUILD 1
+
/* x265_t:
* opaque handler for encoder */
typedef struct x265_t x265_t;
@@ -338,6 +340,13 @@ int x265_param_apply_profile(x265_param_
* for all encoders allocated in the same process. */
extern const int x265_max_bit_depth;
+/* Force a link error in the case of linking against an incompatible API version.
+ * Glue #defines exist to force correct macro expansion; the final output of the macro
+ * is x265_encoder_open_##X264_BUILD (for purposes of dlopen). */
+#define x265_encoder_glue1(x,y) x##y
+#define x265_encoder_glue2(x,y) x265_encoder_glue1(x,y)
+#define x265_encoder_open x265_encoder_glue2(x265_encoder_open_,X265_BUILD)
+
/* x265_encoder_open:
* create a new encoder handler, all parameters from x265_param_t are copied */
x265_t* x265_encoder_open(x265_param_t *);
More information about the x265-commits
mailing list