media/libvpx/vpx/vpx_codec.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11
michael@0 12 /*!\defgroup codec Common Algorithm Interface
michael@0 13 * This abstraction allows applications to easily support multiple video
michael@0 14 * formats with minimal code duplication. This section describes the interface
michael@0 15 * common to all codecs (both encoders and decoders).
michael@0 16 * @{
michael@0 17 */
michael@0 18
michael@0 19 /*!\file
michael@0 20 * \brief Describes the codec algorithm interface to applications.
michael@0 21 *
michael@0 22 * This file describes the interface between an application and a
michael@0 23 * video codec algorithm.
michael@0 24 *
michael@0 25 * An application instantiates a specific codec instance by using
michael@0 26 * vpx_codec_init() and a pointer to the algorithm's interface structure:
michael@0 27 * <pre>
michael@0 28 * my_app.c:
michael@0 29 * extern vpx_codec_iface_t my_codec;
michael@0 30 * {
michael@0 31 * vpx_codec_ctx_t algo;
michael@0 32 * res = vpx_codec_init(&algo, &my_codec);
michael@0 33 * }
michael@0 34 * </pre>
michael@0 35 *
michael@0 36 * Once initialized, the instance is manged using other functions from
michael@0 37 * the vpx_codec_* family.
michael@0 38 */
michael@0 39 #ifndef VPX_CODEC_H
michael@0 40 #define VPX_CODEC_H
michael@0 41
michael@0 42 #ifdef __cplusplus
michael@0 43 extern "C" {
michael@0 44 #endif
michael@0 45
michael@0 46 #include "vpx_integer.h"
michael@0 47 #include "vpx_image.h"
michael@0 48
michael@0 49 /*!\brief Decorator indicating a function is deprecated */
michael@0 50 #ifndef DEPRECATED
michael@0 51 #if defined(__GNUC__) && __GNUC__
michael@0 52 #define DEPRECATED __attribute__ ((deprecated))
michael@0 53 #elif defined(_MSC_VER)
michael@0 54 #define DEPRECATED
michael@0 55 #else
michael@0 56 #define DEPRECATED
michael@0 57 #endif
michael@0 58 #endif /* DEPRECATED */
michael@0 59
michael@0 60 #ifndef DECLSPEC_DEPRECATED
michael@0 61 #if defined(__GNUC__) && __GNUC__
michael@0 62 #define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
michael@0 63 #elif defined(_MSC_VER)
michael@0 64 #define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
michael@0 65 #else
michael@0 66 #define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
michael@0 67 #endif
michael@0 68 #endif /* DECLSPEC_DEPRECATED */
michael@0 69
michael@0 70 /*!\brief Decorator indicating a function is potentially unused */
michael@0 71 #ifdef UNUSED
michael@0 72 #elif __GNUC__
michael@0 73 #define UNUSED __attribute__ ((unused))
michael@0 74 #else
michael@0 75 #define UNUSED
michael@0 76 #endif
michael@0 77
michael@0 78 /*!\brief Current ABI version number
michael@0 79 *
michael@0 80 * \internal
michael@0 81 * If this file is altered in any way that changes the ABI, this value
michael@0 82 * must be bumped. Examples include, but are not limited to, changing
michael@0 83 * types, removing or reassigning enums, adding/removing/rearranging
michael@0 84 * fields to structures
michael@0 85 */
michael@0 86 #define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
michael@0 87
michael@0 88 /*!\brief Algorithm return codes */
michael@0 89 typedef enum {
michael@0 90 /*!\brief Operation completed without error */
michael@0 91 VPX_CODEC_OK,
michael@0 92
michael@0 93 /*!\brief Unspecified error */
michael@0 94 VPX_CODEC_ERROR,
michael@0 95
michael@0 96 /*!\brief Memory operation failed */
michael@0 97 VPX_CODEC_MEM_ERROR,
michael@0 98
michael@0 99 /*!\brief ABI version mismatch */
michael@0 100 VPX_CODEC_ABI_MISMATCH,
michael@0 101
michael@0 102 /*!\brief Algorithm does not have required capability */
michael@0 103 VPX_CODEC_INCAPABLE,
michael@0 104
michael@0 105 /*!\brief The given bitstream is not supported.
michael@0 106 *
michael@0 107 * The bitstream was unable to be parsed at the highest level. The decoder
michael@0 108 * is unable to proceed. This error \ref SHOULD be treated as fatal to the
michael@0 109 * stream. */
michael@0 110 VPX_CODEC_UNSUP_BITSTREAM,
michael@0 111
michael@0 112 /*!\brief Encoded bitstream uses an unsupported feature
michael@0 113 *
michael@0 114 * The decoder does not implement a feature required by the encoder. This
michael@0 115 * return code should only be used for features that prevent future
michael@0 116 * pictures from being properly decoded. This error \ref MAY be treated as
michael@0 117 * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
michael@0 118 */
michael@0 119 VPX_CODEC_UNSUP_FEATURE,
michael@0 120
michael@0 121 /*!\brief The coded data for this stream is corrupt or incomplete
michael@0 122 *
michael@0 123 * There was a problem decoding the current frame. This return code
michael@0 124 * should only be used for failures that prevent future pictures from
michael@0 125 * being properly decoded. This error \ref MAY be treated as fatal to the
michael@0 126 * stream or \ref MAY be treated as fatal to the current GOP. If decoding
michael@0 127 * is continued for the current GOP, artifacts may be present.
michael@0 128 */
michael@0 129 VPX_CODEC_CORRUPT_FRAME,
michael@0 130
michael@0 131 /*!\brief An application-supplied parameter is not valid.
michael@0 132 *
michael@0 133 */
michael@0 134 VPX_CODEC_INVALID_PARAM,
michael@0 135
michael@0 136 /*!\brief An iterator reached the end of list.
michael@0 137 *
michael@0 138 */
michael@0 139 VPX_CODEC_LIST_END
michael@0 140
michael@0 141 }
michael@0 142 vpx_codec_err_t;
michael@0 143
michael@0 144
michael@0 145 /*! \brief Codec capabilities bitfield
michael@0 146 *
michael@0 147 * Each codec advertises the capabilities it supports as part of its
michael@0 148 * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
michael@0 149 * or functionality, and are not required to be supported.
michael@0 150 *
michael@0 151 * The available flags are specified by VPX_CODEC_CAP_* defines.
michael@0 152 */
michael@0 153 typedef long vpx_codec_caps_t;
michael@0 154 #define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
michael@0 155 #define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
michael@0 156 #define VPX_CODEC_CAP_XMA 0x4 /**< Supports eXternal Memory Allocation */
michael@0 157
michael@0 158
michael@0 159 /*! \brief Initialization-time Feature Enabling
michael@0 160 *
michael@0 161 * Certain codec features must be known at initialization time, to allow for
michael@0 162 * proper memory allocation.
michael@0 163 *
michael@0 164 * The available flags are specified by VPX_CODEC_USE_* defines.
michael@0 165 */
michael@0 166 typedef long vpx_codec_flags_t;
michael@0 167 #define VPX_CODEC_USE_XMA 0x00000001 /**< Use eXternal Memory Allocation mode */
michael@0 168
michael@0 169
michael@0 170 /*!\brief Codec interface structure.
michael@0 171 *
michael@0 172 * Contains function pointers and other data private to the codec
michael@0 173 * implementation. This structure is opaque to the application.
michael@0 174 */
michael@0 175 typedef const struct vpx_codec_iface vpx_codec_iface_t;
michael@0 176
michael@0 177
michael@0 178 /*!\brief Codec private data structure.
michael@0 179 *
michael@0 180 * Contains data private to the codec implementation. This structure is opaque
michael@0 181 * to the application.
michael@0 182 */
michael@0 183 typedef struct vpx_codec_priv vpx_codec_priv_t;
michael@0 184
michael@0 185
michael@0 186 /*!\brief Iterator
michael@0 187 *
michael@0 188 * Opaque storage used for iterating over lists.
michael@0 189 */
michael@0 190 typedef const void *vpx_codec_iter_t;
michael@0 191
michael@0 192
michael@0 193 /*!\brief Codec context structure
michael@0 194 *
michael@0 195 * All codecs \ref MUST support this context structure fully. In general,
michael@0 196 * this data should be considered private to the codec algorithm, and
michael@0 197 * not be manipulated or examined by the calling application. Applications
michael@0 198 * may reference the 'name' member to get a printable description of the
michael@0 199 * algorithm.
michael@0 200 */
michael@0 201 typedef struct vpx_codec_ctx {
michael@0 202 const char *name; /**< Printable interface name */
michael@0 203 vpx_codec_iface_t *iface; /**< Interface pointers */
michael@0 204 vpx_codec_err_t err; /**< Last returned error */
michael@0 205 const char *err_detail; /**< Detailed info, if available */
michael@0 206 vpx_codec_flags_t init_flags; /**< Flags passed at init time */
michael@0 207 union {
michael@0 208 struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
michael@0 209 struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
michael@0 210 void *raw;
michael@0 211 } config; /**< Configuration pointer aliasing union */
michael@0 212 vpx_codec_priv_t *priv; /**< Algorithm private storage */
michael@0 213 } vpx_codec_ctx_t;
michael@0 214
michael@0 215
michael@0 216 /*
michael@0 217 * Library Version Number Interface
michael@0 218 *
michael@0 219 * For example, see the following sample return values:
michael@0 220 * vpx_codec_version() (1<<16 | 2<<8 | 3)
michael@0 221 * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
michael@0 222 * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
michael@0 223 */
michael@0 224
michael@0 225 /*!\brief Return the version information (as an integer)
michael@0 226 *
michael@0 227 * Returns a packed encoding of the library version number. This will only include
michael@0 228 * the major.minor.patch component of the version number. Note that this encoded
michael@0 229 * value should be accessed through the macros provided, as the encoding may change
michael@0 230 * in the future.
michael@0 231 *
michael@0 232 */
michael@0 233 int vpx_codec_version(void);
michael@0 234 #define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
michael@0 235 #define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
michael@0 236 #define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
michael@0 237
michael@0 238 /*!\brief Return the version major number */
michael@0 239 #define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
michael@0 240
michael@0 241 /*!\brief Return the version minor number */
michael@0 242 #define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
michael@0 243
michael@0 244 /*!\brief Return the version patch number */
michael@0 245 #define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
michael@0 246
michael@0 247
michael@0 248 /*!\brief Return the version information (as a string)
michael@0 249 *
michael@0 250 * Returns a printable string containing the full library version number. This may
michael@0 251 * contain additional text following the three digit version number, as to indicate
michael@0 252 * release candidates, prerelease versions, etc.
michael@0 253 *
michael@0 254 */
michael@0 255 const char *vpx_codec_version_str(void);
michael@0 256
michael@0 257
michael@0 258 /*!\brief Return the version information (as a string)
michael@0 259 *
michael@0 260 * Returns a printable "extra string". This is the component of the string returned
michael@0 261 * by vpx_codec_version_str() following the three digit version number.
michael@0 262 *
michael@0 263 */
michael@0 264 const char *vpx_codec_version_extra_str(void);
michael@0 265
michael@0 266
michael@0 267 /*!\brief Return the build configuration
michael@0 268 *
michael@0 269 * Returns a printable string containing an encoded version of the build
michael@0 270 * configuration. This may be useful to vpx support.
michael@0 271 *
michael@0 272 */
michael@0 273 const char *vpx_codec_build_config(void);
michael@0 274
michael@0 275
michael@0 276 /*!\brief Return the name for a given interface
michael@0 277 *
michael@0 278 * Returns a human readable string for name of the given codec interface.
michael@0 279 *
michael@0 280 * \param[in] iface Interface pointer
michael@0 281 *
michael@0 282 */
michael@0 283 const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
michael@0 284
michael@0 285
michael@0 286 /*!\brief Convert error number to printable string
michael@0 287 *
michael@0 288 * Returns a human readable string for the last error returned by the
michael@0 289 * algorithm. The returned error will be one line and will not contain
michael@0 290 * any newline characters.
michael@0 291 *
michael@0 292 *
michael@0 293 * \param[in] err Error number.
michael@0 294 *
michael@0 295 */
michael@0 296 const char *vpx_codec_err_to_string(vpx_codec_err_t err);
michael@0 297
michael@0 298
michael@0 299 /*!\brief Retrieve error synopsis for codec context
michael@0 300 *
michael@0 301 * Returns a human readable string for the last error returned by the
michael@0 302 * algorithm. The returned error will be one line and will not contain
michael@0 303 * any newline characters.
michael@0 304 *
michael@0 305 *
michael@0 306 * \param[in] ctx Pointer to this instance's context.
michael@0 307 *
michael@0 308 */
michael@0 309 const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
michael@0 310
michael@0 311
michael@0 312 /*!\brief Retrieve detailed error information for codec context
michael@0 313 *
michael@0 314 * Returns a human readable string providing detailed information about
michael@0 315 * the last error.
michael@0 316 *
michael@0 317 * \param[in] ctx Pointer to this instance's context.
michael@0 318 *
michael@0 319 * \retval NULL
michael@0 320 * No detailed information is available.
michael@0 321 */
michael@0 322 const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
michael@0 323
michael@0 324
michael@0 325 /* REQUIRED FUNCTIONS
michael@0 326 *
michael@0 327 * The following functions are required to be implemented for all codecs.
michael@0 328 * They represent the base case functionality expected of all codecs.
michael@0 329 */
michael@0 330
michael@0 331 /*!\brief Destroy a codec instance
michael@0 332 *
michael@0 333 * Destroys a codec context, freeing any associated memory buffers.
michael@0 334 *
michael@0 335 * \param[in] ctx Pointer to this instance's context
michael@0 336 *
michael@0 337 * \retval #VPX_CODEC_OK
michael@0 338 * The codec algorithm initialized.
michael@0 339 * \retval #VPX_CODEC_MEM_ERROR
michael@0 340 * Memory allocation failed.
michael@0 341 */
michael@0 342 vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
michael@0 343
michael@0 344
michael@0 345 /*!\brief Get the capabilities of an algorithm.
michael@0 346 *
michael@0 347 * Retrieves the capabilities bitfield from the algorithm's interface.
michael@0 348 *
michael@0 349 * \param[in] iface Pointer to the algorithm interface
michael@0 350 *
michael@0 351 */
michael@0 352 vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
michael@0 353
michael@0 354
michael@0 355 /*!\brief Control algorithm
michael@0 356 *
michael@0 357 * This function is used to exchange algorithm specific data with the codec
michael@0 358 * instance. This can be used to implement features specific to a particular
michael@0 359 * algorithm.
michael@0 360 *
michael@0 361 * This wrapper function dispatches the request to the helper function
michael@0 362 * associated with the given ctrl_id. It tries to call this function
michael@0 363 * transparently, but will return #VPX_CODEC_ERROR if the request could not
michael@0 364 * be dispatched.
michael@0 365 *
michael@0 366 * Note that this function should not be used directly. Call the
michael@0 367 * #vpx_codec_control wrapper macro instead.
michael@0 368 *
michael@0 369 * \param[in] ctx Pointer to this instance's context
michael@0 370 * \param[in] ctrl_id Algorithm specific control identifier
michael@0 371 *
michael@0 372 * \retval #VPX_CODEC_OK
michael@0 373 * The control request was processed.
michael@0 374 * \retval #VPX_CODEC_ERROR
michael@0 375 * The control request was not processed.
michael@0 376 * \retval #VPX_CODEC_INVALID_PARAM
michael@0 377 * The data was not valid.
michael@0 378 */
michael@0 379 vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
michael@0 380 int ctrl_id,
michael@0 381 ...);
michael@0 382 #if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
michael@0 383 # define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
michael@0 384 # define VPX_CTRL_USE_TYPE(id, typ)
michael@0 385 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
michael@0 386 # define VPX_CTRL_VOID(id, typ)
michael@0 387
michael@0 388 #else
michael@0 389 /*!\brief vpx_codec_control wrapper macro
michael@0 390 *
michael@0 391 * This macro allows for type safe conversions across the variadic parameter
michael@0 392 * to vpx_codec_control_().
michael@0 393 *
michael@0 394 * \internal
michael@0 395 * It works by dispatching the call to the control function through a wrapper
michael@0 396 * function named with the id parameter.
michael@0 397 */
michael@0 398 # define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
michael@0 399 /**<\hideinitializer*/
michael@0 400
michael@0 401
michael@0 402 /*!\brief vpx_codec_control type definition macro
michael@0 403 *
michael@0 404 * This macro allows for type safe conversions across the variadic parameter
michael@0 405 * to vpx_codec_control_(). It defines the type of the argument for a given
michael@0 406 * control identifier.
michael@0 407 *
michael@0 408 * \internal
michael@0 409 * It defines a static function with
michael@0 410 * the correctly typed arguments as a wrapper to the type-unsafe internal
michael@0 411 * function.
michael@0 412 */
michael@0 413 # define VPX_CTRL_USE_TYPE(id, typ) \
michael@0 414 static vpx_codec_err_t \
michael@0 415 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
michael@0 416 \
michael@0 417 static vpx_codec_err_t \
michael@0 418 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
michael@0 419 return vpx_codec_control_(ctx, ctrl_id, data);\
michael@0 420 } /**<\hideinitializer*/
michael@0 421
michael@0 422
michael@0 423 /*!\brief vpx_codec_control deprecated type definition macro
michael@0 424 *
michael@0 425 * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
michael@0 426 * deprecated and should not be used. Consult the documentation for your
michael@0 427 * codec for more information.
michael@0 428 *
michael@0 429 * \internal
michael@0 430 * It defines a static function with the correctly typed arguments as a
michael@0 431 * wrapper to the type-unsafe internal function.
michael@0 432 */
michael@0 433 # define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
michael@0 434 DECLSPEC_DEPRECATED static vpx_codec_err_t \
michael@0 435 vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
michael@0 436 \
michael@0 437 DECLSPEC_DEPRECATED static vpx_codec_err_t \
michael@0 438 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
michael@0 439 return vpx_codec_control_(ctx, ctrl_id, data);\
michael@0 440 } /**<\hideinitializer*/
michael@0 441
michael@0 442
michael@0 443 /*!\brief vpx_codec_control void type definition macro
michael@0 444 *
michael@0 445 * This macro allows for type safe conversions across the variadic parameter
michael@0 446 * to vpx_codec_control_(). It indicates that a given control identifier takes
michael@0 447 * no argument.
michael@0 448 *
michael@0 449 * \internal
michael@0 450 * It defines a static function without a data argument as a wrapper to the
michael@0 451 * type-unsafe internal function.
michael@0 452 */
michael@0 453 # define VPX_CTRL_VOID(id) \
michael@0 454 static vpx_codec_err_t \
michael@0 455 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
michael@0 456 \
michael@0 457 static vpx_codec_err_t \
michael@0 458 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
michael@0 459 return vpx_codec_control_(ctx, ctrl_id);\
michael@0 460 } /**<\hideinitializer*/
michael@0 461
michael@0 462
michael@0 463 #endif
michael@0 464
michael@0 465
michael@0 466 /*!\defgroup cap_xma External Memory Allocation Functions
michael@0 467 *
michael@0 468 * The following functions are required to be implemented for all codecs
michael@0 469 * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
michael@0 470 * for codecs that don't advertise this capability will result in an error
michael@0 471 * code being returned, usually VPX_CODEC_INCAPABLE
michael@0 472 * @{
michael@0 473 */
michael@0 474
michael@0 475
michael@0 476 /*!\brief Memory Map Entry
michael@0 477 *
michael@0 478 * This structure is used to contain the properties of a memory segment. It
michael@0 479 * is populated by the codec in the request phase, and by the calling
michael@0 480 * application once the requested allocation has been performed.
michael@0 481 */
michael@0 482 typedef struct vpx_codec_mmap {
michael@0 483 /*
michael@0 484 * The following members are set by the codec when requesting a segment
michael@0 485 */
michael@0 486 unsigned int id; /**< identifier for the segment's contents */
michael@0 487 unsigned long sz; /**< size of the segment, in bytes */
michael@0 488 unsigned int align; /**< required alignment of the segment, in bytes */
michael@0 489 unsigned int flags; /**< bitfield containing segment properties */
michael@0 490 #define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
michael@0 491 #define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
michael@0 492 #define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
michael@0 493
michael@0 494 /* The following members are to be filled in by the allocation function */
michael@0 495 void *base; /**< pointer to the allocated segment */
michael@0 496 void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
michael@0 497 void *priv; /**< allocator private storage */
michael@0 498 } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
michael@0 499
michael@0 500
michael@0 501 /*!\brief Iterate over the list of segments to allocate.
michael@0 502 *
michael@0 503 * Iterates over a list of the segments to allocate. The iterator storage
michael@0 504 * should be initialized to NULL to start the iteration. Iteration is complete
michael@0 505 * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
michael@0 506 * allocate is dependent upon the size of the encoded stream. In cases where the
michael@0 507 * stream is not available at allocation time, a fixed size must be requested.
michael@0 508 * The codec will not be able to operate on streams larger than the size used at
michael@0 509 * allocation time.
michael@0 510 *
michael@0 511 * \param[in] ctx Pointer to this instance's context.
michael@0 512 * \param[out] mmap Pointer to the memory map entry to populate.
michael@0 513 * \param[in,out] iter Iterator storage, initialized to NULL
michael@0 514 *
michael@0 515 * \retval #VPX_CODEC_OK
michael@0 516 * The memory map entry was populated.
michael@0 517 * \retval #VPX_CODEC_ERROR
michael@0 518 * Codec does not support XMA mode.
michael@0 519 * \retval #VPX_CODEC_MEM_ERROR
michael@0 520 * Unable to determine segment size from stream info.
michael@0 521 */
michael@0 522 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
michael@0 523 vpx_codec_mmap_t *mmap,
michael@0 524 vpx_codec_iter_t *iter);
michael@0 525
michael@0 526
michael@0 527 /*!\brief Identify allocated segments to codec instance
michael@0 528 *
michael@0 529 * Stores a list of allocated segments in the codec. Segments \ref MUST be
michael@0 530 * passed in the order they are read from vpx_codec_get_mem_map(), but may be
michael@0 531 * passed in groups of any size. Segments \ref MUST be set only once. The
michael@0 532 * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
michael@0 533 * is non-NULL. If the segment requires cleanup handling (e.g., calling free()
michael@0 534 * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
michael@0 535 *
michael@0 536 * \param[in] ctx Pointer to this instance's context.
michael@0 537 * \param[in] mmaps Pointer to the first memory map entry in the list.
michael@0 538 * \param[in] num_maps Number of entries being set at this time
michael@0 539 *
michael@0 540 * \retval #VPX_CODEC_OK
michael@0 541 * The segment was stored in the codec context.
michael@0 542 * \retval #VPX_CODEC_INCAPABLE
michael@0 543 * Codec does not support XMA mode.
michael@0 544 * \retval #VPX_CODEC_MEM_ERROR
michael@0 545 * Segment base address was not set, or segment was already stored.
michael@0 546
michael@0 547 */
michael@0 548 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
michael@0 549 vpx_codec_mmap_t *mmaps,
michael@0 550 unsigned int num_maps);
michael@0 551
michael@0 552 /*!@} - end defgroup cap_xma*/
michael@0 553 /*!@} - end defgroup codec*/
michael@0 554 #ifdef __cplusplus
michael@0 555 }
michael@0 556 #endif
michael@0 557 #endif
michael@0 558

mercurial