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 
38 #ifndef VPX_VPX_CODEC_H_
39 #define VPX_VPX_CODEC_H_
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 #include "./vpx_image.h"
46 #include "./vpx_integer.h"
47 
49 #ifndef VPX_DEPRECATED
50 #if defined(__GNUC__) && __GNUC__
51 #define VPX_DEPRECATED __attribute__((deprecated))
52 #elif defined(_MSC_VER)
53 #define VPX_DEPRECATED
54 #else
55 #define VPX_DEPRECATED
56 #endif
57 #endif /* VPX_DEPRECATED */
58 
59 #ifndef VPX_DECLSPEC_DEPRECATED
60 #if defined(__GNUC__) && __GNUC__
61 #define VPX_DECLSPEC_DEPRECATED
62 #elif defined(_MSC_VER)
63 
64 #define VPX_DECLSPEC_DEPRECATED __declspec(deprecated)
65 #else
66 #define VPX_DECLSPEC_DEPRECATED
67 #endif
68 #endif /* VPX_DECLSPEC_DEPRECATED */
69 
71 #ifndef VPX_UNUSED
72 #if defined(__GNUC__) || defined(__clang__)
73 #define VPX_UNUSED __attribute__((unused))
74 #else
75 #define VPX_UNUSED
76 #endif
77 #endif /* VPX_UNUSED */
78 
87 #define VPX_CODEC_ABI_VERSION (4 + VPX_IMAGE_ABI_VERSION)
90 typedef enum {
91 
93 
96 
99 
102 
105 
112 
121 
131 
136 
141 
143 
152 typedef long vpx_codec_caps_t;
153 #define VPX_CODEC_CAP_DECODER 0x1
154 #define VPX_CODEC_CAP_ENCODER 0x2
158 #define VPX_CODEC_CAP_HIGHBITDEPTH 0x4
159 
167 typedef long vpx_codec_flags_t;
168 
174 typedef const struct vpx_codec_iface vpx_codec_iface_t;
175 
181 typedef struct vpx_codec_priv vpx_codec_priv_t;
182 
187 typedef const void *vpx_codec_iter_t;
188 
197 typedef struct vpx_codec_ctx {
198  const char *name;
201  const char *err_detail;
203  union {
205  const struct vpx_codec_dec_cfg *dec;
207  const struct vpx_codec_enc_cfg *enc;
208  const void *raw;
209  } config;
212 
217 typedef enum vpx_bit_depth {
219  VPX_BITS_10 = 10,
220  VPX_BITS_12 = 12,
222 
223 /*
224  * Library Version Number Interface
225  *
226  * For example, see the following sample return values:
227  * vpx_codec_version() (1<<16 | 2<<8 | 3)
228  * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
229  * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
230  */
231 
242 int vpx_codec_version(void);
243 #define VPX_VERSION_MAJOR(v) \
244  ((v >> 16) & 0xff)
245 #define VPX_VERSION_MINOR(v) \
246  ((v >> 8) & 0xff)
247 #define VPX_VERSION_PATCH(v) \
248  ((v >> 0) & 0xff)
251 #define vpx_codec_version_major() ((vpx_codec_version() >> 16) & 0xff)
252 
254 #define vpx_codec_version_minor() ((vpx_codec_version() >> 8) & 0xff)
255 
257 #define vpx_codec_version_patch() ((vpx_codec_version() >> 0) & 0xff)
258 
268 const char *vpx_codec_version_str(void);
269 
277 const char *vpx_codec_version_extra_str(void);
278 
285 const char *vpx_codec_build_config(void);
286 
294 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
295 
307 
318 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
319 
330 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
331 
332 /* REQUIRED FUNCTIONS
333  *
334  * The following functions are required to be implemented for all codecs.
335  * They represent the base case functionality expected of all codecs.
336  */
337 
350 
359 
384 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id, ...);
385 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
386 #define vpx_codec_control(ctx, id, data) vpx_codec_control_(ctx, id, data)
387 #define VPX_CTRL_USE_TYPE(id, typ)
388 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
389 #define VPX_CTRL_VOID(id, typ)
390 
391 #else
392 
401 #define vpx_codec_control(ctx, id, data) \
402  vpx_codec_control_##id(ctx, id, data)
415 #define VPX_CTRL_USE_TYPE(id, typ) \
416  static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int, typ) \
417  VPX_UNUSED; \
418  \
419  static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
420  int ctrl_id, typ data) { \
421  return vpx_codec_control_(ctx, ctrl_id, data); \
422  }
434 #define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
435  VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
436  vpx_codec_ctx_t *, int, typ) VPX_DEPRECATED VPX_UNUSED; \
437  \
438  VPX_DECLSPEC_DEPRECATED static vpx_codec_err_t vpx_codec_control_##id( \
439  vpx_codec_ctx_t *ctx, int ctrl_id, typ data) { \
440  return vpx_codec_control_(ctx, ctrl_id, data); \
441  }
453 #define VPX_CTRL_VOID(id) \
454  static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *, int) \
455  VPX_UNUSED; \
456  \
457  static vpx_codec_err_t vpx_codec_control_##id(vpx_codec_ctx_t *ctx, \
458  int ctrl_id) { \
459  return vpx_codec_control_(ctx, ctrl_id); \
460  }
462 #endif
463 
465 #ifdef __cplusplus
466 }
467 #endif
468 #endif // VPX_VPX_CODEC_H_
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
const char * vpx_codec_err_to_string(vpx_codec_err_t err)
Convert error number to printable string.
vpx_codec_flags_t init_flags
Definition: vpx_codec.h:202
Unspecified error.
Definition: vpx_codec.h:95
The given bitstream is not supported.
Definition: vpx_codec.h:111
Memory operation failed.
Definition: vpx_codec.h:98
Encoder configuration structure.
Definition: vpx_encoder.h:279
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:130
int vpx_codec_version(void)
Return the version information (as an integer)
An application-supplied parameter is not valid.
Definition: vpx_codec.h:135
const char * vpx_codec_version_extra_str(void)
Return the version information (as a string)
const char * vpx_codec_build_config(void)
Return the build configuration.
const char * name
Definition: vpx_codec.h:198
enum vpx_bit_depth vpx_bit_depth_t
Bit depth for codecThis enumeration determines the bit depth of the codec.
vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
Get the capabilities of an algorithm.
Operation completed without error.
Definition: vpx_codec.h:92
struct vpx_codec_ctx vpx_codec_ctx_t
Codec context structure.
vpx_bit_depth
Bit depth for codecThis enumeration determines the bit depth of the codec.
Definition: vpx_codec.h:217
vpx_codec_iface_t * iface
Definition: vpx_codec.h:199
Describes the vpx image descriptor and associated operations.
const struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:174
Definition: vpx_codec.h:220
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition: vpx_codec.h:167
const char * err_detail
Definition: vpx_codec.h:201
const char * vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
const char * vpx_codec_version_str(void)
Return the version information (as a string)
vpx_codec_err_t
Algorithm return codes.
Definition: vpx_codec.h:90
struct vpx_codec_priv vpx_codec_priv_t
Codec private data structure.
Definition: vpx_codec.h:181
Encoded bitstream uses an unsupported feature.
Definition: vpx_codec.h:120
ABI version mismatch.
Definition: vpx_codec.h:101
union vpx_codec_ctx::@0 config
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
An iterator reached the end of list.
Definition: vpx_codec.h:140
vpx_codec_priv_t * priv
Definition: vpx_codec.h:210
const struct vpx_codec_dec_cfg * dec
Definition: vpx_codec.h:205
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
long vpx_codec_caps_t
Codec capabilities bitfield.
Definition: vpx_codec.h:152
Definition: vpx_codec.h:218
Algorithm does not have required capability.
Definition: vpx_codec.h:104
vpx_codec_err_t err
Definition: vpx_codec.h:200
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
Initialization Configurations.
Definition: vpx_decoder.h:107
Definition: vpx_codec.h:219
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:187
Codec context structure.
Definition: vpx_codec.h:197