00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00043 #ifndef VPX_CODEC_H
00044 #define VPX_CODEC_H
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 #define DECLSPEC_DEPRECATED __declspec(deprecated)
00064 #else
00065 #define DECLSPEC_DEPRECATED
00066 #endif
00067 #endif
00068
00070 #ifdef UNUSED
00071 #elif __GNUC__
00072 #define UNUSED __attribute__ ((unused))
00073 #else
00074 #define UNUSED
00075 #endif
00076
00085 #define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION)
00088 typedef enum {
00089
00090 VPX_CODEC_OK,
00091
00093 VPX_CODEC_ERROR,
00094
00096 VPX_CODEC_MEM_ERROR,
00097
00099 VPX_CODEC_ABI_MISMATCH,
00100
00102 VPX_CODEC_INCAPABLE,
00103
00109 VPX_CODEC_UNSUP_BITSTREAM,
00110
00118 VPX_CODEC_UNSUP_FEATURE,
00119
00128 VPX_CODEC_CORRUPT_FRAME,
00129
00133 VPX_CODEC_INVALID_PARAM,
00134
00138 VPX_CODEC_LIST_END
00139
00140 }
00141 vpx_codec_err_t;
00142
00143
00152 typedef long vpx_codec_caps_t;
00153 #define VPX_CODEC_CAP_DECODER 0x1
00154 #define VPX_CODEC_CAP_ENCODER 0x2
00155 #define VPX_CODEC_CAP_XMA 0x4
00165 typedef long vpx_codec_flags_t;
00166 #define VPX_CODEC_USE_XMA 0x00000001
00174 typedef const struct vpx_codec_iface vpx_codec_iface_t;
00175
00176
00182 typedef struct vpx_codec_priv vpx_codec_priv_t;
00183
00184
00189 typedef const void *vpx_codec_iter_t;
00190
00191
00200 typedef struct vpx_codec_ctx
00201 {
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 {
00209 struct vpx_codec_dec_cfg *dec;
00210 struct vpx_codec_enc_cfg *enc;
00211 void *raw;
00212 } config;
00213 vpx_codec_priv_t *priv;
00214 } vpx_codec_ctx_t;
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00234 int vpx_codec_version(void);
00235 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
00236 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
00237 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
00240 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
00241
00243 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
00244
00246 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
00247
00248
00256 const char *vpx_codec_version_str(void);
00257
00258
00265 const char *vpx_codec_version_extra_str(void);
00266
00267
00274 const char *vpx_codec_build_config(void);
00275
00276
00284 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
00285
00286
00297 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
00298
00299
00310 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
00311
00312
00323 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
00324
00325
00326
00327
00328
00329
00330
00331
00343 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
00344
00345
00353 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
00354
00355
00380 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
00381 int ctrl_id,
00382 ...);
00383 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
00384 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
00385 # define VPX_CTRL_USE_TYPE(id, typ)
00386 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
00387 # define VPX_CTRL_VOID(id, typ)
00388
00389 #else
00390
00399 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
00400
00414 # define VPX_CTRL_USE_TYPE(id, typ) \
00415 static vpx_codec_err_t \
00416 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
00417 \
00418 static vpx_codec_err_t \
00419 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00420 return vpx_codec_control_(ctx, ctrl_id, data);\
00421 }
00434 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
00435 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00436 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
00437 \
00438 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00439 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00440 return vpx_codec_control_(ctx, ctrl_id, data);\
00441 }
00454 # define VPX_CTRL_VOID(id) \
00455 static vpx_codec_err_t \
00456 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
00457 \
00458 static vpx_codec_err_t \
00459 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
00460 return vpx_codec_control_(ctx, ctrl_id);\
00461 }
00464 #endif
00465
00466
00483 typedef struct vpx_codec_mmap
00484 {
00485
00486
00487
00488 unsigned int id;
00489 unsigned long sz;
00490 unsigned int align;
00491 unsigned int flags;
00492 #define VPX_CODEC_MEM_ZERO 0x1
00493 #define VPX_CODEC_MEM_WRONLY 0x2
00494 #define VPX_CODEC_MEM_FAST 0x4
00496
00497 void *base;
00498 void (*dtor)(struct vpx_codec_mmap *map);
00499 void *priv;
00500 } vpx_codec_mmap_t;
00524 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
00525 vpx_codec_mmap_t *mmap,
00526 vpx_codec_iter_t *iter);
00527
00528
00550 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
00551 vpx_codec_mmap_t *mmaps,
00552 unsigned int num_maps);
00553
00558 #endif
00559 #ifdef __cplusplus
00560 }
00561 #endif