[Telepathy-commits] [telepathy-gabble/master] GabbleMediaStream: add _new function

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Feb 26 02:51:12 PST 2009


---
 src/media-channel.c |    8 +-------
 src/media-stream.c  |   18 ++++++++++++++++++
 src/media-stream.h  |    4 ++++
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/src/media-channel.c b/src/media-channel.c
index fb330c8..190189e 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2359,13 +2359,7 @@ create_stream_from_content (GabbleMediaChannel *chan, GabbleJingleContent *c)
   mtype = (type == JINGLE_MEDIA_TYPE_AUDIO) ?
     TP_MEDIA_STREAM_TYPE_AUDIO : TP_MEDIA_STREAM_TYPE_VIDEO;
 
-  stream = g_object_new (GABBLE_TYPE_MEDIA_STREAM,
-      "object-path", object_path,
-      "content", c,
-      "name", name,
-      "id", id,
-      "media-type", mtype,
-      NULL);
+  stream = gabble_media_stream_new (object_path, c, name, id, mtype);
 
   if (locally_created)
     {
diff --git a/src/media-stream.c b/src/media-stream.c
index f6c8422..a9cd7b4 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -139,6 +139,24 @@ static void content_removed_cb (GabbleJingleContent *content,
 static void update_direction (GabbleMediaStream *stream, GabbleJingleContent *c);
 static void update_sending (GabbleMediaStream *stream, gboolean start_sending);
 
+GabbleMediaStream *
+gabble_media_stream_new (const gchar *object_path,
+                         GabbleJingleContent *content,
+                         const gchar *name,
+                         guint id,
+                         TpMediaStreamType mtype)
+{
+  g_return_val_if_fail (GABBLE_IS_JINGLE_MEDIA_RTP (content), NULL);
+
+  return g_object_new (GABBLE_TYPE_MEDIA_STREAM,
+      "object-path", object_path,
+      "content", content,
+      "name", name,
+      "id", id,
+      "media-type", mtype,
+      NULL);
+}
+
 static void
 gabble_media_stream_init (GabbleMediaStream *self)
 {
diff --git a/src/media-stream.h b/src/media-stream.h
index 5a2a594..d1ba06a 100644
--- a/src/media-stream.h
+++ b/src/media-stream.h
@@ -94,6 +94,10 @@ gboolean gabble_media_stream_change_direction (GabbleMediaStream *stream,
     guint requested_dir, GError **error);
 void gabble_media_stream_accept_pending_local_send (GabbleMediaStream *stream);
 
+GabbleMediaStream *gabble_media_stream_new (const gchar *object_path,
+    GabbleJingleContent *content, const gchar *name, guint id,
+    TpMediaStreamType mtype);
+
 G_END_DECLS
 
 #endif /* #ifndef __GABBLE_MEDIA_STREAM_H__*/
-- 
1.5.6.5




More information about the telepathy-commits mailing list