summaryrefslogtreecommitdiff
path: root/pjmedia/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-02-20 01:28:25 +0000
committerBenny Prijono <bennylp@teluu.com>2006-02-20 01:28:25 +0000
commit295cee81042c609eea993b4f5c292614f979cbaa (patch)
treedd2dff73e000544e4b4c16772daa65821eec1adb /pjmedia/include
parentca9c14f791178caba306b47766b26bbbed8a34a8 (diff)
Added conference bridge prototype
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@203 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/include')
-rw-r--r--pjmedia/include/pjmedia/audio_conf.h78
-rw-r--r--pjmedia/include/pjmedia/stream.h17
-rw-r--r--pjmedia/include/pjmedia/types.h5
-rw-r--r--pjmedia/include/pjmedia/vad.h57
4 files changed, 147 insertions, 10 deletions
diff --git a/pjmedia/include/pjmedia/audio_conf.h b/pjmedia/include/pjmedia/audio_conf.h
new file mode 100644
index 00000000..0131ac4e
--- /dev/null
+++ b/pjmedia/include/pjmedia/audio_conf.h
@@ -0,0 +1,78 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2003-2006 Benny Prijono <benny@prijono.org>
+ *
+ * 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_CONF_H__
+#define __PJMEDIA_CONF_H__
+
+
+/**
+ * @file conf.h
+ * @brief Conference bridge.
+ */
+#include <pjmedia/types.h>
+
+/**
+ * Opaque type for conference bridge.
+ */
+typedef struct pjmedia_conf pjmedia_conf;
+
+
+/**
+ * Create conference bridge.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_create( pj_pool_t *pool,
+ unsigned max_ports,
+ pjmedia_conf **p_conf );
+
+
+/**
+ * Add stream port to the conference bridge.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_add_port( pjmedia_conf *conf,
+ pj_pool_t *pool,
+ pjmedia_stream_port *strm_port,
+ const pj_str_t *port_name,
+ unsigned *p_port );
+
+
+/**
+ * Mute or unmute port.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_set_mute( pjmedia_conf *conf,
+ unsigned port,
+ pj_bool_t mute );
+
+
+/**
+ * Set the specified port to be member of conference bridge.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_set_membership( pjmedia_conf *conf,
+ unsigned port,
+ pj_bool_t enabled );
+
+
+/**
+ * Remove the specified port.
+ */
+PJ_DECL(pj_status_t) pjmedia_conf_remove_port( pjmedia_conf *conf,
+ unsigned port );
+
+
+
+#endif /* __PJMEDIA_CONF_H__ */
+
diff --git a/pjmedia/include/pjmedia/stream.h b/pjmedia/include/pjmedia/stream.h
index 5f61bd61..57bbe636 100644
--- a/pjmedia/include/pjmedia/stream.h
+++ b/pjmedia/include/pjmedia/stream.h
@@ -98,6 +98,23 @@ struct pjmedia_stream_stat
/**
+ * Stream ports.
+ */
+struct pjmedia_stream_port
+{
+ /**
+ * Sink port.
+ */
+ pj_status_t (*put_frame)(const pj_int16_t *frame, pj_size_t frame_cnt);
+
+ /**
+ * Source port.
+ */
+ pj_status_t (*get_frame)(pj_int16_t *frame, pj_size_t frame_cnt);
+};
+
+
+/**
* Create a media stream based on the specified stream parameter.
* All channels in the stream initially will be inactive.
*
diff --git a/pjmedia/include/pjmedia/types.h b/pjmedia/include/pjmedia/types.h
index b0bda7e4..7f1a1060 100644
--- a/pjmedia/include/pjmedia/types.h
+++ b/pjmedia/include/pjmedia/types.h
@@ -151,6 +151,11 @@ typedef struct pjmedia_stream_info pjmedia_stream_info;
typedef struct pjmedia_stream_stat pjmedia_stream_stat;
/**
+ * @see pjmedia_stream_port
+ */
+typedef struct pjmedia_stream_port pjmedia_stream_port;
+
+/**
* Typedef for media stream.
*/
typedef struct pjmedia_stream pjmedia_stream;
diff --git a/pjmedia/include/pjmedia/vad.h b/pjmedia/include/pjmedia/vad.h
index 4788799b..a7da42d2 100644
--- a/pjmedia/include/pjmedia/vad.h
+++ b/pjmedia/include/pjmedia/vad.h
@@ -26,9 +26,11 @@
*/
#include <pjmedia/types.h>
+PJ_BEGIN_DECL
+
/**
- * Opaque data type for pjmedia vad.
+ * @see pjmedia_vad
*/
typedef struct pjmedia_vad pjmedia_vad;
@@ -48,6 +50,41 @@ PJ_DECL(pj_status_t) pjmedia_vad_create( pj_pool_t *pool,
/**
+ * Set the vad to operate in adaptive mode.
+ *
+ * @param vad The vad
+ * @param frame_size Number of samplse per frame.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vad_set_adaptive( pjmedia_vad *vad,
+ unsigned frame_size);
+
+
+/**
+ * Set the vad to operate in fixed threshold mode.
+ *
+ * @param vad The vad
+ * @param frame_size Number of samplse per frame.
+ * @param threshold The silence threshold.
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vad_set_fixed( pjmedia_vad *vad,
+ unsigned frame_size,
+ unsigned threshold );
+
+/**
+ * Disable the vad.
+ *
+ * @param vad The vad
+ *
+ * @return PJ_SUCCESS on success.
+ */
+PJ_DECL(pj_status_t) pjmedia_vad_disable( pjmedia_vad *vad );
+
+
+/**
* Calculate average signal level for the given samples.
*
* @param samples Pointer to 16-bit PCM samples.
@@ -56,8 +93,8 @@ PJ_DECL(pj_status_t) pjmedia_vad_create( pj_pool_t *pool,
* @return The average signal level, which simply is total level
* divided by number of samples.
*/
-PJ_DECL(pj_uint32_t) pjmedia_vad_calc_avg_signal_level( pj_int16_t samples[],
- pj_size_t count );
+PJ_DECL(pj_int32_t) pjmedia_vad_calc_avg_signal( const pj_int16_t samples[],
+ pj_size_t count );
/**
@@ -66,18 +103,18 @@ PJ_DECL(pj_uint32_t) pjmedia_vad_calc_avg_signal_level( pj_int16_t samples[],
* @param vad The VAD instance.
* @param samples Pointer to 16-bit PCM input samples.
* @param count Number of samples in the input.
- * @param p_silence Pointer to receive the silence detection result.
- * Non-zero value indicates that that input is considered
- * as silence.
+ * @param p_level Optional pointer to receive average signal level
+ * of the input samples.
*
* @return PJ_SUCCESS on success.
*/
-PJ_DECL(pj_status_t) pjmedia_vad_detect_silence( pjmedia_vad *vad,
- pj_int16_t samples[],
- pj_size_t count,
- pj_bool_t *p_silence);
+PJ_DECL(pj_bool_t) pjmedia_vad_detect_silence( pjmedia_vad *vad,
+ const pj_int16_t samples[],
+ pj_size_t count,
+ pj_int32_t *p_level);
+PJ_END_DECL
#endif /* __PJMEDIA_VAD_H__ */