00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00039 #ifndef VPX_CODEC_H
00040 #define VPX_CODEC_H
00041
00042 #ifdef __cplusplus
00043 extern "C" {
00044 #endif
00045
00046 #include "vpx_integer.h"
00047 #include "vpx_image.h"
00048
00050 #ifndef DEPRECATED
00051 #if defined(__GNUC__) && __GNUC__
00052 #define DEPRECATED __attribute__ ((deprecated))
00053 #elif defined(_MSC_VER)
00054 #define DEPRECATED
00055 #else
00056 #define DEPRECATED
00057 #endif
00058 #endif
00059
00060 #ifndef DECLSPEC_DEPRECATED
00061 #if defined(__GNUC__) && __GNUC__
00062 #define DECLSPEC_DEPRECATED
00063 #elif defined(_MSC_VER)
00064 #define DECLSPEC_DEPRECATED __declspec(deprecated)
00065 #else
00066 #define DECLSPEC_DEPRECATED
00067 #endif
00068 #endif
00069
00071 #ifdef UNUSED
00072 #elif __GNUC__
00073 #define UNUSED __attribute__ ((unused))
00074 #else
00075 #define UNUSED
00076 #endif
00077
00086 #define VPX_CODEC_ABI_VERSION (2 + 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 }
00142 vpx_codec_err_t;
00143
00144
00153 typedef long vpx_codec_caps_t;
00154 #define VPX_CODEC_CAP_DECODER 0x1
00155 #define VPX_CODEC_CAP_ENCODER 0x2
00156 #define VPX_CODEC_CAP_XMA 0x4
00166 typedef long vpx_codec_flags_t;
00167 #define VPX_CODEC_USE_XMA 0x00000001
00175 typedef const struct vpx_codec_iface vpx_codec_iface_t;
00176
00177
00183 typedef struct vpx_codec_priv vpx_codec_priv_t;
00184
00185
00190 typedef const void *vpx_codec_iter_t;
00191
00192
00201 typedef struct vpx_codec_ctx {
00202 const char *name;
00203 vpx_codec_iface_t *iface;
00204 vpx_codec_err_t err;
00205 const char *err_detail;
00206 vpx_codec_flags_t init_flags;
00207 union {
00208 struct vpx_codec_dec_cfg *dec;
00209 struct vpx_codec_enc_cfg *enc;
00210 void *raw;
00211 } config;
00212 vpx_codec_priv_t *priv;
00213 } vpx_codec_ctx_t;
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00233 int vpx_codec_version(void);
00234 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
00235 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
00236 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
00239 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
00240
00242 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
00243
00245 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
00246
00247
00255 const char *vpx_codec_version_str(void);
00256
00257
00264 const char *vpx_codec_version_extra_str(void);
00265
00266
00273 const char *vpx_codec_build_config(void);
00274
00275
00283 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
00284
00285
00296 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
00297
00298
00309 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
00310
00311
00322 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
00323
00324
00325
00326
00327
00328
00329
00330
00342 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
00343
00344
00352 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
00353
00354
00379 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
00380 int ctrl_id,
00381 ...);
00382 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
00383 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
00384 # define VPX_CTRL_USE_TYPE(id, typ)
00385 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
00386 # define VPX_CTRL_VOID(id, typ)
00387
00388 #else
00389
00398 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
00399
00413 # define VPX_CTRL_USE_TYPE(id, typ) \
00414 static vpx_codec_err_t \
00415 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
00416 \
00417 static vpx_codec_err_t \
00418 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00419 return vpx_codec_control_(ctx, ctrl_id, data);\
00420 }
00433 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
00434 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00435 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
00436 \
00437 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00438 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00439 return vpx_codec_control_(ctx, ctrl_id, data);\
00440 }
00453 # define VPX_CTRL_VOID(id) \
00454 static vpx_codec_err_t \
00455 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
00456 \
00457 static vpx_codec_err_t \
00458 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
00459 return vpx_codec_control_(ctx, ctrl_id);\
00460 }
00463 #endif
00464
00465
00482 typedef struct vpx_codec_mmap {
00483
00484
00485
00486 unsigned int id;
00487 unsigned long sz;
00488 unsigned int align;
00489 unsigned int flags;
00490 #define VPX_CODEC_MEM_ZERO 0x1
00491 #define VPX_CODEC_MEM_WRONLY 0x2
00492 #define VPX_CODEC_MEM_FAST 0x4
00494
00495 void *base;
00496 void (*dtor)(struct vpx_codec_mmap *map);
00497 void *priv;
00498 } vpx_codec_mmap_t;
00522 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
00523 vpx_codec_mmap_t *mmap,
00524 vpx_codec_iter_t *iter);
00525
00526
00548 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
00549 vpx_codec_mmap_t *mmaps,
00550 unsigned int num_maps);
00551
00554 #ifdef __cplusplus
00555 }
00556 #endif
00557 #endif
00558