Debian Codegraph @

Xpjproject/pjmedia/include/pjmedia-codec/speex.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_CODEC_SPEEX_H__
20 #define __PJMEDIA_CODEC_SPEEX_H__
21
22 /**
23 * @file speex.h
24 * @brief Speex codec header.
25 */
26
27 #include <pjmedia-codec/types.h>
28
29 /**
30 * @defgroup PJMED_SPEEX Speex Codec Family
31 * @ingroup PJMEDIA_CODEC_CODECS
32 * @brief Implementation of Speex codecs (narrow/wide/ultrawide-band).
33 * @{
34 *
35 * This section describes functions to initialize and register speex codec
36 * factory to the codec manager. After the codec factory has been registered,
37 * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
38 *
39 * The Speex codec uses multiple bit rates, and supports ultra-wideband
40 * (32 kHz sampling rate), wideband (16 kHz sampling rate) and narrowband
41 * (telephone quality, 8 kHz sampling rate)
42 *
43 * By default, the speex codec factory registers three Speex codecs:
44 * "speex/8000" narrowband codec, "speex/16000" wideband codec, and
45 * "speex/32000" ultra-wideband codec. This behavior can be changed by
46 * specifying #pjmedia_speex_options flags during initialization.
47 *
48 *
49 * \section speex_codec_setting Codec Settings
50 *
51 * \subsection speex_general_setting General Settings
52 *
53 * General codec settings for this codec such as VAD and PLC can be
54 * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
55 * Please see the documentation of #pjmedia_codec_param for more info.
56 *
57 * \subsection speex_specific_setting Codec Specific Settings
58 *
59 * The following settings are applicable for this codec.
60 *
61 * \subsubsection speex_quality_vs_complexity Quality vs Complexity
62 *
63 * The Speex codec quality versus computational complexity and bandwidth
64 * requirement can be adjusted by modifying the quality and complexity
65 * setting, by calling #pjmedia_codec_speex_set_param(). The RFC 5574
66 * Section 5 shows the relationship between quality setting and the
67 * resulting bitrate.
68 *
69 * The default setting of quality is specified in
70 * #PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY. And the default setting of
71 * complexity is specified in #PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY.
72 */
73
74 PJ_BEGIN_DECL
75
76
77 /**
78 * Bitmask options to be passed during Speex codec factory initialization.
79 */
80 enum pjmedia_speex_options
81 {
82 PJMEDIA_SPEEX_NO_NB = 1, /**< Disable narrowband mode. */
83 PJMEDIA_SPEEX_NO_WB = 2, /**< Disable wideband mode. */
84 PJMEDIA_SPEEX_NO_UWB = 4, /**< Disable ultra-wideband mode. */
85 };
86
87
88 /**
89 * Initialize and register Speex codec factory to pjmedia endpoint.
90 *
91 * @param endpt The pjmedia endpoint.
92 * @param options Bitmask of pjmedia_speex_options (default=0).
93 * @param quality Specify encoding quality, or use -1 for default
94 * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).
95 * @param complexity Specify encoding complexity , or use -1 for default
96 * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).
97 *
98 * @return PJ_SUCCESS on success.
99 */
100 PJ_DECL(pj_status_t) pjmedia_codec_speex_init( pjmedia_endpt *endpt,
101 unsigned options,
102 int quality,
103 int complexity );
104
105
106 /**
107 * Initialize Speex codec factory using default settings and register to
108 * pjmedia endpoint.
109 *
110 * @param endpt The pjmedia endpoint.
111 *
112 * @return PJ_SUCCESS on success.
113 */
114 PJ_DECL(pj_status_t) pjmedia_codec_speex_init_default(pjmedia_endpt *endpt);
115
116
117 /**
118 * Change the settings of Speex codec.
119 *
120 * @param clock_rate Clock rate of Speex mode to be set.
121 * @param quality Specify encoding quality, or use -1 for default
122 * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY).
123 * @param complexity Specify encoding complexity , or use -1 for default
124 * (@see PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY).
125 *
126 * @return PJ_SUCCESS on success.
127 */
128 PJ_DECL(pj_status_t) pjmedia_codec_speex_set_param(unsigned clock_rate,
129 int quality,
130 int complexity);
131
132
133 /**
134 * Unregister Speex codec factory from pjmedia endpoint and deinitialize
135 * the Speex codec library.
136 *
137 * @return PJ_SUCCESS on success.
138 */
139 PJ_DECL(pj_status_t) pjmedia_codec_speex_deinit(void);
140
141
142 PJ_END_DECL
143
144 /**
145 * @}
146 */
147
148 #endif /* __PJMEDIA_CODEC_SPEEX_H__ */
149