summaryrefslogtreecommitdiff
path: root/pjmedia/include
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2012-09-24 06:58:16 +0000
committerNanang Izzuddin <nanang@teluu.com>2012-09-24 06:58:16 +0000
commit31425448324e10b5fb02557a9f1d5cc86df7bed3 (patch)
tree93edaaebaffa076a067eb38e65358e6a5158b3f6 /pjmedia/include
parentec7c46ffe515eb8613470c9956158ade6829b941 (diff)
Re #1586: Initial version of SILK wrapper.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4264 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r--pjmedia/include/pjmedia-codec.h3
-rw-r--r--pjmedia/include/pjmedia-codec/config.h32
-rw-r--r--pjmedia/include/pjmedia-codec/silk.h133
-rw-r--r--pjmedia/include/pjmedia-codec/types.h28
4 files changed, 183 insertions, 13 deletions
diff --git a/pjmedia/include/pjmedia-codec.h b/pjmedia/include/pjmedia-codec.h
index 48f7c8db..26389f8b 100644
--- a/pjmedia/include/pjmedia-codec.h
+++ b/pjmedia/include/pjmedia-codec.h
@@ -34,8 +34,9 @@
#include <pjmedia-codec/g722.h>
#include <pjmedia-codec/g7221.h>
#include <pjmedia-codec/ipp_codecs.h>
-#include <pjmedia-codec/passthrough.h>
#include <pjmedia-codec/opencore_amrnb.h>
+#include <pjmedia-codec/passthrough.h>
+#include <pjmedia-codec/silk.h>
#endif /* __PJMEDIA_CODEC_PJMEDIA_CODEC_H__ */
diff --git a/pjmedia/include/pjmedia-codec/config.h b/pjmedia/include/pjmedia-codec/config.h
index 99b1d910..a6aa2d66 100644
--- a/pjmedia/include/pjmedia-codec/config.h
+++ b/pjmedia/include/pjmedia-codec/config.h
@@ -378,6 +378,38 @@
/**
+ * Enable SILK codec.
+ *
+ * Default: 0
+ */
+#ifndef PJMEDIA_HAS_SILK_CODEC
+# define PJMEDIA_HAS_SILK_CODEC 0
+#endif
+
+
+/**
+ * SILK codec default complexity setting, valid values are 0 (lowest), 1,
+ * and 2.
+ *
+ * Default: 2
+ */
+#ifndef PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY
+# define PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY 2
+#endif
+
+/**
+ * SILK codec default quality setting, valid values are ranging from
+ * 0 (lowest) to 10. Please note that pjsua-lib may override this setting
+ * via its codec quality setting (i.e PJSUA_DEFAULT_CODEC_QUALITY).
+ *
+ * Default: 10
+ */
+#ifndef PJMEDIA_CODEC_SILK_DEFAULT_QUALITY
+# define PJMEDIA_CODEC_SILK_DEFAULT_QUALITY 10
+#endif
+
+
+/**
* Specify if FFMPEG codecs are available.
*
* Default: PJMEDIA_HAS_LIBAVCODEC
diff --git a/pjmedia/include/pjmedia-codec/silk.h b/pjmedia/include/pjmedia-codec/silk.h
new file mode 100644
index 00000000..ebb364e9
--- /dev/null
+++ b/pjmedia/include/pjmedia-codec/silk.h
@@ -0,0 +1,133 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2012-2012 Teluu Inc. (http://www.teluu.com)
+ * Contributed by Regis Montoya (aka r3gis - www.r3gis.fr)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __PJMEDIA_CODEC_SILK_H__
+#define __PJMEDIA_CODEC_SILK_H__
+
+/**
+ * @file silk.h
+ * @brief SILK codec.
+ */
+
+#include <pjmedia-codec/types.h>
+
+/**
+ * @defgroup PJMED_SILK SILK Codec Family
+ * @ingroup PJMEDIA_CODEC_CODECS
+ * @brief Implementation of SILK codecs (narrow/medium/wide/superwide-band).
+ * @{
+ *
+ * This section describes functions to initialize and register SILK codec
+ * factory to the codec manager. After the codec factory has been registered,
+ * application can use @ref PJMEDIA_CODEC API to manipulate the codec.
+ *
+ * The SILK codec uses multiple bit rates, and supports super wideband
+ * (24 kHz sampling rate), wideband (16 kHz sampling rate), medium (12kHz
+ * sampling rate), and narrowband (telephone quality, 8 kHz sampling rate).
+ *
+ * By default, the SILK codec factory registers two SILK codecs:
+ * "SILK/8000" narrowband codec and "SILK/16000" wideband codec. This behavior
+ * can be changed by specifying #pjmedia_codec_silk_options flags during
+ * initialization.
+ *
+ *
+ * \section codec_setting Codec Settings
+ *
+ * \subsection general_setting General Settings
+ *
+ * General codec settings for this codec such as VAD and PLC can be
+ * manipulated through the <tt>setting</tt> field in #pjmedia_codec_param.
+ * Please see the documentation of #pjmedia_codec_param for more info.
+ *
+ * \subsection specific_setting Codec Specific Settings
+ *
+ * The following settings are applicable for this codec.
+ *
+ * \subsubsection quality_vs_complexity Quality vs Complexity
+ *
+ * The SILK codec quality versus computational complexity and bandwidth
+ * requirement can be adjusted by modifying the quality and complexity
+ * setting, by calling #pjmedia_codec_silk_set_config().
+ *
+ * The default setting of quality is specified in
+ * #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY. And the default setting of
+ * complexity is specified in #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY.
+ */
+
+PJ_BEGIN_DECL
+
+typedef struct pjmedia_codec_silk_setting
+{
+ pj_bool_t enabled; /**< Enable/disable. */
+ int quality; /**< Encoding quality, or use -1 for default
+ (@see PJMEDIA_CODEC_SILK_DEFAULT_QUALITY). */
+ int complexity; /**< Encoding complexity, or use -1 for default
+ (@see PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY)*/
+} pjmedia_codec_silk_setting;
+
+
+/**
+ * Initialize and register SILK codec factory to pjmedia endpoint. By default,
+ * only narrowband (8kHz sampling rate) and wideband (16kHz sampling rate)
+ * will be enabled. Quality and complexity for those sampling rate modes
+ * will be set to the default values (see #PJMEDIA_CODEC_SILK_DEFAULT_QUALITY
+ * and #PJMEDIA_CODEC_SILK_DEFAULT_COMPLEXITY), application may modify these
+ * settings via #pjmedia_codec_silk_set_config().
+ *
+ * @param endpt The pjmedia endpoint.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_init(pjmedia_endpt *endpt);
+
+
+/**
+ * Change the configuration setting of the SILK codec for the specified
+ * clock rate.
+ *
+ * @param clock_rate PCM sampling rate, in Hz, valid values are 8000,
+ * 12000, 16000 and 24000.
+ * @param opt The setting to be applied for the specified
+ * clock rate.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_set_config(
+ unsigned clock_rate,
+ const pjmedia_codec_silk_setting *opt);
+
+
+/**
+ * Unregister SILK codec factory from pjmedia endpoint and deinitialize
+ * the SILK codec library.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_codec_silk_deinit(void);
+
+
+PJ_END_DECL
+
+
+/**
+ * @}
+ */
+
+#endif /* __PJMEDIA_CODEC_SILK_H__ */
+
diff --git a/pjmedia/include/pjmedia-codec/types.h b/pjmedia/include/pjmedia-codec/types.h
index 752a1fcb..d0549f5e 100644
--- a/pjmedia/include/pjmedia-codec/types.h
+++ b/pjmedia/include/pjmedia-codec/types.h
@@ -63,18 +63,10 @@ enum pjmedia_audio_pt
PJMEDIA_RTP_PT_SPEEX_NB, /**< Speex narrowband/8KHz */
PJMEDIA_RTP_PT_SPEEX_WB, /**< Speex wideband/16KHz */
PJMEDIA_RTP_PT_SPEEX_UWB, /**< Speex 32KHz */
- PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */
- PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */
- //PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */
- //PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */
- PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */
- PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */
- //PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */
- //PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */
- //PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */
- //PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */
- //PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */
- //PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */
+ PJMEDIA_RTP_PT_SILK_NB, /**< SILK narrowband/8KHz */
+ PJMEDIA_RTP_PT_SILK_MB, /**< SILK mediumband/12KHz */
+ PJMEDIA_RTP_PT_SILK_WB, /**< SILK wideband/16KHz */
+ PJMEDIA_RTP_PT_SILK_SWB, /**< SILK 24KHz */
PJMEDIA_RTP_PT_ILBC, /**< iLBC (13.3/15.2Kbps) */
PJMEDIA_RTP_PT_AMR, /**< AMR (4.75 - 12.2Kbps) */
PJMEDIA_RTP_PT_AMRWB, /**< AMRWB (6.6 - 23.85Kbps)*/
@@ -91,6 +83,18 @@ enum pjmedia_audio_pt
PJMEDIA_RTP_PT_G7221C_48, /**< G722.1 Annex C (48Kbps)*/
PJMEDIA_RTP_PT_G7221_RSV1, /**< G722.1 reserve */
PJMEDIA_RTP_PT_G7221_RSV2, /**< G722.1 reserve */
+ PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */
+ PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */
+ //PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */
+ //PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */
+ PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */
+ PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */
+ //PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */
+ //PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */
+ //PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */
+ //PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */
+ //PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */
+ //PJMEDIA_RTP_PT_L16_48KHZ_STEREO, /**< L16 @ 48KHz, stereo */
/* Caution!
* Ensure the value of the last pt above is <= 127.