Mercurial > pidgin
comparison libpurple/media.c @ 27903:56770cc3287d
merge of '20320727f6c8f5a4a4b7b8c0f65c74a57ada1e15'
and '693f34aeef5794c9381068260ba79c542090e3fb'
author | maiku@pidgin.im |
---|---|
date | Thu, 13 Aug 2009 07:28:12 +0000 |
parents | f77978e6968e |
children | 98d8c11e4937 8c991e09efcb |
comparison
equal
deleted
inserted
replaced
27902:e30de9ebfa69 | 27903:56770cc3287d |
---|---|
1904 gst_object_unref(pad); | 1904 gst_object_unref(pad); |
1905 gst_pad_set_active(ghost, TRUE); | 1905 gst_pad_set_active(ghost, TRUE); |
1906 gst_element_add_pad(session->media->priv->confbin, ghost); | 1906 gst_element_add_pad(session->media->priv->confbin, ghost); |
1907 } | 1907 } |
1908 | 1908 |
1909 gst_element_set_state(session->tee, GST_STATE_PLAYING); | |
1909 gst_element_link(session->src, session->media->priv->confbin); | 1910 gst_element_link(session->src, session->media->priv->confbin); |
1910 gst_element_set_state(session->tee, GST_STATE_PLAYING); | |
1911 | 1911 |
1912 g_object_get(session->session, "sink-pad", &sinkpad, NULL); | 1912 g_object_get(session->session, "sink-pad", &sinkpad, NULL); |
1913 if (session->type & PURPLE_MEDIA_SEND_AUDIO) { | 1913 if (session->type & PURPLE_MEDIA_SEND_AUDIO) { |
1914 gchar *name = g_strdup_printf("volume_%s", session->id); | 1914 gchar *name = g_strdup_printf("volume_%s", session->id); |
1915 GstElement *level; | 1915 GstElement *level; |
1920 name = g_strdup_printf("sendlevel_%s", session->id); | 1920 name = g_strdup_printf("sendlevel_%s", session->id); |
1921 level = gst_element_factory_make("level", name); | 1921 level = gst_element_factory_make("level", name); |
1922 g_free(name); | 1922 g_free(name); |
1923 gst_bin_add(GST_BIN(session->media->priv->confbin), volume); | 1923 gst_bin_add(GST_BIN(session->media->priv->confbin), volume); |
1924 gst_bin_add(GST_BIN(session->media->priv->confbin), level); | 1924 gst_bin_add(GST_BIN(session->media->priv->confbin), level); |
1925 gst_element_link(session->tee, volume); | |
1926 gst_element_link(volume, level); | |
1927 gst_element_set_state(level, GST_STATE_PLAYING); | 1925 gst_element_set_state(level, GST_STATE_PLAYING); |
1928 gst_element_set_state(volume, GST_STATE_PLAYING); | 1926 gst_element_set_state(volume, GST_STATE_PLAYING); |
1927 gst_element_link(volume, level); | |
1928 gst_element_link(session->tee, volume); | |
1929 srcpad = gst_element_get_static_pad(level, "src"); | 1929 srcpad = gst_element_get_static_pad(level, "src"); |
1930 g_object_set(volume, "volume", input_volume, NULL); | 1930 g_object_set(volume, "volume", input_volume, NULL); |
1931 } else { | 1931 } else { |
1932 srcpad = gst_element_get_request_pad(session->tee, "src%d"); | 1932 srcpad = gst_element_get_request_pad(session->tee, "src%d"); |
1933 } | 1933 } |
2464 gst_bin_add(GST_BIN(priv->confbin), stream->level); | 2464 gst_bin_add(GST_BIN(priv->confbin), stream->level); |
2465 gst_bin_add(GST_BIN(priv->confbin), sink); | 2465 gst_bin_add(GST_BIN(priv->confbin), sink); |
2466 gst_element_set_state(sink, GST_STATE_PLAYING); | 2466 gst_element_set_state(sink, GST_STATE_PLAYING); |
2467 gst_element_set_state(stream->level, GST_STATE_PLAYING); | 2467 gst_element_set_state(stream->level, GST_STATE_PLAYING); |
2468 gst_element_set_state(stream->volume, GST_STATE_PLAYING); | 2468 gst_element_set_state(stream->volume, GST_STATE_PLAYING); |
2469 gst_element_set_state(queue, GST_STATE_PLAYING); | |
2469 gst_element_link(stream->level, sink); | 2470 gst_element_link(stream->level, sink); |
2470 gst_element_link(stream->volume, stream->level); | 2471 gst_element_link(stream->volume, stream->level); |
2471 gst_element_link(queue, stream->volume); | 2472 gst_element_link(queue, stream->volume); |
2472 sink = queue; | 2473 sink = queue; |
2473 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) { | 2474 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) { |
2475 "fsfunnel", NULL); | 2476 "fsfunnel", NULL); |
2476 sink = gst_element_factory_make( | 2477 sink = gst_element_factory_make( |
2477 "fakesink", NULL); | 2478 "fakesink", NULL); |
2478 g_object_set(G_OBJECT(sink), "async", FALSE, NULL); | 2479 g_object_set(G_OBJECT(sink), "async", FALSE, NULL); |
2479 gst_bin_add(GST_BIN(priv->confbin), sink); | 2480 gst_bin_add(GST_BIN(priv->confbin), sink); |
2481 gst_element_set_state(sink, GST_STATE_PLAYING); | |
2480 } | 2482 } |
2481 stream->tee = gst_element_factory_make("tee", NULL); | 2483 stream->tee = gst_element_factory_make("tee", NULL); |
2482 gst_bin_add_many(GST_BIN(priv->confbin), | 2484 gst_bin_add_many(GST_BIN(priv->confbin), |
2483 stream->src, stream->tee, NULL); | 2485 stream->src, stream->tee, NULL); |
2484 gst_element_set_state(sink, GST_STATE_PLAYING); | |
2485 gst_element_set_state(stream->tee, GST_STATE_PLAYING); | 2486 gst_element_set_state(stream->tee, GST_STATE_PLAYING); |
2486 gst_element_set_state(stream->src, GST_STATE_PLAYING); | 2487 gst_element_set_state(stream->src, GST_STATE_PLAYING); |
2487 gst_element_link_many(stream->src, stream->tee, sink, NULL); | 2488 gst_element_link_many(stream->src, stream->tee, sink, NULL); |
2488 } | 2489 } |
2489 | 2490 |
2615 purple_media_add_session(media, session); | 2616 purple_media_add_session(media, session); |
2616 g_signal_emit(media, purple_media_signals[STATE_CHANGED], | 2617 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
2617 0, PURPLE_MEDIA_STATE_NEW, | 2618 0, PURPLE_MEDIA_STATE_NEW, |
2618 session->id, NULL); | 2619 session->id, NULL); |
2619 | 2620 |
2620 session_type = purple_media_from_fs(media_type, | 2621 if (type_direction & FS_DIRECTION_SEND) { |
2621 FS_DIRECTION_SEND); | 2622 session_type = purple_media_from_fs(media_type, |
2622 src = purple_media_manager_get_element( | 2623 FS_DIRECTION_SEND); |
2623 media->priv->manager, session_type, | 2624 src = purple_media_manager_get_element( |
2624 media, session->id, who); | 2625 media->priv->manager, session_type, |
2625 if (!GST_IS_ELEMENT(src)) { | 2626 media, session->id, who); |
2626 purple_debug_error("media", | 2627 if (!GST_IS_ELEMENT(src)) { |
2627 "Error creating src for session %s\n", | 2628 purple_debug_error("media", |
2628 session->id); | 2629 "Error creating src for session %s\n", |
2629 purple_media_end(media, session->id, NULL); | 2630 session->id); |
2630 return FALSE; | 2631 purple_media_end(media, session->id, NULL); |
2632 return FALSE; | |
2633 } | |
2634 | |
2635 purple_media_set_src(media, session->id, src); | |
2636 gst_element_set_state(session->src, GST_STATE_PLAYING); | |
2637 purple_media_manager_create_output_window( | |
2638 media->priv->manager, | |
2639 session->media, | |
2640 session->id, NULL); | |
2631 } | 2641 } |
2632 | |
2633 purple_media_set_src(media, session->id, src); | |
2634 gst_element_set_state(session->src, GST_STATE_PLAYING); | |
2635 | |
2636 purple_media_manager_create_output_window( | |
2637 media->priv->manager, | |
2638 session->media, | |
2639 session->id, NULL); | |
2640 } | 2642 } |
2641 | 2643 |
2642 if (!(participant = purple_media_add_participant(media, who))) { | 2644 if (!(participant = purple_media_add_participant(media, who))) { |
2643 purple_media_remove_session(media, session); | 2645 purple_media_remove_session(media, session); |
2644 g_free(session); | 2646 g_free(session); |
3000 PurpleMediaSession *session; | 3002 PurpleMediaSession *session; |
3001 session = purple_media_get_session(media, sess_id); | 3003 session = purple_media_get_session(media, sess_id); |
3002 | 3004 |
3003 if (session == NULL) | 3005 if (session == NULL) |
3004 return FALSE; | 3006 return FALSE; |
3005 | 3007 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
3006 g_object_get(session->session, "codecs-ready", &ret, NULL); | 3008 PURPLE_MEDIA_SEND_VIDEO)) |
3009 g_object_get(session->session, | |
3010 "codecs-ready", &ret, NULL); | |
3011 else | |
3012 ret = TRUE; | |
3007 } else { | 3013 } else { |
3008 GList *values = g_hash_table_get_values(media->priv->sessions); | 3014 GList *values = g_hash_table_get_values(media->priv->sessions); |
3009 for (; values; values = g_list_delete_link(values, values)) { | 3015 for (; values; values = g_list_delete_link(values, values)) { |
3010 PurpleMediaSession *session = values->data; | 3016 PurpleMediaSession *session = values->data; |
3011 g_object_get(session->session, | 3017 if (session->type & (PURPLE_MEDIA_SEND_AUDIO | |
3012 "codecs-ready", &ret, NULL); | 3018 PURPLE_MEDIA_SEND_VIDEO)) |
3019 g_object_get(session->session, | |
3020 "codecs-ready", &ret, NULL); | |
3021 else | |
3022 ret = TRUE; | |
3023 | |
3013 if (ret == FALSE) | 3024 if (ret == FALSE) |
3014 break; | 3025 break; |
3015 } | 3026 } |
3016 if (values != NULL) | 3027 if (values != NULL) |
3017 g_list_free(values); | 3028 g_list_free(values); |