opencore_amr.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright (C) 2011-2013 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2011 Dan Arrhenius <dan@keystream.se>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __PJMEDIA_CODEC_OPENCORE_AMR_H__
  20. #define __PJMEDIA_CODEC_OPENCORE_AMR_H__
  21. #include <pjmedia-codec/types.h>
  22. /**
  23. * @defgroup PJMED_OC_AMR OpenCORE AMR Codec
  24. * @ingroup PJMEDIA_CODEC_CODECS
  25. * @brief AMRCodec wrapper for OpenCORE AMR codec
  26. * @{
  27. */
  28. PJ_BEGIN_DECL
  29. /**
  30. * Bitmask options to be passed during AMR codec factory initialization.
  31. */
  32. enum pjmedia_amr_options
  33. {
  34. PJMEDIA_AMR_NO_NB = 1, /**< Disable narrowband mode. */
  35. PJMEDIA_AMR_NO_WB = 2, /**< Disable wideband mode. */
  36. };
  37. /**
  38. * Settings. Use pjmedia_codec_opencore_amrnb_set_config() and
  39. * pjmedia_codec_opencore_amrwb_set_config() to activate.
  40. */
  41. typedef struct pjmedia_codec_amr_config
  42. {
  43. /**
  44. * Control whether to use octent align.
  45. */
  46. pj_bool_t octet_align;
  47. /**
  48. * Set the bitrate.
  49. */
  50. unsigned bitrate;
  51. } pjmedia_codec_amr_config;
  52. typedef pjmedia_codec_amr_config pjmedia_codec_amrnb_config;
  53. typedef pjmedia_codec_amr_config pjmedia_codec_amrwb_config;
  54. /**
  55. * Initialize and register AMR codec factory to pjmedia endpoint.
  56. *
  57. * @param endpt The pjmedia endpoint.
  58. * @param options Bitmask of pjmedia_amr_options (default=0).
  59. *
  60. * @return PJ_SUCCESS on success.
  61. */
  62. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_init(pjmedia_endpt* endpt,
  63. unsigned options);
  64. /**
  65. * Initialize and register AMR codec factory using default settings to
  66. * pjmedia endpoint.
  67. *
  68. * @param endpt The pjmedia endpoint.
  69. *
  70. * @return PJ_SUCCESS on success.
  71. */
  72. PJ_DECL(pj_status_t)
  73. pjmedia_codec_opencore_amr_init_default(pjmedia_endpt* endpt);
  74. /**
  75. * Unregister AMR codec factory from pjmedia endpoint and deinitialize
  76. * the OpenCORE codec library.
  77. *
  78. * @return PJ_SUCCESS on success.
  79. */
  80. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amr_deinit(void);
  81. /**
  82. * Initialize and register AMR-NB codec factory to pjmedia endpoint. Calling
  83. * this function will automatically initialize AMR codec factory without
  84. * the wideband mode (i.e. it is equivalent to calling
  85. * #pjmedia_codec_opencore_amr_init() with PJMEDIA_AMR_NO_WB). Application
  86. * should call #pjmedia_codec_opencore_amr_init() instead if wishing to use
  87. * both modes.
  88. *
  89. * @param endpt The pjmedia endpoint.
  90. *
  91. * @return PJ_SUCCESS on success.
  92. */
  93. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_init(pjmedia_endpt* endpt);
  94. /**
  95. * Unregister AMR-NB codec factory from pjmedia endpoint and deinitialize
  96. * the OpenCORE codec library.
  97. *
  98. * @return PJ_SUCCESS on success.
  99. */
  100. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_deinit(void);
  101. /**
  102. * Set AMR-NB parameters.
  103. *
  104. * @param cfg The settings;
  105. *
  106. * @return PJ_SUCCESS on success.
  107. */
  108. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrnb_set_config(
  109. const pjmedia_codec_amrnb_config* cfg);
  110. /**
  111. * Set AMR-WB parameters.
  112. *
  113. * @param cfg The settings;
  114. *
  115. * @return PJ_SUCCESS on success.
  116. */
  117. PJ_DECL(pj_status_t) pjmedia_codec_opencore_amrwb_set_config(
  118. const pjmedia_codec_amrwb_config* cfg);
  119. PJ_END_DECL
  120. /**
  121. * @}
  122. */
  123. #endif /* __PJMEDIA_CODEC_OPENCORE_AMRNB_H__ */