diff --git a/vp8/exports_dec b/vp8/exports_dec index f9b985c8646f89d27668a0b28a9f8b2a304a8f3e..100ac5c27dcd537cff77b51d00c96c29e32ad6b6 100644 --- a/vp8/exports_dec +++ b/vp8/exports_dec @@ -1 +1,2 @@ data vpx_codec_vp8_dx_algo +text vpx_codec_vp8_dx diff --git a/vp8/exports_enc b/vp8/exports_enc index 99670111338c16a9231eecc9f62ef415f7f568c2..29ff35ef7bd5ddac5301d8e110d3513c235bd8e6 100644 --- a/vp8/exports_enc +++ b/vp8/exports_enc @@ -1 +1,2 @@ data vpx_codec_vp8_cx_algo +text vpx_codec_vp8_cx diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index e3f99c08dd8879de2221eb9581d4906236c07f90..f8a4de85be01781db00bc929631fcc92543b3a8d 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -1079,7 +1079,7 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = #ifndef VERSION_STRING #define VERSION_STRING #endif -vpx_codec_iface_t vpx_codec_vp8_cx_algo = +CODEC_INTERFACE(vpx_codec_vp8_cx) = { "WebM Project VP8 Encoder" VERSION_STRING, VPX_CODEC_INTERNAL_ABI_VERSION, diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index e7e535638819c837ea9d6b997ef8b9e51f1e012d..f19cb9a30d68c9a24bacdc994a9d0da879ac0714 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -653,7 +653,7 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] = #ifndef VERSION_STRING #define VERSION_STRING #endif -vpx_codec_iface_t vpx_codec_vp8_dx_algo = +CODEC_INTERFACE(vpx_codec_vp8_dx) = { "WebM Project VP8 Decoder" VERSION_STRING, VPX_CODEC_INTERNAL_ABI_VERSION, diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h index ab4cad10c7294fae6b4d7adbc24cabbb796edf0a..dcb451dca17fe055031b5ddfff620c70743f3263 100644 --- a/vpx/internal/vpx_codec_internal.h +++ b/vpx/internal/vpx_codec_internal.h @@ -389,6 +389,20 @@ struct vpx_codec_priv #define RECAST(id, x) id##__convert(x) +/* CODEC_INTERFACE convenience macro + * + * By convention, each codec interface is a struct with extern linkage, where + * the symbol is suffixed with _algo. A getter function is also defined to + * return a pointer to the struct, since in some cases it's easier to work + * with text symbols than data symbols (see issue #169). This function has + * the same name as the struct, less the _algo suffix. The CODEC_INTERFACE + * macro is provided to define this getter function automatically. + */ +#define CODEC_INTERFACE(id)\ +vpx_codec_iface_t* id(void) { return &id##_algo; }\ +vpx_codec_iface_t id##_algo + + /* Internal Utility Functions * * The following functions are indended to be used inside algorithms as diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h index e1c82114428c4d7985c0c7e8dfda8150b7daa423..efd79459aeb152fc32d04ce77af5951c094e0ee5 100644 --- a/vpx/vp8cx.h +++ b/vpx/vp8cx.h @@ -29,7 +29,8 @@ * This interface provides the capability to encode raw VP8 streams, as would * be found in AVI files. */ -extern vpx_codec_iface_t vpx_codec_vp8_cx_algo; +extern vpx_codec_iface_t vpx_codec_vp8_cx_algo; +extern vpx_codec_iface_t* vpx_codec_vp8_cx(void); /* diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h index 4cad838ffbe71534f1968abb2ebb4728524aa789..fccd407f33d54bca8faaf2e99a8a36679a631015 100644 --- a/vpx/vp8dx.h +++ b/vpx/vp8dx.h @@ -29,7 +29,8 @@ * This interface provides the capability to decode raw VP8 streams, as would * be found in AVI files and other non-Flash uses. */ -extern vpx_codec_iface_t vpx_codec_vp8_dx_algo; +extern vpx_codec_iface_t vpx_codec_vp8_dx_algo; +extern vpx_codec_iface_t* vpx_codec_vp8_dx(void); /* Include controls common to both the encoder and decoder */ #include "vp8.h"