| 576 { |
576 { |
| 577 if (type & PURPLE_MEDIA_AUDIO) |
577 if (type & PURPLE_MEDIA_AUDIO) |
| 578 return FS_MEDIA_TYPE_AUDIO; |
578 return FS_MEDIA_TYPE_AUDIO; |
| 579 else if (type & PURPLE_MEDIA_VIDEO) |
579 else if (type & PURPLE_MEDIA_VIDEO) |
| 580 return FS_MEDIA_TYPE_VIDEO; |
580 return FS_MEDIA_TYPE_VIDEO; |
| |
581 #ifdef HAVE_MEDIA_APPLICATION |
| |
582 else if (type & PURPLE_MEDIA_APPLICATION) |
| |
583 return FS_MEDIA_TYPE_APPLICATION; |
| |
584 #endif |
| 581 else |
585 else |
| 582 return 0; |
586 return 0; |
| 583 } |
587 } |
| 584 |
588 |
| 585 static FsStreamDirection |
589 static FsStreamDirection |
| 586 session_type_to_fs_stream_direction(PurpleMediaSessionType type) |
590 session_type_to_fs_stream_direction(PurpleMediaSessionType type) |
| 587 { |
591 { |
| 588 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || |
592 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO || |
| 589 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO) |
593 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO) |
| 590 return FS_DIRECTION_BOTH; |
594 return FS_DIRECTION_BOTH; |
| 591 else if ((type & PURPLE_MEDIA_SEND_AUDIO) || |
595 else if ((type & PURPLE_MEDIA_SEND_AUDIO) || |
| 592 (type & PURPLE_MEDIA_SEND_VIDEO)) |
596 (type & PURPLE_MEDIA_SEND_VIDEO)) |
| 593 return FS_DIRECTION_SEND; |
597 return FS_DIRECTION_SEND; |
| 594 else if ((type & PURPLE_MEDIA_RECV_AUDIO) || |
598 else if ((type & PURPLE_MEDIA_RECV_AUDIO) || |
| 595 (type & PURPLE_MEDIA_RECV_VIDEO)) |
599 (type & PURPLE_MEDIA_RECV_VIDEO)) |
| 596 return FS_DIRECTION_RECV; |
600 return FS_DIRECTION_RECV; |
| |
601 #ifdef HAVE_MEDIA_APPLICATION |
| |
602 else if ((type & PURPLE_MEDIA_APPLICATION) == PURPLE_MEDIA_APPLICATION) |
| |
603 return FS_DIRECTION_BOTH; |
| |
604 else if (type & PURPLE_MEDIA_SEND_APPLICATION) |
| |
605 return FS_DIRECTION_SEND; |
| |
606 else if (type & PURPLE_MEDIA_RECV_APPLICATION) |
| |
607 return FS_DIRECTION_RECV; |
| |
608 #endif |
| 597 else |
609 else |
| 598 return FS_DIRECTION_NONE; |
610 return FS_DIRECTION_NONE; |
| 599 } |
611 } |
| 600 |
612 |
| 601 static PurpleMediaSessionType |
613 static PurpleMediaSessionType |
| 610 } else if (type == FS_MEDIA_TYPE_VIDEO) { |
622 } else if (type == FS_MEDIA_TYPE_VIDEO) { |
| 611 if (direction & FS_DIRECTION_SEND) |
623 if (direction & FS_DIRECTION_SEND) |
| 612 result |= PURPLE_MEDIA_SEND_VIDEO; |
624 result |= PURPLE_MEDIA_SEND_VIDEO; |
| 613 if (direction & FS_DIRECTION_RECV) |
625 if (direction & FS_DIRECTION_RECV) |
| 614 result |= PURPLE_MEDIA_RECV_VIDEO; |
626 result |= PURPLE_MEDIA_RECV_VIDEO; |
| |
627 #ifdef HAVE_MEDIA_APPLICATION |
| |
628 } else if (type == FS_MEDIA_TYPE_APPLICATION) { |
| |
629 if (direction & FS_DIRECTION_SEND) |
| |
630 result |= PURPLE_MEDIA_SEND_APPLICATION; |
| |
631 if (direction & FS_DIRECTION_RECV) |
| |
632 result |= PURPLE_MEDIA_RECV_APPLICATION; |
| |
633 #endif |
| 615 } |
634 } |
| 616 return result; |
635 return result; |
| 617 } |
636 } |
| 618 |
637 |
| 619 static FsCandidate * |
638 static FsCandidate * |
| 1366 |
1385 |
| 1367 if (purple_media_get_session_type(priv->media, sessions->data) |
1386 if (purple_media_get_session_type(priv->media, sessions->data) |
| 1368 & PURPLE_MEDIA_AUDIO) |
1387 & PURPLE_MEDIA_AUDIO) |
| 1369 purple_media_error(priv->media, |
1388 purple_media_error(priv->media, |
| 1370 _("Error with your microphone")); |
1389 _("Error with your microphone")); |
| 1371 else |
1390 else if (purple_media_get_session_type(priv->media, |
| |
1391 sessions->data) & PURPLE_MEDIA_VIDEO) |
| 1372 purple_media_error(priv->media, |
1392 purple_media_error(priv->media, |
| 1373 _("Error with your webcam")); |
1393 _("Error with your webcam")); |
| 1374 |
1394 |
| 1375 break; |
1395 break; |
| 1376 } |
1396 } |
| 1789 session = g_new0(PurpleMediaBackendFs2Session, 1); |
1809 session = g_new0(PurpleMediaBackendFs2Session, 1); |
| 1790 |
1810 |
| 1791 session->session = fs_conference_new_session(priv->conference, |
1811 session->session = fs_conference_new_session(priv->conference, |
| 1792 session_type_to_fs_media_type(type), &err); |
1812 session_type_to_fs_media_type(type), &err); |
| 1793 |
1813 |
| |
1814 #ifdef HAVE_MEDIA_APPLICATION |
| |
1815 if (type == PURPLE_MEDIA_APPLICATION) { |
| |
1816 GstCaps *caps; |
| |
1817 GObject *rtpsession = NULL; |
| |
1818 |
| |
1819 caps = gst_caps_new_empty_simple ("application/octet-stream"); |
| |
1820 fs_session_set_allowed_caps (session->session, caps, caps, NULL); |
| |
1821 gst_caps_unref (caps); |
| |
1822 g_object_get (session->session, "internal-session", &rtpsession, NULL); |
| |
1823 if (rtpsession) { |
| |
1824 g_object_set (rtpsession, "probation", 0, NULL); |
| |
1825 g_object_unref (rtpsession); |
| |
1826 } |
| |
1827 } |
| |
1828 #endif |
| 1794 if (err != NULL) { |
1829 if (err != NULL) { |
| 1795 purple_media_error(priv->media, |
1830 purple_media_error(priv->media, |
| 1796 _("Error creating session: %s"), |
1831 _("Error creating session: %s"), |
| 1797 err->message); |
1832 err->message); |
| 1798 g_error_free(err); |
1833 g_error_free(err); |
| 2003 sink = gst_element_factory_make("fakesink", NULL); |
2038 sink = gst_element_factory_make("fakesink", NULL); |
| 2004 g_object_set(G_OBJECT(sink), "async", FALSE, NULL); |
2039 g_object_set(G_OBJECT(sink), "async", FALSE, NULL); |
| 2005 gst_bin_add(GST_BIN(priv->confbin), sink); |
2040 gst_bin_add(GST_BIN(priv->confbin), sink); |
| 2006 gst_element_set_state(sink, GST_STATE_PLAYING); |
2041 gst_element_set_state(sink, GST_STATE_PLAYING); |
| 2007 stream->fakesink = sink; |
2042 stream->fakesink = sink; |
| |
2043 #ifdef HAVE_MEDIA_APPLICATION |
| |
2044 } else if (codec->media_type == FS_MEDIA_TYPE_APPLICATION) { |
| |
2045 #if GST_CHECK_VERSION(1,0,0) |
| |
2046 stream->src = gst_element_factory_make("funnel", NULL); |
| |
2047 #else |
| |
2048 stream->src = gst_element_factory_make("fsfunnel", NULL); |
| |
2049 #endif |
| |
2050 sink = purple_media_manager_get_element( |
| |
2051 purple_media_get_manager(priv->media), |
| |
2052 PURPLE_MEDIA_RECV_APPLICATION, priv->media, |
| |
2053 stream->session->id, |
| |
2054 stream->participant); |
| |
2055 gst_bin_add(GST_BIN(priv->confbin), sink); |
| |
2056 gst_element_set_state(sink, GST_STATE_PLAYING); |
| |
2057 #endif |
| 2008 } |
2058 } |
| 2009 stream->tee = gst_element_factory_make("tee", NULL); |
2059 stream->tee = gst_element_factory_make("tee", NULL); |
| 2010 gst_bin_add_many(GST_BIN(priv->confbin), |
2060 gst_bin_add_many(GST_BIN(priv->confbin), |
| 2011 stream->src, stream->tee, NULL); |
2061 stream->src, stream->tee, NULL); |
| 2012 gst_element_set_state(stream->tee, GST_STATE_PLAYING); |
2062 gst_element_set_state(stream->tee, GST_STATE_PLAYING); |
| 2365 |
2415 |
| 2366 if (session == NULL) |
2416 if (session == NULL) |
| 2367 return FALSE; |
2417 return FALSE; |
| 2368 |
2418 |
| 2369 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
2419 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
| |
2420 #ifdef HAVE_MEDIA_APPLICATION |
| |
2421 PURPLE_MEDIA_SEND_APPLICATION | |
| |
2422 #endif |
| 2370 PURPLE_MEDIA_SEND_VIDEO)) { |
2423 PURPLE_MEDIA_SEND_VIDEO)) { |
| 2371 #ifdef HAVE_FARSIGHT |
2424 #ifdef HAVE_FARSIGHT |
| 2372 g_object_get(session->session, |
2425 g_object_get(session->session, |
| 2373 "codecs-ready", &ret, NULL); |
2426 "codecs-ready", &ret, NULL); |
| 2374 #else |
2427 #else |
| 2388 |
2441 |
| 2389 for (; values; values = g_list_delete_link(values, values)) { |
2442 for (; values; values = g_list_delete_link(values, values)) { |
| 2390 PurpleMediaBackendFs2Session *session = values->data; |
2443 PurpleMediaBackendFs2Session *session = values->data; |
| 2391 |
2444 |
| 2392 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
2445 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
| |
2446 #ifdef HAVE_MEDIA_APPLICATION |
| |
2447 PURPLE_MEDIA_SEND_APPLICATION | |
| |
2448 #endif |
| 2393 PURPLE_MEDIA_SEND_VIDEO)) { |
2449 PURPLE_MEDIA_SEND_VIDEO)) { |
| 2394 #ifdef HAVE_FARSIGHT |
2450 #ifdef HAVE_FARSIGHT |
| 2395 g_object_get(session->session, |
2451 g_object_get(session->session, |
| 2396 "codecs-ready", &ret, NULL); |
2452 "codecs-ready", &ret, NULL); |
| 2397 if (ret == FALSE) |
2453 if (ret == FALSE) |