usage.dox 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*!\page usage Usage
  2. The aom multi-format codec SDK provides a unified interface amongst its
  3. supported codecs. This abstraction allows applications using this SDK to
  4. easily support multiple video formats with minimal code duplication or
  5. "special casing." This section describes the interface common to all codecs.
  6. For codec-specific details, see the \ref codecs page.
  7. The following sections are common to all codecs:
  8. - \ref usage_types
  9. - \ref usage_features
  10. - \ref usage_init
  11. - \ref usage_errors
  12. For more information on decoder and encoder specific usage, see the
  13. following pages:
  14. \if decoder
  15. \li \subpage usage_decode
  16. \endif
  17. \if encoder
  18. \li \subpage usage_encode
  19. \endif
  20. \section usage_types Important Data Types
  21. There are two important data structures to consider in this interface.
  22. \subsection usage_ctxs Contexts
  23. A context is a storage area allocated by the calling application that the
  24. codec may write into to store details about a single instance of that codec.
  25. Most of the context is implementation specific, and thus opaque to the
  26. application. The context structure as seen by the application is of fixed
  27. size, and thus can be allocated with automatic storage or dynamically
  28. on the heap.
  29. Most operations require an initialized codec context. Codec context
  30. instances are codec specific. That is, the codec to be used for the encoded
  31. video must be known at initialization time. See #aom_codec_ctx_t for further
  32. information.
  33. \subsection usage_ifaces Interfaces
  34. A codec interface is an opaque structure that controls how function calls
  35. into the generic interface are dispatched to their codec-specific
  36. implementations. Applications \ref MUSTNOT attempt to examine or override
  37. this storage, as it contains internal implementation details likely to
  38. change from release to release.
  39. Each supported codec will expose an interface structure to the application
  40. as an <code>extern</code> reference to a structure of the incomplete type
  41. #aom_codec_iface_t.
  42. \section usage_features Features
  43. Several "features" are defined that are optionally implemented by codec
  44. algorithms. Indeed, the same algorithm may support different features on
  45. different platforms. The purpose of defining these features is that when
  46. they are implemented, they conform to a common interface. The features, or
  47. capabilities, of an algorithm can be queried from it's interface by using
  48. the aom_codec_get_caps() method. Attempts to invoke features not supported
  49. by an algorithm will generally result in #AOM_CODEC_INCAPABLE.
  50. \if decoder
  51. Currently defined decoder features include:
  52. \endif
  53. \section usage_init Initialization
  54. To initialize a codec instance, the address of the codec context
  55. and interface structures are passed to an initialization function. Depending
  56. on the \ref usage_features that the codec supports, the codec could be
  57. initialized in different modes.
  58. To prevent cases of confusion where the ABI of the library changes,
  59. the ABI is versioned. The ABI version number must be passed at
  60. initialization time to ensure the application is using a header file that
  61. matches the library. The current ABI version number is stored in the
  62. preprocessor macros #AOM_CODEC_ABI_VERSION, #AOM_ENCODER_ABI_VERSION, and
  63. #AOM_DECODER_ABI_VERSION. For convenience, each initialization function has
  64. a wrapper macro that inserts the correct version number. These macros are
  65. named like the initialization methods, but without the _ver suffix.
  66. The available initialization methods are:
  67. \if encoder
  68. \li #aom_codec_enc_init (calls aom_codec_enc_init_ver())
  69. \endif
  70. \if decoder
  71. \li #aom_codec_dec_init (calls aom_codec_dec_init_ver())
  72. \endif
  73. \section usage_errors Error Handling
  74. Almost all codec functions return an error status of type #aom_codec_err_t.
  75. The semantics of how each error condition should be processed is clearly
  76. defined in the definitions of each enumerated value. Error values can be
  77. converted into ASCII strings with the aom_codec_error() and
  78. aom_codec_err_to_string() methods. The difference between these two methods is
  79. that aom_codec_error() returns the error state from an initialized context,
  80. whereas aom_codec_err_to_string() can be used in cases where an error occurs
  81. outside any context. The enumerated value returned from the last call can be
  82. retrieved from the <code>err</code> member of the decoder context as well.
  83. Finally, more detailed error information may be able to be obtained by using
  84. the aom_codec_error_detail() method. Not all errors produce detailed error
  85. information.
  86. In addition to error information, the codec library's build configuration
  87. is available at runtime on some platforms. This information can be returned
  88. by calling aom_codec_build_config(), and is formatted as a base64 coded string
  89. (comprised of characters in the set [a-z_a-Z0-9+/]). This information is not
  90. useful to an application at runtime, but may be of use to aom for support.
  91. */