Commit 8e7a9cbd authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add definitions of the types of PayloadType in the Python wrapper.

parent 31ab25d8
...@@ -365,3 +365,42 @@ PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs) { ...@@ -365,3 +365,42 @@ PyObject * PyLinphoneVideoSize_FromMSVideoSize(MSVideoSize vs) {
} }
return pyret; return pyret;
} }
static PyObject * pylinphone_PayloadTypeType_module_method_string(PyObject *self, PyObject *args) {
const char *value_str = "[invalid]";
int value;
PyObject *pyret;
if (!PyArg_ParseTuple(args, "i", &value)) {
return NULL;
}
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%d)", __FUNCTION__, value);
switch (value) {
case PAYLOAD_AUDIO_CONTINUOUS:
value_str = "PAYLOAD_AUDIO_CONTINUOUS";
break;
case PAYLOAD_AUDIO_PACKETIZED:
value_str = "PAYLOAD_AUDIO_PACKETIZED";
break;
case PAYLOAD_VIDEO:
value_str = "PAYLOAD_VIDEO";
break;
case PAYLOAD_TEXT:
value_str = "PAYLOAD_TEXT";
break;
case PAYLOAD_OTHER:
value_str = "PAYLOAD_OTHER";
break;
default:
break;
}
pyret = Py_BuildValue("z", value_str);
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, pyret);
return pyret;
}
static PyMethodDef pylinphone_PayloadTypeType_ModuleMethods[] = {
{ "string", pylinphone_PayloadTypeType_module_method_string, METH_VARARGS, "Get a string representation of a linphone.PayloadTypeType value." },
/* Sentinel */
{ NULL, NULL, 0, NULL }
};
...@@ -258,6 +258,15 @@ PyMODINIT_FUNC initlinphone(void) { ...@@ -258,6 +258,15 @@ PyMODINIT_FUNC initlinphone(void) {
{{/enum_values}} {{/enum_values}}
{{/enums}} {{/enums}}
menum = Py_InitModule3("PayloadTypeType", pylinphone_PayloadTypeType_ModuleMethods, "Type of linphone.PayloadType.");
if (menum == NULL) return;
if (PyModule_AddObject(m, "PayloadTypeType", menum) < 0) return;
if (PyModule_AddIntConstant(menum, "PAYLOAD_AUDIO_CONTINUOUS", PAYLOAD_AUDIO_CONTINUOUS) < 0) return;
if (PyModule_AddIntConstant(menum, "PAYLOAD_AUDIO_PACKETIZED", PAYLOAD_AUDIO_PACKETIZED) < 0) return;
if (PyModule_AddIntConstant(menum, "PAYLOAD_VIDEO", PAYLOAD_VIDEO) < 0) return;
if (PyModule_AddIntConstant(menum, "PAYLOAD_TEXT", PAYLOAD_TEXT) < 0) return;
if (PyModule_AddIntConstant(menum, "PAYLOAD_OTHER", PAYLOAD_OTHER) < 0) return;
{{#classes}} {{#classes}}
Py_INCREF(&pylinphone_{{class_name}}Type); Py_INCREF(&pylinphone_{{class_name}}Type);
PyModule_AddObject(m, "{{class_name}}", (PyObject *)&pylinphone_{{class_name}}Type); PyModule_AddObject(m, "{{class_name}}", (PyObject *)&pylinphone_{{class_name}}Type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment