| 1 | /* |
| 2 | * Copyright (C) 2017 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_BCG729_H__ |
| 19 | #define __PJMEDIA_CODEC_BCG729_H__ |
| 20 | |
| 21 | /** |
| 22 | * @file bcg729.h |
| 23 | * @brief BCG729 codec. |
| 24 | */ |
| 25 | |
| 26 | #include <pjmedia-codec/types.h> |
| 27 | |
| 28 | /** |
| 29 | * @defgroup PJMED_BCG729 BCG729 Codec |
| 30 | * @ingroup PJMEDIA_CODEC_CODECS |
| 31 | * @brief Implementation of BCG729 codecs. |
| 32 | * @{ |
| 33 | * |
| 34 | * This section describes functions to initialize and register BCG729 codec |
| 35 | * factory to the codec manager. After the codec factory has been registered, |
| 36 | * application can use @ref PJMEDIA_CODEC API to manipulate the codec. |
| 37 | * |
| 38 | * This codec factory contains G.729 codec. |
| 39 | * |
| 40 | * \section pjmedia_codec_bcg729 BCG729 |
| 41 | * |
| 42 | * BCG729 is compliant with ITU-T G.729 and Annexes A, B specifications. |
| 43 | * |
| 44 | * BCGG729 supports 16-bit PCM audio signal with sampling rate 8000Hz, |
| 45 | * frame length 10ms, and resulting in bitrate 8000bps. |
| 46 | * |
| 47 | * \subsection bcg729_codec_setting Codec Settings |
| 48 | * |
| 49 | * General codec settings for this codec such as VAD and PLC can be |
| 50 | * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param. |
| 51 | * Please see the documentation of #pjmedia_codec_param for more info. |
| 52 | * |
| 53 | * Note that G.729 VAD status should be signalled in SDP, see more |
| 54 | * description below. |
| 55 | * |
| 56 | * \subsubsection bcg729_annexb Annex B |
| 57 | * |
| 58 | * The capability of VAD/DTX is specified in Annex B. |
| 59 | * |
| 60 | * By default, Annex B is enabled. This default setting of Annex B can |
| 61 | * be modified using #pjmedia_codec_mgr_set_default_param(). |
| 62 | * |
| 63 | * In #pjmedia_codec_param, Annex B is configured via VAD setting and |
| 64 | * format parameter "annexb" in the SDP "a=fmtp" attribute in |
| 65 | * decoding fmtp field. Valid values are "yes" and "no", |
| 66 | * the implementation default is "yes". When this parameter is omitted |
| 67 | * in the SDP, the value will be "yes" (RFC 4856 Section 2.1.9). |
| 68 | * |
| 69 | * Here is an example of modifying default setting of Annex B to |
| 70 | * be disabled using #pjmedia_codec_mgr_set_default_param(): |
| 71 | \code |
| 72 | pjmedia_codec_param param; |
| 73 | |
| 74 | pjmedia_codec_mgr_get_default_param(.., ¶m); |
| 75 | ... |
| 76 | // Set VAD |
| 77 | param.setting.vad = 0; |
| 78 | // Set SDP format parameter |
| 79 | param.setting.dec_fmtp.cnt = 1; |
| 80 | param.setting.dec_fmtp.param[0].name = pj_str("annexb"); |
| 81 | param.setting.dec_fmtp.param[0].val = pj_str("no"); |
| 82 | ... |
| 83 | pjmedia_codec_mgr_set_default_param(.., ¶m); |
| 84 | \endcode |
| 85 | * |
| 86 | * \note |
| 87 | * The difference of Annex B status in SDP offer/answer may be considered as |
| 88 | * incompatible codec in SDP negotiation. |
| 89 | * |
| 90 | */ |
| 91 | |
| 92 | PJ_BEGIN_DECL |
| 93 | |
| 94 | /** |
| 95 | * Initialize and register BCG729 codec factory to pjmedia endpoint. |
| 96 | * |
| 97 | * @param endpt The pjmedia endpoint. |
| 98 | * |
| 99 | * @return PJ_SUCCESS on success. |
| 100 | */ |
| 101 | PJ_DECL(pj_status_t) pjmedia_codec_bcg729_init(pjmedia_endpt *endpt); |
| 102 | |
| 103 | /** |
| 104 | * Unregister BCG729 codec factory from pjmedia endpoint and deinitialize |
| 105 | * the BCG729 codec library. |
| 106 | * |
| 107 | * @return PJ_SUCCESS on success. |
| 108 | */ |
| 109 | PJ_DECL(pj_status_t) pjmedia_codec_bcg729_deinit(void); |
| 110 | |
| 111 | |
| 112 | PJ_END_DECL |
| 113 | |
| 114 | |
| 115 | /** |
| 116 | * @} |
| 117 | */ |
| 118 | |
| 119 | #endif /* __PJMEDIA_CODEC_BCG729_H__ */ |
| 120 |