WebM Codec SDK
vpx_codec.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
41#ifndef VPX_VPX_VPX_CODEC_H_
42#define VPX_VPX_VPX_CODEC_H_
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#include "./vpx_image.h"
49#include "./vpx_integer.h"
50
52#ifndef VPX_DEPRECATED
53#if defined(__GNUC__) && __GNUC__
54#define VPX_DEPRECATED __attribute__((deprecated))
55#elif defined(_MSC_VER)
56#define VPX_DEPRECATED
57#else
58#define VPX_DEPRECATED
59#endif
60#endif /* VPX_DEPRECATED */
61
62#ifndef VPX_DECLSPEC_DEPRECATED
63#if defined(__GNUC__) && __GNUC__
64#define VPX_DECLSPEC_DEPRECATED
65#elif defined(_MSC_VER)
67#define VPX_DECLSPEC_DEPRECATED __declspec(deprecated)
68#else
69#define VPX_DECLSPEC_DEPRECATED
70#endif
71#endif /* VPX_DECLSPEC_DEPRECATED */
72
74#ifndef VPX_UNUSED
75#if defined(__GNUC__) || defined(__clang__)
76#define VPX_UNUSED __attribute__((unused))
77#else
78#define VPX_UNUSED
79#endif
80#endif /* VPX_UNUSED */
81
90#define VPX_CODEC_ABI_VERSION (4 + VPX_IMAGE_ABI_VERSION)
93typedef enum {
96
99
102
105
108
115
124
134
139
144
146
155typedef long vpx_codec_caps_t;
156#define VPX_CODEC_CAP_DECODER 0x1
157#define VPX_CODEC_CAP_ENCODER 0x2
161#define VPX_CODEC_CAP_HIGHBITDEPTH 0x4
162
170typedef long vpx_codec_flags_t;
171
177typedef const struct vpx_codec_iface vpx_codec_iface_t;
178
184typedef struct vpx_codec_priv vpx_codec_priv_t;
185
190typedef const void *vpx_codec_iter_t;
191
200typedef struct vpx_codec_ctx {
201 const char *name;
204 const char *err_detail;
206 union {
208 const struct vpx_codec_dec_cfg *dec;
210 const struct vpx_codec_enc_cfg *enc;
211 const void *raw;
215
220typedef enum vpx_bit_depth {
225
226/*
227 * Library Version Number Interface
228 *
229 * For example, see the following sample return values:
230 * vpx_codec_version() (1<<16 | 2<<8 | 3)
231 * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
232 * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
233 */
234
246#define VPX_VERSION_MAJOR(v) \
247 (((v) >> 16) & 0xff)
248#define VPX_VERSION_MINOR(v) \
249 (((v) >> 8) & 0xff)
250#define VPX_VERSION_PATCH(v) \
251 (((v) >> 0) & 0xff)
254#define vpx_codec_version_major() ((vpx_codec_version() >> 16) & 0xff)
255
257#define vpx_codec_version_minor() ((vpx_codec_version() >> 8) & 0xff)
258
260#define vpx_codec_version_patch() ((vpx_codec_version() >> 0) & 0xff)
261
271const char *vpx_codec_version_str(void);
272
280const char *vpx_codec_version_extra_str(void);
281
288const char *vpx_codec_build_config(void);
289
297const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
298
310
321const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
322
334
335/* REQUIRED FUNCTIONS
337 * The following functions are required to be implemented for all codecs.
338 * They represent the base case functionality expected of all codecs.
339 */
340
353
362
388#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
389#define vpx_codec_control(ctx, id, data) vpx_codec_control_(ctx, id, data)
390#define VPX_CTRL_USE_TYPE(id, typ)
391#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
392#define VPX_CTRL_VOID(id, typ)
393
394#else
404#define vpx_codec_control(ctx, id, data) \
405 vpx_codec_control_##id(ctx, id, data)
418#define VPX_CTRL_USE_TYPE(id, typ) \
419 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int, typ) \
420 VPX_UNUSED; \
421 \
422 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
423 int ctrl_id, typ data) { \
424 return vpx_codec_control_(ctx, ctrl_id, data); \
425 }
437#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
438 VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
439 vpx_codec_ctx_t *, int, typ) VPX_DEPRECATED VPX_UNUSED; \
440 \
441 VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
442 vpx_codec_ctx_t *ctx, int ctrl_id, typ data) { \
443 return vpx_codec_control_(ctx, ctrl_id, data); \
444 }
456#define VPX_CTRL_VOID(id) \
457 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int) \
458 VPX_UNUSED; \
459 \
460 static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
461 int ctrl_id) { \
462 return vpx_codec_control_(ctx, ctrl_id); \
463 }
465#endif
466
468#ifdef __cplusplus
469}
470#endif
471#endif // VPX_VPX_VPX_CODEC_H_
int vpx_codec_version(void)
Return the version information (as an integer)
struct vpx_codec_priv vpx_codec_priv_t
Codec private data structure.
Definition: vpx_codec.h:184
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition: vpx_codec.h:170
vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
Get the capabilities of an algorithm.
const char * vpx_codec_err_to_string(vpx_codec_err_t err)
Convert error number to printable string.
struct vpx_codec_ctx vpx_codec_ctx_t
Codec context structure.
const char * vpx_codec_version_str(void)
Return the version information (as a string)
const char * vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:190
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
const char * vpx_codec_build_config(void)
Return the build configuration.
enum vpx_bit_depth vpx_bit_depth_t
Bit depth for codecThis enumeration determines the bit depth of the codec.
long vpx_codec_caps_t
Codec capabilities bitfield.
Definition: vpx_codec.h:155
vpx_codec_err_t
Algorithm return codes.
Definition: vpx_codec.h:93
const char * vpx_codec_version_extra_str(void)
Return the version information (as a string)
const struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:177
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
vpx_bit_depth
Bit depth for codecThis enumeration determines the bit depth of the codec.
Definition: vpx_codec.h:220
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
@ VPX_CODEC_CORRUPT_FRAME
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:133
@ VPX_CODEC_INCAPABLE
Algorithm does not have required capability.
Definition: vpx_codec.h:107
@ VPX_CODEC_LIST_END
An iterator reached the end of list.
Definition: vpx_codec.h:143
@ VPX_CODEC_UNSUP_FEATURE
Encoded bitstream uses an unsupported feature.
Definition: vpx_codec.h:123
@ VPX_CODEC_MEM_ERROR
Memory operation failed.
Definition: vpx_codec.h:101
@ VPX_CODEC_INVALID_PARAM
An application-supplied parameter is not valid.
Definition: vpx_codec.h:138
@ VPX_CODEC_ERROR
Unspecified error.
Definition: vpx_codec.h:98
@ VPX_CODEC_OK
Operation completed without error.
Definition: vpx_codec.h:95
@ VPX_CODEC_ABI_MISMATCH
ABI version mismatch.
Definition: vpx_codec.h:104
@ VPX_CODEC_UNSUP_BITSTREAM
The given bitstream is not supported.
Definition: vpx_codec.h:114
@ VPX_BITS_8
Definition: vpx_codec.h:221
@ VPX_BITS_12
Definition: vpx_codec.h:223
@ VPX_BITS_10
Definition: vpx_codec.h:222
Codec context structure.
Definition: vpx_codec.h:200
const struct vpx_codec_dec_cfg * dec
Definition: vpx_codec.h:208
vpx_codec_err_t err
Definition: vpx_codec.h:203
union vpx_codec_ctx::@0 config
vpx_codec_flags_t init_flags
Definition: vpx_codec.h:205
const char * name
Definition: vpx_codec.h:201
vpx_codec_priv_t * priv
Definition: vpx_codec.h:213
const char * err_detail
Definition: vpx_codec.h:204
vpx_codec_iface_t * iface
Definition: vpx_codec.h:202
Initialization Configurations.
Definition: vpx_decoder.h:106
Encoder configuration structure.
Definition: vpx_encoder.h:271
Describes the vpx image descriptor and associated operations.