Mercurial > pidgin
comparison libpurple/media/media.c @ 29157:e85df0170905
Decouple the media_bus_call from the backend. It will still be needed even
after integration with the backend is finished.
author | maiku@pidgin.im |
---|---|
date | Fri, 23 Oct 2009 18:20:54 +0000 |
parents | 846a475a1573 |
children | ae81f8baa148 |
comparison
equal
deleted
inserted
replaced
29156:846a475a1573 | 29157:e85df0170905 |
---|---|
111 PurpleMediaManager *manager; | 111 PurpleMediaManager *manager; |
112 PurpleAccount *account; | 112 PurpleAccount *account; |
113 PurpleMediaBackend *backend; | 113 PurpleMediaBackend *backend; |
114 FsConference *conference; | 114 FsConference *conference; |
115 gchar *conference_type; | 115 gchar *conference_type; |
116 gulong gst_bus_handler_id; | |
116 gboolean initiator; | 117 gboolean initiator; |
117 gpointer prpl_data; | 118 gpointer prpl_data; |
118 | 119 |
119 GHashTable *sessions; /* PurpleMediaSession table */ | 120 GHashTable *sessions; /* PurpleMediaSession table */ |
120 GHashTable *participants; /* FsParticipant table */ | 121 GHashTable *participants; /* FsParticipant table */ |
376 GList *participants = g_hash_table_get_values(priv->participants); | 377 GList *participants = g_hash_table_get_values(priv->participants); |
377 for (; participants; participants = g_list_delete_link(participants, participants)) | 378 for (; participants; participants = g_list_delete_link(participants, participants)) |
378 g_object_unref(participants->data); | 379 g_object_unref(participants->data); |
379 } | 380 } |
380 | 381 |
381 if (priv->manager) { | 382 if (priv->gst_bus_handler_id != 0) { |
382 GstElement *pipeline = purple_media_manager_get_pipeline( | 383 GstElement *pipeline = purple_media_manager_get_pipeline( |
383 priv->manager); | 384 priv->manager); |
384 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); | 385 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); |
385 g_signal_handlers_disconnect_matched(G_OBJECT(bus), | 386 g_signal_handler_disconnect(bus, priv->gst_bus_handler_id); |
386 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, | |
387 0, 0, 0, media_bus_call, media); | |
388 gst_object_unref(bus); | 387 gst_object_unref(bus); |
389 | 388 priv->gst_bus_handler_id = 0; |
389 } | |
390 | |
391 if (priv->manager) { | |
390 g_object_unref(priv->manager); | 392 g_object_unref(priv->manager); |
391 priv->manager = NULL; | 393 priv->manager = NULL; |
392 } | 394 } |
393 | 395 |
394 G_OBJECT_CLASS(parent_class)->dispose(media); | 396 G_OBJECT_CLASS(parent_class)->dispose(media); |
1605 purple_media_to_fs_stream_direction(type); | 1607 purple_media_to_fs_stream_direction(type); |
1606 gboolean is_nice = !strcmp(transmitter, "nice"); | 1608 gboolean is_nice = !strcmp(transmitter, "nice"); |
1607 | 1609 |
1608 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); | 1610 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
1609 | 1611 |
1612 if (media->priv->gst_bus_handler_id == 0) { | |
1613 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE( | |
1614 purple_media_manager_get_pipeline( | |
1615 purple_media_manager_get()))); | |
1616 media->priv->gst_bus_handler_id = | |
1617 g_signal_connect(G_OBJECT(bus), "message", | |
1618 G_CALLBACK(media_bus_call), media); | |
1619 gst_object_unref(bus); | |
1620 } | |
1621 | |
1610 if (!purple_media_backend_add_stream(media->priv->backend, | 1622 if (!purple_media_backend_add_stream(media->priv->backend, |
1611 sess_id, who, type, initiator, transmitter, | 1623 sess_id, who, type, initiator, transmitter, |
1612 num_params, params)) { | 1624 num_params, params)) { |
1613 purple_debug_error("media", "Error adding stream.\n"); | 1625 purple_debug_error("media", "Error adding stream.\n"); |
1614 return FALSE; | 1626 return FALSE; |
1615 } | 1627 } |
1616 | 1628 |
1617 /* XXX: Temporary call while integrating with backend */ | 1629 /* XXX: Temporary call while integrating with backend */ |
1618 if (media->priv->conference == NULL) { | 1630 if (media->priv->conference == NULL) { |
1619 GstBus *bus; | |
1620 media->priv->conference = | 1631 media->priv->conference = |
1621 purple_media_backend_fs2_get_conference( | 1632 purple_media_backend_fs2_get_conference( |
1622 PURPLE_MEDIA_BACKEND_FS2( | 1633 PURPLE_MEDIA_BACKEND_FS2( |
1623 media->priv->backend)); | 1634 media->priv->backend)); |
1624 media->priv->confbin = GST_ELEMENT_PARENT( | 1635 media->priv->confbin = GST_ELEMENT_PARENT( |
1625 media->priv->conference); | 1636 media->priv->conference); |
1626 bus = gst_pipeline_get_bus(GST_PIPELINE( | |
1627 purple_media_manager_get_pipeline( | |
1628 purple_media_manager_get()))); | |
1629 g_signal_connect(G_OBJECT(bus), "message", | |
1630 G_CALLBACK(media_bus_call), media); | |
1631 gst_object_unref(bus); | |
1632 } | 1637 } |
1633 | 1638 |
1634 session = purple_media_get_session(media, sess_id); | 1639 session = purple_media_get_session(media, sess_id); |
1635 | 1640 |
1636 if (!session) { | 1641 if (!session) { |