audio_codecs.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. */
  18. #ifndef __PJMEDIA_CODEC_ALL_CODECS_H__
  19. #define __PJMEDIA_CODEC_ALL_CODECS_H__
  20. /**
  21. * @file pjmedia-codec/audio_codecs.h
  22. * @brief Helper function to register all codecs
  23. */
  24. #include <pjmedia/endpoint.h>
  25. #include <pjmedia-codec/passthrough.h>
  26. PJ_BEGIN_DECL
  27. /**
  28. * @defgroup PJMEDIA_CODEC_REGISTER_ALL Codec registration helper
  29. * @ingroup PJMEDIA_CODEC_CODECS
  30. * @brief Helper function to register all codecs
  31. * @{
  32. *
  33. * Helper function to register all codecs that are implemented in
  34. * PJMEDIA-CODEC library.
  35. */
  36. /**
  37. * Codec configuration. Call #pjmedia_audio_codec_config_default() to initialize
  38. * this structure with the default values.
  39. */
  40. typedef struct pjmedia_audio_codec_config
  41. {
  42. /** Speex codec settings. See #pjmedia_codec_speex_init() for more info */
  43. struct {
  44. unsigned option; /**< Bitmask of options. */
  45. int quality; /**< Codec quality. */
  46. int complexity; /**< Codec complexity. */
  47. } speex;
  48. /** iLBC settings */
  49. struct {
  50. unsigned mode; /**< iLBC mode. */
  51. } ilbc;
  52. /** Passthrough */
  53. struct {
  54. pjmedia_codec_passthrough_setting setting; /**< Passthrough */
  55. } passthrough;
  56. } pjmedia_audio_codec_config;
  57. /**
  58. * Initialize pjmedia_audio_codec_config structure with default values.
  59. *
  60. * @param cfg The codec config to be initialized.
  61. */
  62. PJ_DECL(void)
  63. pjmedia_audio_codec_config_default(pjmedia_audio_codec_config *cfg);
  64. /**
  65. * Register all known audio codecs implemented in PJMEDA-CODEC library to the
  66. * specified media endpoint.
  67. *
  68. * @param endpt The media endpoint.
  69. * @param c Optional codec configuration, or NULL to use default
  70. * values.
  71. *
  72. * @return PJ_SUCCESS on success or the appropriate error code.
  73. */
  74. PJ_DECL(pj_status_t)
  75. pjmedia_codec_register_audio_codecs(pjmedia_endpt *endpt,
  76. const pjmedia_audio_codec_config *c);
  77. /**
  78. * @} PJMEDIA_CODEC_REGISTER_ALL
  79. */
  80. PJ_END_DECL
  81. #endif /* __PJMEDIA_CODEC_ALL_CODECS_H__ */