comparison libpurple/media/backend-fs2.c @ 29571:f0966e90ec44

Move get_local_candidates functionality over to the Fs2 media backend.
author maiku@pidgin.im
date Mon, 26 Oct 2009 22:50:23 +0000
parents cc0d1fbe9c71
children a7cad99144f0
comparison
equal deleted inserted replaced
29570:cc0d1fbe9c71 29571:f0966e90ec44
463 "priority", fscandidate->priority, 463 "priority", fscandidate->priority,
464 "username", fscandidate->username, 464 "username", fscandidate->username,
465 "password", fscandidate->password, 465 "password", fscandidate->password,
466 "ttl", fscandidate->ttl, NULL); 466 "ttl", fscandidate->ttl, NULL);
467 return candidate; 467 return candidate;
468 }
469
470 static GList *
471 _candidate_list_from_fs(GList *candidates)
472 {
473 GList *new_list = NULL;
474
475 for (; candidates; candidates = g_list_next(candidates)) {
476 new_list = g_list_prepend(new_list,
477 _candidate_from_fs(candidates->data));
478 }
479
480 new_list = g_list_reverse(new_list);
481 return new_list;
468 } 482 }
469 483
470 #if 0 484 #if 0
471 static FsCodec * 485 static FsCodec *
472 _codec_to_fs(const PurpleMediaCodec *codec) 486 _codec_to_fs(const PurpleMediaCodec *codec)
703 FsStream *stream; 717 FsStream *stream;
704 FsCandidate *local_candidate; 718 FsCandidate *local_candidate;
705 PurpleMediaCandidate *candidate; 719 PurpleMediaCandidate *candidate;
706 FsParticipant *participant; 720 FsParticipant *participant;
707 PurpleMediaBackendFs2Session *session; 721 PurpleMediaBackendFs2Session *session;
722 PurpleMediaBackendFs2Stream *media_stream;
708 gchar *name; 723 gchar *name;
709 724
710 value = gst_structure_get_value(msg->structure, "stream"); 725 value = gst_structure_get_value(msg->structure, "stream");
711 stream = g_value_get_object(value); 726 stream = g_value_get_object(value);
712 value = gst_structure_get_value(msg->structure, "candidate"); 727 value = gst_structure_get_value(msg->structure, "candidate");
720 735
721 g_object_get(stream, "participant", &participant, NULL); 736 g_object_get(stream, "participant", &participant, NULL);
722 g_object_get(participant, "cname", &name, NULL); 737 g_object_get(participant, "cname", &name, NULL);
723 g_object_unref(participant); 738 g_object_unref(participant);
724 739
725 #if 0 740 media_stream = _get_stream(self, session->id, name);
726 purple_media_insert_local_candidate(session, name, 741 media_stream->local_candidates = g_list_append(
742 media_stream->local_candidates,
727 fs_candidate_copy(local_candidate)); 743 fs_candidate_copy(local_candidate));
728 #endif
729 744
730 candidate = _candidate_from_fs(local_candidate); 745 candidate = _candidate_from_fs(local_candidate);
731 g_signal_emit_by_name(self, "new-candidate", 746 g_signal_emit_by_name(self, "new-candidate",
732 session->id, name, candidate); 747 session->id, name, candidate);
733 g_object_unref(candidate); 748 g_object_unref(candidate);
1399 1414
1400 static GList * 1415 static GList *
1401 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self, 1416 purple_media_backend_fs2_get_local_candidates(PurpleMediaBackend *self,
1402 const gchar *sess_id, const gchar *participant) 1417 const gchar *sess_id, const gchar *participant)
1403 { 1418 {
1404 return NULL; 1419 PurpleMediaBackendFs2Stream *stream;
1420 GList *candidates = NULL;
1421
1422 g_return_val_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(self), NULL);
1423
1424 stream = _get_stream(PURPLE_MEDIA_BACKEND_FS2(self),
1425 sess_id, participant);
1426
1427 if (stream != NULL)
1428 candidates = _candidate_list_from_fs(
1429 stream->local_candidates);
1430 return candidates;
1405 } 1431 }
1406 1432
1407 static void 1433 static void
1408 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self, 1434 purple_media_backend_fs2_set_remote_codecs(PurpleMediaBackend *self,
1409 const gchar *sess_id, const gchar *participant, 1435 const gchar *sess_id, const gchar *participant,