vpx_codec.h
Go to the documentation of this file.
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPX_VPX_VPX_CODEC_H_
#define VPX_VPX_VPX_CODEC_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "./vpx_image.h"
#include "./vpx_integer.h"
#ifndef VPX_DEPRECATED
#if defined(__GNUC__)
#define VPX_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
#define VPX_DEPRECATED
#else
#define VPX_DEPRECATED
#endif
#endif /* VPX_DEPRECATED */
#ifndef VPX_DECLSPEC_DEPRECATED
#if defined(__GNUC__)
#define VPX_DECLSPEC_DEPRECATED
#elif defined(_MSC_VER)
#define VPX_DECLSPEC_DEPRECATED __declspec(deprecated)
#else
#define VPX_DECLSPEC_DEPRECATED
#endif
#endif /* VPX_DECLSPEC_DEPRECATED */
#ifndef VPX_UNUSED
#if defined(__GNUC__) || defined(__clang__)
#define VPX_UNUSED __attribute__((unused))
#else
#define VPX_UNUSED
#endif
#endif /* VPX_UNUSED */
#define VPX_CODEC_ABI_VERSION (4 + VPX_IMAGE_ABI_VERSION)
typedef enum {
VPX_CODEC_OK,
VPX_CODEC_ERROR,
VPX_CODEC_MEM_ERROR,
VPX_CODEC_ABI_MISMATCH,
VPX_CODEC_INCAPABLE,
VPX_CODEC_UNSUP_BITSTREAM,
VPX_CODEC_UNSUP_FEATURE,
VPX_CODEC_CORRUPT_FRAME,
VPX_CODEC_INVALID_PARAM,
VPX_CODEC_LIST_END
} vpx_codec_err_t;
typedef long vpx_codec_caps_t;
#define VPX_CODEC_CAP_DECODER 0x1
#define VPX_CODEC_CAP_ENCODER 0x2
#define VPX_CODEC_CAP_HIGHBITDEPTH 0x4
typedef long vpx_codec_flags_t;
typedef const struct vpx_codec_iface vpx_codec_iface_t;
typedef struct vpx_codec_priv vpx_codec_priv_t;
typedef const void *vpx_codec_iter_t;
typedef struct vpx_codec_ctx {
const char *name;
vpx_codec_iface_t *iface;
vpx_codec_err_t err;
const char *err_detail;
vpx_codec_flags_t init_flags;
union {
const struct vpx_codec_dec_cfg *dec;
const struct vpx_codec_enc_cfg *enc;
const void *raw;
} config;
vpx_codec_priv_t *priv;
} vpx_codec_ctx_t;
typedef enum vpx_bit_depth {
VPX_BITS_8 = 8,
VPX_BITS_10 = 10,
VPX_BITS_12 = 12,
} vpx_bit_depth_t;
/*
* Library Version Number Interface
*
* For example, see the following sample return values:
* vpx_codec_version() (1<<16 | 2<<8 | 3)
* vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
* vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
*/
int vpx_codec_version(void);
#define VPX_VERSION_MAJOR(v) \
(((v) >> 16) & 0xff)
#define VPX_VERSION_MINOR(v) \
(((v) >> 8) & 0xff)
#define VPX_VERSION_PATCH(v) \
(((v) >> 0) & 0xff)
#define vpx_codec_version_major() ((vpx_codec_version() >> 16) & 0xff)
#define vpx_codec_version_minor() ((vpx_codec_version() >> 8) & 0xff)
#define vpx_codec_version_patch() ((vpx_codec_version() >> 0) & 0xff)
const char *vpx_codec_version_str(void);
const char *vpx_codec_version_extra_str(void);
const char *vpx_codec_build_config(void);
const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
const char *vpx_codec_err_to_string(vpx_codec_err_t err);
const char *vpx_codec_error(const vpx_codec_ctx_t *ctx);
const char *vpx_codec_error_detail(const vpx_codec_ctx_t *ctx);
/* REQUIRED FUNCTIONS
*
* The following functions are required to be implemented for all codecs.
* They represent the base case functionality expected of all codecs.
*/
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id, ...);
#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
#define vpx_codec_control(ctx, id, data) vpx_codec_control_(ctx, id, data)
#define VPX_CTRL_USE_TYPE(id, typ)
#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
#define VPX_CTRL_VOID(id, typ)
#else
#define vpx_codec_control(ctx, id, data) \
vpx_codec_control_##id(ctx, id, data)
#define VPX_CTRL_USE_TYPE(id, typ) \
static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int, typ) \
VPX_UNUSED; \
\
static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
int ctrl_id, typ data) { \
return vpx_codec_control_(ctx, ctrl_id, data); \
}
#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
vpx_codec_ctx_t *, int, typ) VPX_DEPRECATED VPX_UNUSED; \
\
VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
vpx_codec_ctx_t *ctx, int ctrl_id, typ data) { \
return vpx_codec_control_(ctx, ctrl_id, data); \
}
#define VPX_CTRL_VOID(id) \
static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int) \
VPX_UNUSED; \
\
static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
int ctrl_id) { \
return vpx_codec_control_(ctx, ctrl_id); \
}
#endif
#ifdef __cplusplus
}
#endif
#endif // VPX_VPX_VPX_CODEC_H_
vpx_codec_version
int vpx_codec_version(void)
Return the version information (as an integer).
vpx_codec_priv_t
struct vpx_codec_priv vpx_codec_priv_t
Codec private data structure.
Definition vpx_codec.h:184
vpx_codec_error_detail
const char * vpx_codec_error_detail(const vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
vpx_codec_flags_t
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition vpx_codec.h:170
vpx_codec_get_caps
vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
Get the capabilities of an algorithm.
vpx_codec_err_to_string
const char * vpx_codec_err_to_string(vpx_codec_err_t err)
Convert error number to printable string.
vpx_codec_ctx_t
struct vpx_codec_ctx vpx_codec_ctx_t
Codec context structure.
vpx_codec_version_str
const char * vpx_codec_version_str(void)
Return the version information (as a string).
vpx_codec_destroy
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
vpx_codec_iter_t
const void * vpx_codec_iter_t
Iterator.
Definition vpx_codec.h:190
vpx_codec_iface_name
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
vpx_codec_build_config
const char * vpx_codec_build_config(void)
Return the build configuration.
vpx_bit_depth_t
enum vpx_bit_depth vpx_bit_depth_t
Bit depth for codecThis enumeration determines the bit depth of the codec.
vpx_codec_error
const char * vpx_codec_error(const vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
vpx_codec_caps_t
long vpx_codec_caps_t
Codec capabilities bitfield.
Definition vpx_codec.h:155
vpx_codec_err_t
vpx_codec_err_t
Algorithm return codes.
Definition vpx_codec.h:93
vpx_codec_version_extra_str
const char * vpx_codec_version_extra_str(void)
Return the version information (as a string).
vpx_codec_iface_t
const struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition vpx_codec.h:177
vpx_bit_depth
vpx_bit_depth
Bit depth for codecThis enumeration determines the bit depth of the codec.
Definition vpx_codec.h:220
vpx_codec_control_
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
VPX_CODEC_CORRUPT_FRAME
@ VPX_CODEC_CORRUPT_FRAME
The coded data for this stream is corrupt or incomplete.
Definition vpx_codec.h:133
VPX_CODEC_INCAPABLE
@ VPX_CODEC_INCAPABLE
Algorithm does not have required capability.
Definition vpx_codec.h:107
VPX_CODEC_LIST_END
@ VPX_CODEC_LIST_END
An iterator reached the end of list.
Definition vpx_codec.h:143
VPX_CODEC_UNSUP_FEATURE
@ VPX_CODEC_UNSUP_FEATURE
Encoded bitstream uses an unsupported feature.
Definition vpx_codec.h:123
VPX_CODEC_MEM_ERROR
@ VPX_CODEC_MEM_ERROR
Memory operation failed.
Definition vpx_codec.h:101
VPX_CODEC_INVALID_PARAM
@ VPX_CODEC_INVALID_PARAM
An application-supplied parameter is not valid.
Definition vpx_codec.h:138
VPX_CODEC_ERROR
@ VPX_CODEC_ERROR
Unspecified error.
Definition vpx_codec.h:98
VPX_CODEC_OK
@ VPX_CODEC_OK
Operation completed without error.
Definition vpx_codec.h:95
VPX_CODEC_ABI_MISMATCH
@ VPX_CODEC_ABI_MISMATCH
ABI version mismatch.
Definition vpx_codec.h:104
VPX_CODEC_UNSUP_BITSTREAM
@ VPX_CODEC_UNSUP_BITSTREAM
The given bitstream is not supported.
Definition vpx_codec.h:114
VPX_BITS_8
@ VPX_BITS_8
Definition vpx_codec.h:221
VPX_BITS_12
@ VPX_BITS_12
Definition vpx_codec.h:223
VPX_BITS_10
@ VPX_BITS_10
Definition vpx_codec.h:222
vpx_codec_ctx
Codec context structure.
Definition vpx_codec.h:200
vpx_codec_ctx::dec
const struct vpx_codec_dec_cfg * dec
Definition vpx_codec.h:208
vpx_codec_ctx::config
union vpx_codec_ctx::@052112313031111117223354304243016072104200351315 config
vpx_codec_ctx::err
vpx_codec_err_t err
Definition vpx_codec.h:203
vpx_codec_ctx::init_flags
vpx_codec_flags_t init_flags
Definition vpx_codec.h:205
vpx_codec_ctx::name
const char * name
Definition vpx_codec.h:201
vpx_codec_ctx::priv
vpx_codec_priv_t * priv
Definition vpx_codec.h:213
vpx_codec_ctx::err_detail
const char * err_detail
Definition vpx_codec.h:204
vpx_codec_ctx::iface
vpx_codec_iface_t * iface
Definition vpx_codec.h:202
vpx_codec_dec_cfg
Initialization Configurations.
Definition vpx_decoder.h:106
vpx_codec_enc_cfg
Encoder configuration structure.
Definition vpx_encoder.h:279
vpx_image.h
Describes the vpx image descriptor and associated operations.