silk.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (C) 2012-2012 Teluu Inc. (http://www.teluu.com)
  3. * Contributed by Regis Montoya (aka r3gis - www.r3gis.fr)
  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_SILK_H__
  20. #define __PJMEDIA_CODEC_SILK_H__
  21. /**
  22. * @file silk.h
  23. * @brief SILK codec.
  24. */
  25. #include <pjmedia-codec/types.h>
  26. /**
  27. * @defgroup PJMED_SILK SILK Codec Family
  28. * @ingroup PJMEDIA_CODEC_CODECS
  29. * @brief Implementation of SILK codecs (narrow/medium/wide/superwide-band).
  30. * @{
  31. *
  32. * This section describes functions to initialize and register SILK codec
  33. * factory to the codec manager. After the codec factory has been registered,
  34. * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
  35. *
  36. * The SILK codec uses multiple bit rates, and supports super wideband
  37. * (24 kHz sampling rate), wideband (16 kHz sampling rate), medium (12kHz
  38. * sampling rate), and narrowband (telephone quality, 8 kHz sampling rate).
  39. *
  40. * \section silk_codec_setting Codec Settings
  41. *
  42. * \subsection silk_general_setting General Settings
  43. *
  44. * General codec settings for this codec such as VAD and PLC can be
  45. * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
  46. * Please see the documentation of #pjmedia_codec_param for more info.
  47. *
  48. * \subsection silk_specific_setting Codec Specific Settings
  49. *
  50. * The following settings are applicable for this codec.
  51. *
  52. * \subsubsection silk_quality_vs_complexity Quality vs Complexity
  53. *
  54. * The SILK codec quality versus computational complexity and bandwidth
  55. * requirement can be adjusted by modifying the quality and complexity
  56. * setting, by calling #pjmedia_codec_silk_set_config().
  57. *
  58. * The default setting of quality is specified in
  59. * #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY. And the default setting of
  60. * complexity is specified in #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY.
  61. */
  62. PJ_BEGIN_DECL
  63. typedef struct pjmedia_codec_silk_setting
  64. {
  65. pj_bool_t enabled; /**< Enable/disable. */
  66. int quality; /**< Encoding quality, or use -1 for default
  67. (@see PJMEDIA_CODEC_SILK_DEFAULT_QUALITY). */
  68. int complexity; /**< Encoding complexity, or use -1 for default
  69. (@see PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY)*/
  70. } pjmedia_codec_silk_setting;
  71. /**
  72. * Initialize and register SILK codec factory to pjmedia endpoint. By default,
  73. * only narrowband (8kHz sampling rate) and wideband (16kHz sampling rate)
  74. * will be enabled. Quality and complexity for those sampling rate modes
  75. * will be set to the default values (see #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY
  76. * and #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY), application may modify these
  77. * settings via #pjmedia_codec_silk_set_config().
  78. *
  79. * @param endpt The pjmedia endpoint.
  80. *
  81. * @return PJ_SUCCESS on success.
  82. */
  83. PJ_DECL(pj_status_t) pjmedia_codec_silk_init(pjmedia_endpt *endpt);
  84. /**
  85. * Change the configuration setting of the SILK codec for the specified
  86. * clock rate.
  87. *
  88. * @param clock_rate PCM sampling rate, in Hz, valid values are 8000,
  89. * 12000, 16000 and 24000.
  90. * @param opt The setting to be applied for the specified
  91. * clock rate.
  92. *
  93. * @return PJ_SUCCESS on success.
  94. */
  95. PJ_DECL(pj_status_t) pjmedia_codec_silk_set_config(
  96. unsigned clock_rate,
  97. const pjmedia_codec_silk_setting *opt);
  98. /**
  99. * Unregister SILK codec factory from pjmedia endpoint and deinitialize
  100. * the SILK codec library.
  101. *
  102. * @return PJ_SUCCESS on success.
  103. */
  104. PJ_DECL(pj_status_t) pjmedia_codec_silk_deinit(void);
  105. PJ_END_DECL
  106. /**
  107. * @}
  108. */
  109. #endif /* __PJMEDIA_CODEC_SILK_H__ */