maiku.vv: 5585b8e9: Prepare vv GUI earlier and create sinks ...
maiku at soc.pidgin.im
maiku at soc.pidgin.im
Wed Nov 5 21:25:29 EST 2008
-----------------------------------------------------------------
Revision: 5585b8e919d9adb0eb491c714768027e81f1918c
Ancestor: fbed2ea188bd9ae48534251b5d3e5b6cd694fe2f
Author: maiku at soc.pidgin.im
Date: 2008-11-06T02:21:16
Branch: im.pidgin.maiku.vv
URL: http://d.pidgin.im/viewmtn/revision/info/5585b8e919d9adb0eb491c714768027e81f1918c
Modified files:
libpurple/media.c pidgin/gtkmedia.c
ChangeLog:
Prepare vv GUI earlier and create sinks when src-pad-added is triggered.
-------------- next part --------------
============================================================
--- libpurple/media.c 3a0bccc0b0c3eb5115d865ee4564d5784810dfd8
+++ libpurple/media.c 34d6715ff0352e75b4535c5406cd3179356e943c
@@ -917,7 +917,7 @@ purple_media_video_init_src(GstElement *
queue = gst_element_factory_make("queue", "purplelocalvideoqueue");
gst_bin_add(GST_BIN(*sendbin), queue);
- /* The queue is linked later, when the local video is ready to be shown */
+ gst_element_link(tee, queue);
local_sink = gst_element_factory_make("autovideosink", "purplelocalvideosink");
gst_bin_add(GST_BIN(*sendbin), local_sink);
@@ -1034,9 +1034,16 @@ purple_media_src_pad_added_cb(FsStream *
purple_media_src_pad_added_cb(FsStream *stream, GstPad *srcpad,
FsCodec *codec, PurpleMediaSession *session)
{
- GstPad *sinkpad = gst_element_get_static_pad(session->sink, "ghostsink");
+ PurpleMediaSessionType type = purple_media_from_fs(codec->media_type, FS_DIRECTION_RECV);
+ GstPad *sinkpad = NULL;
+ session->sink = purple_media_manager_get_element(purple_media_manager_get(), type);
+
+ gst_bin_add(GST_BIN(purple_media_get_pipeline(session->media)),
+ session->sink);
+ sinkpad = gst_element_get_static_pad(session->sink, "ghostsink");
purple_debug_info("media", "connecting new src pad: %s\n",
gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK ? "success" : "failure");
+ gst_element_set_state(session->sink, GST_STATE_PLAYING);
}
static gchar *
============================================================
--- pidgin/gtkmedia.c 4c8c2f03b4fcc94490112810c3abd9af613759ab
+++ pidgin/gtkmedia.c a52c93dfeac2d27e2fc1b999f2a4fb93be4b5840
@@ -302,10 +302,13 @@ pidgin_media_ready_cb(PurpleMedia *media
static void
pidgin_media_ready_cb(PurpleMedia *media, PidginMedia *gtkmedia)
{
+ GstElement *pipeline = purple_media_get_pipeline(media);
+ GtkWidget *send_widget = NULL, *recv_widget = NULL;
GstElement *audiosendbin = NULL, *audiosendlevel = NULL;
- GstElement *audiorecvbin = NULL, *audiorecvlevel = NULL;
GstElement *videosendbin = NULL;
- GstElement *videorecvbin = NULL;
+ gboolean audiorecvbool = FALSE;
+ gboolean videorecvbool = FALSE;
+ GstBus *bus;
GList *sessions = purple_media_get_session_names(media);
@@ -317,10 +320,8 @@ pidgin_media_ready_cb(PurpleMedia *media
purple_media_set_src(media, sessions->data, audiosendbin);
gst_element_set_state(audiosendbin, GST_STATE_PLAYING);
}
- if (!audiorecvbin && (type & PURPLE_MEDIA_RECV_AUDIO)) {
- purple_media_audio_init_recv(&audiorecvbin, &audiorecvlevel);
- purple_media_set_sink(media, sessions->data, audiorecvbin);
- gst_element_set_state(audiorecvbin, GST_STATE_READY);
+ if (!audiorecvbool && (type & PURPLE_MEDIA_RECV_AUDIO)) {
+ audiorecvbool = TRUE;
}
} else if (type & PURPLE_MEDIA_VIDEO) {
if (!videosendbin && (type & PURPLE_MEDIA_SEND_VIDEO)) {
@@ -328,48 +329,13 @@ pidgin_media_ready_cb(PurpleMedia *media
purple_media_set_src(media, sessions->data, videosendbin);
gst_element_set_state(videosendbin, GST_STATE_PLAYING);
}
- if (!videorecvbin && (type & PURPLE_MEDIA_RECV_VIDEO)) {
- purple_media_video_init_recv(&videorecvbin);
- purple_media_set_sink(media, sessions->data, videorecvbin);
- gst_element_set_state(videorecvbin, GST_STATE_READY);
+ if (!videorecvbool && (type & PURPLE_MEDIA_RECV_VIDEO)) {
+ videorecvbool = TRUE;
}
}
}
- if (audiosendlevel || audiorecvlevel) {
- g_object_set(gtkmedia, "send-level", audiosendlevel,
- "recv-level", audiorecvlevel,
- NULL);
- }
-}
-
-static void
-pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
- pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING);
-}
-
-/* maybe we should have different callbacks for when we received the accept
- and we accepted ourselves */
-static void
-pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia)
-{
- GtkWidget *send_widget = NULL, *recv_widget = NULL;
-
- GstElement *pipeline = purple_media_get_pipeline(media);
- GstElement *audiosendbin = NULL;
- GstElement *audiorecvbin = NULL;
- GstElement *videosendbin = NULL;
- GstElement *videorecvbin = NULL;
- GstBus *bus;
-
- pidgin_media_emit_message(gtkmedia, _("Call in progress."));
- pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
-
- purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
- &videosendbin, &videorecvbin);
-
- if (videorecvbin || audiorecvbin) {
+ if (videorecvbool || audiorecvbool) {
recv_widget = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
gtk_box_pack_start(GTK_BOX(gtkmedia->priv->display),
recv_widget, TRUE, TRUE, 0);
@@ -382,7 +348,7 @@ pidgin_media_accept_cb(PurpleMedia *medi
gtk_widget_show(send_widget);
}
- if (videorecvbin) {
+ if (videorecvbool) {
GtkWidget *aspect;
GtkWidget *remote_video;
@@ -397,12 +363,10 @@ pidgin_media_accept_cb(PurpleMedia *medi
gtk_widget_show(aspect);
gtkmedia->priv->remote_video = remote_video;
- gst_element_set_state(videorecvbin, GST_STATE_PLAYING);
}
if (videosendbin) {
GtkWidget *aspect;
GtkWidget *local_video;
- GstElement *tee, *queue;
aspect = gtk_aspect_frame_new(NULL, 0.5, 0.5, 4.0/3.0, FALSE);
gtk_frame_set_shadow_type(GTK_FRAME(aspect), GTK_SHADOW_IN);
@@ -415,15 +379,9 @@ pidgin_media_accept_cb(PurpleMedia *medi
gtk_widget_show(aspect);
gtkmedia->priv->local_video = local_video;
-
- tee = gst_bin_get_by_name(GST_BIN(videosendbin), "purplevideosrctee");
- queue = gst_bin_get_by_name(GST_BIN(videosendbin), "purplelocalvideoqueue");
- gst_element_link(tee, queue);
- gst_object_unref(tee);
- gst_object_unref(queue);
}
- if (audiorecvbin) {
+ if (audiorecvbool) {
gtkmedia->priv->recv_progress = gtk_progress_bar_new();
gtk_widget_set_size_request(gtkmedia->priv->recv_progress, 10, 70);
gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(gtkmedia->priv->recv_progress),
@@ -431,7 +389,6 @@ pidgin_media_accept_cb(PurpleMedia *medi
gtk_box_pack_end(GTK_BOX(recv_widget),
gtkmedia->priv->recv_progress, FALSE, FALSE, 0);
gtk_widget_show(gtkmedia->priv->recv_progress);
- gst_element_set_state(audiorecvbin, GST_STATE_PLAYING);
}
if (audiosendbin) {
gtkmedia->priv->send_progress = gtk_progress_bar_new();
@@ -445,19 +402,46 @@ pidgin_media_accept_cb(PurpleMedia *medi
gtk_widget_show(gtkmedia->priv->mute);
}
- if (audiorecvbin || audiosendbin || videorecvbin || videosendbin)
- gtk_widget_show(gtkmedia->priv->display);
+ bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
- bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
- if (audiorecvbin || audiosendbin)
+ if (videorecvbool || videosendbin)
+ gst_bus_set_sync_handler(bus,
+ (GstBusSyncHandler)create_window, gtkmedia);
+
+ if (audiorecvbool || audiosendbin)
g_signal_connect(G_OBJECT(bus), "message::element",
G_CALLBACK(level_message_cb), gtkmedia);
- if (videorecvbin || videosendbin)
- gst_bus_set_sync_handler(bus, (GstBusSyncHandler)create_window, gtkmedia);
+
gst_object_unref(bus);
}
static void
+pidgin_media_wait_cb(PurpleMedia *media, PidginMedia *gtkmedia)
+{
+ pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_WAITING);
+}
+
+/* maybe we should have different callbacks for when we received the accept
+ and we accepted ourselves */
+static void
+pidgin_media_accept_cb(PurpleMedia *media, PidginMedia *gtkmedia)
+{
+ GstElement *audiosendbin = NULL;
+ GstElement *audiorecvbin = NULL;
+ GstElement *videosendbin = NULL;
+ GstElement *videorecvbin = NULL;
+
+ pidgin_media_emit_message(gtkmedia, _("Call in progress."));
+ pidgin_media_set_state(gtkmedia, PIDGIN_MEDIA_ACCEPTED);
+
+ purple_media_get_elements(media, &audiosendbin, &audiorecvbin,
+ &videosendbin, &videorecvbin);
+
+ if (audiorecvbin || audiosendbin || videorecvbin || videosendbin)
+ gtk_widget_show(gtkmedia->priv->display);
+}
+
+static void
pidgin_media_hangup_cb(PurpleMedia *media, PidginMedia *gtkmedia)
{
pidgin_media_emit_message(gtkmedia, _("You have ended the call."));
More information about the Commits
mailing list