WebM VP8 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 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #ifndef VPX_CODEC_H
44 #define VPX_CODEC_H
45 #include "vpx_integer.h"
46 #include "vpx_image.h"
47 
49 #ifndef DEPRECATED
50 #if defined(__GNUC__) && __GNUC__
51 #define DEPRECATED __attribute__ ((deprecated))
52 #elif defined(_MSC_VER)
53 #define DEPRECATED
54 #else
55 #define DEPRECATED
56 #endif
57 #endif /* DEPRECATED */
58 
59 #ifndef DECLSPEC_DEPRECATED
60 #if defined(__GNUC__) && __GNUC__
61 #define DECLSPEC_DEPRECATED
62 #elif defined(_MSC_VER)
63 #define DECLSPEC_DEPRECATED __declspec(deprecated)
64 #else
65 #define DECLSPEC_DEPRECATED
66 #endif
67 #endif /* DECLSPEC_DEPRECATED */
68 
70 #ifdef UNUSED
71 #elif __GNUC__
72 #define UNUSED __attribute__ ((unused))
73 #else
74 #define UNUSED
75 #endif
76 
85 #define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION)
88  typedef enum {
89 
91 
94 
97 
100 
103 
110 
119 
129 
134 
139 
140  }
142 
143 
152  typedef long vpx_codec_caps_t;
153 #define VPX_CODEC_CAP_DECODER 0x1
154 #define VPX_CODEC_CAP_ENCODER 0x2
155 #define VPX_CODEC_CAP_XMA 0x4
165  typedef long vpx_codec_flags_t;
166 #define VPX_CODEC_USE_XMA 0x00000001
174  typedef const struct vpx_codec_iface vpx_codec_iface_t;
175 
176 
182  typedef struct vpx_codec_priv vpx_codec_priv_t;
183 
184 
189  typedef const void *vpx_codec_iter_t;
190 
191 
200  typedef struct vpx_codec_ctx {
201  const char *name;
204  const char *err_detail;
206  union {
209  void *raw;
210  } config;
212  } vpx_codec_ctx_t;
213 
214 
215  /*
216  * Library Version Number Interface
217  *
218  * For example, see the following sample return values:
219  * vpx_codec_version() (1<<16 | 2<<8 | 3)
220  * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
221  * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
222  */
223 
232  int vpx_codec_version(void);
233 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
234 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
235 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
238 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
239 
241 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
242 
244 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
245 
246 
254  const char *vpx_codec_version_str(void);
255 
256 
263  const char *vpx_codec_version_extra_str(void);
264 
265 
272  const char *vpx_codec_build_config(void);
273 
274 
282  const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
283 
284 
295  const char *vpx_codec_err_to_string(vpx_codec_err_t err);
296 
297 
308  const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
309 
310 
321  const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
322 
323 
324  /* REQUIRED FUNCTIONS
325  *
326  * The following functions are required to be implemented for all codecs.
327  * They represent the base case functionality expected of all codecs.
328  */
329 
342 
343 
352 
353 
379  int ctrl_id,
380  ...);
381 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
382 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
383 # define VPX_CTRL_USE_TYPE(id, typ)
384 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
385 # define VPX_CTRL_VOID(id, typ)
386 
387 #else
388 
397 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
398 
412 # define VPX_CTRL_USE_TYPE(id, typ) \
413  static vpx_codec_err_t \
414  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
415  \
416  static vpx_codec_err_t \
417  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
418  return vpx_codec_control_(ctx, ctrl_id, data);\
419  }
432 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
433  DECLSPEC_DEPRECATED static vpx_codec_err_t \
434  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
435  \
436  DECLSPEC_DEPRECATED static vpx_codec_err_t \
437  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
438  return vpx_codec_control_(ctx, ctrl_id, data);\
439  }
452 # define VPX_CTRL_VOID(id) \
453  static vpx_codec_err_t \
454  vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
455  \
456  static vpx_codec_err_t \
457  vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
458  return vpx_codec_control_(ctx, ctrl_id);\
459  }
462 #endif
463 
464 
481  typedef struct vpx_codec_mmap {
482  /*
483  * The following members are set by the codec when requesting a segment
484  */
485  unsigned int id;
486  unsigned long sz;
487  unsigned int align;
488  unsigned int flags;
489 #define VPX_CODEC_MEM_ZERO 0x1
490 #define VPX_CODEC_MEM_WRONLY 0x2
491 #define VPX_CODEC_MEM_FAST 0x4
493  /* The following members are to be filled in by the allocation function */
494  void *base;
495  void (*dtor)(struct vpx_codec_mmap *map);
496  void *priv;
497  } vpx_codec_mmap_t;
522  vpx_codec_mmap_t *mmap,
523  vpx_codec_iter_t *iter);
524 
525 
548  vpx_codec_mmap_t *mmaps,
549  unsigned int num_maps);
550 
555 #endif
556 #ifdef __cplusplus
557 }
558 #endif
struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:174
unsigned long sz
Definition: vpx_codec.h:508
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.
unsigned int id
Definition: vpx_codec.h:507
vpx_codec_flags_t init_flags
Definition: vpx_codec.h:205
void * base
Definition: vpx_codec.h:516
Unspecified error.
Definition: vpx_codec.h:93
The given bitstream is not supported.
Definition: vpx_codec.h:109
struct vpx_codec_enc_cfg * enc
Definition: vpx_codec.h:208
Memory operation failed.
Definition: vpx_codec.h:96
Encoder configuration structure.
Definition: vpx_encoder.h:271
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:128
void * priv
Definition: vpx_codec.h:518
int vpx_codec_version(void)
Return the version information (as an integer)
An application-supplied parameter is not valid.
Definition: vpx_codec.h:133
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:201
void(* dtor)(struct vpx_codec_mmap *map)
Definition: vpx_codec.h:517
unsigned int flags
Definition: vpx_codec.h:510
unsigned int align
Definition: vpx_codec.h:509
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:90
struct vpx_codec_ctx vpx_codec_ctx_t
Codec context structure.
vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx, vpx_codec_mmap_t *mmaps, unsigned int num_maps)
Identify allocated segments to codec instance.
vpx_codec_iface_t * iface
Definition: vpx_codec.h:202
Describes the vpx image descriptor and associated operations.
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition: vpx_codec.h:165
const char * err_detail
Definition: vpx_codec.h:204
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)
struct vpx_codec_mmap vpx_codec_mmap_t
Memory Map Entry.
Memory Map Entry.
Definition: vpx_codec.h:503
vpx_codec_err_t
Algorithm return codes.
Definition: vpx_codec.h:88
struct vpx_codec_priv vpx_codec_priv_t
Codec private data structure.
Definition: vpx_codec.h:182
Encoded bitstream uses an unsupported feature.
Definition: vpx_codec.h:118
ABI version mismatch.
Definition: vpx_codec.h:99
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx, vpx_codec_mmap_t *mmap, vpx_codec_iter_t *iter)
Iterate over the list of segments to allocate.
union vpx_codec_ctx::@0 config
An iterator reached the end of list.
Definition: vpx_codec.h:138
vpx_codec_priv_t * priv
Definition: vpx_codec.h:211
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:152
Algorithm does not have required capability.
Definition: vpx_codec.h:102
vpx_codec_err_t err
Definition: vpx_codec.h:203
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
Initialization Configurations.
Definition: vpx_decoder.h:112
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:189
Codec context structure.
Definition: vpx_codec.h:200