00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00038 #ifndef VPX_VPX_CODEC_H_
00039 #define VPX_VPX_CODEC_H_
00040
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044
00045 #include "./vpx_integer.h"
00046 #include "./vpx_image.h"
00047
00049 #ifndef DEPRECATED
00050 #if defined(__GNUC__) && __GNUC__
00051 #define DEPRECATED __attribute__((deprecated))
00052 #elif defined(_MSC_VER)
00053 #define DEPRECATED
00054 #else
00055 #define DEPRECATED
00056 #endif
00057 #endif
00058
00059 #ifndef DECLSPEC_DEPRECATED
00060 #if defined(__GNUC__) && __GNUC__
00061 #define DECLSPEC_DEPRECATED
00062 #elif defined(_MSC_VER)
00063
00064 #define DECLSPEC_DEPRECATED __declspec(deprecated)
00065 #else
00066 #define DECLSPEC_DEPRECATED
00067 #endif
00068 #endif
00069
00071 #ifdef UNUSED
00072 #elif defined(__GNUC__) || defined(__clang__)
00073 #define UNUSED __attribute__((unused))
00074 #else
00075 #define UNUSED
00076 #endif
00077
00086 #define VPX_CODEC_ABI_VERSION (3 + VPX_IMAGE_ABI_VERSION)
00089 typedef enum {
00090
00091 VPX_CODEC_OK,
00092
00094 VPX_CODEC_ERROR,
00095
00097 VPX_CODEC_MEM_ERROR,
00098
00100 VPX_CODEC_ABI_MISMATCH,
00101
00103 VPX_CODEC_INCAPABLE,
00104
00110 VPX_CODEC_UNSUP_BITSTREAM,
00111
00119 VPX_CODEC_UNSUP_FEATURE,
00120
00129 VPX_CODEC_CORRUPT_FRAME,
00130
00134 VPX_CODEC_INVALID_PARAM,
00135
00139 VPX_CODEC_LIST_END
00140
00141 } vpx_codec_err_t;
00142
00151 typedef long vpx_codec_caps_t;
00152 #define VPX_CODEC_CAP_DECODER 0x1
00153 #define VPX_CODEC_CAP_ENCODER 0x2
00162 typedef long vpx_codec_flags_t;
00163
00169 typedef const struct vpx_codec_iface vpx_codec_iface_t;
00170
00176 typedef struct vpx_codec_priv vpx_codec_priv_t;
00177
00182 typedef const void *vpx_codec_iter_t;
00183
00192 typedef struct vpx_codec_ctx {
00193 const char *name;
00194 vpx_codec_iface_t *iface;
00195 vpx_codec_err_t err;
00196 const char *err_detail;
00197 vpx_codec_flags_t init_flags;
00198 union {
00200 const struct vpx_codec_dec_cfg *dec;
00202 const struct vpx_codec_enc_cfg *enc;
00203 const void *raw;
00204 } config;
00205 vpx_codec_priv_t *priv;
00206 } vpx_codec_ctx_t;
00207
00212 typedef enum vpx_bit_depth {
00213 VPX_BITS_8 = 8,
00214 VPX_BITS_10 = 10,
00215 VPX_BITS_12 = 12,
00216 } vpx_bit_depth_t;
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00237 int vpx_codec_version(void);
00238 #define VPX_VERSION_MAJOR(v) \
00239 ((v >> 16) & 0xff)
00240 #define VPX_VERSION_MINOR(v) \
00241 ((v >> 8) & 0xff)
00242 #define VPX_VERSION_PATCH(v) \
00243 ((v >> 0) & 0xff)
00246 #define vpx_codec_version_major() ((vpx_codec_version() >> 16) & 0xff)
00247
00249 #define vpx_codec_version_minor() ((vpx_codec_version() >> 8) & 0xff)
00250
00252 #define vpx_codec_version_patch() ((vpx_codec_version() >> 0) & 0xff)
00253
00263 const char *vpx_codec_version_str(void);
00264
00272 const char *vpx_codec_version_extra_str(void);
00273
00280 const char *vpx_codec_build_config(void);
00281
00289 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
00290
00301 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
00302
00313 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
00314
00325 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
00326
00327
00328
00329
00330
00331
00332
00344 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
00345
00353 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
00354
00379 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id, ...);
00380 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
00381 #define vpx_codec_control(ctx, id, data) vpx_codec_control_(ctx, id, data)
00382 #define VPX_CTRL_USE_TYPE(id, typ)
00383 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
00384 #define VPX_CTRL_VOID(id, typ)
00385
00386 #else
00387
00396 #define vpx_codec_control(ctx, id, data) \
00397 vpx_codec_control_##id(ctx, id, data)
00410 #define VPX_CTRL_USE_TYPE(id, typ) \
00411 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int, typ) \
00412 UNUSED; \
00413 \
00414 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
00415 int ctrl_id, typ data) { \
00416 return vpx_codec_control_(ctx, ctrl_id, data); \
00417 }
00429 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
00430 DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
00431 vpx_codec_ctx_t *, int, typ) DEPRECATED UNUSED; \
00432 \
00433 DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
00434 vpx_codec_ctx_t *ctx, int ctrl_id, typ data) { \
00435 return vpx_codec_control_(ctx, ctrl_id, data); \
00436 }
00448 #define VPX_CTRL_VOID(id) \
00449 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int) \
00450 UNUSED; \
00451 \
00452 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
00453 int ctrl_id) { \
00454 return vpx_codec_control_(ctx, ctrl_id); \
00455 }
00457 #endif
00458
00460 #ifdef __cplusplus
00461 }
00462 #endif
00463 #endif // VPX_VPX_CODEC_H_