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