summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2006-07-27 22:04:56 +0000
committerBenny Prijono <bennylp@teluu.com>2006-07-27 22:04:56 +0000
commit34520eaca94bf5e4edb9fe37301c72f5b57aa7e2 (patch)
treedb0fde4c8e5ab0b422a079309877bfe9e376f845 /pjsip
parent9716653fda5019f1c944b0e1dafe304ab14e5aa3 (diff)
Added capability in pjsua to add application created media port to pjsua's conference bridge, also capability to use custom sound device in pjsua.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@632 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsua-lib/pjsua.h41
-rw-r--r--pjsip/include/pjsua-lib/pjsua_internal.h1
-rw-r--r--pjsip/src/pjsua-lib/pjsua_media.c48
3 files changed, 89 insertions, 1 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h
index 07287a0a..6958bc4f 100644
--- a/pjsip/include/pjsua-lib/pjsua.h
+++ b/pjsip/include/pjsua-lib/pjsua.h
@@ -2247,6 +2247,36 @@ PJ_DECL(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id id,
/**
+ * Add arbitrary media port to PJSUA's conference bridge. Application
+ * can use this function to add the media port that it creates. For
+ * media ports that are created by PJSUA-LIB (such as calls, file player,
+ * or file recorder), PJSUA-LIB will automatically add the port to
+ * the bridge.
+ *
+ * @param pool Pool to use.
+ * @param port Media port to be added to the bridge.
+ * @param p_id Optional pointer to receive the conference
+ * slot id.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_conf_add_port(pj_pool_t *pool,
+ pjmedia_port *port,
+ pjsua_conf_port_id *p_id);
+
+
+/**
+ * Remove arbitrary slot from the conference bridge. Application should only
+ * call this function if it registered the port manually.
+ *
+ * @param id The slot id of the port to be removed.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id id);
+
+
+/**
* Establish unidirectional media flow from souce to sink. One source
* may transmit to multiple destinations/sink. And if multiple
* sources are transmitting to the same sink, the media will be mixed
@@ -2424,6 +2454,17 @@ PJ_DECL(pj_status_t) pjsua_set_snd_dev(int capture_dev,
PJ_DECL(pj_status_t) pjsua_set_null_snd_dev(void);
+/**
+ * Disconnect the main conference bridge from any sound devices, and let
+ * application connect the bridge to it's own sound device/master port.
+ *
+ * @return The port interface of the conference bridge,
+ * so that application can connect this to it's own
+ * sound device or master port.
+ */
+PJ_DECL(pjmedia_port*) pjsua_set_no_snd_dev(void);
+
+
/*****************************************************************************
* Codecs.
*/
diff --git a/pjsip/include/pjsua-lib/pjsua_internal.h b/pjsip/include/pjsua-lib/pjsua_internal.h
index fe57b451..c862219f 100644
--- a/pjsip/include/pjsua-lib/pjsua_internal.h
+++ b/pjsip/include/pjsua-lib/pjsua_internal.h
@@ -204,6 +204,7 @@ struct pjsua_data
pjmedia_conf *mconf; /**< Conference bridge. */
int cap_dev; /**< Capture device ID. */
int play_dev; /**< Playback device ID. */
+ pj_bool_t no_snd; /**< No sound (app will manage it) */
pjmedia_snd_port *snd_port; /**< Sound port. */
pjmedia_master_port *null_snd; /**< Master port for null sound. */
pjmedia_port *null_port; /**< Null port. */
diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c
index a25c6745..c8c20490 100644
--- a/pjsip/src/pjsua-lib/pjsua_media.c
+++ b/pjsip/src/pjsua-lib/pjsua_media.c
@@ -339,7 +339,9 @@ pj_status_t pjsua_media_subsys_start(void)
}
/* Create sound port if none is created yet */
- if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL) {
+ if (pjsua_var.snd_port==NULL && pjsua_var.null_snd==NULL &&
+ !pjsua_var.no_snd)
+ {
status = pjsua_set_snd_dev(pjsua_var.cap_dev, pjsua_var.play_dev);
if (status != PJ_SUCCESS) {
/* Error opening sound device, use null device */
@@ -571,6 +573,35 @@ PJ_DEF(pj_status_t) pjsua_conf_get_port_info( pjsua_conf_port_id id,
/*
+ * Add arbitrary media port to PJSUA's conference bridge.
+ */
+PJ_DEF(pj_status_t) pjsua_conf_add_port( pj_pool_t *pool,
+ pjmedia_port *port,
+ pjsua_conf_port_id *p_id)
+{
+ pj_status_t status;
+
+ status = pjmedia_conf_add_port(pjsua_var.mconf, pool,
+ port, NULL, (unsigned*)p_id);
+ if (status != PJ_SUCCESS) {
+ if (p_id)
+ *p_id = PJSUA_INVALID_ID;
+ }
+
+ return status;
+}
+
+
+/*
+ * Remove arbitrary slot from the conference bridge.
+ */
+PJ_DEF(pj_status_t) pjsua_conf_remove_port(pjsua_conf_port_id id)
+{
+ return pjmedia_conf_remove_port(pjsua_var.mconf, (unsigned)id);
+}
+
+
+/*
* Establish unidirectional media flow from souce to sink.
*/
PJ_DEF(pj_status_t) pjsua_conf_connect( pjsua_conf_port_id source,
@@ -962,6 +993,21 @@ PJ_DEF(pj_status_t) pjsua_set_null_snd_dev(void)
}
+
+/*
+ * Use no device!
+ */
+PJ_DEF(pjmedia_port*) pjsua_set_no_snd_dev(void)
+{
+ /* Close existing sound device */
+ close_snd_dev();
+
+ pjsua_var.no_snd = PJ_TRUE;
+ return pjmedia_conf_get_master_port(pjsua_var.mconf);
+}
+
+
+
/*****************************************************************************
* Codecs.
*/