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 
11 
39 #ifndef VPX_VPX_CODEC_H_
40 #define VPX_VPX_CODEC_H_
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 #include "./vpx_integer.h"
47 #include "./vpx_image.h"
48 
50 #ifndef DEPRECATED
51 #if defined(__GNUC__) && __GNUC__
52 #define DEPRECATED __attribute__ ((deprecated))
53 #elif defined(_MSC_VER)
54 #define DEPRECATED
55 #else
56 #define DEPRECATED
57 #endif
58 #endif /* DEPRECATED */
59 
60 #ifndef DECLSPEC_DEPRECATED
61 #if defined(__GNUC__) && __GNUC__
62 #define DECLSPEC_DEPRECATED
63 #elif defined(_MSC_VER)
64 #define DECLSPEC_DEPRECATED __declspec(deprecated)
65 #else
66 #define DECLSPEC_DEPRECATED
67 #endif
68 #endif /* DECLSPEC_DEPRECATED */
69 
71 #ifdef UNUSED
72 #elif __GNUC__
73 #define UNUSED __attribute__ ((unused))
74 #else
75 #define UNUSED
76 #endif
77 
86 #define VPX_CODEC_ABI_VERSION (3 + VPX_IMAGE_ABI_VERSION)
89  typedef enum {
90 
92 
95 
98 
101 
104 
111 
120 
130 
135 
140 
141  }
143 
144 
153  typedef long vpx_codec_caps_t;
154 #define VPX_CODEC_CAP_DECODER 0x1
155 #define VPX_CODEC_CAP_ENCODER 0x2
165  typedef long vpx_codec_flags_t;
166 
167 
173  typedef const struct vpx_codec_iface vpx_codec_iface_t;
174 
175 
181  typedef struct vpx_codec_priv vpx_codec_priv_t;
182 
183 
188  typedef const void *vpx_codec_iter_t;
189 
190 
199  typedef struct vpx_codec_ctx {
200  const char *name;
203  const char *err_detail;
205  union {
207  const struct vpx_codec_dec_cfg *dec;
209  const struct vpx_codec_enc_cfg *enc;
210  const void *raw;
211  } config;
213  } vpx_codec_ctx_t;
214 
219  typedef enum vpx_bit_depth {
221  VPX_BITS_10 = 10,
222  VPX_BITS_12 = 12,
223  } vpx_bit_depth_t;
224 
225  /*
226  * Library Version Number Interface
227  *
228  * For example, see the following sample return values:
229  * vpx_codec_version() (1<<16 | 2<<8 | 3)
230  * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
231  * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
232  */
233 
242  int vpx_codec_version(void);
243 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
244 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
245 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
248 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
249 
251 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
252 
254 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
255 
256 
264  const char *vpx_codec_version_str(void);
265 
266 
273  const char *vpx_codec_version_extra_str(void);
274 
275 
282  const char *vpx_codec_build_config(void);
283 
284 
292  const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
293 
294 
305  const char *vpx_codec_err_to_string(vpx_codec_err_t err);
306 
307 
318  const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
319 
320 
331  const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
332 
333 
334  /* REQUIRED FUNCTIONS
335  *
336  * The following functions are required to be implemented for all codecs.
337  * They represent the base case functionality expected of all codecs.
338  */
339 
352 
353 
362 
363 
389  int ctrl_id,
390  ...);
391 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
392 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
393 # define VPX_CTRL_USE_TYPE(id, typ)
394 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
395 # define VPX_CTRL_VOID(id, typ)
396 
397 #else
398 
407 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
408 
422 # define VPX_CTRL_USE_TYPE(id, typ) \
423  static vpx_codec_err_t \
424  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
425  \
426  static vpx_codec_err_t \
427  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
428  return vpx_codec_control_(ctx, ctrl_id, data);\
429  }
442 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
443  DECLSPEC_DEPRECATED static vpx_codec_err_t \
444  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
445  \
446  DECLSPEC_DEPRECATED static vpx_codec_err_t \
447  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
448  return vpx_codec_control_(ctx, ctrl_id, data);\
449  }
462 # define VPX_CTRL_VOID(id) \
463  static vpx_codec_err_t \
464  vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
465  \
466  static vpx_codec_err_t \
467  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
468  return vpx_codec_control_(ctx, ctrl_id);\
469  }
472 #endif
473 
475 #ifdef __cplusplus
476 }
477 #endif
478 #endif // VPX_VPX_CODEC_H_
479 
struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:173
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:204
Unspecified error.
Definition: vpx_codec.h:94
The given bitstream is not supported.
Definition: vpx_codec.h:110
Memory operation failed.
Definition: vpx_codec.h:97
Encoder configuration structure.
Definition: vpx_encoder.h:311
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:129
int vpx_codec_version(void)
Return the version information (as an integer)
An application-supplied parameter is not valid.
Definition: vpx_codec.h:134
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:200
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:91
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:219
vpx_codec_iface_t * iface
Definition: vpx_codec.h:201
Describes the vpx image descriptor and associated operations.
Definition: vpx_codec.h:222
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition: vpx_codec.h:165
const char * err_detail
Definition: vpx_codec.h:203
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:89
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:119
ABI version mismatch.
Definition: vpx_codec.h:100
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
union vpx_codec_ctx::@0 config
An iterator reached the end of list.
Definition: vpx_codec.h:139
vpx_codec_priv_t * priv
Definition: vpx_codec.h:212
struct vpx_codec_dec_cfg * dec
Definition: vpx_codec.h:207
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:153
Definition: vpx_codec.h:220
Algorithm does not have required capability.
Definition: vpx_codec.h:103
vpx_codec_err_t err
Definition: vpx_codec.h:202
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
Initialization Configurations.
Definition: vpx_decoder.h:115
Definition: vpx_codec.h:221
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:188
Codec context structure.
Definition: vpx_codec.h:199