Add Python wrapper for linphone_core_new_with_config().

This commit is contained in:
Ghislain MARY 2014-08-05 16:35:27 +02:00
parent d141724b6c
commit 89dd6fbaa1
2 changed files with 45 additions and 3 deletions

View file

@ -80,7 +80,6 @@ blacklisted_functions = [
'linphone_core_get_supported_video_sizes',
'linphone_core_get_video_codecs',
'linphone_core_get_video_policy',
'linphone_core_new_with_config',
'linphone_core_payload_type_enabled',
'linphone_core_payload_type_is_vbr',
'linphone_core_publish',
@ -115,7 +114,8 @@ blacklisted_functions = [
'lp_config_section_to_dict'
]
hand_written_functions = [
'linphone_core_new'
'linphone_core_new',
'linphone_core_new_with_config'
]
def generate(apixmlfile):

View file

@ -124,7 +124,7 @@ static PyObject * pylinphone_Core_class_method_new(PyObject *cls, PyObject *args
{{{event_vtable_reference}}}
{{/events}}
pylinphone_trace(1, "[PYLINPHONE] >>> %s(\"%s\", \"%s\")", __FUNCTION__, _config_path, _factory_config_path);
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p, \"%s\", \"%s\")", __FUNCTION__, _vtable_dict, _config_path, _factory_config_path);
cresult = linphone_core_new(&_vtable, _config_path, _factory_config_path, self);
self->native_ptr = cresult;
@ -134,3 +134,45 @@ static PyObject * pylinphone_Core_class_method_new(PyObject *cls, PyObject *args
Py_DECREF(self);
return pyret;
}
static PyObject * pylinphone_Core_class_method_new_with_config(PyObject *cls, PyObject *args) {
LinphoneCore * cresult;
pylinphone_CoreObject *self;
PyObject * pyret;
LinphoneCoreVTable _vtable = { 0 };
PyObject * _vtable_dict;
PyObject * _config;
LpConfig * _config_native_ptr;
if (!PyArg_ParseTuple(args, "OO", &_vtable_dict, &_config)) {
return NULL;
}
if (!PyDict_Check(_vtable_dict)) {
PyErr_SetString(PyExc_TypeError, "The first argument must be a dictionary");
return NULL;
}
if ((_config_native_ptr = pylinphone_LpConfig_get_native_ptr(_config)) == NULL) {
return NULL;
}
self = (pylinphone_CoreObject *)PyObject_New(pylinphone_CoreObject, &pylinphone_CoreType);
if (self == NULL) {
return NULL;
}
Py_INCREF(_vtable_dict);
self->vtable_dict = _vtable_dict;
{{#events}}
{{{event_vtable_reference}}}
{{/events}}
pylinphone_trace(1, "[PYLINPHONE] >>> %s(%p [%p])", __FUNCTION__, _config, _config_native_ptr);
cresult = linphone_core_new_with_config(&_vtable, _config_native_ptr, self);
self->native_ptr = cresult;
pyret = Py_BuildValue("O", self);
pylinphone_trace(-1, "[PYLINPHONE] <<< %s -> %p", __FUNCTION__, pyret);
Py_DECREF(self);
return pyret;
}