00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00038 #ifdef __cplusplus
00039 extern "C" {
00040 #endif
00041
00042 #ifndef VPX_CODEC_H
00043 #define VPX_CODEC_H
00044 #ifdef HAVE_CONFIG_H
00045 # include "vpx_config.h"
00046 #endif
00047 #if defined(HAVE_VPX_PORTS) && HAVE_VPX_PORTS
00048 # include "vpx_ports/vpx_integer.h"
00049 #else
00050 # include "vpx_integer.h"
00051 #endif
00052 #include "vpx_image.h"
00053
00055 #ifndef DEPRECATED
00056 #if defined(__GNUC__) && __GNUC__
00057 #define DEPRECATED __attribute__ ((deprecated))
00058 #define DECLSPEC_DEPRECATED
00059 #elif defined(_MSC_VER)
00060 #define DEPRECATED
00061 #define DECLSPEC_DEPRECATED __declspec(deprecated)
00062 #else
00063 #define DEPRECATED
00064 #define DECLSPEC_DEPRECATED
00065 #endif
00066 #endif
00067
00069 #ifdef UNUSED
00070 #elif __GNUC__
00071 #define UNUSED __attribute__ ((unused));
00072 #else
00073 #define UNUSED
00074 #endif
00075
00084 #define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION)
00087 typedef enum {
00088
00089 VPX_CODEC_OK,
00090
00092 VPX_CODEC_ERROR,
00093
00095 VPX_CODEC_MEM_ERROR,
00096
00098 VPX_CODEC_ABI_MISMATCH,
00099
00101 VPX_CODEC_INCAPABLE,
00102
00108 VPX_CODEC_UNSUP_BITSTREAM,
00109
00117 VPX_CODEC_UNSUP_FEATURE,
00118
00127 VPX_CODEC_CORRUPT_FRAME,
00128
00132 VPX_CODEC_INVALID_PARAM,
00133
00137 VPX_CODEC_LIST_END,
00138
00139 }
00140 vpx_codec_err_t;
00141
00142
00151 typedef long vpx_codec_caps_t;
00152 #define VPX_CODEC_CAP_DECODER 0x1
00153 #define VPX_CODEC_CAP_ENCODER 0x2
00154 #define VPX_CODEC_CAP_XMA 0x4
00164 typedef long vpx_codec_flags_t;
00165 #define VPX_CODEC_USE_XMA 0x00000001
00173 typedef const struct vpx_codec_iface vpx_codec_iface_t;
00174
00175
00181 typedef struct vpx_codec_priv vpx_codec_priv_t;
00182
00183
00188 typedef const void *vpx_codec_iter_t;
00189
00190
00199 typedef struct
00200 {
00201 const char *name;
00202 vpx_codec_iface_t *iface;
00203 vpx_codec_err_t err;
00204 const char *err_detail;
00205 vpx_codec_flags_t init_flags;
00206 union
00207 {
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
00487 unsigned int id;
00488 unsigned long sz;
00489 unsigned int align;
00490 unsigned int flags;
00491 #define VPX_CODEC_MEM_ZERO 0x1
00492 #define VPX_CODEC_MEM_WRONLY 0x2
00493 #define VPX_CODEC_MEM_FAST 0x4
00495
00496 void *base;
00497 void (*dtor)(struct vpx_codec_mmap *map);
00498 void *priv;
00499 } vpx_codec_mmap_t;
00523 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
00524 vpx_codec_mmap_t *mmap,
00525 vpx_codec_iter_t *iter);
00526
00527
00549 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
00550 vpx_codec_mmap_t *mmaps,
00551 unsigned int num_maps);
00552
00557 #endif
00558 #ifdef __cplusplus
00559 }
00560 #endif