Mercurial > pidgin.yaz
comparison libpurple/media.c @ 26432:064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
is not defined.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Mon, 23 Mar 2009 04:00:11 +0000 |
parents | 1ae3af12095a |
children | c91d09e53215 |
comparison
equal
deleted
inserted
replaced
26431:1ae3af12095a | 26432:064657db29c4 |
---|---|
77 GList *active_remote_candidates; | 77 GList *active_remote_candidates; |
78 | 78 |
79 gulong window_id; | 79 gulong window_id; |
80 guint connected_cb_id; | 80 guint connected_cb_id; |
81 }; | 81 }; |
82 #endif | |
82 | 83 |
83 struct _PurpleMediaPrivate | 84 struct _PurpleMediaPrivate |
84 { | 85 { |
86 #ifdef USE_VV | |
85 PurpleMediaManager *manager; | 87 PurpleMediaManager *manager; |
86 PurpleConnection *pc; | 88 PurpleConnection *pc; |
87 FsConference *conference; | 89 FsConference *conference; |
88 gboolean initiator; | 90 gboolean initiator; |
89 gpointer prpl_data; | 91 gpointer prpl_data; |
92 GHashTable *participants; /* FsParticipant table */ | 94 GHashTable *participants; /* FsParticipant table */ |
93 | 95 |
94 GList *streams; /* PurpleMediaStream table */ | 96 GList *streams; /* PurpleMediaStream table */ |
95 | 97 |
96 GstElement *confbin; | 98 GstElement *confbin; |
99 #else | |
100 gpointer dummy; | |
101 #endif | |
97 }; | 102 }; |
98 | 103 |
104 #ifdef USE_VV | |
99 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) | 105 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) |
100 | 106 |
101 static void purple_media_class_init (PurpleMediaClass *klass); | 107 static void purple_media_class_init (PurpleMediaClass *klass); |
102 static void purple_media_init (PurpleMedia *media); | 108 static void purple_media_init (PurpleMedia *media); |
103 static void purple_media_dispose (GObject *object); | 109 static void purple_media_dispose (GObject *object); |
137 PROP_CONNECTION, | 143 PROP_CONNECTION, |
138 PROP_CONFERENCE, | 144 PROP_CONFERENCE, |
139 PROP_INITIATOR, | 145 PROP_INITIATOR, |
140 PROP_PRPL_DATA, | 146 PROP_PRPL_DATA, |
141 }; | 147 }; |
148 #endif | |
142 | 149 |
143 GType | 150 GType |
144 purple_media_get_type() | 151 purple_media_get_type() |
145 { | 152 { |
153 #ifdef USE_VV | |
146 static GType type = 0; | 154 static GType type = 0; |
147 | 155 |
148 if (type == 0) { | 156 if (type == 0) { |
149 static const GTypeInfo info = { | 157 static const GTypeInfo info = { |
150 sizeof(PurpleMediaClass), | 158 sizeof(PurpleMediaClass), |
159 NULL | 167 NULL |
160 }; | 168 }; |
161 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); | 169 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); |
162 } | 170 } |
163 return type; | 171 return type; |
172 #else | |
173 return G_TYPE_NONE; | |
174 #endif | |
164 } | 175 } |
165 | 176 |
166 GType | 177 GType |
167 purple_media_state_changed_get_type() | 178 purple_media_state_changed_get_type() |
168 { | 179 { |
201 type = g_enum_register_static("PurpleMediaInfoType", values); | 212 type = g_enum_register_static("PurpleMediaInfoType", values); |
202 } | 213 } |
203 return type; | 214 return type; |
204 } | 215 } |
205 | 216 |
217 #ifdef USE_VV | |
206 static void | 218 static void |
207 purple_media_class_init (PurpleMediaClass *klass) | 219 purple_media_class_init (PurpleMediaClass *klass) |
208 { | 220 { |
209 GObjectClass *gobject_class = (GObjectClass*)klass; | 221 GObjectClass *gobject_class = (GObjectClass*)klass; |
210 parent_class = g_type_class_peek_parent(klass); | 222 parent_class = g_type_class_peek_parent(klass); |
503 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | 515 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
504 break; | 516 break; |
505 } | 517 } |
506 | 518 |
507 } | 519 } |
520 #endif | |
508 | 521 |
509 PurpleMediaCandidate * | 522 PurpleMediaCandidate * |
510 purple_media_candidate_new(const gchar *foundation, guint component_id, | 523 purple_media_candidate_new(const gchar *foundation, guint component_id, |
511 PurpleMediaCandidateType type, | 524 PurpleMediaCandidateType type, |
512 PurpleMediaNetworkProtocol proto, | 525 PurpleMediaNetworkProtocol proto, |
558 g_free((gchar*)candidate->username); | 571 g_free((gchar*)candidate->username); |
559 g_free((gchar*)candidate->password); | 572 g_free((gchar*)candidate->password); |
560 g_free(candidate); | 573 g_free(candidate); |
561 } | 574 } |
562 | 575 |
576 #ifdef USE_VV | |
563 static FsCandidate * | 577 static FsCandidate * |
564 purple_media_candidate_to_fs(PurpleMediaCandidate *candidate) | 578 purple_media_candidate_to_fs(PurpleMediaCandidate *candidate) |
565 { | 579 { |
566 FsCandidate *fscandidate; | 580 FsCandidate *fscandidate; |
567 | 581 |
628 } | 642 } |
629 | 643 |
630 new_list = g_list_reverse(new_list); | 644 new_list = g_list_reverse(new_list); |
631 return new_list; | 645 return new_list; |
632 } | 646 } |
647 #endif | |
633 | 648 |
634 GList * | 649 GList * |
635 purple_media_candidate_list_copy(GList *candidates) | 650 purple_media_candidate_list_copy(GList *candidates) |
636 { | 651 { |
637 GList *new_list = NULL; | 652 GList *new_list = NULL; |
667 (GBoxedFreeFunc)purple_media_candidate_free); | 682 (GBoxedFreeFunc)purple_media_candidate_free); |
668 } | 683 } |
669 return type; | 684 return type; |
670 } | 685 } |
671 | 686 |
687 #ifdef USE_VV | |
672 static FsMediaType | 688 static FsMediaType |
673 purple_media_to_fs_media_type(PurpleMediaSessionType type) | 689 purple_media_to_fs_media_type(PurpleMediaSessionType type) |
674 { | 690 { |
675 if (type & PURPLE_MEDIA_AUDIO) | 691 if (type & PURPLE_MEDIA_AUDIO) |
676 return FS_MEDIA_TYPE_AUDIO; | 692 return FS_MEDIA_TYPE_AUDIO; |
711 if (direction & FS_DIRECTION_RECV) | 727 if (direction & FS_DIRECTION_RECV) |
712 result |= PURPLE_MEDIA_RECV_VIDEO; | 728 result |= PURPLE_MEDIA_RECV_VIDEO; |
713 } | 729 } |
714 return result; | 730 return result; |
715 } | 731 } |
732 #endif | |
716 | 733 |
717 void | 734 void |
718 purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, | 735 purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec, |
719 const gchar *name, const gchar *value) | 736 const gchar *name, const gchar *value) |
720 { | 737 { |
816 } | 833 } |
817 | 834 |
818 g_free(codec); | 835 g_free(codec); |
819 } | 836 } |
820 | 837 |
838 #ifdef USE_VV | |
821 static FsCodec * | 839 static FsCodec * |
822 purple_media_codec_to_fs(const PurpleMediaCodec *codec) | 840 purple_media_codec_to_fs(const PurpleMediaCodec *codec) |
823 { | 841 { |
824 FsCodec *new_codec; | 842 FsCodec *new_codec; |
825 GList *iter; | 843 GList *iter; |
862 param->name, param->value); | 880 param->name, param->value); |
863 } | 881 } |
864 | 882 |
865 return new_codec; | 883 return new_codec; |
866 } | 884 } |
885 #endif | |
867 | 886 |
868 gchar * | 887 gchar * |
869 purple_media_codec_to_string(const PurpleMediaCodec *codec) | 888 purple_media_codec_to_string(const PurpleMediaCodec *codec) |
870 { | 889 { |
890 #ifdef USE_VV | |
871 FsCodec *fscodec = purple_media_codec_to_fs(codec); | 891 FsCodec *fscodec = purple_media_codec_to_fs(codec); |
872 gchar *str = fs_codec_to_string(fscodec); | 892 gchar *str = fs_codec_to_string(fscodec); |
873 fs_codec_destroy(fscodec); | 893 fs_codec_destroy(fscodec); |
874 return str; | 894 return str; |
875 } | 895 #else |
876 | 896 return g_strdup(""); |
897 #endif | |
898 } | |
899 | |
900 #ifdef USE_VV | |
877 static GList * | 901 static GList * |
878 purple_media_codec_list_from_fs(GList *codecs) | 902 purple_media_codec_list_from_fs(GList *codecs) |
879 { | 903 { |
880 GList *new_list = NULL; | 904 GList *new_list = NULL; |
881 | 905 |
901 } | 925 } |
902 | 926 |
903 new_list = g_list_reverse(new_list); | 927 new_list = g_list_reverse(new_list); |
904 return new_list; | 928 return new_list; |
905 } | 929 } |
930 #endif | |
906 | 931 |
907 GList * | 932 GList * |
908 purple_media_codec_list_copy(GList *codecs) | 933 purple_media_codec_list_copy(GList *codecs) |
909 { | 934 { |
910 GList *new_list = NULL; | 935 GList *new_list = NULL; |
940 (GBoxedFreeFunc)purple_media_codec_free); | 965 (GBoxedFreeFunc)purple_media_codec_free); |
941 } | 966 } |
942 return type; | 967 return type; |
943 } | 968 } |
944 | 969 |
970 #ifdef USE_VV | |
945 static PurpleMediaSession* | 971 static PurpleMediaSession* |
946 purple_media_get_session(PurpleMedia *media, const gchar *sess_id) | 972 purple_media_get_session(PurpleMedia *media, const gchar *sess_id) |
947 { | 973 { |
948 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 974 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
949 return (PurpleMediaSession*) (media->priv->sessions) ? | 975 return (PurpleMediaSession*) (media->priv->sessions) ? |
1081 g_return_if_fail(session != NULL); | 1107 g_return_if_fail(session != NULL); |
1082 | 1108 |
1083 stream = purple_media_get_stream(session->media, session->id, name); | 1109 stream = purple_media_get_stream(session->media, session->id, name); |
1084 stream->local_candidates = g_list_append(stream->local_candidates, candidate); | 1110 stream->local_candidates = g_list_append(stream->local_candidates, candidate); |
1085 } | 1111 } |
1112 #endif | |
1086 | 1113 |
1087 GList * | 1114 GList * |
1088 purple_media_get_session_names(PurpleMedia *media) | 1115 purple_media_get_session_names(PurpleMedia *media) |
1089 { | 1116 { |
1117 #ifdef USE_VV | |
1090 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1118 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1091 return media->priv->sessions != NULL ? | 1119 return media->priv->sessions != NULL ? |
1092 g_hash_table_get_keys(media->priv->sessions) : NULL; | 1120 g_hash_table_get_keys(media->priv->sessions) : NULL; |
1093 } | 1121 #else |
1094 | 1122 return NULL; |
1123 #endif | |
1124 } | |
1125 | |
1126 #ifdef USE_VV | |
1095 static void | 1127 static void |
1096 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src) | 1128 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src) |
1097 { | 1129 { |
1098 PurpleMediaSession *session; | 1130 PurpleMediaSession *session; |
1099 GstPad *sinkpad; | 1131 GstPad *sinkpad; |
1126 purple_debug_info("media", "connecting pad: %s\n", | 1158 purple_debug_info("media", "connecting pad: %s\n", |
1127 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK | 1159 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK |
1128 ? "success" : "failure"); | 1160 ? "success" : "failure"); |
1129 gst_element_set_locked_state(session->src, FALSE); | 1161 gst_element_set_locked_state(session->src, FALSE); |
1130 } | 1162 } |
1163 #endif | |
1131 | 1164 |
1132 #if 0 | 1165 #if 0 |
1133 static void | 1166 static void |
1134 purple_media_set_sink(PurpleMedia *media, const gchar *sess_id, | 1167 purple_media_set_sink(PurpleMedia *media, const gchar *sess_id, |
1135 const gchar *participant, GstElement *sink) | 1168 const gchar *participant, GstElement *sink) |
1155 #endif | 1188 #endif |
1156 | 1189 |
1157 GstElement * | 1190 GstElement * |
1158 purple_media_get_src(PurpleMedia *media, const gchar *sess_id) | 1191 purple_media_get_src(PurpleMedia *media, const gchar *sess_id) |
1159 { | 1192 { |
1193 #ifdef USE_VV | |
1160 PurpleMediaSession *session; | 1194 PurpleMediaSession *session; |
1161 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1195 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1162 session = purple_media_get_session(media, sess_id); | 1196 session = purple_media_get_session(media, sess_id); |
1163 return (session != NULL) ? session->src : NULL; | 1197 return (session != NULL) ? session->src : NULL; |
1164 } | 1198 #else |
1165 | 1199 return NULL; |
1200 #endif | |
1201 } | |
1202 | |
1203 #ifdef USE_VV | |
1166 static PurpleMediaSession * | 1204 static PurpleMediaSession * |
1167 purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream) | 1205 purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream) |
1168 { | 1206 { |
1169 FsSession *fssession; | 1207 FsSession *fssession; |
1170 GList *values; | 1208 GList *values; |
1292 break; | 1330 break; |
1293 } | 1331 } |
1294 | 1332 |
1295 return TRUE; | 1333 return TRUE; |
1296 } | 1334 } |
1335 #endif | |
1297 | 1336 |
1298 GstElement * | 1337 GstElement * |
1299 purple_media_get_pipeline(PurpleMedia *media) | 1338 purple_media_get_pipeline(PurpleMedia *media) |
1300 { | 1339 { |
1340 #ifdef USE_VV | |
1301 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1341 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1302 | 1342 |
1303 return purple_media_manager_get_pipeline(media->priv->manager); | 1343 return purple_media_manager_get_pipeline(media->priv->manager); |
1344 #else | |
1345 return NULL; | |
1346 #endif | |
1304 } | 1347 } |
1305 | 1348 |
1306 PurpleConnection * | 1349 PurpleConnection * |
1307 purple_media_get_connection(PurpleMedia *media) | 1350 purple_media_get_connection(PurpleMedia *media) |
1308 { | 1351 { |
1352 #ifdef USE_VV | |
1309 PurpleConnection *pc; | 1353 PurpleConnection *pc; |
1310 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1354 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1311 g_object_get(G_OBJECT(media), "connection", &pc, NULL); | 1355 g_object_get(G_OBJECT(media), "connection", &pc, NULL); |
1312 return pc; | 1356 return pc; |
1357 #else | |
1358 return NULL; | |
1359 #endif | |
1313 } | 1360 } |
1314 | 1361 |
1315 gpointer | 1362 gpointer |
1316 purple_media_get_prpl_data(PurpleMedia *media) | 1363 purple_media_get_prpl_data(PurpleMedia *media) |
1317 { | 1364 { |
1365 #ifdef USE_VV | |
1318 gpointer prpl_data; | 1366 gpointer prpl_data; |
1319 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1367 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1320 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); | 1368 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); |
1321 return prpl_data; | 1369 return prpl_data; |
1370 #else | |
1371 return NULL; | |
1372 #endif | |
1322 } | 1373 } |
1323 | 1374 |
1324 void | 1375 void |
1325 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) | 1376 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) |
1326 { | 1377 { |
1378 #ifdef USE_VV | |
1327 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1379 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1328 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); | 1380 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); |
1381 #endif | |
1329 } | 1382 } |
1330 | 1383 |
1331 void | 1384 void |
1332 purple_media_error(PurpleMedia *media, const gchar *error, ...) | 1385 purple_media_error(PurpleMedia *media, const gchar *error, ...) |
1333 { | 1386 { |
1387 #ifdef USE_VV | |
1334 va_list args; | 1388 va_list args; |
1335 gchar *message; | 1389 gchar *message; |
1336 | 1390 |
1337 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1391 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1338 | 1392 |
1342 | 1396 |
1343 purple_debug_error("media", "%s\n", message); | 1397 purple_debug_error("media", "%s\n", message); |
1344 g_signal_emit(media, purple_media_signals[ERROR], 0, message); | 1398 g_signal_emit(media, purple_media_signals[ERROR], 0, message); |
1345 | 1399 |
1346 g_free(message); | 1400 g_free(message); |
1401 #endif | |
1347 } | 1402 } |
1348 | 1403 |
1349 void | 1404 void |
1350 purple_media_accept(PurpleMedia *media) | 1405 purple_media_accept(PurpleMedia *media) |
1351 { | 1406 { |
1407 #ifdef USE_VV | |
1352 GList *streams; | 1408 GList *streams; |
1353 | 1409 |
1354 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1410 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1355 | 1411 |
1356 streams = media->priv->streams; | 1412 streams = media->priv->streams; |
1363 stream->accepted = TRUE; | 1419 stream->accepted = TRUE; |
1364 } | 1420 } |
1365 | 1421 |
1366 g_signal_emit(media, purple_media_signals[ACCEPTED], | 1422 g_signal_emit(media, purple_media_signals[ACCEPTED], |
1367 0, NULL, NULL); | 1423 0, NULL, NULL); |
1424 #endif | |
1368 } | 1425 } |
1369 | 1426 |
1370 void | 1427 void |
1371 purple_media_hangup(PurpleMedia *media) | 1428 purple_media_hangup(PurpleMedia *media) |
1372 { | 1429 { |
1430 #ifdef USE_VV | |
1373 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1431 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1374 g_signal_emit(media, purple_media_signals[STREAM_INFO], | 1432 g_signal_emit(media, purple_media_signals[STREAM_INFO], |
1375 0, PURPLE_MEDIA_INFO_HANGUP, | 1433 0, PURPLE_MEDIA_INFO_HANGUP, |
1376 NULL, NULL); | 1434 NULL, NULL); |
1377 purple_media_end(media, NULL, NULL); | 1435 purple_media_end(media, NULL, NULL); |
1436 #endif | |
1378 } | 1437 } |
1379 | 1438 |
1380 void | 1439 void |
1381 purple_media_reject(PurpleMedia *media) | 1440 purple_media_reject(PurpleMedia *media) |
1382 { | 1441 { |
1442 #ifdef USE_VV | |
1383 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1443 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1384 g_signal_emit(media, purple_media_signals[STREAM_INFO], | 1444 g_signal_emit(media, purple_media_signals[STREAM_INFO], |
1385 0, PURPLE_MEDIA_INFO_REJECT, | 1445 0, PURPLE_MEDIA_INFO_REJECT, |
1386 NULL, NULL); | 1446 NULL, NULL); |
1387 purple_media_end(media, NULL, NULL); | 1447 purple_media_end(media, NULL, NULL); |
1448 #endif | |
1388 } | 1449 } |
1389 | 1450 |
1390 void | 1451 void |
1391 purple_media_end(PurpleMedia *media, | 1452 purple_media_end(PurpleMedia *media, |
1392 const gchar *session_id, const gchar *participant) | 1453 const gchar *session_id, const gchar *participant) |
1393 { | 1454 { |
1455 #ifdef USE_VV | |
1394 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1456 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1395 if (session_id == NULL && participant == NULL) { | 1457 if (session_id == NULL && participant == NULL) { |
1396 g_signal_emit(media, purple_media_signals[STATE_CHANGED], | 1458 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
1397 0, PURPLE_MEDIA_STATE_END, | 1459 0, PURPLE_MEDIA_STATE_END, |
1398 NULL, NULL); | 1460 NULL, NULL); |
1399 g_object_unref(media); | 1461 g_object_unref(media); |
1400 } | 1462 } |
1401 } | 1463 #endif |
1402 | 1464 } |
1465 | |
1466 #ifdef USE_VV | |
1403 static void | 1467 static void |
1404 purple_media_new_local_candidate_cb(FsStream *stream, | 1468 purple_media_new_local_candidate_cb(FsStream *stream, |
1405 FsCandidate *local_candidate, | 1469 FsCandidate *local_candidate, |
1406 PurpleMediaSession *session) | 1470 PurpleMediaSession *session) |
1407 { | 1471 { |
1787 g_object_set(stream->stream, "direction", type_direction, NULL); | 1851 g_object_set(stream->stream, "direction", type_direction, NULL); |
1788 } | 1852 } |
1789 | 1853 |
1790 return TRUE; | 1854 return TRUE; |
1791 } | 1855 } |
1856 #endif | |
1792 | 1857 |
1793 gboolean | 1858 gboolean |
1794 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who, | 1859 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who, |
1795 PurpleMediaSessionType type, | 1860 PurpleMediaSessionType type, |
1796 const gchar *transmitter, | 1861 const gchar *transmitter, |
1797 guint num_params, GParameter *params) | 1862 guint num_params, GParameter *params) |
1798 { | 1863 { |
1864 #ifdef USE_VV | |
1799 FsStreamDirection type_direction; | 1865 FsStreamDirection type_direction; |
1800 | 1866 |
1801 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 1867 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
1802 | 1868 |
1803 if (type & PURPLE_MEDIA_AUDIO) { | 1869 if (type & PURPLE_MEDIA_AUDIO) { |
1817 transmitter, num_params, params)) { | 1883 transmitter, num_params, params)) { |
1818 return FALSE; | 1884 return FALSE; |
1819 } | 1885 } |
1820 } | 1886 } |
1821 return TRUE; | 1887 return TRUE; |
1888 #else | |
1889 return FALSE; | |
1890 #endif | |
1822 } | 1891 } |
1823 | 1892 |
1824 void | 1893 void |
1825 purple_media_remove_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who) | 1894 purple_media_remove_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who) |
1826 { | 1895 { |
1828 } | 1897 } |
1829 | 1898 |
1830 PurpleMediaSessionType | 1899 PurpleMediaSessionType |
1831 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) | 1900 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) |
1832 { | 1901 { |
1902 #ifdef USE_VV | |
1833 PurpleMediaSession *session; | 1903 PurpleMediaSession *session; |
1834 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); | 1904 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); |
1835 session = purple_media_get_session(media, sess_id); | 1905 session = purple_media_get_session(media, sess_id); |
1836 return session->type; | 1906 return session->type; |
1907 #else | |
1908 return PURPLE_MEDIA_NONE; | |
1909 #endif | |
1837 } | 1910 } |
1838 /* XXX: Should wait until codecs-ready is TRUE before using this function */ | 1911 /* XXX: Should wait until codecs-ready is TRUE before using this function */ |
1839 GList * | 1912 GList * |
1840 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) | 1913 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) |
1841 { | 1914 { |
1915 #ifdef USE_VV | |
1842 GList *fscodecs; | 1916 GList *fscodecs; |
1843 GList *codecs; | 1917 GList *codecs; |
1844 PurpleMediaSession *session; | 1918 PurpleMediaSession *session; |
1845 | 1919 |
1846 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1920 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1853 g_object_get(G_OBJECT(session->session), | 1927 g_object_get(G_OBJECT(session->session), |
1854 "codecs", &fscodecs, NULL); | 1928 "codecs", &fscodecs, NULL); |
1855 codecs = purple_media_codec_list_from_fs(fscodecs); | 1929 codecs = purple_media_codec_list_from_fs(fscodecs); |
1856 fs_codec_list_destroy(fscodecs); | 1930 fs_codec_list_destroy(fscodecs); |
1857 return codecs; | 1931 return codecs; |
1932 #else | |
1933 return NULL; | |
1934 #endif | |
1858 } | 1935 } |
1859 | 1936 |
1860 GList * | 1937 GList * |
1861 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name) | 1938 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name) |
1862 { | 1939 { |
1940 #ifdef USE_VV | |
1863 PurpleMediaStream *stream; | 1941 PurpleMediaStream *stream; |
1864 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1942 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1865 stream = purple_media_get_stream(media, sess_id, name); | 1943 stream = purple_media_get_stream(media, sess_id, name); |
1866 return purple_media_candidate_list_from_fs(stream->local_candidates); | 1944 return purple_media_candidate_list_from_fs(stream->local_candidates); |
1945 #else | |
1946 return NULL; | |
1947 #endif | |
1867 } | 1948 } |
1868 | 1949 |
1869 void | 1950 void |
1870 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, | 1951 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, |
1871 const gchar *name, GList *remote_candidates) | 1952 const gchar *name, GList *remote_candidates) |
1872 { | 1953 { |
1954 #ifdef USE_VV | |
1873 PurpleMediaStream *stream; | 1955 PurpleMediaStream *stream; |
1874 GError *err = NULL; | 1956 GError *err = NULL; |
1875 | 1957 |
1876 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 1958 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
1877 stream = purple_media_get_stream(media, sess_id, name); | 1959 stream = purple_media_get_stream(media, sess_id, name); |
1885 if (err) { | 1967 if (err) { |
1886 purple_debug_error("media", "Error adding remote" | 1968 purple_debug_error("media", "Error adding remote" |
1887 " candidates: %s\n", err->message); | 1969 " candidates: %s\n", err->message); |
1888 g_error_free(err); | 1970 g_error_free(err); |
1889 } | 1971 } |
1972 #endif | |
1890 } | 1973 } |
1891 | 1974 |
1892 GList * | 1975 GList * |
1893 purple_media_get_active_local_candidates(PurpleMedia *media, | 1976 purple_media_get_active_local_candidates(PurpleMedia *media, |
1894 const gchar *sess_id, const gchar *name) | 1977 const gchar *sess_id, const gchar *name) |
1895 { | 1978 { |
1979 #ifdef USE_VV | |
1896 PurpleMediaStream *stream; | 1980 PurpleMediaStream *stream; |
1897 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1981 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1898 stream = purple_media_get_stream(media, sess_id, name); | 1982 stream = purple_media_get_stream(media, sess_id, name); |
1899 return purple_media_candidate_list_from_fs( | 1983 return purple_media_candidate_list_from_fs( |
1900 stream->active_local_candidates); | 1984 stream->active_local_candidates); |
1985 #else | |
1986 return NULL; | |
1987 #endif | |
1901 } | 1988 } |
1902 | 1989 |
1903 GList * | 1990 GList * |
1904 purple_media_get_active_remote_candidates(PurpleMedia *media, | 1991 purple_media_get_active_remote_candidates(PurpleMedia *media, |
1905 const gchar *sess_id, const gchar *name) | 1992 const gchar *sess_id, const gchar *name) |
1906 { | 1993 { |
1994 #ifdef USE_VV | |
1907 PurpleMediaStream *stream; | 1995 PurpleMediaStream *stream; |
1908 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 1996 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
1909 stream = purple_media_get_stream(media, sess_id, name); | 1997 stream = purple_media_get_stream(media, sess_id, name); |
1910 return purple_media_candidate_list_from_fs( | 1998 return purple_media_candidate_list_from_fs( |
1911 stream->active_remote_candidates); | 1999 stream->active_remote_candidates); |
2000 #else | |
2001 return NULL; | |
2002 #endif | |
1912 } | 2003 } |
1913 | 2004 |
1914 gboolean | 2005 gboolean |
1915 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs) | 2006 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs) |
1916 { | 2007 { |
2008 #ifdef USE_VV | |
1917 PurpleMediaStream *stream; | 2009 PurpleMediaStream *stream; |
1918 FsStream *fsstream; | 2010 FsStream *fsstream; |
1919 GList *fscodecs; | 2011 GList *fscodecs; |
1920 GError *err = NULL; | 2012 GError *err = NULL; |
1921 | 2013 |
1935 err->message); | 2027 err->message); |
1936 g_error_free(err); | 2028 g_error_free(err); |
1937 return FALSE; | 2029 return FALSE; |
1938 } | 2030 } |
1939 return TRUE; | 2031 return TRUE; |
2032 #else | |
2033 return FALSE; | |
2034 #endif | |
1940 } | 2035 } |
1941 | 2036 |
1942 gboolean | 2037 gboolean |
1943 purple_media_candidates_prepared(PurpleMedia *media, | 2038 purple_media_candidates_prepared(PurpleMedia *media, |
1944 const gchar *session_id, const gchar *participant) | 2039 const gchar *session_id, const gchar *participant) |
1945 { | 2040 { |
2041 #ifdef USE_VV | |
1946 GList *streams; | 2042 GList *streams; |
1947 gboolean prepared = TRUE; | 2043 gboolean prepared = TRUE; |
1948 | 2044 |
1949 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 2045 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
1950 | 2046 |
1958 break; | 2054 break; |
1959 } | 2055 } |
1960 } | 2056 } |
1961 | 2057 |
1962 return prepared; | 2058 return prepared; |
2059 #else | |
2060 return FALSE; | |
2061 #endif | |
1963 } | 2062 } |
1964 | 2063 |
1965 gboolean | 2064 gboolean |
1966 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) | 2065 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) |
1967 { | 2066 { |
2067 #ifdef USE_VV | |
1968 PurpleMediaSession *session; | 2068 PurpleMediaSession *session; |
1969 FsCodec *fscodec; | 2069 FsCodec *fscodec; |
1970 GError *err = NULL; | 2070 GError *err = NULL; |
1971 | 2071 |
1972 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 2072 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
1984 purple_debug_error("media", "Error setting send codec\n"); | 2084 purple_debug_error("media", "Error setting send codec\n"); |
1985 g_error_free(err); | 2085 g_error_free(err); |
1986 return FALSE; | 2086 return FALSE; |
1987 } | 2087 } |
1988 return TRUE; | 2088 return TRUE; |
2089 #else | |
2090 return FALSE; | |
2091 #endif | |
1989 } | 2092 } |
1990 | 2093 |
1991 gboolean | 2094 gboolean |
1992 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) | 2095 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) |
1993 { | 2096 { |
2097 #ifdef USE_VV | |
1994 gboolean ret; | 2098 gboolean ret; |
1995 | 2099 |
1996 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 2100 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
1997 | 2101 |
1998 if (sess_id != NULL) { | 2102 if (sess_id != NULL) { |
2014 } | 2118 } |
2015 if (values != NULL) | 2119 if (values != NULL) |
2016 g_list_free(values); | 2120 g_list_free(values); |
2017 } | 2121 } |
2018 return ret; | 2122 return ret; |
2123 #else | |
2124 return FALSE; | |
2125 #endif | |
2019 } | 2126 } |
2020 | 2127 |
2021 gboolean | 2128 gboolean |
2022 purple_media_accepted(PurpleMedia *media, const gchar *sess_id, | 2129 purple_media_accepted(PurpleMedia *media, const gchar *sess_id, |
2023 const gchar *participant) | 2130 const gchar *participant) |
2024 { | 2131 { |
2132 #ifdef USE_VV | |
2025 gboolean accepted = TRUE; | 2133 gboolean accepted = TRUE; |
2026 | 2134 |
2027 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 2135 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
2028 | 2136 |
2029 if (sess_id == NULL && participant == NULL) { | 2137 if (sess_id == NULL && participant == NULL) { |
2054 if (stream == NULL || stream->accepted == FALSE) | 2162 if (stream == NULL || stream->accepted == FALSE) |
2055 accepted = FALSE; | 2163 accepted = FALSE; |
2056 } | 2164 } |
2057 | 2165 |
2058 return accepted; | 2166 return accepted; |
2167 #else | |
2168 return FALSE; | |
2169 #endif | |
2059 } | 2170 } |
2060 | 2171 |
2061 void purple_media_mute(PurpleMedia *media, gboolean active) | 2172 void purple_media_mute(PurpleMedia *media, gboolean active) |
2062 { | 2173 { |
2174 #ifdef USE_VV | |
2063 GList *sessions; | 2175 GList *sessions; |
2064 | 2176 |
2065 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 2177 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
2066 | 2178 |
2067 sessions = g_hash_table_get_values(media->priv->sessions); | 2179 sessions = g_hash_table_get_values(media->priv->sessions); |
2074 GST_BIN(session->src), | 2186 GST_BIN(session->src), |
2075 "purpleaudioinputvolume"); | 2187 "purpleaudioinputvolume"); |
2076 g_object_set(volume, "mute", active, NULL); | 2188 g_object_set(volume, "mute", active, NULL); |
2077 } | 2189 } |
2078 } | 2190 } |
2191 #endif | |
2079 } | 2192 } |
2080 | 2193 |
2081 void purple_media_set_input_volume(PurpleMedia *media, | 2194 void purple_media_set_input_volume(PurpleMedia *media, |
2082 const gchar *session_id, double level) | 2195 const gchar *session_id, double level) |
2083 { | 2196 { |
2197 #ifdef USE_VV | |
2084 GList *sessions; | 2198 GList *sessions; |
2085 | 2199 |
2086 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 2200 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
2087 | 2201 |
2088 if (session_id == NULL) | 2202 if (session_id == NULL) |
2099 GST_BIN(session->src), | 2213 GST_BIN(session->src), |
2100 "purpleaudioinputvolume"); | 2214 "purpleaudioinputvolume"); |
2101 g_object_set(volume, "volume", level, NULL); | 2215 g_object_set(volume, "volume", level, NULL); |
2102 } | 2216 } |
2103 } | 2217 } |
2218 #endif | |
2104 } | 2219 } |
2105 | 2220 |
2106 void purple_media_set_output_volume(PurpleMedia *media, | 2221 void purple_media_set_output_volume(PurpleMedia *media, |
2107 const gchar *session_id, const gchar *participant, | 2222 const gchar *session_id, const gchar *participant, |
2108 double level) | 2223 double level) |
2109 { | 2224 { |
2225 #ifdef USE_VV | |
2110 GList *streams; | 2226 GList *streams; |
2111 | 2227 |
2112 g_return_if_fail(PURPLE_IS_MEDIA(media)); | 2228 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
2113 | 2229 |
2114 streams = purple_media_get_streams(media, | 2230 streams = purple_media_get_streams(media, |
2139 gst_object_unref(sinkpad); | 2255 gst_object_unref(sinkpad); |
2140 } | 2256 } |
2141 gst_iterator_free(iter); | 2257 gst_iterator_free(iter); |
2142 } | 2258 } |
2143 } | 2259 } |
2260 #endif | |
2144 } | 2261 } |
2145 | 2262 |
2146 gulong | 2263 gulong |
2147 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, | 2264 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, |
2148 const gchar *participant, gulong window_id) | 2265 const gchar *participant, gulong window_id) |
2149 { | 2266 { |
2267 #ifdef USE_VV | |
2150 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 2268 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
2151 | 2269 |
2152 return purple_media_manager_set_output_window(media->priv->manager, | 2270 return purple_media_manager_set_output_window(media->priv->manager, |
2153 media, session_id, participant, window_id); | 2271 media, session_id, participant, window_id); |
2272 #else | |
2273 return 0; | |
2274 #endif | |
2154 } | 2275 } |
2155 | 2276 |
2156 void | 2277 void |
2157 purple_media_remove_output_windows(PurpleMedia *media) | 2278 purple_media_remove_output_windows(PurpleMedia *media) |
2158 { | 2279 { |
2280 #ifdef USE_VV | |
2159 GList *iter = media->priv->streams; | 2281 GList *iter = media->priv->streams; |
2160 for (; iter; iter = g_list_next(iter)) { | 2282 for (; iter; iter = g_list_next(iter)) { |
2161 PurpleMediaStream *stream = iter->data; | 2283 PurpleMediaStream *stream = iter->data; |
2162 purple_media_manager_remove_output_windows( | 2284 purple_media_manager_remove_output_windows( |
2163 media->priv->manager, media, | 2285 media->priv->manager, media, |
2169 gchar *session_name = iter->data; | 2291 gchar *session_name = iter->data; |
2170 purple_media_manager_remove_output_windows( | 2292 purple_media_manager_remove_output_windows( |
2171 media->priv->manager, media, | 2293 media->priv->manager, media, |
2172 session_name, NULL); | 2294 session_name, NULL); |
2173 } | 2295 } |
2296 #endif | |
2174 } | 2297 } |
2175 | 2298 |
2176 GstElement * | 2299 GstElement * |
2177 purple_media_get_tee(PurpleMedia *media, | 2300 purple_media_get_tee(PurpleMedia *media, |
2178 const gchar *session_id, const gchar *participant) | 2301 const gchar *session_id, const gchar *participant) |
2179 { | 2302 { |
2303 #ifdef USE_VV | |
2180 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); | 2304 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
2181 | 2305 |
2182 if (session_id != NULL && participant == NULL) { | 2306 if (session_id != NULL && participant == NULL) { |
2183 PurpleMediaSession *session = | 2307 PurpleMediaSession *session = |
2184 purple_media_get_session(media, session_id); | 2308 purple_media_get_session(media, session_id); |
2188 purple_media_get_stream(media, | 2312 purple_media_get_stream(media, |
2189 session_id, participant); | 2313 session_id, participant); |
2190 return (stream != NULL) ? stream->tee : NULL; | 2314 return (stream != NULL) ? stream->tee : NULL; |
2191 } | 2315 } |
2192 g_return_val_if_reached(NULL); | 2316 g_return_val_if_reached(NULL); |
2193 } | 2317 #else |
2194 | 2318 return NULL; |
2195 #endif /* USE_VV */ | 2319 #endif |
2320 } | |
2321 |