WebM VP8 Codec SDK: vpx/vpx_codec.h Source File

WebM VP8 Codec SDK

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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_CODEC_H
40 #define 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 (2 + VPX_IMAGE_ABI_VERSION)
89 typedef enum {
90
91 VPX_CODEC_OK,
92
94 VPX_CODEC_ERROR,
95
97 VPX_CODEC_MEM_ERROR,
98
100 VPX_CODEC_ABI_MISMATCH,
101
103 VPX_CODEC_INCAPABLE,
104
110 VPX_CODEC_UNSUP_BITSTREAM,
111
119 VPX_CODEC_UNSUP_FEATURE,
120
129 VPX_CODEC_CORRUPT_FRAME,
130
134 VPX_CODEC_INVALID_PARAM,
135
139 VPX_CODEC_LIST_END
140
141 }
142 vpx_codec_err_t;
143
144
153 typedef long vpx_codec_caps_t;
154 #define VPX_CODEC_CAP_DECODER 0x1
155 #define VPX_CODEC_CAP_ENCODER 0x2
156 #define VPX_CODEC_CAP_XMA 0x4
166 typedef long vpx_codec_flags_t;
167 #define VPX_CODEC_USE_XMA 0x00000001
175 typedef const struct vpx_codec_iface vpx_codec_iface_t;
176
177
183 typedef struct vpx_codec_priv vpx_codec_priv_t;
184
185
190 typedef const void *vpx_codec_iter_t;
191
192
201 typedef struct vpx_codec_ctx {
202 const char *name;
203 vpx_codec_iface_t *iface;
204 vpx_codec_err_t err;
205 const char *err_detail;
206 vpx_codec_flags_t init_flags;
207 union {
208 struct vpx_codec_dec_cfg *dec;
209 struct vpx_codec_enc_cfg *enc;
210 void *raw;
211 } config;
212 vpx_codec_priv_t *priv;
213 } vpx_codec_ctx_t;
214
215
216 /*
217 * Library Version Number Interface
218 *
219 * For example, see the following sample return values:
220 * vpx_codec_version() (1<<16 | 2<<8 | 3)
221 * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
222 * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
223 */
224
233 int vpx_codec_version(void);
234 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff)
235 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff)
236 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff)
239 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
240
242 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
243
245 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
246
247
255 const char *vpx_codec_version_str(void);
256
257
264 const char *vpx_codec_version_extra_str(void);
265
266
273 const char *vpx_codec_build_config(void);
274
275
283 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
284
285
296 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
297
298
309 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
310
311
322 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
323
324
325 /* REQUIRED FUNCTIONS
326 *
327 * The following functions are required to be implemented for all codecs.
328 * They represent the base case functionality expected of all codecs.
329 */
330
342 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
343
344
352 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
353
354
379 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
380 int ctrl_id,
381 ...);
382 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
383 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
384 # define VPX_CTRL_USE_TYPE(id, typ)
385 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
386 # define VPX_CTRL_VOID(id, typ)
387
388 #else
389
398 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
399
413 # define VPX_CTRL_USE_TYPE(id, typ) \
414 static vpx_codec_err_t \
415 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
416 \
417 static vpx_codec_err_t \
418 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
419 return vpx_codec_control_(ctx, ctrl_id, data);\
420 }
433 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
434 DECLSPEC_DEPRECATED static vpx_codec_err_t \
435 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
436 \
437 DECLSPEC_DEPRECATED static vpx_codec_err_t \
438 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
439 return vpx_codec_control_(ctx, ctrl_id, data);\
440 }
453 # define VPX_CTRL_VOID(id) \
454 static vpx_codec_err_t \
455 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
456 \
457 static vpx_codec_err_t \
458 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
459 return vpx_codec_control_(ctx, ctrl_id);\
460 }
463 #endif
464
465
482 typedef struct vpx_codec_mmap {
483 /*
484 * The following members are set by the codec when requesting a segment
485 */
486 unsigned int id;
487 unsigned long sz;
488 unsigned int align;
489 unsigned int flags;
490 #define VPX_CODEC_MEM_ZERO 0x1
491 #define VPX_CODEC_MEM_WRONLY 0x2
492 #define VPX_CODEC_MEM_FAST 0x4
494 /* The following members are to be filled in by the allocation function */
495 void *base;
496 void (*dtor)(struct vpx_codec_mmap *map);
497 void *priv;
498 } vpx_codec_mmap_t;
522 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
523 vpx_codec_mmap_t *mmap,
524 vpx_codec_iter_t *iter);
525
526
548 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
549 vpx_codec_mmap_t *mmaps,
550 unsigned int num_maps);
551
554 #ifdef __cplusplus
555 }
556 #endif
557 #endif
558
vpx_codec_mmap::sz
unsigned long sz
Definition: vpx_codec.h:509
vpx_codec_iface_name
const char * vpx_codec_iface_name(vpx_codec_iface_t *iface)
Return the name for a given interface.
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_mmap::id
unsigned int id
Definition: vpx_codec.h:508
vpx_codec_ctx::init_flags
vpx_codec_flags_t init_flags
Definition: vpx_codec.h:206
vpx_codec_mmap::base
void * base
Definition: vpx_codec.h:517
VPX_CODEC_ERROR
Unspecified error.
Definition: vpx_codec.h:94
VPX_CODEC_UNSUP_BITSTREAM
The given bitstream is not supported.
Definition: vpx_codec.h:110
vpx_codec_ctx::enc
struct vpx_codec_enc_cfg * enc
Definition: vpx_codec.h:209
VPX_CODEC_MEM_ERROR
Memory operation failed.
Definition: vpx_codec.h:97
vpx_codec_enc_cfg
Encoder configuration structure.
Definition: vpx_encoder.h:277
VPX_CODEC_CORRUPT_FRAME
The coded data for this stream is corrupt or incomplete.
Definition: vpx_codec.h:129
vpx_codec_mmap::priv
void * priv
Definition: vpx_codec.h:519
vpx_codec_version
int vpx_codec_version(void)
Return the version information (as an integer)
VPX_CODEC_INVALID_PARAM
An application-supplied parameter is not valid.
Definition: vpx_codec.h:134
vpx_codec_version_extra_str
const char * vpx_codec_version_extra_str(void)
Return the version information (as a string)
vpx_codec_build_config
const char * vpx_codec_build_config(void)
Return the build configuration.
vpx_codec_ctx::name
const char * name
Definition: vpx_codec.h:202
vpx_codec_mmap::flags
unsigned int flags
Definition: vpx_codec.h:511
vpx_codec_mmap::align
unsigned int align
Definition: vpx_codec.h:510
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_OK
Operation completed without error.
Definition: vpx_codec.h:91
vpx_codec_ctx_t
struct vpx_codec_ctx vpx_codec_ctx_t
Codec context structure.
vpx_codec_set_mem_map
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_ctx::iface
vpx_codec_iface_t * iface
Definition: vpx_codec.h:203
vpx_image.h
Describes the vpx image descriptor and associated operations.
vpx_codec_iface_t
const struct vpx_codec_iface vpx_codec_iface_t
Codec interface structure.
Definition: vpx_codec.h:175
vpx_codec_flags_t
long vpx_codec_flags_t
Initialization-time Feature Enabling.
Definition: vpx_codec.h:166
vpx_codec_ctx::err_detail
const char * err_detail
Definition: vpx_codec.h:205
vpx_codec_error_detail
const char * vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
Retrieve detailed error information for codec context.
vpx_codec_version_str
const char * vpx_codec_version_str(void)
Return the version information (as a string)
vpx_codec_mmap_t
struct vpx_codec_mmap vpx_codec_mmap_t
Memory Map Entry.
vpx_codec_mmap
Memory Map Entry.
Definition: vpx_codec.h:504
vpx_codec_err_t
vpx_codec_err_t
Algorithm return codes.
Definition: vpx_codec.h:89
vpx_codec_priv_t
struct vpx_codec_priv vpx_codec_priv_t
Codec private data structure.
Definition: vpx_codec.h:183
VPX_CODEC_UNSUP_FEATURE
Encoded bitstream uses an unsupported feature.
Definition: vpx_codec.h:119
VPX_CODEC_ABI_MISMATCH
ABI version mismatch.
Definition: vpx_codec.h:100
vpx_codec_control_
vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx, int ctrl_id,...)
Control algorithm.
vpx_codec_mmap::dtor
void(* dtor)(struct vpx_codec_mmap *map)
Definition: vpx_codec.h:518
vpx_codec_get_mem_map
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.
vpx_codec_ctx::config
union vpx_codec_ctx::@0 config
VPX_CODEC_LIST_END
An iterator reached the end of list.
Definition: vpx_codec.h:139
vpx_codec_ctx::priv
vpx_codec_priv_t * priv
Definition: vpx_codec.h:212
vpx_codec_ctx::dec
struct vpx_codec_dec_cfg * dec
Definition: vpx_codec.h:208
vpx_codec_destroy
vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
Destroy a codec instance.
vpx_codec_caps_t
long vpx_codec_caps_t
Codec capabilities bitfield.
Definition: vpx_codec.h:153
VPX_CODEC_INCAPABLE
Algorithm does not have required capability.
Definition: vpx_codec.h:103
vpx_codec_ctx::err
vpx_codec_err_t err
Definition: vpx_codec.h:204
vpx_codec_error
const char * vpx_codec_error(vpx_codec_ctx_t *ctx)
Retrieve error synopsis for codec context.
vpx_codec_dec_cfg
Initialization Configurations.
Definition: vpx_decoder.h:111
vpx_codec_iter_t
const void * vpx_codec_iter_t
Iterator.
Definition: vpx_codec.h:190
vpx_codec_ctx
Codec context structure.
Definition: vpx_codec.h:201