cpw.maiku.media_refactor: a397d9b0: Various tweaks, fixes, and added debug o...
maiku at pidgin.im
maiku at pidgin.im
Thu Oct 22 22:36:05 EDT 2009
-----------------------------------------------------------------
Revision: a397d9b0b7a76b624bdea50eaa4b8dc71cd9ae82
Ancestor: 863911a6524c71b5eab25e58eeb71afdd8741218
Author: maiku at pidgin.im
Date: 2009-10-23T01:55:39
Branch: im.pidgin.cpw.maiku.media_refactor
URL: http://d.pidgin.im/viewmtn/revision/info/a397d9b0b7a76b624bdea50eaa4b8dc71cd9ae82
Modified files:
libpurple/media/backend-fs2.c libpurple/media/backend-fs2.h
ChangeLog:
Various tweaks, fixes, and added debug output. Attached some media signals,
and created a temporary function to help test out integrating with PurpleMedia.
-------------- next part --------------
============================================================
--- libpurple/media/backend-fs2.c 41b27b9537e0901facf8927674c58f0f3d58be94
+++ libpurple/media/backend-fs2.c d14f81dd90deda0772075c3f4abaa6bede46d517
@@ -45,6 +45,13 @@ _gst_bus_cb(GstBus *bus, GstMessage *msg
static gboolean
_gst_bus_cb(GstBus *bus, GstMessage *msg, PurpleMediaBackend *self);
+static void
+_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
+ gchar *sid, gchar *name, PurpleMediaBackendFs2 *self);
+static void
+_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
+ gchar *sid, gchar *name, gboolean local,
+ PurpleMediaBackendFs2 *self);
static gboolean purple_media_backend_fs2_add_stream(PurpleMediaBackend *self,
const gchar *sess_id, const gchar *who,
@@ -106,6 +113,8 @@ purple_media_backend_fs2_dispose(GObject
PurpleMediaBackendFs2Private *priv =
PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
+ purple_debug_info("backend-fs2", "purple_media_backend_fs2_dispose\n");
+
if (priv->confbin) {
GstElement *pipeline;
@@ -137,9 +146,12 @@ purple_media_backend_fs2_dispose(GObject
}
if (priv->media) {
- g_object_unref(priv->media);
+ g_object_remove_weak_pointer(G_OBJECT(priv->media),
+ (gpointer*)&priv->media);
priv->media = NULL;
}
+
+ G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->dispose(obj);
}
static void
@@ -147,7 +159,12 @@ purple_media_backend_fs2_finalize(GObjec
{
PurpleMediaBackendFs2Private *priv =
PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(obj);
+
+ purple_debug_info("backend-fs2", "purple_media_backend_fs2_finalize\n");
+
g_free(priv->conference_type);
+
+ G_OBJECT_CLASS(purple_media_backend_fs2_parent_class)->finalize(obj);
}
static void
@@ -164,7 +181,21 @@ purple_media_backend_fs2_set_property(GO
priv->conference_type = g_value_dup_string(value);
break;
case PROP_MEDIA:
- priv->media = g_value_dup_object(value);
+ priv->media = g_value_get_object(value);
+
+ if (priv->media == NULL)
+ break;
+
+ g_object_add_weak_pointer(G_OBJECT(priv->media),
+ (gpointer*)&priv->media);
+
+ g_signal_connect(G_OBJECT(priv->media),
+ "state-changed",
+ G_CALLBACK(_state_changed_cb),
+ PURPLE_MEDIA_BACKEND_FS2(object));
+ g_signal_connect(G_OBJECT(priv->media), "stream-info",
+ G_CALLBACK(_stream_info_cb),
+ PURPLE_MEDIA_BACKEND_FS2(object));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(
@@ -232,6 +263,19 @@ _gst_bus_cb(GstBus *bus, GstMessage *msg
return TRUE;
}
+static void
+_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
+ gchar *sid, gchar *name, PurpleMediaBackendFs2 *self)
+{
+}
+
+static void
+_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
+ gchar *sid, gchar *name, gboolean local,
+ PurpleMediaBackendFs2 *self)
+{
+}
+
static gboolean
_init_conference(PurpleMediaBackend *self)
{
@@ -250,7 +294,7 @@ _init_conference(PurpleMediaBackend *sel
}
pipeline = purple_media_manager_get_pipeline(
- purple_media_manager_get());
+ purple_media_get_manager(priv->media));
if (pipeline == NULL) {
purple_debug_error("backend-fs2",
@@ -313,7 +357,7 @@ purple_media_backend_fs2_add_stream(Purp
PurpleMediaBackendFs2Private *priv =
PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
- if (priv->conference == NULL || !_init_conference(self)) {
+ if (priv->conference == NULL && !_init_conference(self)) {
purple_debug_error("backend-fs2",
"Error initializing the conference.\n");
return FALSE;
@@ -356,3 +400,11 @@ purple_media_backend_fs2_set_send_codec(
{
}
+FsConference *
+purple_media_backend_fs2_get_conference(PurpleMediaBackendFs2 *self)
+{
+ PurpleMediaBackendFs2Private *priv =
+ PURPLE_MEDIA_BACKEND_FS2_GET_PRIVATE(self);
+ return priv->conference;
+}
+
============================================================
--- libpurple/media/backend-fs2.h 7558e91bec843486165004b49709facf1320f2f8
+++ libpurple/media/backend-fs2.h aa2ed4205cba442c1c5cb9117014dfa2b33d7ca1
@@ -55,6 +55,15 @@ GType purple_media_backend_fs2_get_type(
*/
GType purple_media_backend_fs2_get_type(void);
+/*
+ * Temporary function in order to be able to test while
+ * integrating with PurpleMedia
+ */
+#include <gst/farsight/fs-conference-iface.h>
+FsConference *purple_media_backend_fs2_get_conference(
+ PurpleMediaBackendFs2 *self);
+/* end tmp */
+
G_END_DECLS
#endif /* _MEDIA_BACKEND_FS2_H_ */
More information about the Commits
mailing list