Debian Codegraph @

Xpjproject/pjmedia/include/pjmedia-codec/g7221.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <[email protected]>
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_CODECS_G7221_H__
20 #define __PJMEDIA_CODECS_G7221_H__
21
22 /**
23 * @file pjmedia-codec/g7221.h
24 * @brief G722.1 codec.
25 */
26
27 #include <pjmedia-codec/types.h>
28
29 /**
30 * @defgroup PJMED_G7221_CODEC G.722.1 Codec (Siren7/Siren14)
31 * @ingroup PJMEDIA_CODEC_CODECS
32 * @brief Implementation of G.722.1 codec
33 * @{
34 *
35 * <b>G.722.1 licensed from Polycom�</b><br />
36 * <b>G.722.1 Annex C licensed from Polycom�</b>
37 *
38 * This section describes functions to initialize and register G.722.1 codec
39 * factory to the codec manager. After the codec factory has been registered,
40 * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
41 *
42 * PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation
43 * G.722.1 (05/2005) C fixed point implementation including its Annex C.
44 *
45 * G.722.1 is a low complexity codec that supports 7kHz and 14kHz audio
46 * bandwidth working at bitrates ranging from 16kbps to 48kbps. It may be
47 * used with speech or music inputs.
48 *
49 *
50 * \section g7221_codec_setting Codec Settings
51 *
52 * \subsection g7221_general_setting General Settings
53 *
54 * General codec settings for this codec such as VAD and PLC can be
55 * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
56 * Please see the documentation of #pjmedia_codec_param for more info.
57 *
58 * \subsection g7221_specific_setting Codec Specific Settings
59 *
60 * The following settings are applicable for this codec.
61 *
62 * \subsubsection g7221_bitrate Bitrate
63 *
64 * The codec implementation supports standard and non-standard bitrates.
65 * Use #pjmedia_codec_g7221_set_mode() to enable or disable the bitrates.
66 *
67 * By default, only standard bitrates are enabled upon initialization:
68 * - for 7kHz audio bandwidth (16kHz sampling rate): 24kbps and 32kbps,
69 * - for 14kHz audio bandwidth (32kHz sampling rate): 24kbps, 32kbps, and
70 * 48kbps.
71 *
72 * The usage of non-standard bitrates must follow these requirements:
73 * - for 7kHz audio bandwidth (16kHz sampling rate): 16000 to 32000 bps,
74 * multiplication of 400
75 * - for 14kHz audio bandwidth (32kHz sampling rate): 24000 to 48000 bps,
76 * multiplication of 400
77 *
78 * The bitrate is set via <tt>param.setting.dec_fmtp</tt>, if it does not
79 * contain bitrate info, the codec will check <tt>param.info.avg_bps</tt>.
80 *
81 * \note
82 * Currently only up to two non-standard modes can be enabled.
83 *
84 * \remark
85 * There is a flaw in the codec manager as currently it could not
86 * differentiate G.722.1 codecs by bitrates, hence invoking
87 * #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec
88 * with the highest priority (or first index found in codec enumeration
89 * when they have same priority) and invoking
90 * #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1
91 * codecs with sampling rate as specified.
92 */
93
94 PJ_BEGIN_DECL
95
96 /**
97 * Initialize and register G.722.1 codec factory to pjmedia endpoint.
98 *
99 * @param endpt The pjmedia endpoint.
100 *
101 * @return PJ_SUCCESS on success.
102 */
103 PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt );
104
105
106 /**
107 * Enable and disable G.722.1 mode. By default, the standard modes are
108 * enabled upon initialization, i.e.:
109 * - sampling rate 16kHz, bitrate 24kbps and 32kbps.
110 * - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps.
111 * This function can also be used for enabling non-standard modes.
112 * Note that currently only up to two non-standard modes can be enabled
113 * at one time.
114 *
115 * @param sample_rate PCM sampling rate, in Hz, valid values are only
116 * 16000 and 32000.
117 * @param bitrate G722.1 bitrate, in bps, the valid values are
118 * standard and non-standard bitrates as described
119 * above.
120 * @param enabled PJ_TRUE for enabling specified mode.
121 *
122 * @return PJ_SUCCESS on success.
123 */
124 PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_mode(unsigned sample_rate,
125 unsigned bitrate,
126 pj_bool_t enabled);
127
128 /**
129 * Set the G.722.1 codec encoder and decoder level adjustment.
130 * If the value is non-zero, then PCM input samples to the encoder will
131 * be shifted right by this value, and similarly PCM output samples from
132 * the decoder will be shifted left by this value.
133 *
134 * \note
135 * This function is also applicable for G722.1 implementation with IPP
136 * back-end.
137 *
138 * Default value is PJMEDIA_G7221_DEFAULT_PCM_SHIFT.
139 *
140 * @param val The value
141 *
142 * @return PJ_SUCCESS on success.
143 */
144 PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_pcm_shift(int val);
145
146
147
148 /**
149 * Unregister G.722.1 codecs factory from pjmedia endpoint.
150 *
151 * @return PJ_SUCCESS on success.
152 */
153 PJ_DECL(pj_status_t) pjmedia_codec_g7221_deinit(void);
154
155
156 PJ_END_DECL
157
158
159 /**
160 * @}
161 */
162
163 #endif /* __PJMEDIA_CODECS_G7221_H__ */
164