summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/python/_pjsua.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-19 15:40:21 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-19 15:40:21 +0000
commit2a67327941910feadbfd953e4f8b53e675d5fe1a (patch)
treeda3fbd97af216a62992ebfe23e3110bbad88719c /pjsip-apps/src/python/_pjsua.c
parentc2574cdf8965f1f7f77a77152c49e930af36a15b (diff)
Added WAV playlist and conf_set/get_level API to Python module
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2158 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip-apps/src/python/_pjsua.c')
-rw-r--r--pjsip-apps/src/python/_pjsua.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/pjsip-apps/src/python/_pjsua.c b/pjsip-apps/src/python/_pjsua.c
index 6590dd5c..65a48e90 100644
--- a/pjsip-apps/src/python/_pjsua.c
+++ b/pjsip-apps/src/python/_pjsua.c
@@ -3457,6 +3457,76 @@ static PyObject *py_pjsua_conf_disconnect
}
/*
+ * py_pjsua_conf_set_tx_level
+ */
+static PyObject *py_pjsua_conf_set_tx_level
+(PyObject *pSelf, PyObject *pArgs)
+{
+ int slot;
+ float level;
+ int status;
+
+ PJ_UNUSED_ARG(pSelf);
+
+ if (!PyArg_ParseTuple(pArgs, "if", &slot, &level))
+ {
+ return NULL;
+ }
+
+ status = pjsua_conf_adjust_tx_level(slot, level);
+
+
+ return Py_BuildValue("i", status);
+}
+
+/*
+ * py_pjsua_conf_set_rx_level
+ */
+static PyObject *py_pjsua_conf_set_rx_level
+(PyObject *pSelf, PyObject *pArgs)
+{
+ int slot;
+ float level;
+ int status;
+
+ PJ_UNUSED_ARG(pSelf);
+
+ if (!PyArg_ParseTuple(pArgs, "if", &slot, &level))
+ {
+ return NULL;
+ }
+
+ status = pjsua_conf_adjust_rx_level(slot, level);
+
+
+ return Py_BuildValue("i", status);
+}
+
+/*
+ * py_pjsua_conf_get_signal_level
+ */
+static PyObject *py_pjsua_conf_get_signal_level
+(PyObject *pSelf, PyObject *pArgs)
+{
+ int slot;
+ unsigned tx_level, rx_level;
+ int status;
+
+ PJ_UNUSED_ARG(pSelf);
+
+ if (!PyArg_ParseTuple(pArgs, "i", &slot))
+ {
+ return NULL;
+ }
+
+ status = pjsua_conf_get_signal_level(slot, &tx_level, &rx_level);
+
+
+ return Py_BuildValue("iff", status, (float)(tx_level/255.0),
+ (float)(rx_level/255.0));
+}
+
+/*
* py_pjsua_player_create
*/
static PyObject *py_pjsua_player_create
@@ -3482,6 +3552,45 @@ static PyObject *py_pjsua_player_create
}
/*
+ * py_pjsua_playlist_create
+ */
+static PyObject *py_pjsua_playlist_create
+(PyObject *pSelf, PyObject *pArgs)
+{
+ int id;
+ int options;
+ PyObject *arg_label, *arg_filelist;
+ pj_str_t label;
+ int count;
+ pj_str_t files[64];
+ int status;
+
+ PJ_UNUSED_ARG(pSelf);
+
+ if (!PyArg_ParseTuple(pArgs, "OOi", &arg_label, &arg_filelist, &options))
+ {
+ return NULL;
+ }
+ label.ptr = PyString_AsString(arg_label);
+ label.slen = PyString_Size(arg_label);
+
+ if (!PyList_Check(arg_filelist))
+ return NULL;
+
+ count = 0;
+ for (count=0; count<PyList_Size(arg_filelist) &&
+ count<PJ_ARRAY_SIZE(files); ++count)
+ {
+ files[count].ptr = PyString_AsString(PyList_GetItem(arg_filelist, count));
+ files[count].slen = PyString_Size(PyList_GetItem(arg_filelist, count));
+ }
+
+ status = pjsua_playlist_create(files, count, &label, options, &id);
+
+ return Py_BuildValue("ii", status, id);
+}
+
+/*
* py_pjsua_player_get_conf_port
*/
static PyObject *py_pjsua_player_get_conf_port
@@ -5765,10 +5874,28 @@ static PyMethodDef py_pjsua_methods[] =
pjsua_conf_disconnect_doc
},
{
+ "conf_set_tx_level", py_pjsua_conf_set_tx_level, METH_VARARGS,
+ "Adjust the signal level to be transmitted from the bridge to the"
+ " specified port by making it louder or quieter"
+ },
+ {
+ "conf_set_rx_level", py_pjsua_conf_set_rx_level, METH_VARARGS,
+ "Adjust the signal level to be received from the specified port (to"
+ " the bridge) by making it louder or quieter"
+ },
+ {
+ "conf_get_signal_level", py_pjsua_conf_get_signal_level, METH_VARARGS,
+ "Get last signal level transmitted to or received from the specified port"
+ },
+ {
"player_create", py_pjsua_player_create, METH_VARARGS,
pjsua_player_create_doc
},
{
+ "playlist_create", py_pjsua_playlist_create, METH_VARARGS,
+ "Create WAV playlist"
+ },
+ {
"player_get_conf_port", py_pjsua_player_get_conf_port, METH_VARARGS,
pjsua_player_get_conf_port_doc
},