tdav_codec_amr.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2010-2011 Mamadou Diop.
  3. *
  4. * Contact: Mamadou Diop <diopmamadou(at)doubango.org>
  5. *
  6. * This file is part of Open Source Doubango Framework.
  7. *
  8. * DOUBANGO is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * DOUBANGO is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with DOUBANGO.
  20. *
  21. */
  22. /**@file tdav_codec_amr.h
  23. * @brief AMR-NB and AMR-WB codecs.
  24. * RTP payloader/depayloader are based on RFC 4867
  25. *
  26. * @author Mamadou Diop <diopmamadou(at)doubango.org>
  27. *
  28. */
  29. #ifndef TINYDAV_CODEC_AMR_H
  30. #define TINYDAV_CODEC_AMR_H
  31. #include "tinydav_config.h"
  32. #if HAVE_OPENCORE_AMR
  33. #include "tinymedia/tmedia_codec.h"
  34. #include <opencore-amrnb/interf_dec.h>
  35. #include <opencore-amrnb/interf_enc.h>
  36. TDAV_BEGIN_DECLS
  37. #define TDAV_CODEC_AMR(self) ((tdav_codec_amr_t*)(self))
  38. typedef enum tdav_codec_amr_type_e {
  39. tdav_codec_amr_type_nb,
  40. tdav_codec_amr_type_wb,
  41. }
  42. tdav_codec_amr_type_t;
  43. typedef enum tdav_codec_amr_mode_e {
  44. tdav_codec_amr_mode_oa,
  45. tdav_codec_amr_mode_be,
  46. }
  47. tdav_codec_amr_mode_t;
  48. /** Base class for all AMR codecs */
  49. typedef struct tdav_codec_amr_s {
  50. TMEDIA_DECLARE_CODEC_AUDIO;
  51. tdav_codec_amr_type_t type;
  52. tdav_codec_amr_mode_t mode;
  53. enum Mode encoder_mode;
  54. void* encoder;
  55. void* decoder;
  56. unsigned modes:16; /**< 0..7 for NB and 0..8 for WB plus SID, SPEECH_LOST, NO_DATA etc etc */
  57. unsigned mcp:2; /**< mode-change-periode (1 or 2) */
  58. unsigned mcc:2; /**< mode-change-capability (1 or 2) */
  59. unsigned mcn:1; /**< mode-change-neighnor (0 or 1) */
  60. unsigned crc:1; /**< 0 or 1 */
  61. unsigned robust_sorting:1; /**< robust-sorting (0 or 1) */
  62. }
  63. tdav_codec_amr_t;
  64. #define TDAV_DECLARE_CODEC_AMR tdav_codec_amr_t __codec_amr__
  65. TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrnb_oa_plugin_def_t;
  66. TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrnb_be_plugin_def_t;
  67. TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrwb_oa_plugin_def_t;
  68. TINYDAV_GEXTERN const tmedia_codec_plugin_def_t *tdav_codec_amrwb_be_plugin_def_t;
  69. TDAV_END_DECLS
  70. #endif /* HAVE_OPENCORE_AMR */
  71. #endif /* TINYDAV_CODEC_AMR_H */