diff options
author | John Koleszar <jkoleszar@google.com> | 2010-09-21 10:35:52 -0400 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2010-09-23 14:58:43 -0400 |
commit | fa7a55bb043a6abfc661a8d06a2611b54372fe1c (patch) | |
tree | 98090f133249c74923eed5171ad7d38f13c9294b /vpx/internal/vpx_codec_internal.h | |
parent | 12651b3c2b91697920c73ebb121a44e4dd767d32 (diff) | |
download | libvpx-fa7a55bb043a6abfc661a8d06a2611b54372fe1c.tar libvpx-fa7a55bb043a6abfc661a8d06a2611b54372fe1c.tar.gz libvpx-fa7a55bb043a6abfc661a8d06a2611b54372fe1c.tar.bz2 libvpx-fa7a55bb043a6abfc661a8d06a2611b54372fe1c.zip |
Add getter functions for the interface data symbols
Having these symbols be available as functions rather than data is
occasionally more convenient. Implemented this way rather than a
get-codec-by-id style to avoid creating a link-time dependency
between the encoder and the decoder.
Fixes issue #169
Change-Id: I319f281277033a5e7e3ee3b092b9a87cce2f463d
Diffstat (limited to 'vpx/internal/vpx_codec_internal.h')
-rw-r--r-- | vpx/internal/vpx_codec_internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h index ab4cad10c..dcb451dca 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 |