vpx_codec.h 19.2 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5
6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9
10
11
12
13
14
15
16
17
18
 */


/*!\defgroup codec Common Algorithm Interface
 * This abstraction allows applications to easily support multiple video
 * formats with minimal code duplication. This section describes the interface
 * common to all codecs (both encoders and decoders).
 * @{
 */

James Zern's avatar
James Zern committed
19
/*!\file
John Koleszar's avatar
John Koleszar committed
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 * \brief Describes the codec algorithm interface to applications.
 *
 * This file describes the interface between an application and a
 * video codec algorithm.
 *
 * An application instantiates a specific codec instance by using
 * vpx_codec_init() and a pointer to the algorithm's interface structure:
 *     <pre>
 *     my_app.c:
 *       extern vpx_codec_iface_t my_codec;
 *       {
 *           vpx_codec_ctx_t algo;
 *           res = vpx_codec_init(&algo, &my_codec);
 *       }
 *     </pre>
 *
 * Once initialized, the instance is manged using other functions from
 * the vpx_codec_* family.
 */
James Zern's avatar
James Zern committed
39
40
#ifndef VPX_VPX_CODEC_H_
#define VPX_VPX_CODEC_H_
Adrian Grange's avatar
Adrian Grange committed
41

John Koleszar's avatar
John Koleszar committed
42
43
44
45
#ifdef __cplusplus
extern "C" {
#endif

46
47
#include "./vpx_integer.h"
#include "./vpx_image.h"
John Koleszar's avatar
John Koleszar committed
48

John Koleszar's avatar
John Koleszar committed
49
  /*!\brief Decorator indicating a function is deprecated */
John Koleszar's avatar
John Koleszar committed
50
51
52
53
54
55
56
57
#ifndef DEPRECATED
#if defined(__GNUC__) && __GNUC__
#define DEPRECATED          __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED
#else
#define DEPRECATED
#endif
58
59
60
61
62
63
64
65
66
#endif  /* DEPRECATED */

#ifndef DECLSPEC_DEPRECATED
#if defined(__GNUC__) && __GNUC__
#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
#elif defined(_MSC_VER)
#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
#else
#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
John Koleszar's avatar
John Koleszar committed
67
#endif
68
#endif  /* DECLSPEC_DEPRECATED */
John Koleszar's avatar
John Koleszar committed
69

John Koleszar's avatar
John Koleszar committed
70
  /*!\brief Decorator indicating a function is potentially unused */
John Koleszar's avatar
John Koleszar committed
71
72
#ifdef UNUSED
#elif __GNUC__
73
#define UNUSED __attribute__ ((unused))
John Koleszar's avatar
John Koleszar committed
74
75
76
77
#else
#define UNUSED
#endif

John Koleszar's avatar
John Koleszar committed
78
79
80
81
82
83
84
85
  /*!\brief Current ABI version number
   *
   * \internal
   * If this file is altered in any way that changes the ABI, this value
   * must be bumped.  Examples include, but are not limited to, changing
   * types, removing or reassigning enums, adding/removing/rearranging
   * fields to structures
   */
John Koleszar's avatar
John Koleszar committed
86
87
#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/

John Koleszar's avatar
John Koleszar committed
88
89
90
91
  /*!\brief Algorithm return codes */
  typedef enum {
    /*!\brief Operation completed without error */
    VPX_CODEC_OK,
John Koleszar's avatar
John Koleszar committed
92

John Koleszar's avatar
John Koleszar committed
93
94
    /*!\brief Unspecified error */
    VPX_CODEC_ERROR,
John Koleszar's avatar
John Koleszar committed
95

John Koleszar's avatar
John Koleszar committed
96
97
    /*!\brief Memory operation failed */
    VPX_CODEC_MEM_ERROR,
John Koleszar's avatar
John Koleszar committed
98

John Koleszar's avatar
John Koleszar committed
99
100
    /*!\brief ABI version mismatch */
    VPX_CODEC_ABI_MISMATCH,
John Koleszar's avatar
John Koleszar committed
101

John Koleszar's avatar
John Koleszar committed
102
103
    /*!\brief Algorithm does not have required capability */
    VPX_CODEC_INCAPABLE,
John Koleszar's avatar
John Koleszar committed
104

John Koleszar's avatar
John Koleszar committed
105
    /*!\brief The given bitstream is not supported.
John Koleszar's avatar
John Koleszar committed
106
     *
John Koleszar's avatar
John Koleszar committed
107
108
109
110
     * The bitstream was unable to be parsed at the highest level. The decoder
     * is unable to proceed. This error \ref SHOULD be treated as fatal to the
     * stream. */
    VPX_CODEC_UNSUP_BITSTREAM,
John Koleszar's avatar
John Koleszar committed
111

John Koleszar's avatar
John Koleszar committed
112
    /*!\brief Encoded bitstream uses an unsupported feature
John Koleszar's avatar
John Koleszar committed
113
     *
John Koleszar's avatar
John Koleszar committed
114
115
116
117
     * The decoder does not implement a feature required by the encoder. This
     * return code should only be used for features that prevent future
     * pictures from being properly decoded. This error \ref MAY be treated as
     * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
John Koleszar's avatar
John Koleszar committed
118
     */
John Koleszar's avatar
John Koleszar committed
119
    VPX_CODEC_UNSUP_FEATURE,
John Koleszar's avatar
John Koleszar committed
120

John Koleszar's avatar
John Koleszar committed
121
    /*!\brief The coded data for this stream is corrupt or incomplete
John Koleszar's avatar
John Koleszar committed
122
     *
John Koleszar's avatar
John Koleszar committed
123
124
125
126
127
     * There was a problem decoding the current frame.  This return code
     * should only be used for failures that prevent future pictures from
     * being properly decoded. This error \ref MAY be treated as fatal to the
     * stream or \ref MAY be treated as fatal to the current GOP. If decoding
     * is continued for the current GOP, artifacts may be present.
John Koleszar's avatar
John Koleszar committed
128
     */
John Koleszar's avatar
John Koleszar committed
129
    VPX_CODEC_CORRUPT_FRAME,
John Koleszar's avatar
John Koleszar committed
130

John Koleszar's avatar
John Koleszar committed
131
    /*!\brief An application-supplied parameter is not valid.
John Koleszar's avatar
John Koleszar committed
132
133
     *
     */
John Koleszar's avatar
John Koleszar committed
134
    VPX_CODEC_INVALID_PARAM,
John Koleszar's avatar
John Koleszar committed
135

John Koleszar's avatar
John Koleszar committed
136
    /*!\brief An iterator reached the end of list.
John Koleszar's avatar
John Koleszar committed
137
138
     *
     */
John Koleszar's avatar
John Koleszar committed
139
    VPX_CODEC_LIST_END
John Koleszar's avatar
John Koleszar committed
140

John Koleszar's avatar
John Koleszar committed
141
142
  }
  vpx_codec_err_t;
John Koleszar's avatar
John Koleszar committed
143
144


John Koleszar's avatar
John Koleszar committed
145
146
147
148
149
150
151
152
153
154
155
156
  /*! \brief Codec capabilities bitfield
   *
   *  Each codec advertises the capabilities it supports as part of its
   *  ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
   *  or functionality, and are not required to be supported.
   *
   *  The available flags are specified by VPX_CODEC_CAP_* defines.
   */
  typedef long vpx_codec_caps_t;
#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
#define VPX_CODEC_CAP_XMA     0x4 /**< Supports eXternal Memory Allocation */
John Koleszar's avatar
John Koleszar committed
157
158


John Koleszar's avatar
John Koleszar committed
159
160
161
162
163
164
165
166
167
  /*! \brief Initialization-time Feature Enabling
   *
   *  Certain codec features must be known at initialization time, to allow for
   *  proper memory allocation.
   *
   *  The available flags are specified by VPX_CODEC_USE_* defines.
   */
  typedef long vpx_codec_flags_t;
#define VPX_CODEC_USE_XMA 0x00000001    /**< Use eXternal Memory Allocation mode */
John Koleszar's avatar
John Koleszar committed
168
169


John Koleszar's avatar
John Koleszar committed
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
  /*!\brief Codec interface structure.
   *
   * Contains function pointers and other data private to the codec
   * implementation. This structure is opaque to the application.
   */
  typedef const struct vpx_codec_iface vpx_codec_iface_t;


  /*!\brief Codec private data structure.
   *
   * Contains data private to the codec implementation. This structure is opaque
   * to the application.
   */
  typedef       struct vpx_codec_priv  vpx_codec_priv_t;


  /*!\brief Iterator
   *
   * Opaque storage used for iterating over lists.
   */
  typedef const void *vpx_codec_iter_t;


  /*!\brief Codec context structure
   *
   * All codecs \ref MUST support this context structure fully. In general,
   * this data should be considered private to the codec algorithm, and
   * not be manipulated or examined by the calling application. Applications
   * may reference the 'name' member to get a printable description of the
   * algorithm.
   */
  typedef struct vpx_codec_ctx {
    const char              *name;        /**< Printable interface name */
    vpx_codec_iface_t       *iface;       /**< Interface pointers */
    vpx_codec_err_t          err;         /**< Last returned error */
    const char              *err_detail;  /**< Detailed info, if available */
    vpx_codec_flags_t        init_flags;  /**< Flags passed at init time */
    union {
      struct vpx_codec_dec_cfg  *dec;   /**< Decoder Configuration Pointer */
      struct vpx_codec_enc_cfg  *enc;   /**< Encoder Configuration Pointer */
      void                      *raw;
    }                        config;      /**< Configuration pointer aliasing union */
    vpx_codec_priv_t        *priv;        /**< Algorithm private storage */
  } vpx_codec_ctx_t;


  /*
   * Library Version Number Interface
   *
   * For example, see the following sample return values:
   *     vpx_codec_version()           (1<<16 | 2<<8 | 3)
   *     vpx_codec_version_str()       "v1.2.3-rc1-16-gec6a1ba"
   *     vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
   */

  /*!\brief Return the version information (as an integer)
   *
   * Returns a packed encoding of the library version number. This will only include
   * the major.minor.patch component of the version number. Note that this encoded
   * value should be accessed through the macros provided, as the encoding may change
   * in the future.
   *
   */
  int vpx_codec_version(void);
#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
#define VPX_VERSION_MINOR(v) ((v>>8)&0xff)  /**< extract minor from packed version */
#define VPX_VERSION_PATCH(v) ((v>>0)&0xff)  /**< extract patch from packed version */
John Koleszar's avatar
John Koleszar committed
237

John Koleszar's avatar
John Koleszar committed
238
239
  /*!\brief Return the version major number */
#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
John Koleszar's avatar
John Koleszar committed
240

John Koleszar's avatar
John Koleszar committed
241
242
  /*!\brief Return the version minor number */
#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
John Koleszar's avatar
John Koleszar committed
243

John Koleszar's avatar
John Koleszar committed
244
245
  /*!\brief Return the version patch number */
#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
John Koleszar's avatar
John Koleszar committed
246
247


John Koleszar's avatar
John Koleszar committed
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
  /*!\brief Return the version information (as a string)
   *
   * Returns a printable string containing the full library version number. This may
   * contain additional text following the three digit version number, as to indicate
   * release candidates, prerelease versions, etc.
   *
   */
  const char *vpx_codec_version_str(void);


  /*!\brief Return the version information (as a string)
   *
   * Returns a printable "extra string". This is the component of the string returned
   * by vpx_codec_version_str() following the three digit version number.
   *
   */
  const char *vpx_codec_version_extra_str(void);


  /*!\brief Return the build configuration
   *
   * Returns a printable string containing an encoded version of the build
   * configuration. This may be useful to vpx support.
   *
   */
  const char *vpx_codec_build_config(void);


  /*!\brief Return the name for a given interface
   *
   * Returns a human readable string for name of the given codec interface.
   *
   * \param[in]    iface     Interface pointer
   *
   */
  const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);


  /*!\brief Convert error number to printable string
   *
   * Returns a human readable string for the last error returned by the
   * algorithm. The returned error will be one line and will not contain
   * any newline characters.
   *
   *
   * \param[in]    err     Error number.
   *
   */
  const char *vpx_codec_err_to_string(vpx_codec_err_t  err);


  /*!\brief Retrieve error synopsis for codec context
   *
   * Returns a human readable string for the last error returned by the
   * algorithm. The returned error will be one line and will not contain
   * any newline characters.
   *
   *
   * \param[in]    ctx     Pointer to this instance's context.
   *
   */
  const char *vpx_codec_error(vpx_codec_ctx_t  *ctx);


  /*!\brief Retrieve detailed error information for codec context
   *
   * Returns a human readable string providing detailed information about
   * the last error.
   *
   * \param[in]    ctx     Pointer to this instance's context.
   *
   * \retval NULL
   *     No detailed information is available.
   */
  const char *vpx_codec_error_detail(vpx_codec_ctx_t  *ctx);


  /* REQUIRED FUNCTIONS
   *
   * The following functions are required to be implemented for all codecs.
   * They represent the base case functionality expected of all codecs.
   */

  /*!\brief Destroy a codec instance
   *
   * Destroys a codec context, freeing any associated memory buffers.
   *
   * \param[in] ctx   Pointer to this instance's context
   *
   * \retval #VPX_CODEC_OK
   *     The codec algorithm initialized.
   * \retval #VPX_CODEC_MEM_ERROR
   *     Memory allocation failed.
   */
  vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);


  /*!\brief Get the capabilities of an algorithm.
   *
   * Retrieves the capabilities bitfield from the algorithm's interface.
   *
   * \param[in] iface   Pointer to the algorithm interface
   *
   */
  vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);


  /*!\brief Control algorithm
   *
   * This function is used to exchange algorithm specific data with the codec
   * instance. This can be used to implement features specific to a particular
   * algorithm.
   *
   * This wrapper function dispatches the request to the helper function
   * associated with the given ctrl_id. It tries to call this function
   * transparently, but will return #VPX_CODEC_ERROR if the request could not
   * be dispatched.
   *
   * Note that this function should not be used directly. Call the
   * #vpx_codec_control wrapper macro instead.
   *
   * \param[in]     ctx              Pointer to this instance's context
   * \param[in]     ctrl_id          Algorithm specific control identifier
   *
   * \retval #VPX_CODEC_OK
   *     The control request was processed.
   * \retval #VPX_CODEC_ERROR
   *     The control request was not processed.
   * \retval #VPX_CODEC_INVALID_PARAM
   *     The data was not valid.
   */
  vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t  *ctx,
                                     int               ctrl_id,
                                     ...);
John Koleszar's avatar
John Koleszar committed
382
383
384
385
386
387
388
#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
#    define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
#    define VPX_CTRL_USE_TYPE(id, typ)
#    define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
#    define VPX_CTRL_VOID(id, typ)

#else
John Koleszar's avatar
John Koleszar committed
389
390
391
392
393
394
395
396
397
  /*!\brief vpx_codec_control wrapper macro
   *
   * This macro allows for type safe conversions across the variadic parameter
   * to vpx_codec_control_().
   *
   * \internal
   * It works by dispatching the call to the control function through a wrapper
   * function named with the id parameter.
   */
John Koleszar's avatar
John Koleszar committed
398
#    define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
John Koleszar's avatar
John Koleszar committed
399
400
401
402
403
404
405
406
407
408
409
410
411
412
  /**<\hideinitializer*/


  /*!\brief vpx_codec_control type definition macro
   *
   * This macro allows for type safe conversions across the variadic parameter
   * to vpx_codec_control_(). It defines the type of the argument for a given
   * control identifier.
   *
   * \internal
   * It defines a static function with
   * the correctly typed arguments as a wrapper to the type-unsafe internal
   * function.
   */
John Koleszar's avatar
John Koleszar committed
413
#    define VPX_CTRL_USE_TYPE(id, typ) \
John Koleszar's avatar
John Koleszar committed
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
  static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
  \
  static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t  *ctx, int ctrl_id, typ data) {\
    return vpx_codec_control_(ctx, ctrl_id, data);\
  } /**<\hideinitializer*/


  /*!\brief vpx_codec_control deprecated type definition macro
   *
   * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
   * deprecated and should not be used. Consult the documentation for your
   * codec for more information.
   *
   * \internal
   * It defines a static function with the correctly typed arguments as a
   * wrapper to the type-unsafe internal function.
   */
John Koleszar's avatar
John Koleszar committed
433
#    define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
John Koleszar's avatar
John Koleszar committed
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
  DECLSPEC_DEPRECATED static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
  \
  DECLSPEC_DEPRECATED static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t  *ctx, int ctrl_id, typ data) {\
    return vpx_codec_control_(ctx, ctrl_id, data);\
  } /**<\hideinitializer*/


  /*!\brief vpx_codec_control void type definition macro
   *
   * This macro allows for type safe conversions across the variadic parameter
   * to vpx_codec_control_(). It indicates that a given control identifier takes
   * no argument.
   *
   * \internal
   * It defines a static function without a data argument as a wrapper to the
   * type-unsafe internal function.
   */
John Koleszar's avatar
John Koleszar committed
453
#    define VPX_CTRL_VOID(id) \
John Koleszar's avatar
John Koleszar committed
454
455
456
457
458
459
460
  static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
  \
  static vpx_codec_err_t \
  vpx_codec_control_##id(vpx_codec_ctx_t  *ctx, int ctrl_id) {\
    return vpx_codec_control_(ctx, ctrl_id);\
  } /**<\hideinitializer*/
John Koleszar's avatar
John Koleszar committed
461
462
463
464
465


#endif


John Koleszar's avatar
John Koleszar committed
466
467
468
469
470
471
472
473
  /*!\defgroup cap_xma External Memory Allocation Functions
   *
   * 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
   * @{
   */
John Koleszar's avatar
John Koleszar committed
474
475


John Koleszar's avatar
John Koleszar committed
476
477
478
479
480
481
482
483
484
  /*!\brief 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.
   */
  typedef struct vpx_codec_mmap {
    /*
     * The following members are set by the codec when requesting a segment
John Koleszar's avatar
John Koleszar committed
485
     */
John Koleszar's avatar
John Koleszar committed
486
487
488
489
    unsigned int   id;     /**< identifier for the segment's contents */
    unsigned long  sz;     /**< size of the segment, in bytes */
    unsigned int   align;  /**< required alignment of the segment, in bytes */
    unsigned int   flags;  /**< bitfield containing segment properties */
John Koleszar's avatar
John Koleszar committed
490
491
492
493
#define VPX_CODEC_MEM_ZERO     0x1  /**< Segment must be zeroed by allocation */
#define VPX_CODEC_MEM_WRONLY   0x2  /**< Segment need not be readable */
#define VPX_CODEC_MEM_FAST     0x4  /**< Place in fast memory, if available */

John Koleszar's avatar
John Koleszar committed
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
    /* The following members are to be filled in by the allocation function */
    void          *base;   /**< pointer to the allocated segment */
    void (*dtor)(struct vpx_codec_mmap *map);         /**< destructor to call */
    void          *priv;   /**< allocator private storage */
  } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */


  /*!\brief 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.
   *
   * \param[in]      ctx     Pointer to this instance's context.
   * \param[out]     mmap    Pointer to the memory map entry to populate.
   * \param[in,out]  iter    Iterator storage, initialized to NULL
   *
   * \retval #VPX_CODEC_OK
   *     The memory map entry was populated.
   * \retval #VPX_CODEC_ERROR
   *     Codec does not support XMA mode.
   * \retval #VPX_CODEC_MEM_ERROR
   *     Unable to determine segment size from stream info.
   */
  vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t                *ctx,
                                        vpx_codec_mmap_t               *mmap,
                                        vpx_codec_iter_t               *iter);


  /*!\brief Identify allocated segments to codec instance
   *
   * Stores a list of allocated segments in the codec. Segments \ref 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 \ref MUST be set only once. The
   * allocation function \ref 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 \ref MUST be populated.
   *
   * \param[in]      ctx     Pointer to this instance's context.
   * \param[in]      mmaps   Pointer to the first memory map entry in the list.
   * \param[in]      num_maps  Number of entries being set at this time
   *
   * \retval #VPX_CODEC_OK
   *     The segment was stored in the codec context.
   * \retval #VPX_CODEC_INCAPABLE
   *     Codec does not support XMA mode.
   * \retval #VPX_CODEC_MEM_ERROR
   *     Segment base address was not set, or segment was already stored.

   */
  vpx_codec_err_t  vpx_codec_set_mem_map(vpx_codec_ctx_t   *ctx,
                                         vpx_codec_mmap_t  *mmaps,
                                         unsigned int       num_maps);

  /*!@} - end defgroup cap_xma*/
  /*!@} - end defgroup codec*/
John Koleszar's avatar
John Koleszar committed
554
555
556
#ifdef __cplusplus
}
#endif
James Zern's avatar
James Zern committed
557
#endif  // VPX_VPX_CODEC_H_
Adrian Grange's avatar
Adrian Grange committed
558