Mercurial > pidgin
annotate libpurple/media.c @ 30297:ea3c2bbcf1a6
Updated Norwegian Nynorsk translation and translator's e-mail address. Fixes #12348
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Tue, 27 Jul 2010 06:07:12 +0000 |
parents | 3f84b7069366 |
children | 1feb2baeac2d ee3226c6092f |
rev | line source |
---|---|
29352
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1 /** |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
2 * @file media.c Media API |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
3 * @ingroup core |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
4 */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
5 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
6 /* purple |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
7 * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
8 * Purple is the legal property of its developers, whose names are too numerous |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
10 * source distribution. |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
11 * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
15 * (at your option) any later version. |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
16 * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
21 * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
25 */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
26 #include "internal.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
27 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
28 #include "account.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
29 #include "media.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
30 #include "media/backend-iface.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
31 #include "mediamanager.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
32 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
33 #include "debug.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
34 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
35 #ifdef USE_GSTREAMER |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
36 #include "media/backend-fs2.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
37 #include "marshallers.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
38 #include "media-gst.h" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
39 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
40 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
41 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
42 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
43 /** @copydoc _PurpleMediaSession */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
44 typedef struct _PurpleMediaSession PurpleMediaSession; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
45 /** @copydoc _PurpleMediaStream */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
46 typedef struct _PurpleMediaStream PurpleMediaStream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
47 /** @copydoc _PurpleMediaClass */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
48 typedef struct _PurpleMediaClass PurpleMediaClass; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
49 /** @copydoc _PurpleMediaPrivate */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
50 typedef struct _PurpleMediaPrivate PurpleMediaPrivate; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
51 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
52 /** The media class */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
53 struct _PurpleMediaClass |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
54 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
55 GObjectClass parent_class; /**< The parent class. */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
56 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
57 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
58 /** The media class's private data */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
59 struct _PurpleMedia |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
60 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
61 GObject parent; /**< The parent of this object. */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
62 PurpleMediaPrivate *priv; /**< The private data of this object. */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
63 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
64 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
65 struct _PurpleMediaSession |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
66 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
67 gchar *id; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
68 PurpleMedia *media; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
69 PurpleMediaSessionType type; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
70 gboolean initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
71 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
72 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
73 struct _PurpleMediaStream |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
74 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
75 PurpleMediaSession *session; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
76 gchar *participant; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
77 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
78 GList *local_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
79 GList *remote_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
80 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
81 gboolean initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
82 gboolean accepted; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
83 gboolean candidates_prepared; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
84 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
85 GList *active_local_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
86 GList *active_remote_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
87 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
88 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
89 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
90 struct _PurpleMediaPrivate |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
91 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
92 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
93 PurpleMediaManager *manager; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
94 PurpleAccount *account; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
95 PurpleMediaBackend *backend; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
96 gchar *conference_type; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
97 gboolean initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
98 gpointer prpl_data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
99 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
100 GHashTable *sessions; /* PurpleMediaSession table */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
101 GList *participants; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
102 GList *streams; /* PurpleMediaStream table */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
103 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
104 gpointer dummy; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
105 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
106 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
107 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
108 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
109 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
110 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
111 static void purple_media_class_init (PurpleMediaClass *klass); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
112 static void purple_media_init (PurpleMedia *media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
113 static void purple_media_dispose (GObject *object); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
114 static void purple_media_finalize (GObject *object); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
115 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
116 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
117 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
118 static void purple_media_new_local_candidate_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
119 const gchar *sess_id, const gchar *participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
120 PurpleMediaCandidate *candidate, PurpleMedia *media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
121 static void purple_media_candidates_prepared_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
122 const gchar *sess_id, const gchar *name, PurpleMedia *media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
123 static void purple_media_candidate_pair_established_cb( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
124 PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
125 const gchar *sess_id, const gchar *name, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
126 PurpleMediaCandidate *local_candidate, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
127 PurpleMediaCandidate *remote_candidate, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
128 PurpleMedia *media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
129 static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
130 const gchar *sess_id, PurpleMedia *media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
131 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
132 static GObjectClass *parent_class = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
133 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
134 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
135 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
136 enum { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
137 S_ERROR, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
138 CANDIDATES_PREPARED, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
139 CODECS_CHANGED, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
140 LEVEL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
141 NEW_CANDIDATE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
142 STATE_CHANGED, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
143 STREAM_INFO, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
144 LAST_SIGNAL |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
145 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
146 static guint purple_media_signals[LAST_SIGNAL] = {0}; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
147 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
148 enum { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
149 PROP_0, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
150 PROP_MANAGER, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
151 PROP_BACKEND, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
152 PROP_ACCOUNT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
153 PROP_CONFERENCE_TYPE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
154 PROP_INITIATOR, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
155 PROP_PRPL_DATA, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
156 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
157 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
158 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
159 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
160 GType |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
161 purple_media_get_type() |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
162 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
163 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
164 static GType type = 0; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
165 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
166 if (type == 0) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
167 static const GTypeInfo info = { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
168 sizeof(PurpleMediaClass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
169 NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
170 NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
171 (GClassInitFunc) purple_media_class_init, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
172 NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
173 NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
174 sizeof(PurpleMedia), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
175 0, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
176 (GInstanceInitFunc) purple_media_init, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
177 NULL |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
178 }; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
179 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
180 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
181 return type; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
182 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
183 return G_TYPE_NONE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
184 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
185 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
186 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
187 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
188 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
189 purple_media_class_init (PurpleMediaClass *klass) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
190 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
191 GObjectClass *gobject_class = (GObjectClass*)klass; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
192 parent_class = g_type_class_peek_parent(klass); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
193 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
194 gobject_class->dispose = purple_media_dispose; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
195 gobject_class->finalize = purple_media_finalize; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
196 gobject_class->set_property = purple_media_set_property; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
197 gobject_class->get_property = purple_media_get_property; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
198 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
199 g_object_class_install_property(gobject_class, PROP_MANAGER, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
200 g_param_spec_object("manager", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
201 "Purple Media Manager", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
202 "The media manager that contains this media session.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
203 PURPLE_TYPE_MEDIA_MANAGER, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
204 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
205 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
206 /* |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
207 * This one should be PURPLE_TYPE_MEDIA_BACKEND, but it doesn't |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
208 * like interfaces because they "aren't GObjects" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
209 */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
210 g_object_class_install_property(gobject_class, PROP_BACKEND, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
211 g_param_spec_object("backend", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
212 "Purple Media Backend", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
213 "The backend object this media object uses.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
214 G_TYPE_OBJECT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
215 G_PARAM_READABLE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
216 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
217 g_object_class_install_property(gobject_class, PROP_ACCOUNT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
218 g_param_spec_pointer("account", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
219 "PurpleAccount", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
220 "The account this media session is on.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
221 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
222 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
223 g_object_class_install_property(gobject_class, PROP_CONFERENCE_TYPE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
224 g_param_spec_string("conference-type", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
225 "Conference Type", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
226 "The type of conference that this media object " |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
227 "has been created to provide.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
228 NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
229 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
230 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
231 g_object_class_install_property(gobject_class, PROP_INITIATOR, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
232 g_param_spec_boolean("initiator", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
233 "initiator", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
234 "If the local user initiated the conference.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
235 FALSE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
236 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
237 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
238 g_object_class_install_property(gobject_class, PROP_PRPL_DATA, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
239 g_param_spec_pointer("prpl-data", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
240 "gpointer", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
241 "Data the prpl plugin set on the media session.", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
242 G_PARAM_READWRITE)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
243 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
244 purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
245 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
246 g_cclosure_marshal_VOID__STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
247 G_TYPE_NONE, 1, G_TYPE_STRING); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
248 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
249 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
250 purple_smarshal_VOID__STRING_STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
251 G_TYPE_NONE, 2, G_TYPE_STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
252 G_TYPE_STRING); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
253 purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
254 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
255 g_cclosure_marshal_VOID__STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
256 G_TYPE_NONE, 1, G_TYPE_STRING); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
257 purple_media_signals[LEVEL] = g_signal_new("level", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
258 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
259 purple_smarshal_VOID__STRING_STRING_DOUBLE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
260 G_TYPE_NONE, 3, G_TYPE_STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
261 G_TYPE_STRING, G_TYPE_DOUBLE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
262 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
263 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
264 purple_smarshal_VOID__POINTER_POINTER_OBJECT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
265 G_TYPE_NONE, 3, G_TYPE_POINTER, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
266 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
267 purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
268 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
269 purple_smarshal_VOID__ENUM_STRING_STRING, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
270 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
271 G_TYPE_STRING, G_TYPE_STRING); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
272 purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
273 G_SIGNAL_RUN_LAST, 0, NULL, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
274 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
275 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
276 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
277 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
278 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
279 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
280 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
281 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
282 purple_media_init (PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
283 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
284 media->priv = PURPLE_MEDIA_GET_PRIVATE(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
285 memset(media->priv, 0, sizeof(*media->priv)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
286 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
287 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
288 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
289 purple_media_stream_free(PurpleMediaStream *stream) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
290 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
291 if (stream == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
292 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
293 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
294 g_free(stream->participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
295 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
296 if (stream->local_candidates) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
297 purple_media_candidate_list_free(stream->local_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
298 if (stream->remote_candidates) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
299 purple_media_candidate_list_free(stream->remote_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
300 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
301 if (stream->active_local_candidates) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
302 purple_media_candidate_list_free( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
303 stream->active_local_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
304 if (stream->active_remote_candidates) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
305 purple_media_candidate_list_free( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
306 stream->active_remote_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
307 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
308 g_free(stream); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
309 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
310 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
311 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
312 purple_media_session_free(PurpleMediaSession *session) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
313 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
314 if (session == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
315 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
316 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
317 g_free(session->id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
318 g_free(session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
319 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
320 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
321 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
322 purple_media_dispose(GObject *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
323 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
324 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
325 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
326 purple_debug_info("media","purple_media_dispose\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
327 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
328 purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
329 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
330 if (priv->backend) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
331 g_object_unref(priv->backend); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
332 priv->backend = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
333 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
334 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
335 if (priv->manager) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
336 g_object_unref(priv->manager); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
337 priv->manager = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
338 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
339 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
340 G_OBJECT_CLASS(parent_class)->dispose(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
341 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
342 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
343 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
344 purple_media_finalize(GObject *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
345 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
346 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
347 purple_debug_info("media","purple_media_finalize\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
348 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
349 for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
350 purple_media_stream_free(priv->streams->data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
351 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
352 for (; priv->participants; priv->participants = g_list_delete_link( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
353 priv->participants, priv->participants)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
354 g_free(priv->participants->data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
355 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
356 if (priv->sessions) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
357 GList *sessions = g_hash_table_get_values(priv->sessions); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
358 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
359 purple_media_session_free(sessions->data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
360 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
361 g_hash_table_destroy(priv->sessions); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
362 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
363 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
364 G_OBJECT_CLASS(parent_class)->finalize(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
365 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
366 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
367 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
368 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
369 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
370 PurpleMedia *media; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
371 g_return_if_fail(PURPLE_IS_MEDIA(object)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
372 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
373 media = PURPLE_MEDIA(object); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
374 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
375 switch (prop_id) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
376 case PROP_MANAGER: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
377 media->priv->manager = g_value_dup_object(value); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
378 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
379 case PROP_ACCOUNT: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
380 media->priv->account = g_value_get_pointer(value); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
381 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
382 case PROP_CONFERENCE_TYPE: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
383 media->priv->conference_type = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
384 g_value_dup_string(value); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
385 media->priv->backend = g_object_new( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
386 purple_media_manager_get_backend_type( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
387 purple_media_manager_get()), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
388 "conference-type", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
389 media->priv->conference_type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
390 "media", media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
391 NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
392 g_signal_connect(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
393 "active-candidate-pair", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
394 G_CALLBACK( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
395 purple_media_candidate_pair_established_cb), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
396 media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
397 g_signal_connect(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
398 "candidates-prepared", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
399 G_CALLBACK( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
400 purple_media_candidates_prepared_cb), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
401 media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
402 g_signal_connect(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
403 "codecs-changed", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
404 G_CALLBACK( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
405 purple_media_codecs_changed_cb), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
406 media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
407 g_signal_connect(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
408 "new-candidate", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
409 G_CALLBACK( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
410 purple_media_new_local_candidate_cb), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
411 media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
412 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
413 case PROP_INITIATOR: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
414 media->priv->initiator = g_value_get_boolean(value); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
415 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
416 case PROP_PRPL_DATA: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
417 media->priv->prpl_data = g_value_get_pointer(value); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
418 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
419 default: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
420 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
421 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
422 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
423 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
424 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
425 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
426 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
427 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
428 PurpleMedia *media; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
429 g_return_if_fail(PURPLE_IS_MEDIA(object)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
430 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
431 media = PURPLE_MEDIA(object); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
432 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
433 switch (prop_id) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
434 case PROP_MANAGER: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
435 g_value_set_object(value, media->priv->manager); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
436 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
437 case PROP_BACKEND: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
438 g_value_set_object(value, media->priv->backend); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
439 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
440 case PROP_ACCOUNT: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
441 g_value_set_pointer(value, media->priv->account); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
442 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
443 case PROP_CONFERENCE_TYPE: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
444 g_value_set_string(value, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
445 media->priv->conference_type); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
446 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
447 case PROP_INITIATOR: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
448 g_value_set_boolean(value, media->priv->initiator); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
449 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
450 case PROP_PRPL_DATA: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
451 g_value_set_pointer(value, media->priv->prpl_data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
452 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
453 default: |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
454 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
455 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
456 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
457 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
458 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
459 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
460 static PurpleMediaSession* |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
461 purple_media_get_session(PurpleMedia *media, const gchar *sess_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
462 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
463 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
464 return (PurpleMediaSession*) (media->priv->sessions) ? |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
465 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
466 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
467 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
468 static PurpleMediaStream* |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
469 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
470 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
471 GList *streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
472 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
473 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
474 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
475 streams = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
476 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
477 for (; streams; streams = g_list_next(streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
478 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
479 if (!strcmp(stream->session->id, session) && |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
480 !strcmp(stream->participant, participant)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
481 return stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
482 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
483 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
484 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
485 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
486 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
487 static GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
488 purple_media_get_streams(PurpleMedia *media, const gchar *session, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
489 const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
490 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
491 GList *streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
492 GList *ret = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
493 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
494 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
495 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
496 streams = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
497 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
498 for (; streams; streams = g_list_next(streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
499 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
500 if ((session == NULL || |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
501 !strcmp(stream->session->id, session)) && |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
502 (participant == NULL || |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
503 !strcmp(stream->participant, participant))) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
504 ret = g_list_append(ret, stream); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
505 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
506 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
507 return ret; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
508 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
509 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
510 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
511 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
512 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
513 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
514 g_return_if_fail(session != NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
515 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
516 if (!media->priv->sessions) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
517 purple_debug_info("media", "Creating hash table for sessions\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
518 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
519 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
520 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
521 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
522 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
523 #if 0 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
524 static gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
525 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
526 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
527 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
528 return g_hash_table_remove(media->priv->sessions, session->id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
529 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
530 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
531 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
532 static PurpleMediaStream * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
533 purple_media_insert_stream(PurpleMediaSession *session, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
534 const gchar *name, gboolean initiator) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
535 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
536 PurpleMediaStream *media_stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
537 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
538 g_return_val_if_fail(session != NULL, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
539 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
540 media_stream = g_new0(PurpleMediaStream, 1); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
541 media_stream->participant = g_strdup(name); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
542 media_stream->session = session; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
543 media_stream->initiator = initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
544 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
545 session->media->priv->streams = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
546 g_list_append(session->media->priv->streams, media_stream); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
547 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
548 return media_stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
549 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
550 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
551 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
552 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
553 PurpleMediaCandidate *candidate) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
554 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
555 PurpleMediaStream *stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
556 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
557 g_return_if_fail(session != NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
558 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
559 stream = purple_media_get_stream(session->media, session->id, name); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
560 stream->local_candidates = g_list_append(stream->local_candidates, candidate); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
561 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
562 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
563 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
564 GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
565 purple_media_get_session_ids(PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
566 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
567 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
568 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
569 return media->priv->sessions != NULL ? |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
570 g_hash_table_get_keys(media->priv->sessions) : NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
571 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
572 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
573 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
574 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
575 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
576 #ifdef USE_GSTREAMER |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
577 GstElement * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
578 purple_media_get_src(PurpleMedia *media, const gchar *sess_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
579 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
580 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
581 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
582 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
583 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
584 return purple_media_backend_fs2_get_src( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
585 PURPLE_MEDIA_BACKEND_FS2( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
586 media->priv->backend), sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
587 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
588 g_return_val_if_reached(NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
589 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
590 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
591 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
592 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
593 #endif /* USE_GSTREAMER */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
594 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
595 PurpleAccount * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
596 purple_media_get_account(PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
597 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
598 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
599 PurpleAccount *account; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
600 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
601 g_object_get(G_OBJECT(media), "account", &account, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
602 return account; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
603 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
604 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
605 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
606 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
607 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
608 gpointer |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
609 purple_media_get_prpl_data(PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
610 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
611 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
612 gpointer prpl_data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
613 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
614 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
615 return prpl_data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
616 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
617 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
618 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
619 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
620 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
621 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
622 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
623 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
624 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
625 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
626 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
627 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
628 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
629 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
630 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
631 purple_media_error(PurpleMedia *media, const gchar *error, ...) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
632 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
633 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
634 va_list args; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
635 gchar *message; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
636 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
637 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
638 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
639 va_start(args, error); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
640 message = g_strdup_vprintf(error, args); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
641 va_end(args); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
642 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
643 purple_debug_error("media", "%s\n", message); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
644 g_signal_emit(media, purple_media_signals[S_ERROR], 0, message); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
645 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
646 g_free(message); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
647 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
648 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
649 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
650 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
651 purple_media_end(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
652 const gchar *session_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
653 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
654 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
655 GList *iter, *sessions = NULL, *participants = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
656 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
657 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
658 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
659 iter = purple_media_get_streams(media, session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
660 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
661 /* Free matching streams */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
662 for (; iter; iter = g_list_delete_link(iter, iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
663 PurpleMediaStream *stream = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
664 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
665 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
666 0, PURPLE_MEDIA_STATE_END, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
667 stream->session->id, stream->participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
668 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
669 media->priv->streams = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
670 g_list_remove(media->priv->streams, stream); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
671 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
672 if (g_list_find(sessions, stream->session) == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
673 sessions = g_list_prepend(sessions, stream->session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
674 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
675 if (g_list_find_custom(participants, stream->participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
676 (GCompareFunc)strcmp) == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
677 participants = g_list_prepend(participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
678 g_strdup(stream->participant)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
679 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
680 purple_media_stream_free(stream); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
681 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
682 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
683 iter = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
684 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
685 /* Reduce to list of sessions to remove */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
686 for (; iter; iter = g_list_next(iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
687 PurpleMediaStream *stream = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
688 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
689 sessions = g_list_remove(sessions, stream->session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
690 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
691 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
692 /* Free sessions with no streams left */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
693 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
694 PurpleMediaSession *session = sessions->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
695 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
696 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
697 0, PURPLE_MEDIA_STATE_END, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
698 session->id, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
699 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
700 g_hash_table_remove(media->priv->sessions, session->id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
701 purple_media_session_free(session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
702 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
703 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
704 iter = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
705 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
706 /* Reduce to list of participants to remove */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
707 for (; iter; iter = g_list_next(iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
708 PurpleMediaStream *stream = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
709 GList *tmp; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
710 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
711 tmp = g_list_find_custom(participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
712 stream->participant, (GCompareFunc)strcmp); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
713 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
714 if (tmp != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
715 g_free(tmp->data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
716 participants = g_list_delete_link(participants, tmp); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
717 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
718 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
719 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
720 /* Remove participants with no streams left (just emit the signal) */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
721 for (; participants; participants = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
722 g_list_delete_link(participants, participants)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
723 gchar *participant = participants->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
724 GList *link = g_list_find_custom(media->priv->participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
725 participant, (GCompareFunc)strcmp); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
726 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
727 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
728 0, PURPLE_MEDIA_STATE_END, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
729 NULL, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
730 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
731 if (link != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
732 g_free(link->data); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
733 media->priv->participants = g_list_delete_link( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
734 media->priv->participants, link); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
735 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
736 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
737 g_free(participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
738 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
739 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
740 /* Free the conference if no sessions left */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
741 if (media->priv->sessions != NULL && |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
742 g_hash_table_size(media->priv->sessions) == 0) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
743 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
744 0, PURPLE_MEDIA_STATE_END, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
745 NULL, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
746 g_object_unref(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
747 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
748 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
749 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
750 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
751 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
752 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
753 purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
754 const gchar *session_id, const gchar *participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
755 gboolean local) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
756 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
757 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
758 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
759 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
760 if (type == PURPLE_MEDIA_INFO_ACCEPT) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
761 GList *streams, *sessions = NULL, *participants = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
762 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
763 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
764 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
765 streams = purple_media_get_streams(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
766 session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
767 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
768 /* Emit stream acceptance */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
769 for (; streams; streams = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
770 g_list_delete_link(streams, streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
771 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
772 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
773 stream->accepted = TRUE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
774 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
775 g_signal_emit(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
776 purple_media_signals[STREAM_INFO], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
777 0, type, stream->session->id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
778 stream->participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
779 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
780 if (g_list_find(sessions, stream->session) == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
781 sessions = g_list_prepend(sessions, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
782 stream->session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
783 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
784 if (g_list_find_custom(participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
785 stream->participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
786 (GCompareFunc)strcmp) == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
787 participants = g_list_prepend(participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
788 g_strdup(stream->participant)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
789 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
790 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
791 /* Emit session acceptance */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
792 for (; sessions; sessions = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
793 g_list_delete_link(sessions, sessions)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
794 PurpleMediaSession *session = sessions->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
795 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
796 if (purple_media_accepted(media, session->id, NULL)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
797 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
798 STREAM_INFO], 0, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
799 PURPLE_MEDIA_INFO_ACCEPT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
800 session->id, NULL, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
801 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
802 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
803 /* Emit participant acceptance */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
804 for (; participants; participants = g_list_delete_link( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
805 participants, participants)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
806 gchar *participant = participants->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
807 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
808 if (purple_media_accepted(media, NULL, participant)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
809 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
810 STREAM_INFO], 0, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
811 PURPLE_MEDIA_INFO_ACCEPT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
812 NULL, participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
813 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
814 g_free(participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
815 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
816 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
817 /* Emit conference acceptance */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
818 if (purple_media_accepted(media, NULL, NULL)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
819 g_signal_emit(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
820 purple_media_signals[STREAM_INFO], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
821 0, PURPLE_MEDIA_INFO_ACCEPT, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
822 NULL, NULL, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
823 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
824 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
825 } else if (type == PURPLE_MEDIA_INFO_HANGUP || |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
826 type == PURPLE_MEDIA_INFO_REJECT) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
827 GList *streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
828 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
829 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
830 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
831 streams = purple_media_get_streams(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
832 session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
833 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
834 /* Emit for stream */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
835 for (; streams; streams = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
836 g_list_delete_link(streams, streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
837 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
838 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
839 g_signal_emit(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
840 purple_media_signals[STREAM_INFO], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
841 0, type, stream->session->id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
842 stream->participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
843 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
844 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
845 if (session_id != NULL && participant != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
846 /* Everything that needs to be emitted has been */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
847 } else if (session_id == NULL && participant == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
848 /* Emit for everything in the conference */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
849 GList *sessions = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
850 GList *participants = media->priv->participants; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
851 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
852 if (media->priv->sessions != NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
853 sessions = g_hash_table_get_values( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
854 media->priv->sessions); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
855 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
856 /* Emit for sessions */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
857 for (; sessions; sessions = g_list_delete_link( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
858 sessions, sessions)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
859 PurpleMediaSession *session = sessions->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
860 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
861 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
862 STREAM_INFO], 0, type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
863 session->id, NULL, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
864 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
865 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
866 /* Emit for participants */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
867 for (; participants; participants = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
868 g_list_next(participants)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
869 gchar *participant = participants->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
870 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
871 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
872 STREAM_INFO], 0, type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
873 NULL, participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
874 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
875 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
876 /* Emit for conference */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
877 g_signal_emit(media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
878 purple_media_signals[STREAM_INFO], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
879 0, type, NULL, NULL, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
880 } else if (session_id != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
881 /* Emit just the specific session */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
882 PurpleMediaSession *session = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
883 purple_media_get_session( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
884 media, session_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
885 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
886 if (session == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
887 purple_debug_warning("media", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
888 "Couldn't find session" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
889 " to hangup/reject.\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
890 } else { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
891 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
892 STREAM_INFO], 0, type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
893 session->id, NULL, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
894 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
895 } else if (participant != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
896 /* Emit just the specific participant */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
897 if (!g_list_find_custom(media->priv->participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
898 participant, (GCompareFunc)strcmp)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
899 purple_debug_warning("media", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
900 "Couldn't find participant" |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
901 " to hangup/reject.\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
902 } else { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
903 g_signal_emit(media, purple_media_signals[ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
904 STREAM_INFO], 0, type, NULL, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
905 participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
906 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
907 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
908 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
909 purple_media_end(media, session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
910 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
911 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
912 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
913 g_signal_emit(media, purple_media_signals[STREAM_INFO], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
914 0, type, session_id, participant, local); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
915 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
916 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
917 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
918 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
919 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
920 purple_media_new_local_candidate_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
921 const gchar *sess_id, const gchar *participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
922 PurpleMediaCandidate *candidate, PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
923 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
924 PurpleMediaSession *session = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
925 purple_media_get_session(media, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
926 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
927 purple_media_insert_local_candidate(session, participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
928 purple_media_candidate_copy(candidate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
929 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
930 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
931 0, session->id, participant, candidate); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
932 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
933 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
934 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
935 purple_media_candidates_prepared_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
936 const gchar *sess_id, const gchar *name, PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
937 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
938 PurpleMediaStream *stream_data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
939 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
940 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
941 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
942 stream_data = purple_media_get_stream(media, sess_id, name); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
943 stream_data->candidates_prepared = TRUE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
944 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
945 g_signal_emit(media, purple_media_signals[CANDIDATES_PREPARED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
946 0, sess_id, name); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
947 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
948 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
949 /* callback called when a pair of transport candidates (local and remote) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
950 * has been established */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
951 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
952 purple_media_candidate_pair_established_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
953 const gchar *sess_id, const gchar *name, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
954 PurpleMediaCandidate *local_candidate, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
955 PurpleMediaCandidate *remote_candidate, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
956 PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
957 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
958 PurpleMediaStream *stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
959 GList *iter; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
960 guint id; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
961 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
962 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
963 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
964 stream = purple_media_get_stream(media, sess_id, name); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
965 id = purple_media_candidate_get_component_id(local_candidate); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
966 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
967 iter = stream->active_local_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
968 for(; iter; iter = g_list_next(iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
969 PurpleMediaCandidate *c = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
970 if (id == purple_media_candidate_get_component_id(c)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
971 g_object_unref(c); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
972 stream->active_local_candidates = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
973 g_list_delete_link(iter, iter); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
974 stream->active_local_candidates = g_list_prepend( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
975 stream->active_local_candidates, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
976 purple_media_candidate_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
977 local_candidate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
978 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
979 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
980 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
981 if (iter == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
982 stream->active_local_candidates = g_list_prepend( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
983 stream->active_local_candidates, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
984 purple_media_candidate_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
985 local_candidate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
986 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
987 id = purple_media_candidate_get_component_id(local_candidate); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
988 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
989 iter = stream->active_remote_candidates; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
990 for(; iter; iter = g_list_next(iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
991 PurpleMediaCandidate *c = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
992 if (id == purple_media_candidate_get_component_id(c)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
993 g_object_unref(c); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
994 stream->active_remote_candidates = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
995 g_list_delete_link(iter, iter); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
996 stream->active_remote_candidates = g_list_prepend( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
997 stream->active_remote_candidates, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
998 purple_media_candidate_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
999 remote_candidate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1000 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1001 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1002 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1003 if (iter == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1004 stream->active_remote_candidates = g_list_prepend( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1005 stream->active_remote_candidates, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1006 purple_media_candidate_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1007 remote_candidate)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1008 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1009 purple_debug_info("media", "candidate pair established\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1010 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1011 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1012 static void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1013 purple_media_codecs_changed_cb(PurpleMediaBackend *backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1014 const gchar *sess_id, PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1015 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1016 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1017 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1018 #endif /* USE_VV */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1019 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1020 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1021 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1022 const gchar *who, PurpleMediaSessionType type, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1023 gboolean initiator, const gchar *transmitter, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1024 guint num_params, GParameter *params) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1025 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1026 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1027 PurpleMediaSession *session; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1028 PurpleMediaStream *stream = NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1029 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1030 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1031 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1032 if (!purple_media_backend_add_stream(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1033 sess_id, who, type, initiator, transmitter, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1034 num_params, params)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1035 purple_debug_error("media", "Error adding stream.\n"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1036 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1037 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1038 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1039 session = purple_media_get_session(media, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1040 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1041 if (!session) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1042 session = g_new0(PurpleMediaSession, 1); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1043 session->id = g_strdup(sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1044 session->media = media; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1045 session->type = type; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1046 session->initiator = initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1047 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1048 purple_media_add_session(media, session); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1049 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1050 0, PURPLE_MEDIA_STATE_NEW, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1051 session->id, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1052 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1053 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1054 if (!g_list_find_custom(media->priv->participants, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1055 who, (GCompareFunc)strcmp)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1056 media->priv->participants = g_list_prepend( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1057 media->priv->participants, g_strdup(who)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1058 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1059 g_signal_emit_by_name(media, "state-changed", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1060 PURPLE_MEDIA_STATE_NEW, NULL, who); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1061 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1062 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1063 if (purple_media_get_stream(media, sess_id, who) == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1064 stream = purple_media_insert_stream(session, who, initiator); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1065 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1066 g_signal_emit(media, purple_media_signals[STATE_CHANGED], |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1067 0, PURPLE_MEDIA_STATE_NEW, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1068 session->id, who); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1069 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1070 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1071 return TRUE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1072 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1073 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1074 #endif /* USE_VV */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1075 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1076 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1077 PurpleMediaManager * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1078 purple_media_get_manager(PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1079 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1080 PurpleMediaManager *ret; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1081 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1082 g_object_get(media, "manager", &ret, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1083 return ret; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1084 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1085 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1086 PurpleMediaSessionType |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1087 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1088 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1089 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1090 PurpleMediaSession *session; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1091 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1092 session = purple_media_get_session(media, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1093 return session->type; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1094 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1095 return PURPLE_MEDIA_NONE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1096 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1097 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1098 /* XXX: Should wait until codecs-ready is TRUE before using this function */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1099 GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1100 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1101 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1102 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1103 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1104 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1105 return purple_media_backend_get_codecs(media->priv->backend, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1106 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1107 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1108 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1109 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1110 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1111 GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1112 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1113 const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1114 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1115 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1116 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1117 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1118 return purple_media_backend_get_local_candidates(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1119 sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1120 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1121 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1122 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1123 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1124 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1125 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1126 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1127 const gchar *participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1128 GList *remote_candidates) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1129 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1130 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1131 PurpleMediaStream *stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1132 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1133 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1134 stream = purple_media_get_stream(media, sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1135 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1136 if (stream == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1137 purple_debug_error("media", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1138 "purple_media_add_remote_candidates: " |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1139 "couldn't find stream %s %s.\n", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1140 sess_id ? sess_id : "(null)", |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1141 participant ? participant : "(null)"); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1142 return; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1143 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1144 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1145 stream->remote_candidates = g_list_concat(stream->remote_candidates, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1146 purple_media_candidate_list_copy(remote_candidates)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1147 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1148 purple_media_backend_add_remote_candidates(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1149 sess_id, participant, remote_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1150 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1151 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1152 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1153 #if 0 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1154 /* |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1155 * These two functions aren't being used and I'd rather not lock in the API |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1156 * until they are needed. If they ever are. |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1157 */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1158 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1159 GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1160 purple_media_get_active_local_candidates(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1161 const gchar *sess_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1162 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1163 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1164 PurpleMediaStream *stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1165 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1166 stream = purple_media_get_stream(media, sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1167 return purple_media_candidate_list_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1168 stream->active_local_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1169 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1170 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1171 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1172 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1173 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1174 GList * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1175 purple_media_get_active_remote_candidates(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1176 const gchar *sess_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1177 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1178 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1179 PurpleMediaStream *stream; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1180 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1181 stream = purple_media_get_stream(media, sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1182 return purple_media_candidate_list_copy( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1183 stream->active_remote_candidates); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1184 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1185 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1186 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1187 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1188 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1189 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1190 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1191 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1192 const gchar *participant, GList *codecs) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1193 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1194 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1195 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1196 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1197 return purple_media_backend_set_remote_codecs(media->priv->backend, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1198 sess_id, participant, codecs); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1199 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1200 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1201 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1202 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1203 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1204 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1205 purple_media_candidates_prepared(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1206 const gchar *session_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1207 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1208 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1209 GList *streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1210 gboolean prepared = TRUE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1211 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1212 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1213 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1214 streams = purple_media_get_streams(media, session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1215 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1216 for (; streams; streams = g_list_delete_link(streams, streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1217 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1218 if (stream->candidates_prepared == FALSE) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1219 g_list_free(streams); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1220 prepared = FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1221 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1222 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1223 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1224 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1225 return prepared; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1226 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1227 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1228 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1229 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1230 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1231 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1232 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1233 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1234 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1235 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1236 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1237 return purple_media_backend_set_send_codec( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1238 media->priv->backend, sess_id, codec); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1239 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1240 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1241 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1242 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1243 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1244 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1245 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1246 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1247 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1248 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1249 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1250 return purple_media_backend_codecs_ready( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1251 media->priv->backend, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1252 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1253 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1254 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1255 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1256 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1257 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1258 purple_media_is_initiator(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1259 const gchar *sess_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1260 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1261 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1262 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1263 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1264 if (sess_id == NULL && participant == NULL) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1265 return media->priv->initiator; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1266 else if (sess_id != NULL && participant == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1267 PurpleMediaSession *session = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1268 purple_media_get_session(media, sess_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1269 return session != NULL ? session->initiator : FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1270 } else if (sess_id != NULL && participant != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1271 PurpleMediaStream *stream = purple_media_get_stream( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1272 media, sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1273 return stream != NULL ? stream->initiator : FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1274 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1275 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1276 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1277 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1278 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1279 gboolean |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1280 purple_media_accepted(PurpleMedia *media, const gchar *sess_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1281 const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1282 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1283 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1284 gboolean accepted = TRUE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1285 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1286 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1287 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1288 if (sess_id == NULL && participant == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1289 GList *streams = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1290 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1291 for (; streams; streams = g_list_next(streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1292 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1293 if (stream->accepted == FALSE) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1294 accepted = FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1295 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1296 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1297 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1298 } else if (sess_id != NULL && participant == NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1299 GList *streams = purple_media_get_streams( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1300 media, sess_id, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1301 for (; streams; streams = |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1302 g_list_delete_link(streams, streams)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1303 PurpleMediaStream *stream = streams->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1304 if (stream->accepted == FALSE) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1305 g_list_free(streams); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1306 accepted = FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1307 break; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1308 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1309 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1310 } else if (sess_id != NULL && participant != NULL) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1311 PurpleMediaStream *stream = purple_media_get_stream( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1312 media, sess_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1313 if (stream == NULL || stream->accepted == FALSE) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1314 accepted = FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1315 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1316 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1317 return accepted; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1318 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1319 return FALSE; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1320 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1321 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1322 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1323 void purple_media_set_input_volume(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1324 const gchar *session_id, double level) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1325 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1326 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1327 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1328 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1329 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1330 purple_media_backend_fs2_set_input_volume( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1331 PURPLE_MEDIA_BACKEND_FS2( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1332 media->priv->backend), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1333 session_id, level); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1334 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1335 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1336 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1337 void purple_media_set_output_volume(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1338 const gchar *session_id, const gchar *participant, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1339 double level) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1340 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1341 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1342 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1343 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1344 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1345 purple_media_backend_fs2_set_output_volume( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1346 PURPLE_MEDIA_BACKEND_FS2( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1347 media->priv->backend), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1348 session_id, participant, level); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1349 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1350 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1351 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1352 gulong |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1353 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1354 const gchar *participant, gulong window_id) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1355 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1356 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1357 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1358 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1359 return purple_media_manager_set_output_window(media->priv->manager, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1360 media, session_id, participant, window_id); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1361 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1362 return 0; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1363 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1364 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1365 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1366 void |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1367 purple_media_remove_output_windows(PurpleMedia *media) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1368 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1369 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1370 GList *iter = media->priv->streams; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1371 for (; iter; iter = g_list_next(iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1372 PurpleMediaStream *stream = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1373 purple_media_manager_remove_output_windows( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1374 media->priv->manager, media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1375 stream->session->id, stream->participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1376 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1377 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1378 iter = purple_media_get_session_ids(media); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1379 for (; iter; iter = g_list_delete_link(iter, iter)) { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1380 gchar *session_name = iter->data; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1381 purple_media_manager_remove_output_windows( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1382 media->priv->manager, media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1383 session_name, NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1384 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1385 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1386 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1387 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1388 #ifdef USE_GSTREAMER |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1389 GstElement * |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1390 purple_media_get_tee(PurpleMedia *media, |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1391 const gchar *session_id, const gchar *participant) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1392 { |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1393 #ifdef USE_VV |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1394 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1395 |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1396 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend)) |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1397 return purple_media_backend_fs2_get_tee( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1398 PURPLE_MEDIA_BACKEND_FS2( |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1399 media->priv->backend), |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1400 session_id, participant); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1401 g_return_val_if_reached(NULL); |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1402 #else |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1403 return NULL; |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1404 #endif |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1405 } |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1406 #endif /* USE_GSTREAMER */ |
419415a431e1
Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff
changeset
|
1407 |