data vpx_codec_vp8_dx_algo
+text vpx_codec_vp8_dx
data vpx_codec_vp8_cx_algo
+text vpx_codec_vp8_cx
#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,
#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,
#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
* 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);
/*
* 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"