annotate libpurple/media/media.c @ 29592:0b54934f2742

Remove a couple more unnecessary headers from media.c
author maiku@pidgin.im
date Tue, 27 Oct 2009 21:50:19 +0000
parents a71400a86933
children 8b04812396b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1 /**
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
2 * @file media.c Media API
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
3 * @ingroup core
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
4 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
5
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
6 /* purple
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
7 *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
10 * source distribution.
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
11 *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
15 * (at your option) any later version.
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
16 *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
20 * GNU General Public License for more details.
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
21 *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
25 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
26
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
27 #include "internal.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
28
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
29 #include "account.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
30 #include "media.h"
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
31 #include "media/backend-fs2.h"
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
32 #include "media/backend-iface.h"
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
33 #include "mediamanager.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
34
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
35 #include "debug.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
36
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
37 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
38 #include "marshallers.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
39 #include "media-gst.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
40 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
41
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
42 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
43
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
44 /** @copydoc _PurpleMediaSession */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
45 typedef struct _PurpleMediaSession PurpleMediaSession;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
46 /** @copydoc _PurpleMediaStream */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
47 typedef struct _PurpleMediaStream PurpleMediaStream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
48 /** @copydoc _PurpleMediaClass */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
49 typedef struct _PurpleMediaClass PurpleMediaClass;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
50 /** @copydoc _PurpleMediaPrivate */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
51 typedef struct _PurpleMediaPrivate PurpleMediaPrivate;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
52
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
53 /** The media class */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
54 struct _PurpleMediaClass
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
55 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
56 GObjectClass parent_class; /**< The parent class. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
57 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
58
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
59 /** The media class's private data */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
60 struct _PurpleMedia
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
61 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
62 GObject parent; /**< The parent of this object. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
63 PurpleMediaPrivate *priv; /**< The private data of this object. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
64 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
65
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
66 struct _PurpleMediaSession
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
67 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
68 gchar *id;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
69 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
70 PurpleMediaSessionType type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
71 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
72 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
73
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
74 struct _PurpleMediaStream
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
75 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
76 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
77 gchar *participant;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
78
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
79 GList *local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
80 GList *remote_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
81
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
82 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
83 gboolean accepted;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
84 gboolean candidates_prepared;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
85
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
86 GList *active_local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
87 GList *active_remote_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
88
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
89 guint connected_cb_id;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
90 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
91 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
92
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
93 struct _PurpleMediaPrivate
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
94 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
95 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
96 PurpleMediaManager *manager;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
97 PurpleAccount *account;
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
98 PurpleMediaBackend *backend;
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
99 gchar *conference_type;
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
100 gulong gst_bus_handler_id;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
101 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
102 gpointer prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
103
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
104 GHashTable *sessions; /* PurpleMediaSession table */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
105
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
106 GList *streams; /* PurpleMediaStream table */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
107 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
108 gpointer dummy;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
109 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
110 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
111
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
112 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
113 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
114
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
115 static void purple_media_class_init (PurpleMediaClass *klass);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
116 static void purple_media_init (PurpleMedia *media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
117 static void purple_media_dispose (GObject *object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
118 static void purple_media_finalize (GObject *object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
119 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
120 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
121
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
122 static void purple_media_new_local_candidate_cb(PurpleMediaBackend *backend,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
123 const gchar *sess_id, const gchar *participant,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
124 PurpleMediaCandidate *candidate, PurpleMedia *media);
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
125 static void purple_media_candidates_prepared_cb(PurpleMediaBackend *backend,
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
126 const gchar *sess_id, const gchar *name, PurpleMedia *media);
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
127 static void purple_media_candidate_pair_established_cb(
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
128 PurpleMediaBackend *backend,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
129 const gchar *sess_id, const gchar *name,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
130 PurpleMediaCandidate *local_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
131 PurpleMediaCandidate *remote_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
132 PurpleMedia *media);
29555
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
133 static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
134 const gchar *sess_id, PurpleMedia *media);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
135
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
136 static GObjectClass *parent_class = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
137
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
138
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
139
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
140 enum {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
141 S_ERROR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
142 CANDIDATES_PREPARED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
143 CODECS_CHANGED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
144 LEVEL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
145 NEW_CANDIDATE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
146 STATE_CHANGED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
147 STREAM_INFO,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
148 LAST_SIGNAL
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
149 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
150 static guint purple_media_signals[LAST_SIGNAL] = {0};
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
151
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
152 enum {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
153 PROP_0,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
154 PROP_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
155 PROP_ACCOUNT,
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
156 PROP_CONFERENCE_TYPE,
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
157 PROP_INITIATOR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
158 PROP_PRPL_DATA,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
159 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
160 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
161
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
162
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
163 GType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
164 purple_media_get_type()
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
165 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
166 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
167 static GType type = 0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
168
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
169 if (type == 0) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
170 static const GTypeInfo info = {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
171 sizeof(PurpleMediaClass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
172 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
173 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
174 (GClassInitFunc) purple_media_class_init,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
175 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
176 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
177 sizeof(PurpleMedia),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
178 0,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
179 (GInstanceInitFunc) purple_media_init,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
180 NULL
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
181 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
182 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
183 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
184 return type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
185 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
186 return G_TYPE_NONE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
187 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
188 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
189
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
190 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
191 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
192 purple_media_class_init (PurpleMediaClass *klass)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
193 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
194 GObjectClass *gobject_class = (GObjectClass*)klass;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
195 parent_class = g_type_class_peek_parent(klass);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
196
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
197 gobject_class->dispose = purple_media_dispose;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
198 gobject_class->finalize = purple_media_finalize;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
199 gobject_class->set_property = purple_media_set_property;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
200 gobject_class->get_property = purple_media_get_property;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
201
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
202 g_object_class_install_property(gobject_class, PROP_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
203 g_param_spec_object("manager",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
204 "Purple Media Manager",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
205 "The media manager that contains this media session.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
206 PURPLE_TYPE_MEDIA_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
207 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
208
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
209 g_object_class_install_property(gobject_class, PROP_ACCOUNT,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
210 g_param_spec_pointer("account",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
211 "PurpleAccount",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
212 "The account this media session is on.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
213 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
214
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
215 g_object_class_install_property(gobject_class, PROP_CONFERENCE_TYPE,
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
216 g_param_spec_string("conference-type",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
217 "Conference Type",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
218 "The type of conference that this media object "
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
219 "has been created to provide.",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
220 NULL,
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
221 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
222
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
223 g_object_class_install_property(gobject_class, PROP_INITIATOR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
224 g_param_spec_boolean("initiator",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
225 "initiator",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
226 "If the local user initiated the conference.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
227 FALSE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
228 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
229
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
230 g_object_class_install_property(gobject_class, PROP_PRPL_DATA,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
231 g_param_spec_pointer("prpl-data",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
232 "gpointer",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
233 "Data the prpl plugin set on the media session.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
234 G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
235
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
236 purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
237 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
238 g_cclosure_marshal_VOID__STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
239 G_TYPE_NONE, 1, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
240 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
241 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
242 purple_smarshal_VOID__STRING_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
243 G_TYPE_NONE, 2, G_TYPE_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
244 G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
245 purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
246 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
247 g_cclosure_marshal_VOID__STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
248 G_TYPE_NONE, 1, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
249 purple_media_signals[LEVEL] = g_signal_new("level", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
250 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
251 purple_smarshal_VOID__STRING_STRING_DOUBLE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
252 G_TYPE_NONE, 3, G_TYPE_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
253 G_TYPE_STRING, G_TYPE_DOUBLE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
254 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
255 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
256 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
257 G_TYPE_NONE, 3, G_TYPE_POINTER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
258 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
259 purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
260 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
261 purple_smarshal_VOID__ENUM_STRING_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
262 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
263 G_TYPE_STRING, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
264 purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
265 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
266 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
267 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
268 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
269 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
270 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
271
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
272
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
273 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
274 purple_media_init (PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
275 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
276 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
277 memset(media->priv, 0, sizeof(*media->priv));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
278 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
279
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
280 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
281 purple_media_stream_free(PurpleMediaStream *stream)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
282 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
283 if (stream == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
284 return;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
285
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
286 /* Remove the connected_cb timeout */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
287 if (stream->connected_cb_id != 0)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
288 purple_timeout_remove(stream->connected_cb_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
289
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
290 g_free(stream->participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
291
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
292 if (stream->local_candidates)
29559
cb843608e183 Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29557
diff changeset
293 purple_media_candidate_list_free(stream->local_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
294 if (stream->remote_candidates)
29560
18571ea6e44a Store remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29559
diff changeset
295 purple_media_candidate_list_free(stream->remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
296
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
297 if (stream->active_local_candidates)
29561
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
298 purple_media_candidate_list_free(
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
299 stream->active_local_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
300 if (stream->active_remote_candidates)
29562
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
301 purple_media_candidate_list_free(
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
302 stream->active_remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
303
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
304 g_free(stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
305 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
306
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
307 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
308 purple_media_session_free(PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
309 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
310 if (session == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
311 return;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
312
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
313 g_free(session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
314 g_free(session);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
315 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
316
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
317 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
318 purple_media_dispose(GObject *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
319 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
320 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
321
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
322 purple_debug_info("media","purple_media_dispose\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
323
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
324 purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
325
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
326 if (priv->backend) {
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
327 g_object_unref(priv->backend);
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
328 priv->backend = NULL;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
329 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
330
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
331 if (priv->gst_bus_handler_id != 0) {
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
332 GstElement *pipeline = purple_media_manager_get_pipeline(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
333 priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
334 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
335 g_signal_handler_disconnect(bus, priv->gst_bus_handler_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
336 gst_object_unref(bus);
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
337 priv->gst_bus_handler_id = 0;
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
338 }
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
339
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
340 if (priv->manager) {
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
341 g_object_unref(priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
342 priv->manager = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
343 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
344
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
345 G_OBJECT_CLASS(parent_class)->dispose(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
346 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
347
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
348 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
349 purple_media_finalize(GObject *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
350 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
351 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
352 purple_debug_info("media","purple_media_finalize\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
353
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
354 for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
355 purple_media_stream_free(priv->streams->data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
356
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
357 if (priv->sessions) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
358 GList *sessions = g_hash_table_get_values(priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
359 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
360 purple_media_session_free(sessions->data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
361 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
362 g_hash_table_destroy(priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
363 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
364
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
365 G_OBJECT_CLASS(parent_class)->finalize(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
366 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
367
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
368 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
369 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
370 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
371 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
372 g_return_if_fail(PURPLE_IS_MEDIA(object));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
373
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
374 media = PURPLE_MEDIA(object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
375
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
376 switch (prop_id) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
377 case PROP_MANAGER:
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
378 media->priv->manager = g_value_dup_object(value);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
379 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
380 case PROP_ACCOUNT:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
381 media->priv->account = g_value_get_pointer(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
382 break;
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
383 case PROP_CONFERENCE_TYPE:
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
384 media->priv->conference_type =
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
385 g_value_dup_string(value);
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
386 /* Will eventually get this type from the media manager */
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
387 media->priv->backend = g_object_new(
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
388 PURPLE_TYPE_MEDIA_BACKEND_FS2,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
389 "conference-type",
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
390 media->priv->conference_type,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
391 "media", media,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
392 NULL);
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
393 g_signal_connect(media->priv->backend,
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
394 "active-candidate-pair",
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
395 G_CALLBACK(
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
396 purple_media_candidate_pair_established_cb),
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
397 media);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
398 g_signal_connect(media->priv->backend,
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
399 "candidates-prepared",
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
400 G_CALLBACK(
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
401 purple_media_candidates_prepared_cb),
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
402 media);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
403 g_signal_connect(media->priv->backend,
29555
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
404 "codecs-changed",
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
405 G_CALLBACK(
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
406 purple_media_codecs_changed_cb),
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
407 media);
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
408 g_signal_connect(media->priv->backend,
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
409 "new-candidate",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
410 G_CALLBACK(
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
411 purple_media_new_local_candidate_cb),
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
412 media);
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
413 break;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
414 case PROP_INITIATOR:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
415 media->priv->initiator = g_value_get_boolean(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
416 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
417 case PROP_PRPL_DATA:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
418 media->priv->prpl_data = g_value_get_pointer(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
419 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
420 default:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
421 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
422 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
423 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
424 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
425
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
426 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
427 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
428 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
429 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
430 g_return_if_fail(PURPLE_IS_MEDIA(object));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
431
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
432 media = PURPLE_MEDIA(object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
433
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
434 switch (prop_id) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
435 case PROP_MANAGER:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
436 g_value_set_object(value, media->priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
437 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
438 case PROP_ACCOUNT:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
439 g_value_set_pointer(value, media->priv->account);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
440 break;
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
441 case PROP_CONFERENCE_TYPE:
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
442 g_value_set_string(value,
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
443 media->priv->conference_type);
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
444 break;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
445 case PROP_INITIATOR:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
446 g_value_set_boolean(value, media->priv->initiator);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
447 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
448 case PROP_PRPL_DATA:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
449 g_value_set_pointer(value, media->priv->prpl_data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
450 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
451 default:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
452 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
453 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
454 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
455
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
456 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
457
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
458 static PurpleMediaSession*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
459 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
460 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
461 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
462 return (PurpleMediaSession*) (media->priv->sessions) ?
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
463 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
464 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
465
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
466 static PurpleMediaStream*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
467 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
468 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
469 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
470
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
471 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
472
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
473 streams = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
474
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
475 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
476 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
477 if (!strcmp(stream->session->id, session) &&
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
478 !strcmp(stream->participant, participant))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
479 return stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
480 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
481
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
482 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
483 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
484
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
485 static GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
486 purple_media_get_streams(PurpleMedia *media, const gchar *session,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
487 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
488 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
489 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
490 GList *ret = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
491
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
492 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
493
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
494 streams = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
495
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
496 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
497 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
498 if ((session == NULL ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
499 !strcmp(stream->session->id, session)) &&
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
500 (participant == NULL ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
501 !strcmp(stream->participant, participant)))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
502 ret = g_list_append(ret, stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
503 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
504
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
505 return ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
506 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
507
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
508 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
509 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
510 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
511 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
512 g_return_if_fail(session != NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
513
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
514 if (!media->priv->sessions) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
515 purple_debug_info("media", "Creating hash table for sessions\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
516 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
517 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
518 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
519 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
520
29568
d9d0674dfbb3 Silence warning.
maiku@pidgin.im
parents: 29567
diff changeset
521 #if 0
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
522 static gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
523 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
524 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
525 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
526 return g_hash_table_remove(media->priv->sessions, session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
527 }
29568
d9d0674dfbb3 Silence warning.
maiku@pidgin.im
parents: 29567
diff changeset
528 #endif
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
529
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
530 static PurpleMediaStream *
29580
7e9d8840e97f Remove FsStream from PurpleMedia stream.
maiku@pidgin.im
parents: 29579
diff changeset
531 purple_media_insert_stream(PurpleMediaSession *session,
7e9d8840e97f Remove FsStream from PurpleMedia stream.
maiku@pidgin.im
parents: 29579
diff changeset
532 const gchar *name, gboolean initiator)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
533 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
534 PurpleMediaStream *media_stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
535
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
536 g_return_val_if_fail(session != NULL, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
537
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
538 media_stream = g_new0(PurpleMediaStream, 1);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
539 media_stream->participant = g_strdup(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
540 media_stream->session = session;
29580
7e9d8840e97f Remove FsStream from PurpleMedia stream.
maiku@pidgin.im
parents: 29579
diff changeset
541 media_stream->initiator = initiator;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
542
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
543 session->media->priv->streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
544 g_list_append(session->media->priv->streams, media_stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
545
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
546 return media_stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
547 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
548
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
549 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
550 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
29559
cb843608e183 Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29557
diff changeset
551 PurpleMediaCandidate *candidate)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
552 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
553 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
554
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
555 g_return_if_fail(session != NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
556
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
557 stream = purple_media_get_stream(session->media, session->id, name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
558 stream->local_candidates = g_list_append(stream->local_candidates, candidate);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
559 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
560 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
561
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
562 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
563 purple_media_get_session_ids(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
564 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
565 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
566 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
567 return media->priv->sessions != NULL ?
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
568 g_hash_table_get_keys(media->priv->sessions) : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
569 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
570 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
571 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
572 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
573
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
574 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
575 GstElement *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
576 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
577 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
578 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
579 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
29583
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
580
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
581 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
582 return purple_media_backend_fs2_get_src(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
583 PURPLE_MEDIA_BACKEND_FS2(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
584 media->priv->backend), sess_id);
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
585
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
586 g_return_val_if_reached(NULL);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
587 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
588 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
589 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
590 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
591 #endif /* USE_GSTREAMER */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
592
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
593 PurpleAccount *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
594 purple_media_get_account(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
595 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
596 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
597 PurpleAccount *account;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
598 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
599 g_object_get(G_OBJECT(media), "account", &account, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
600 return account;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
601 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
602 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
603 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
604 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
605
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
606 gpointer
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
607 purple_media_get_prpl_data(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
608 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
609 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
610 gpointer prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
611 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
612 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
613 return prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
614 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
615 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
616 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
617 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
618
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
619 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
620 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
621 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
622 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
623 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
624 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
625 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
626 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
627
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
628 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
629 purple_media_error(PurpleMedia *media, const gchar *error, ...)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
630 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
631 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
632 va_list args;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
633 gchar *message;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
634
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
635 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
636
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
637 va_start(args, error);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
638 message = g_strdup_vprintf(error, args);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
639 va_end(args);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
640
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
641 purple_debug_error("media", "%s\n", message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
642 g_signal_emit(media, purple_media_signals[S_ERROR], 0, message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
643
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
644 g_free(message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
645 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
646 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
647
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
648 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
649 purple_media_end(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
650 const gchar *session_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
651 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
652 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
653 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
654 if (session_id == NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
655 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
656 0, PURPLE_MEDIA_STATE_END,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
657 NULL, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
658 g_object_unref(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
659 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
660 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
661 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
662
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
663 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
664 purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
665 const gchar *session_id, const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
666 gboolean local)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
667 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
668 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
669 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
670
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
671 if (type == PURPLE_MEDIA_INFO_ACCEPT) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
672 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
673
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
674 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
675
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
676 streams = purple_media_get_streams(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
677 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
678
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
679 for (; streams; streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
680 g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
681 PurpleMediaStream *stream = streams->data;
29576
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29575
diff changeset
682
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
683 stream->accepted = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
684 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
685 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
686
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
687 g_signal_emit(media, purple_media_signals[STREAM_INFO],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
688 0, type, session_id, participant, local);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
689
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
690 if (type == PURPLE_MEDIA_INFO_HANGUP ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
691 type == PURPLE_MEDIA_INFO_REJECT) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
692 purple_media_end(media, session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
693 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
694 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
695 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
696
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
697 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
698 static void
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
699 purple_media_new_local_candidate_cb(PurpleMediaBackend *backend,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
700 const gchar *sess_id, const gchar *participant,
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
701 PurpleMediaCandidate *candidate, PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
702 {
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
703 PurpleMediaSession *session =
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
704 purple_media_get_session(media, sess_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
705
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
706 purple_media_insert_local_candidate(session, participant,
29559
cb843608e183 Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29557
diff changeset
707 purple_media_candidate_copy(candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
708
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
709 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
710 0, session->id, participant, candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
711 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
712
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
713 static void
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
714 purple_media_candidates_prepared_cb(PurpleMediaBackend *backend,
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
715 const gchar *sess_id, const gchar *name, PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
716 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
717 PurpleMediaStream *stream_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
718
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
719 g_return_if_fail(PURPLE_IS_MEDIA(media));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
720
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
721 stream_data = purple_media_get_stream(media, sess_id, name);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
722 stream_data->candidates_prepared = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
723
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
724 g_signal_emit(media, purple_media_signals[CANDIDATES_PREPARED],
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
725 0, sess_id, name);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
726 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
727
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
728 /* callback called when a pair of transport candidates (local and remote)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
729 * has been established */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
730 static void
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
731 purple_media_candidate_pair_established_cb(PurpleMediaBackend *backend,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
732 const gchar *sess_id, const gchar *name,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
733 PurpleMediaCandidate *local_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
734 PurpleMediaCandidate *remote_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
735 PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
736 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
737 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
738 GList *iter;
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
739 guint id;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
740
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
741 g_return_if_fail(PURPLE_IS_MEDIA(media));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
742
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
743 stream = purple_media_get_stream(media, sess_id, name);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
744 id = purple_media_candidate_get_component_id(local_candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
745
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
746 iter = stream->active_local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
747 for(; iter; iter = g_list_next(iter)) {
29561
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
748 PurpleMediaCandidate *c = iter->data;
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
749 if (id == purple_media_candidate_get_component_id(c)) {
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
750 g_object_unref(c);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
751 stream->active_local_candidates =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
752 g_list_delete_link(iter, iter);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
753 stream->active_local_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
754 stream->active_local_candidates,
29561
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
755 purple_media_candidate_copy(
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
756 local_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
757 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
758 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
759 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
760 if (iter == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
761 stream->active_local_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
762 stream->active_local_candidates,
29561
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
763 purple_media_candidate_copy(
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
764 local_candidate));
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
765
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
766 id = purple_media_candidate_get_component_id(local_candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
767
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
768 iter = stream->active_remote_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
769 for(; iter; iter = g_list_next(iter)) {
29562
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
770 PurpleMediaCandidate *c = iter->data;
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
771 if (id == purple_media_candidate_get_component_id(c)) {
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
772 g_object_unref(c);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
773 stream->active_remote_candidates =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
774 g_list_delete_link(iter, iter);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
775 stream->active_remote_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
776 stream->active_remote_candidates,
29562
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
777 purple_media_candidate_copy(
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
778 remote_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
779 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
780 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
781 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
782 if (iter == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
783 stream->active_remote_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
784 stream->active_remote_candidates,
29562
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
785 purple_media_candidate_copy(
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
786 remote_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
787
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
788 purple_debug_info("media", "candidate pair established\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
789 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
790
29555
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
791 static void
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
792 purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
793 const gchar *sess_id, PurpleMedia *media)
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
794 {
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
795 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, sess_id);
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
796 }
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
797 #endif /* USE_VV */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
798
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
799 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
800 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
801 const gchar *who, PurpleMediaSessionType type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
802 gboolean initiator, const gchar *transmitter,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
803 guint num_params, GParameter *params)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
804 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
805 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
806 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
807 PurpleMediaStream *stream = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
808
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
809 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
810
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
811 if (!purple_media_backend_add_stream(media->priv->backend,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
812 sess_id, who, type, initiator, transmitter,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
813 num_params, params)) {
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
814 purple_debug_error("media", "Error adding stream.\n");
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
815 return FALSE;
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
816 }
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
817
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
818 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
819
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
820 if (!session) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
821 session = g_new0(PurpleMediaSession, 1);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
822 session->id = g_strdup(sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
823 session->media = media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
824 session->type = type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
825 session->initiator = initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
826
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
827 purple_media_add_session(media, session);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
828 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
829 0, PURPLE_MEDIA_STATE_NEW,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
830 session->id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
831 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
832
29579
f65689100cfe Move odd direction changing functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29578
diff changeset
833 if (purple_media_get_stream(media, sess_id, who) == NULL) {
29580
7e9d8840e97f Remove FsStream from PurpleMedia stream.
maiku@pidgin.im
parents: 29579
diff changeset
834 stream = purple_media_insert_stream(session, who, initiator);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
835
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
836 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
837 0, PURPLE_MEDIA_STATE_NEW,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
838 session->id, who);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
839 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
840
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
841 return TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
842 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
843 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
844 #endif /* USE_VV */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
845 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
846
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
847 PurpleMediaManager *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
848 purple_media_get_manager(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
849 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
850 PurpleMediaManager *ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
851 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
852 g_object_get(media, "manager", &ret, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
853 return ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
854 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
855
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
856 PurpleMediaSessionType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
857 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
858 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
859 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
860 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
861 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
862 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
863 return session->type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
864 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
865 return PURPLE_MEDIA_NONE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
866 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
867 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
868 /* XXX: Should wait until codecs-ready is TRUE before using this function */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
869 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
870 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
871 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
872 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
873 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
874
29569
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29568
diff changeset
875 return purple_media_backend_get_codecs(media->priv->backend, sess_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
876 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
877 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
878 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
879 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
880
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
881 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
882 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
883 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
884 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
885 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
886 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
29571
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29569
diff changeset
887
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29569
diff changeset
888 return purple_media_backend_get_local_candidates(media->priv->backend,
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29569
diff changeset
889 sess_id, participant);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
890 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
891 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
892 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
893 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
894
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
895 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
896 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
897 const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
898 GList *remote_candidates)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
899 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
900 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
901 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
902
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
903 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
904 stream = purple_media_get_stream(media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
905
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
906 if (stream == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
907 purple_debug_error("media",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
908 "purple_media_add_remote_candidates: "
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
909 "couldn't find stream %s %s.\n",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
910 sess_id ? sess_id : "(null)",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
911 participant ? participant : "(null)");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
912 return;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
913 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
914
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
915 stream->remote_candidates = g_list_concat(stream->remote_candidates,
29560
18571ea6e44a Store remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29559
diff changeset
916 purple_media_candidate_list_copy(remote_candidates));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
917
29576
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29575
diff changeset
918 purple_media_backend_add_remote_candidates(media->priv->backend,
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29575
diff changeset
919 sess_id, participant, remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
920 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
921 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
922
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
923 #if 0
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
924 /*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
925 * These two functions aren't being used and I'd rather not lock in the API
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
926 * until they are needed. If they ever are.
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
927 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
928
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
929 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
930 purple_media_get_active_local_candidates(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
931 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
932 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
933 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
934 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
935 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
936 stream = purple_media_get_stream(media, sess_id, participant);
29561
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
937 return purple_media_candidate_list_copy(
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
938 stream->active_local_candidates);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
939 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
940 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
941 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
942 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
943
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
944 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
945 purple_media_get_active_remote_candidates(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
946 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
947 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
948 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
949 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
950 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
951 stream = purple_media_get_stream(media, sess_id, participant);
29562
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
952 return purple_media_candidate_list_copy(
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
953 stream->active_remote_candidates);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
954 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
955 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
956 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
957 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
958 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
959
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
960 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
961 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
962 const gchar *participant, GList *codecs)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
963 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
964 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
965 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
966
29573
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29571
diff changeset
967 return purple_media_backend_set_remote_codecs(media->priv->backend,
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29571
diff changeset
968 sess_id, participant, codecs);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
969 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
970 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
971 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
972 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
973
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
974 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
975 purple_media_candidates_prepared(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
976 const gchar *session_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
977 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
978 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
979 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
980 gboolean prepared = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
981
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
982 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
983
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
984 streams = purple_media_get_streams(media, session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
985
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
986 for (; streams; streams = g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
987 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
988 if (stream->candidates_prepared == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
989 g_list_free(streams);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
990 prepared = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
991 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
992 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
993 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
994
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
995 return prepared;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
996 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
997 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
998 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
999 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1000
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1001 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1002 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1003 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1004 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1005 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1006
29575
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29573
diff changeset
1007 return purple_media_backend_set_send_codec(
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29573
diff changeset
1008 media->priv->backend, sess_id, codec);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1009 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1010 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1011 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1012 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1013
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1014 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1015 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1016 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1017 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1018 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1019
29581
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29580
diff changeset
1020 return purple_media_backend_codecs_ready(
f351e87b7af0 Add codecs_ready to the media backend interface.
maiku@pidgin.im
parents: 29580
diff changeset
1021 media->priv->backend, sess_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1022 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1023 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1024 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1025 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1026
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1027 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1028 purple_media_is_initiator(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1029 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1030 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1031 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1032 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1033
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1034 if (sess_id == NULL && participant == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1035 return media->priv->initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1036 else if (sess_id != NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1037 PurpleMediaSession *session =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1038 purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1039 return session != NULL ? session->initiator : FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1040 } else if (sess_id != NULL && participant != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1041 PurpleMediaStream *stream = purple_media_get_stream(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1042 media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1043 return stream != NULL ? stream->initiator : FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1044 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1045 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1046 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1047 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1048
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1049 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1050 purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1051 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1052 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1053 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1054 gboolean accepted = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1055
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1056 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1057
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1058 if (sess_id == NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1059 GList *streams = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1060
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1061 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1062 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1063 if (stream->accepted == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1064 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1065 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1066 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1067 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1068 } else if (sess_id != NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1069 GList *streams = purple_media_get_streams(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1070 media, sess_id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1071 for (; streams; streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1072 g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1073 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1074 if (stream->accepted == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1075 g_list_free(streams);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1076 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1077 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1078 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1079 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1080 } else if (sess_id != NULL && participant != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1081 PurpleMediaStream *stream = purple_media_get_stream(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1082 media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1083 if (stream == NULL || stream->accepted == FALSE)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1084 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1085 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1086
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1087 return accepted;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1088 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1089 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1090 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1091 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1092
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1093 void purple_media_set_input_volume(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1094 const gchar *session_id, double level)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1095 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1096 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1097 g_return_if_fail(PURPLE_IS_MEDIA(media));
29585
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1098 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1099
29585
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1100 purple_media_backend_fs2_set_input_volume(
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1101 PURPLE_MEDIA_BACKEND_FS2(
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1102 media->priv->backend),
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1103 session_id, level);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1104 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1105 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1106
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1107 void purple_media_set_output_volume(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1108 const gchar *session_id, const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1109 double level)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1110 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1111 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1112 g_return_if_fail(PURPLE_IS_MEDIA(media));
29585
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1113 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1114
29585
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1115 purple_media_backend_fs2_set_output_volume(
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1116 PURPLE_MEDIA_BACKEND_FS2(
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1117 media->priv->backend),
95f918df7f09 Move volume setting functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29584
diff changeset
1118 session_id, participant, level);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1119 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1120 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1121
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1122 gulong
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1123 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1124 const gchar *participant, gulong window_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1125 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1126 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1127 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1128
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1129 return purple_media_manager_set_output_window(media->priv->manager,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1130 media, session_id, participant, window_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1131 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1132 return 0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1133 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1134 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1135
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1136 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1137 purple_media_remove_output_windows(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1138 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1139 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1140 GList *iter = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1141 for (; iter; iter = g_list_next(iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1142 PurpleMediaStream *stream = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1143 purple_media_manager_remove_output_windows(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1144 media->priv->manager, media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1145 stream->session->id, stream->participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1146 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1147
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1148 iter = purple_media_get_session_ids(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1149 for (; iter; iter = g_list_delete_link(iter, iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1150 gchar *session_name = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1151 purple_media_manager_remove_output_windows(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1152 media->priv->manager, media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1153 session_name, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1154 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1155 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1156 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1157
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1158 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1159 GstElement *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1160 purple_media_get_tee(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1161 const gchar *session_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1162 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1163 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1164 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1165
29583
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
1166 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
1167 return purple_media_backend_fs2_get_tee(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
1168 PURPLE_MEDIA_BACKEND_FS2(
eadb9e309b87 Move all src and sink creation in PurpleMedia to the Fs2 media backend.
maiku@pidgin.im
parents: 29582
diff changeset
1169 media->priv->backend),
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1170 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1171 g_return_val_if_reached(NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1172 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1173 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1174 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1175 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1176 #endif /* USE_GSTREAMER */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1177