Go to the documentation of this file.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 #define DECLSPEC_DEPRECATED
00053 #elif defined(_MSC_VER)
00054 #define DEPRECATED
00055 #define DECLSPEC_DEPRECATED __declspec(deprecated)
00056 #else
00057 #define DEPRECATED
00058 #define DECLSPEC_DEPRECATED
00059 #endif
00060 #endif
00061
00063 #ifdef UNUSED
00064 #elif __GNUC__
00065 #define UNUSED __attribute__ ((unused));
00066 #else
00067 #define UNUSED
00068 #endif
00069
00078 #define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION)
00081 typedef enum {
00082
00083 VPX_CODEC_OK,
00084
00086 VPX_CODEC_ERROR,
00087
00089 VPX_CODEC_MEM_ERROR,
00090
00092 VPX_CODEC_ABI_MISMATCH,
00093
00095 VPX_CODEC_INCAPABLE,
00096
00102 VPX_CODEC_UNSUP_BITSTREAM,
00103
00111 VPX_CODEC_UNSUP_FEATURE,
00112
00121 VPX_CODEC_CORRUPT_FRAME,
00122
00126 VPX_CODEC_INVALID_PARAM,
00127
00131 VPX_CODEC_LIST_END,
00132
00133 }
00134 vpx_codec_err_t;
00135
00136
00145 typedef long vpx_codec_caps_t;
00146 #define VPX_CODEC_CAP_DECODER 0x1
00147 #define VPX_CODEC_CAP_ENCODER 0x2
00148 #define VPX_CODEC_CAP_XMA 0x4
00158 typedef long vpx_codec_flags_t;
00159 #define VPX_CODEC_USE_XMA 0x00000001
00167 typedef const struct vpx_codec_iface vpx_codec_iface_t;
00168
00169
00175 typedef struct vpx_codec_priv vpx_codec_priv_t;
00176
00177
00182 typedef const void *vpx_codec_iter_t;
00183
00184
00193 typedef struct vpx_codec_ctx
00194 {
00195 const char *name;
00196 vpx_codec_iface_t *iface;
00197 vpx_codec_err_t err;
00198 const char *err_detail;
00199 vpx_codec_flags_t init_flags;
00200 union
00201 {
00202 struct vpx_codec_dec_cfg *dec;
00203 struct vpx_codec_enc_cfg *enc;
00204 void *raw;
00205 } config;
00206 vpx_codec_priv_t *priv;
00207 } vpx_codec_ctx_t;
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00227 int vpx_codec_version(void);
00228 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
00229 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
00230 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
00233 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
00234
00236 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
00237
00239 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
00240
00241
00249 const char *vpx_codec_version_str(void);
00250
00251
00258 const char *vpx_codec_version_extra_str(void);
00259
00260
00267 const char *vpx_codec_build_config(void);
00268
00269
00277 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
00278
00279
00290 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
00291
00292
00303 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
00304
00305
00316 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
00317
00318
00319
00320
00321
00322
00323
00324
00336 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
00337
00338
00346 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
00347
00348
00373 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
00374 int ctrl_id,
00375 ...);
00376 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
00377 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
00378 # define VPX_CTRL_USE_TYPE(id, typ)
00379 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
00380 # define VPX_CTRL_VOID(id, typ)
00381
00382 #else
00383
00392 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
00393
00407 # define VPX_CTRL_USE_TYPE(id, typ) \
00408 static vpx_codec_err_t \
00409 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
00410 \
00411 static vpx_codec_err_t \
00412 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00413 return vpx_codec_control_(ctx, ctrl_id, data);\
00414 }
00427 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
00428 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00429 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
00430 \
00431 DECLSPEC_DEPRECATED static vpx_codec_err_t \
00432 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
00433 return vpx_codec_control_(ctx, ctrl_id, data);\
00434 }
00447 # define VPX_CTRL_VOID(id) \
00448 static vpx_codec_err_t \
00449 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
00450 \
00451 static vpx_codec_err_t \
00452 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
00453 return vpx_codec_control_(ctx, ctrl_id);\
00454 }
00457 #endif
00458
00459
00476 typedef struct vpx_codec_mmap
00477 {
00478
00479
00480
00481 unsigned int id;
00482 unsigned long sz;
00483 unsigned int align;
00484 unsigned int flags;
00485 #define VPX_CODEC_MEM_ZERO 0x1
00486 #define VPX_CODEC_MEM_WRONLY 0x2
00487 #define VPX_CODEC_MEM_FAST 0x4
00489
00490 void *base;
00491 void (*dtor)(struct vpx_codec_mmap *map);
00492 void *priv;
00493 } vpx_codec_mmap_t;
00517 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
00518 vpx_codec_mmap_t *mmap,
00519 vpx_codec_iter_t *iter);
00520
00521
00543 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
00544 vpx_codec_mmap_t *mmaps,
00545 unsigned int num_maps);
00546
00551 #endif
00552 #ifdef __cplusplus
00553 }
00554 #endif