WebM VP8 Codec SDK: External Memory Allocation Functions

WebM VP8 Codec SDK

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

Data Structures | Typedefs | Functions
External Memory Allocation Functions
Common Algorithm Interface

## Data Structures
struct | vpx_codec_mmap
| Memory Map Entry. More...

## Typedefs
typedef struct vpx_codec_mmap | vpx_codec_mmap_t
| Memory Map Entry. More...

## Functions
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. More...
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. More...

## Detailed Description

The following functions are required to be implemented for all codecs that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions for codecs that don't advertise this capability will result in an error code being returned, usually VPX_CODEC_INCAPABLE

## Typedef Documentation

typedef struct vpx_codec_mmap vpx_codec_mmap_t

Memory Map Entry.

This structure is used to contain the properties of a memory segment. It is populated by the codec in the request phase, and by the calling application once the requested allocation has been performed.alias for struct vpx_codec_mmap

## Function Documentation

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.

Iterates over a list of the segments to allocate. The iterator storage should be initialized to NULL to start the iteration. Iteration is complete when this function returns VPX_CODEC_LIST_END. The amount of memory needed to allocate is dependent upon the size of the encoded stream. In cases where the stream is not available at allocation time, a fixed size must be requested. The codec will not be able to operate on streams larger than the size used at allocation time.

Parameters

  [in] | ctx | Pointer to this instance's context.
  [out] | mmap | Pointer to the memory map entry to populate.
  [in,out] | iter | Iterator storage, initialized to NULL

Return values

  VPX_CODEC_OK | The memory map entry was populated.
  VPX_CODEC_ERROR | Codec does not support XMA mode.
  VPX_CODEC_MEM_ERROR | Unable to determine segment size from stream info.

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.

Stores a list of allocated segments in the codec. Segments MUST be passed in the order they are read from vpx_codec_get_mem_map(), but may be passed in groups of any size. Segments MUST be set only once. The allocation function MUST ensure that the vpx_codec_mmap_t::base member is non-NULL. If the segment requires cleanup handling (e.g., calling free() or close()) then the vpx_codec_mmap_t::dtor member MUST be populated.

Parameters

  [in] | ctx | Pointer to this instance's context.
  [in] | mmaps | Pointer to the first memory map entry in the list.
  [in] | num_maps | Number of entries being set at this time

Return values

  VPX_CODEC_OK | The segment was stored in the codec context.
  VPX_CODEC_INCAPABLE | Codec does not support XMA mode.
  VPX_CODEC_MEM_ERROR | Segment base address was not set, or segment was already stored.