annotate libpurple/media.c @ 31172:e89df17f5ae7

certificate: Better validation of chains which have an intermediate signed w/ MD5. We already distribute the CAcert class 3 root as a trusted root. Newer versions of GnuTLS (combined with the changes to deal with MSN's cert breakage) require us to check if the last cert (not just its issuer) is in our trusted store.
author Paul Aurich <paul@darkrain42.org>
date Sun, 30 Jan 2011 17:51:02 +0000
parents a8cc50c2279f
children ea2a155b4439
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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);
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
193
29352
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;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
419 default:
29352
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));
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
430
29352
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;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
453 default:
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
454 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
29352
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;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
493
29352
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");
30439
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 29353
diff changeset
518 media->priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal,
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 29353
diff changeset
519 g_free, NULL);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
520 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
521 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
522 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
523
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
524 #if 0
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
525 static gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
526 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
527 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
528 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
529 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
530 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
531 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
532
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
533 static PurpleMediaStream *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
534 purple_media_insert_stream(PurpleMediaSession *session,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
535 const gchar *name, gboolean initiator)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
536 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
537 PurpleMediaStream *media_stream;
31086
a8cc50c2279f Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents: 30439
diff changeset
538
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
539 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
540
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
541 media_stream = g_new0(PurpleMediaStream, 1);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
542 media_stream->participant = g_strdup(name);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
543 media_stream->session = session;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
544 media_stream->initiator = initiator;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
545
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
546 session->media->priv->streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
547 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
548
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
549 return media_stream;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
552 static void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
553 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
554 PurpleMediaCandidate *candidate)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
555 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
556 PurpleMediaStream *stream;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
557
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
558 g_return_if_fail(session != NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
559
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
560 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
561 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
562 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
563 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
564
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
565 GList *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
566 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
567 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
568 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
569 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
570 return media->priv->sessions != NULL ?
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
571 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
572 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
573 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
574 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
577 #ifdef USE_GSTREAMER
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
578 GstElement *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
579 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
580 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
581 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
582 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
583
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
584 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
585 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
586 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
587 media->priv->backend), sess_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
588
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
589 g_return_val_if_reached(NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
590 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
591 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
592 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
593 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
594 #endif /* USE_GSTREAMER */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
595
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
596 PurpleAccount *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
597 purple_media_get_account(PurpleMedia *media)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
598 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
599 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
600 PurpleAccount *account;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
601 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
602 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
603 return account;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
604 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
605 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
606 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
609 gpointer
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
610 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
611 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
612 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
613 gpointer prpl_data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
614 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
615 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
616 return prpl_data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
617 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
618 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
619 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
622 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
623 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
624 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
625 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
626 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
627 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
628 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
631 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
632 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
633 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
634 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
635 va_list args;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
636 gchar *message;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
637
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
638 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
639
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
640 va_start(args, error);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
641 message = g_strdup_vprintf(error, args);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
642 va_end(args);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
643
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
644 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
645 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
646
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
647 g_free(message);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
648 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
651 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
652 purple_media_end(PurpleMedia *media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
653 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
654 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
655 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
656 GList *iter, *sessions = NULL, *participants = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
657
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
658 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
659
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
660 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
661
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
662 /* Free matching streams */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
663 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
664 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
665
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
666 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
667 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
668 stream->session->id, stream->participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
669
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
670 media->priv->streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
671 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
672
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
673 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
674 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
675
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
676 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
677 (GCompareFunc)strcmp) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
678 participants = g_list_prepend(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
679 g_strdup(stream->participant));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
680
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
681 purple_media_stream_free(stream);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
684 iter = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
685
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
686 /* 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
687 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
688 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
689
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
690 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
691 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
692
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
693 /* Free sessions with no streams left */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
694 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
695 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
696
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
697 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
698 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
699 session->id, NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
700
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
701 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
702 purple_media_session_free(session);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
705 iter = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
706
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
707 /* 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
708 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
709 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
710 GList *tmp;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
711
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
712 tmp = g_list_find_custom(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
713 stream->participant, (GCompareFunc)strcmp);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
714
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
715 if (tmp != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
716 g_free(tmp->data);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
717 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
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
721 /* 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
722 for (; participants; participants =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
723 g_list_delete_link(participants, participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
724 gchar *participant = participants->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
725 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
726 participant, (GCompareFunc)strcmp);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
727
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
728 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
729 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
730 NULL, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
731
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
732 if (link != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
733 g_free(link->data);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
734 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
735 media->priv->participants, link);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
738 g_free(participant);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
741 /* 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
742 if (media->priv->sessions != NULL &&
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
743 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
744 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
745 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
746 NULL, NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
747 g_object_unref(media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
748 return;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
749 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
750 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
753 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
754 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
755 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
756 gboolean local)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
757 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
758 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
759 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
760
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
761 if (type == PURPLE_MEDIA_INFO_ACCEPT) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
762 GList *streams, *sessions = NULL, *participants = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
763
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
764 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
765
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
766 streams = purple_media_get_streams(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
767 session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
768
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
769 /* Emit stream acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
770 for (; streams; streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
771 g_list_delete_link(streams, streams)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
772 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
773
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
774 stream->accepted = TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
775
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
776 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
777 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
778 0, type, stream->session->id,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
779 stream->participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
780
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
781 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
782 sessions = g_list_prepend(sessions,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
783 stream->session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
784
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
785 if (g_list_find_custom(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
786 stream->participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
787 (GCompareFunc)strcmp) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
788 participants = g_list_prepend(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
789 g_strdup(stream->participant));
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
792 /* Emit session acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
793 for (; sessions; sessions =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
794 g_list_delete_link(sessions, sessions)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
795 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
796
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
797 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
798 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
799 STREAM_INFO], 0,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
800 PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
801 session->id, NULL, local);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
804 /* Emit participant acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
805 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
806 participants, participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
807 gchar *participant = participants->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
808
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
809 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
810 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
811 STREAM_INFO], 0,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
812 PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
813 NULL, participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
814
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
815 g_free(participant);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
818 /* Emit conference acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
819 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
820 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
821 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
822 0, PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
823 NULL, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
824
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
825 return;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
826 } 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
827 type == PURPLE_MEDIA_INFO_REJECT) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
828 GList *streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
829
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
830 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
831
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
832 streams = purple_media_get_streams(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
833 session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
834
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
835 /* Emit for stream */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
836 for (; streams; streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
837 g_list_delete_link(streams, streams)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
838 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
839
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
840 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
841 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
842 0, type, stream->session->id,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
843 stream->participant, local);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
846 if (session_id != NULL && participant != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
847 /* 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
848 } 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
849 /* Emit for everything in the conference */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
850 GList *sessions = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
851 GList *participants = media->priv->participants;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
852
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
853 if (media->priv->sessions != NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
854 sessions = g_hash_table_get_values(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
855 media->priv->sessions);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
856
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
857 /* Emit for sessions */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
858 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
859 sessions, sessions)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
860 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
861
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
862 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
863 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
864 session->id, NULL, local);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
867 /* Emit for participants */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
868 for (; participants; participants =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
869 g_list_next(participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
870 gchar *participant = participants->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
871
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
872 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
873 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
874 NULL, participant, local);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
877 /* Emit for conference */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
878 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
879 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
880 0, type, NULL, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
881 } else if (session_id != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
882 /* Emit just the specific session */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
883 PurpleMediaSession *session =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
884 purple_media_get_session(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
885 media, session_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
886
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
887 if (session == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
888 purple_debug_warning("media",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
889 "Couldn't find session"
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
890 " to hangup/reject.\n");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
891 } else {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
892 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
893 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
894 session->id, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
895 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
896 } else if (participant != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
897 /* Emit just the specific participant */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
898 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
899 participant, (GCompareFunc)strcmp)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
900 purple_debug_warning("media",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
901 "Couldn't find participant"
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
902 " to hangup/reject.\n");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
903 } else {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
904 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
905 STREAM_INFO], 0, type, NULL,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
906 participant, local);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
910 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
911 return;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
914 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
915 0, type, session_id, participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
916 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
919 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
920 static void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
921 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
922 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
923 PurpleMediaCandidate *candidate, PurpleMedia *media)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
924 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
925 PurpleMediaSession *session =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
926 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
927
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
928 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
929 purple_media_candidate_copy(candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
930
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
931 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
932 0, session->id, participant, candidate);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
935 static void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
936 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
937 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
938 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
939 PurpleMediaStream *stream_data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
940
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
941 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
942
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
943 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
944 stream_data->candidates_prepared = TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
945
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
946 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
947 0, sess_id, name);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
950 /* 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
951 * has been established */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
952 static void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
953 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
954 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
955 PurpleMediaCandidate *local_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
956 PurpleMediaCandidate *remote_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
957 PurpleMedia *media)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
958 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
959 PurpleMediaStream *stream;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
960 GList *iter;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
961 guint id;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
962
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
963 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
964
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
965 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
966 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
967
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
968 iter = stream->active_local_candidates;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
969 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
970 PurpleMediaCandidate *c = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
971 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
972 g_object_unref(c);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
973 stream->active_local_candidates =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
974 g_list_delete_link(iter, iter);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
975 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
976 stream->active_local_candidates,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
977 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
978 local_candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
979 break;
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 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
982 if (iter == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
983 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
984 stream->active_local_candidates,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
985 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
986 local_candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
987
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
988 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
989
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
990 iter = stream->active_remote_candidates;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
991 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
992 PurpleMediaCandidate *c = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
993 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
994 g_object_unref(c);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
995 stream->active_remote_candidates =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
996 g_list_delete_link(iter, iter);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
997 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
998 stream->active_remote_candidates,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
999 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1000 remote_candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1001 break;
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 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1004 if (iter == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1005 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
1006 stream->active_remote_candidates,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1007 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1008 remote_candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1009
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1010 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
1011 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1012
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1013 static void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1014 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
1015 const gchar *sess_id, PurpleMedia *media)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1016 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1017 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
1018 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1019 #endif /* USE_VV */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1020
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1021 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1022 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
1023 const gchar *who, PurpleMediaSessionType type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1024 gboolean initiator, const gchar *transmitter,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1025 guint num_params, GParameter *params)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1026 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1027 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1028 PurpleMediaSession *session;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1029 PurpleMediaStream *stream = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1030
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1031 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
1032
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1033 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
1034 sess_id, who, type, initiator, transmitter,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1035 num_params, params)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1036 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
1037 return FALSE;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1040 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
1041
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1042 if (!session) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1043 session = g_new0(PurpleMediaSession, 1);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1044 session->id = g_strdup(sess_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1045 session->media = media;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1046 session->type = type;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1047 session->initiator = initiator;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1048
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1049 purple_media_add_session(media, session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1050 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
1051 0, PURPLE_MEDIA_STATE_NEW,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1052 session->id, NULL);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1055 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
1056 who, (GCompareFunc)strcmp)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1057 media->priv->participants = g_list_prepend(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1058 media->priv->participants, g_strdup(who));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1059
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1060 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
1061 PURPLE_MEDIA_STATE_NEW, NULL, who);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1064 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
1065 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
1066
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1067 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
1068 0, PURPLE_MEDIA_STATE_NEW,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1069 session->id, who);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1072 return TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1073 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1074 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1075 #endif /* USE_VV */
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1078 PurpleMediaManager *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1079 purple_media_get_manager(PurpleMedia *media)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1080 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1081 PurpleMediaManager *ret;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1082 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
1083 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
1084 return ret;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1087 PurpleMediaSessionType
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1088 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
1089 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1090 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1091 PurpleMediaSession *session;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1092 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
1093 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
1094 return session->type;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1095 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1096 return PURPLE_MEDIA_NONE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1097 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1098 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1099 /* 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
1100 GList *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1101 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
1102 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1103 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1104 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
1105
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1106 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
1107 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1108 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1109 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1112 GList *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1113 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
1114 const gchar *participant)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1115 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1116 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1117 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
1118
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1119 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
1120 sess_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1121 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1122 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1123 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1126 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1127 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
1128 const gchar *participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1129 GList *remote_candidates)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1130 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1131 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1132 PurpleMediaStream *stream;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1133
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1134 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
1135 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
1136
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1137 if (stream == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1138 purple_debug_error("media",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1139 "purple_media_add_remote_candidates: "
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1140 "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
1141 sess_id ? sess_id : "(null)",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1142 participant ? participant : "(null)");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1143 return;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1146 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
1147 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
1148
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1149 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
1150 sess_id, participant, remote_candidates);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1151 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1154 #if 0
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1155 /*
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1156 * 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
1157 * 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
1158 */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1159
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1160 GList *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1161 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
1162 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
1163 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1164 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1165 PurpleMediaStream *stream;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1166 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
1167 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
1168 return purple_media_candidate_list_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1169 stream->active_local_candidates);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1170 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1171 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1172 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1175 GList *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1176 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
1177 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
1178 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1179 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1180 PurpleMediaStream *stream;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1181 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
1182 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
1183 return purple_media_candidate_list_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1184 stream->active_remote_candidates);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1185 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1186 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1187 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1188 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1189 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1190
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1191 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1192 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
1193 const gchar *participant, GList *codecs)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1194 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1195 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1196 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
1197
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1198 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
1199 sess_id, participant, codecs);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1200 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1201 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1202 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1205 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1206 purple_media_candidates_prepared(PurpleMedia *media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1207 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
1208 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1209 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1210 GList *streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1211 gboolean prepared = TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1212
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1213 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
1214
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1215 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
1216
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1217 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
1218 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1219 if (stream->candidates_prepared == FALSE) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1220 g_list_free(streams);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1221 prepared = FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1222 break;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1226 return prepared;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1227 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1228 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1229 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1232 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1233 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
1234 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1235 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1236 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
1237
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1238 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
1239 media->priv->backend, sess_id, codec);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1240 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1241 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1242 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1245 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1246 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
1247 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1248 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1249 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
1250
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1251 return purple_media_backend_codecs_ready(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1252 media->priv->backend, sess_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1253 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1254 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1255 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1258 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1259 purple_media_is_initiator(PurpleMedia *media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1260 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
1261 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1262 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1263 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
1264
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1265 if (sess_id == NULL && participant == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1266 return media->priv->initiator;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1267 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
1268 PurpleMediaSession *session =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1269 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
1270 return session != NULL ? session->initiator : FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1271 } 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
1272 PurpleMediaStream *stream = purple_media_get_stream(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1273 media, sess_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1274 return stream != NULL ? stream->initiator : FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1275 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1276 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1277 return FALSE;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1280 gboolean
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1281 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
1282 const gchar *participant)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1283 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1284 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1285 gboolean accepted = TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1286
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1287 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
1288
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1289 if (sess_id == NULL && participant == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1290 GList *streams = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1291
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1292 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
1293 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1294 if (stream->accepted == FALSE) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1295 accepted = FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1296 break;
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 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1299 } 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
1300 GList *streams = purple_media_get_streams(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1301 media, sess_id, NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1302 for (; streams; streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1303 g_list_delete_link(streams, streams)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1304 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1305 if (stream->accepted == FALSE) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1306 g_list_free(streams);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1307 accepted = FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1308 break;
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 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1311 } 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
1312 PurpleMediaStream *stream = purple_media_get_stream(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1313 media, sess_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1314 if (stream == NULL || stream->accepted == FALSE)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1315 accepted = FALSE;
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1318 return accepted;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1319 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1320 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1321 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1324 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
1325 const gchar *session_id, double level)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1326 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1327 #ifdef USE_VV
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(media));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1329 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
1330
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1331 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
1332 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1333 media->priv->backend),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1334 session_id, level);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1335 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1338 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
1339 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
1340 double level)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1341 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1342 #ifdef USE_VV
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(media));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1344 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
1345
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1346 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
1347 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1348 media->priv->backend),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1349 session_id, participant, level);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1350 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1353 gulong
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1354 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
1355 const gchar *participant, gulong window_id)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1356 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1357 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1358 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
1359
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1360 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
1361 media, session_id, participant, window_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1362 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1363 return 0;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1364 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1367 void
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1368 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
1369 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1370 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1371 GList *iter = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1372 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
1373 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1374 purple_media_manager_remove_output_windows(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1375 media->priv->manager, media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1376 stream->session->id, stream->participant);
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1379 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
1380 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
1381 gchar *session_name = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1382 purple_media_manager_remove_output_windows(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1383 media->priv->manager, media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1384 session_name, NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1385 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1386 #endif
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
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1389 #ifdef USE_GSTREAMER
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1390 GstElement *
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1391 purple_media_get_tee(PurpleMedia *media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1392 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
1393 {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1394 #ifdef USE_VV
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1395 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
1396
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1397 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
1398 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
1399 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1400 media->priv->backend),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1401 session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1402 g_return_val_if_reached(NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1403 #else
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1404 return NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1405 #endif
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1406 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1407 #endif /* USE_GSTREAMER */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1408