| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 * | 146 * |
| 147 * Each codec advertises the capabilities it supports as part of its | 147 * Each codec advertises the capabilities it supports as part of its |
| 148 * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces | 148 * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces |
| 149 * or functionality, and are not required to be supported. | 149 * or functionality, and are not required to be supported. |
| 150 * | 150 * |
| 151 * The available flags are specified by VPX_CODEC_CAP_* defines. | 151 * The available flags are specified by VPX_CODEC_CAP_* defines. |
| 152 */ | 152 */ |
| 153 typedef long vpx_codec_caps_t; | 153 typedef long vpx_codec_caps_t; |
| 154 #define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */ | 154 #define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */ |
| 155 #define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */ | 155 #define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */ |
| 156 #define VPX_CODEC_CAP_XMA 0x4 /**< Supports eXternal Memory Allocation */ | |
| 157 | 156 |
| 158 | 157 |
| 159 /*! \brief Initialization-time Feature Enabling | 158 /*! \brief Initialization-time Feature Enabling |
| 160 * | 159 * |
| 161 * Certain codec features must be known at initialization time, to allow for | 160 * Certain codec features must be known at initialization time, to allow for |
| 162 * proper memory allocation. | 161 * proper memory allocation. |
| 163 * | 162 * |
| 164 * The available flags are specified by VPX_CODEC_USE_* defines. | 163 * The available flags are specified by VPX_CODEC_USE_* defines. |
| 165 */ | 164 */ |
| 166 typedef long vpx_codec_flags_t; | 165 typedef long vpx_codec_flags_t; |
| 167 #define VPX_CODEC_USE_XMA 0x00000001 /**< Use eXternal Memory Allocation mode
*/ | |
| 168 | 166 |
| 169 | 167 |
| 170 /*!\brief Codec interface structure. | 168 /*!\brief Codec interface structure. |
| 171 * | 169 * |
| 172 * Contains function pointers and other data private to the codec | 170 * Contains function pointers and other data private to the codec |
| 173 * implementation. This structure is opaque to the application. | 171 * implementation. This structure is opaque to the application. |
| 174 */ | 172 */ |
| 175 typedef const struct vpx_codec_iface vpx_codec_iface_t; | 173 typedef const struct vpx_codec_iface vpx_codec_iface_t; |
| 176 | 174 |
| 177 | 175 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\ | 462 vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\ |
| 465 \ | 463 \ |
| 466 static vpx_codec_err_t \ | 464 static vpx_codec_err_t \ |
| 467 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\ | 465 vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\ |
| 468 return vpx_codec_control_(ctx, ctrl_id);\ | 466 return vpx_codec_control_(ctx, ctrl_id);\ |
| 469 } /**<\hideinitializer*/ | 467 } /**<\hideinitializer*/ |
| 470 | 468 |
| 471 | 469 |
| 472 #endif | 470 #endif |
| 473 | 471 |
| 474 | |
| 475 /*!\defgroup cap_xma External Memory Allocation Functions | |
| 476 * | |
| 477 * The following functions are required to be implemented for all codecs | |
| 478 * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions | |
| 479 * for codecs that don't advertise this capability will result in an error | |
| 480 * code being returned, usually VPX_CODEC_INCAPABLE | |
| 481 * @{ | |
| 482 */ | |
| 483 | |
| 484 | |
| 485 /*!\brief Memory Map Entry | |
| 486 * | |
| 487 * This structure is used to contain the properties of a memory segment. It | |
| 488 * is populated by the codec in the request phase, and by the calling | |
| 489 * application once the requested allocation has been performed. | |
| 490 */ | |
| 491 typedef struct vpx_codec_mmap { | |
| 492 /* | |
| 493 * The following members are set by the codec when requesting a segment | |
| 494 */ | |
| 495 unsigned int id; /**< identifier for the segment's contents */ | |
| 496 unsigned long sz; /**< size of the segment, in bytes */ | |
| 497 unsigned int align; /**< required alignment of the segment, in bytes */ | |
| 498 unsigned int flags; /**< bitfield containing segment properties */ | |
| 499 #define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */ | |
| 500 #define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */ | |
| 501 #define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */ | |
| 502 | |
| 503 /* The following members are to be filled in by the allocation function */ | |
| 504 void *base; /**< pointer to the allocated segment */ | |
| 505 void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */ | |
| 506 void *priv; /**< allocator private storage */ | |
| 507 } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */ | |
| 508 | |
| 509 | |
| 510 /*!\brief Iterate over the list of segments to allocate. | |
| 511 * | |
| 512 * Iterates over a list of the segments to allocate. The iterator storage | |
| 513 * should be initialized to NULL to start the iteration. Iteration is complete | |
| 514 * when this function returns VPX_CODEC_LIST_END. The amount of memory needed
to | |
| 515 * allocate is dependent upon the size of the encoded stream. In cases where t
he | |
| 516 * stream is not available at allocation time, a fixed size must be requested. | |
| 517 * The codec will not be able to operate on streams larger than the size used
at | |
| 518 * allocation time. | |
| 519 * | |
| 520 * \param[in] ctx Pointer to this instance's context. | |
| 521 * \param[out] mmap Pointer to the memory map entry to populate. | |
| 522 * \param[in,out] iter Iterator storage, initialized to NULL | |
| 523 * | |
| 524 * \retval #VPX_CODEC_OK | |
| 525 * The memory map entry was populated. | |
| 526 * \retval #VPX_CODEC_ERROR | |
| 527 * Codec does not support XMA mode. | |
| 528 * \retval #VPX_CODEC_MEM_ERROR | |
| 529 * Unable to determine segment size from stream info. | |
| 530 */ | |
| 531 vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx, | |
| 532 vpx_codec_mmap_t *mmap, | |
| 533 vpx_codec_iter_t *iter); | |
| 534 | |
| 535 | |
| 536 /*!\brief Identify allocated segments to codec instance | |
| 537 * | |
| 538 * Stores a list of allocated segments in the codec. Segments \ref MUST be | |
| 539 * passed in the order they are read from vpx_codec_get_mem_map(), but may be | |
| 540 * passed in groups of any size. Segments \ref MUST be set only once. The | |
| 541 * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member | |
| 542 * is non-NULL. If the segment requires cleanup handling (e.g., calling free() | |
| 543 * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated. | |
| 544 * | |
| 545 * \param[in] ctx Pointer to this instance's context. | |
| 546 * \param[in] mmaps Pointer to the first memory map entry in the list. | |
| 547 * \param[in] num_maps Number of entries being set at this time | |
| 548 * | |
| 549 * \retval #VPX_CODEC_OK | |
| 550 * The segment was stored in the codec context. | |
| 551 * \retval #VPX_CODEC_INCAPABLE | |
| 552 * Codec does not support XMA mode. | |
| 553 * \retval #VPX_CODEC_MEM_ERROR | |
| 554 * Segment base address was not set, or segment was already stored. | |
| 555 | |
| 556 */ | |
| 557 vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx, | |
| 558 vpx_codec_mmap_t *mmaps, | |
| 559 unsigned int num_maps); | |
| 560 | |
| 561 /*!@} - end defgroup cap_xma*/ | |
| 562 /*!@} - end defgroup codec*/ | 472 /*!@} - end defgroup codec*/ |
| 563 #ifdef __cplusplus | 473 #ifdef __cplusplus |
| 564 } | 474 } |
| 565 #endif | 475 #endif |
| 566 #endif // VPX_VPX_CODEC_H_ | 476 #endif // VPX_VPX_CODEC_H_ |
| 567 | 477 |
| OLD | NEW |