| | 401 | %% |
| | 402 | override farsight_stream_add_remote_candidate kwargs |
| | 403 | static PyObject* _wrap_farsight_stream_add_remote_candidate(PyGObject *self, |
| | 404 | PyObject *args, |
| | 405 | PyObject *kwargs) |
| | 406 | { |
| | 407 | static char* kwlist[] = {"remote_candidate", NULL}; |
| | 408 | PyObject* list; |
| | 409 | GArray* candidate_array; |
| | 410 | GList* candidate_list=NULL; |
| | 411 | int i, listsize; |
| | 412 | |
| | 413 | if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O", kwlist, &list)) |
| | 414 | return NULL; |
| | 415 | |
| | 416 | candidate_array=g_array_sized_new(FALSE, TRUE, |
| | 417 | sizeof(FarsightTransportInfo), PySequence_Size(list)); |
| | 418 | |
| | 419 | listsize=PySequence_Size(list); |
| | 420 | for(i=0;i<listsize;i++) { |
| | 421 | FarsightTransportInfo fti; |
| | 422 | |
| | 423 | dict_to_farsight_transport_info(PySequence_GetItem(list, listsize-i-1), &fti); |
| | 424 | |
| | 425 | g_array_append_val(candidate_array, fti); |
| | 426 | |
| | 427 | candidate_list = g_list_prepend(candidate_list, |
| | 428 | &g_array_index(candidate_array, FarsightTransportInfo, i)); |
| | 429 | } |
| | 430 | |
| | 431 | GList* t; |
| | 432 | for(t=candidate_list;t;t=g_list_next(t)) { |
| | 433 | FarsightTransportInfo* info=t->data; |
| | 434 | printf ("Remote transport candidate: %s %d %s %s %s %d pref %f", |
| | 435 | info->candidate_id, info->component, |
| | 436 | (info->proto == FARSIGHT_NETWORK_PROTOCOL_TCP) ? "TCP" : "UDP", |
| | 437 | info->proto_subtype, info->ip, info->port, (double) info->preference); |
| | 438 | } |
| | 439 | |
| | 440 | if(!PyErr_Occurred()) { |
| | 441 | farsight_stream_add_remote_candidate(FARSIGHT_STREAM(self->obj), candidate_list); |
| | 442 | } |
| | 443 | |
| | 444 | g_array_free(candidate_array, FALSE); |
| | 445 | g_list_free(candidate_list); |
| | 446 | |
| | 447 | if(!PyErr_Occurred()) { |
| | 448 | Py_INCREF(Py_None); |
| | 449 | return Py_None; |
| | 450 | } else { |
| | 451 | return NULL; |
| | 452 | } |
| | 453 | } |