1
/* $Id: g7221.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJMEDIA_CODECS_G7221_H__
21
#define __PJMEDIA_CODECS_G7221_H__
24
* @file pjmedia-codec/g7221.h
25
* @brief G722.1 codec.
28
#include <pjmedia-codec/types.h>
31
* @defgroup PJMED_G7221_CODEC G.722.1 Codec (Siren7/Siren14)
32
* @ingroup PJMEDIA_CODEC_CODECS
33
* @brief Implementation of G.722.1 codec
36
* <b>G.722.1 licensed from Polycom�</b><br />
37
* <b>G.722.1 Annex C licensed from Polycom�</b>
39
* This section describes functions to initialize and register G.722.1 codec
40
* factory to the codec manager. After the codec factory has been registered,
41
* application can use @ref PJMEDIA_CODEC API to manipulate the codec.
43
* PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation
44
* G.722.1 (05/2005) C fixed point implementation including its Annex C.
46
* G.722.1 is a low complexity codec that supports 7kHz and 14kHz audio
47
* bandwidth working at bitrates ranging from 16kbps to 48kbps. It may be
48
* used with speech or music inputs.
51
* \section codec_setting Codec Settings
53
* \subsection general_setting General Settings
55
* General codec settings for this codec such as VAD and PLC can be
56
* manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
57
* Please see the documentation of #pjmedia_codec_param for more info.
59
* \subsection specific_setting Codec Specific Settings
61
* The following settings are applicable for this codec.
63
* \subsubsection bitrate Bitrate
65
* The codec implementation supports standard and non-standard bitrates.
66
* Use #pjmedia_codec_g7221_set_mode() to enable or disable the bitrates.
68
* By default, only standard bitrates are enabled upon initialization:
69
* - for 7kHz audio bandwidth (16kHz sampling rate): 24kbps and 32kbps,
70
* - for 14kHz audio bandwidth (32kHz sampling rate): 24kbps, 32kbps, and
73
* The usage of non-standard bitrates must follow these requirements:
74
* - for 7kHz audio bandwidth (16kHz sampling rate): 16000 to 32000 bps,
75
* multiplication of 400
76
* - for 14kHz audio bandwidth (32kHz sampling rate): 24000 to 48000 bps,
77
* multiplication of 400
80
* Currently only up to two non-standard modes can be enabled.
83
* There is a flaw in the codec manager as currently it could not
84
* differentiate G.722.1 codecs by bitrates, hence invoking
85
* #pjmedia_codec_mgr_set_default_param() may only affect a G.722.1 codec
86
* with the highest priority (or first index found in codec enumeration
87
* when they have same priority) and invoking
88
* #pjmedia_codec_mgr_set_codec_priority() will set priority of all G.722.1
89
* codecs with sampling rate as specified.
95
* Initialize and register G.722.1 codec factory to pjmedia endpoint.
97
* @param endpt The pjmedia endpoint.
99
* @return PJ_SUCCESS on success.
101
PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt );
105
* Enable and disable G.722.1 mode. By default, the standard modes are
106
* enabled upon initialization, i.e.:
107
* - sampling rate 16kHz, bitrate 24kbps and 32kbps.
108
* - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps.
109
* This function can also be used for enabling non-standard modes.
110
* Note that currently only up to two non-standard modes can be enabled
113
* @param sample_rate PCM sampling rate, in Hz, valid values are only
115
* @param bitrate G722.1 bitrate, in bps, the valid values are
116
* standard and non-standard bitrates as described
118
* @param enabled PJ_TRUE for enabling specified mode.
120
* @return PJ_SUCCESS on success.
122
PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_mode(unsigned sample_rate,
127
* Set the G.722.1 codec encoder and decoder level adjustment.
128
* If the value is non-zero, then PCM input samples to the encoder will
129
* be shifted right by this value, and similarly PCM output samples from
130
* the decoder will be shifted left by this value.
133
* This function is also applicable for G722.1 implementation with IPP
136
* Default value is PJMEDIA_G7221_DEFAULT_PCM_SHIFT.
138
* @param val The value
140
* @return PJ_SUCCESS on success.
142
PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_pcm_shift(int val);
147
* Unregister G.722.1 codecs factory from pjmedia endpoint.
149
* @return PJ_SUCCESS on success.
151
PJ_DECL(pj_status_t) pjmedia_codec_g7221_deinit(void);
161
#endif /* __PJMEDIA_CODECS_G7221_H__ */