[x264-devel] commit: Force a link error in case of incompatible API ( Jason Garrett-Glaser )

git version control git at videolan.org
Wed Sep 2 06:16:39 CEST 2009


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Tue Sep  1 11:36:54 2009 -0700| [326113b4f57de6c5a2599c047ab5c7762b1a4b13] | committer: Jason Garrett-Glaser 

Force a link error in case of incompatible API
This is because the number of bug reports due to miscompiled ffmpeg builds is reaching critical mass.
The name of x264_encoder_open is now #defined based on the current X264_BUILD.
Note that this changes the calling convention required for dlopen, but not for ordinary calls to x264_encoder_open.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=326113b4f57de6c5a2599c047ab5c7762b1a4b13
---

 encoder/encoder.c |    2 +-
 x264.h            |   12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/encoder/encoder.c b/encoder/encoder.c
index af62765..a27b724 100644
--- a/encoder/encoder.c
+++ b/encoder/encoder.c
@@ -736,7 +736,7 @@ static void x264_set_aspect_ratio( x264_t *h, x264_param_t *param, int initial )
 /****************************************************************************
  * x264_encoder_open:
  ****************************************************************************/
-x264_t *x264_encoder_open   ( x264_param_t *param )
+x264_t *x264_encoder_open( x264_param_t *param )
 {
     x264_t *h;
     char buf[1000], *p;
diff --git a/x264.h b/x264.h
index 6609a32..5e6d411 100644
--- a/x264.h
+++ b/x264.h
@@ -35,7 +35,7 @@
 
 #include <stdarg.h>
 
-#define X264_BUILD 73
+#define X264_BUILD 74
 
 /* x264_t:
  *      opaque handler for encoder */
@@ -436,9 +436,17 @@ int x264_nal_encode( void *, int *, int b_annexeb, x264_nal_t *nal );
  * Encoder functions:
  ****************************************************************************/
 
+/* 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 x264_encoder_open_##X264_BUILD (for purposes of dlopen). */
+#define x264_encoder_glue1(x,y) x##y
+#define x264_encoder_glue2(x,y) x264_encoder_glue1(x,y)
+#define x264_encoder_open x264_encoder_glue2(x264_encoder_open_,X264_BUILD)
+
 /* x264_encoder_open:
  *      create a new encoder handler, all parameters from x264_param_t are copied */
-x264_t *x264_encoder_open   ( x264_param_t * );
+x264_t *x264_encoder_open( x264_param_t * );
+
 /* x264_encoder_reconfig:
  *      analysis-related parameters from x264_param_t are copied.
  *      this takes effect immediately, on whichever frame is encoded next;



More information about the x264-devel mailing list