annotate libpurple/media/media.c @ 29576:a27e41f373db

Handle part of accepting a stream in the Fs2 media backend.
author maiku@pidgin.im
date Tue, 27 Oct 2009 00:13:39 +0000
parents ec5ed142f551
children 3bab2237724d
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 <string.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 "internal.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
30
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
31 #include "account.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
32 #include "media.h"
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
33 #include "media/backend-fs2.h"
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
34 #include "media/backend-iface.h"
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
35 #include "mediamanager.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
36 #include "network.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
37
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
38 #include "debug.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
39
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
40 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
41 #include "marshallers.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
42 #include "media-gst.h"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
43 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
44
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
45 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
46
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
47 #include <gst/farsight/fs-conference-iface.h>
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
48 #include <gst/farsight/fs-element-added-notifier.h>
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
49
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
50 /** @copydoc _PurpleMediaSession */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
51 typedef struct _PurpleMediaSession PurpleMediaSession;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
52 /** @copydoc _PurpleMediaStream */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
53 typedef struct _PurpleMediaStream PurpleMediaStream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
54 /** @copydoc _PurpleMediaClass */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
55 typedef struct _PurpleMediaClass PurpleMediaClass;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
56 /** @copydoc _PurpleMediaPrivate */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
57 typedef struct _PurpleMediaPrivate PurpleMediaPrivate;
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 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
60 struct _PurpleMediaClass
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 GObjectClass parent_class; /**< The parent class. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
63 };
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 /** The media class's private data */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
66 struct _PurpleMedia
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 GObject parent; /**< The parent of this object. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
69 PurpleMediaPrivate *priv; /**< The private data of this object. */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
70 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
71
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
72 struct _PurpleMediaSession
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 gchar *id;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
75 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
76 GstElement *src;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
77 GstElement *tee;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
78 FsSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
79
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
80 PurpleMediaSessionType type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
81 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
82 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
83
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
84 struct _PurpleMediaStream
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 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
87 gchar *participant;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
88 FsStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
89 GstElement *src;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
90 GstElement *tee;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
91 GstElement *volume;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
92 GstElement *level;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
93
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
94 GList *local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
95 GList *remote_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
96
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
97 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
98 gboolean accepted;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
99 gboolean candidates_prepared;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
100
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
101 GList *active_local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
102 GList *active_remote_candidates;
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 guint connected_cb_id;
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 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
107
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
108 struct _PurpleMediaPrivate
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
109 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
110 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
111 PurpleMediaManager *manager;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
112 PurpleAccount *account;
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
113 PurpleMediaBackend *backend;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
114 FsConference *conference;
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
115 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
116 gulong gst_bus_handler_id;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
117 gboolean initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
118 gpointer prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
119
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
120 GHashTable *sessions; /* PurpleMediaSession table */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
121
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
122 GList *streams; /* PurpleMediaStream table */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
123
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
124 GstElement *confbin;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
125 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
126 gpointer dummy;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
127 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
128 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
129
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
130 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
131 #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
132
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
133 static void purple_media_class_init (PurpleMediaClass *klass);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
134 static void purple_media_init (PurpleMedia *media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
135 static void purple_media_dispose (GObject *object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
136 static void purple_media_finalize (GObject *object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
137 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
138 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
139
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
140 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
141 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
142 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
143 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
144 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
145 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
146 PurpleMediaBackend *backend,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
147 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
148 PurpleMediaCandidate *local_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
149 PurpleMediaCandidate *remote_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
150 PurpleMedia *media);
29555
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
151 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
152 const gchar *sess_id, PurpleMedia *media);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
153 static gboolean media_bus_call(GstBus *bus,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
154 GstMessage *msg, PurpleMedia *media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
155
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
156 static GObjectClass *parent_class = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
157
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
158
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 enum {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
161 S_ERROR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
162 CANDIDATES_PREPARED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
163 CODECS_CHANGED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
164 LEVEL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
165 NEW_CANDIDATE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
166 STATE_CHANGED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
167 STREAM_INFO,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
168 LAST_SIGNAL
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
169 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
170 static guint purple_media_signals[LAST_SIGNAL] = {0};
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
171
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
172 enum {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
173 PROP_0,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
174 PROP_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
175 PROP_ACCOUNT,
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
176 #ifndef PURPLE_DISABLE_DEPRECATED
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
177 PROP_CONFERENCE,
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
178 #endif
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
179 PROP_CONFERENCE_TYPE,
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
180 PROP_INITIATOR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
181 PROP_PRPL_DATA,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
182 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
183 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
184
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
185
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
186 GType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
187 purple_media_get_type()
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 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
190 static GType type = 0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
191
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
192 if (type == 0) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
193 static const GTypeInfo info = {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
194 sizeof(PurpleMediaClass),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
195 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
196 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
197 (GClassInitFunc) purple_media_class_init,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
198 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
199 NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
200 sizeof(PurpleMedia),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
201 0,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
202 (GInstanceInitFunc) purple_media_init,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
203 NULL
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
204 };
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
205 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
206 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
207 return type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
208 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
209 return G_TYPE_NONE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
210 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
211 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
212
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
213 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
214 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
215 purple_media_class_init (PurpleMediaClass *klass)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
216 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
217 GObjectClass *gobject_class = (GObjectClass*)klass;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
218 parent_class = g_type_class_peek_parent(klass);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
219
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
220 gobject_class->dispose = purple_media_dispose;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
221 gobject_class->finalize = purple_media_finalize;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
222 gobject_class->set_property = purple_media_set_property;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
223 gobject_class->get_property = purple_media_get_property;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
224
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
225 g_object_class_install_property(gobject_class, PROP_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
226 g_param_spec_object("manager",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
227 "Purple Media Manager",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
228 "The media manager that contains this media session.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
229 PURPLE_TYPE_MEDIA_MANAGER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
230 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
231
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
232 g_object_class_install_property(gobject_class, PROP_ACCOUNT,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
233 g_param_spec_pointer("account",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
234 "PurpleAccount",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
235 "The account this media session is on.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
236 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
237
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
238 #ifndef PURPLE_DISABLE_DEPRECATED
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
239 g_object_class_install_property(gobject_class, PROP_CONFERENCE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
240 g_param_spec_object("conference",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
241 "Farsight conference",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
242 "The FsConference associated with this media.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
243 FS_TYPE_CONFERENCE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
244 G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
245 #endif
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
246
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
247 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
248 g_param_spec_string("conference-type",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
249 "Conference Type",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
250 "The type of conference that this media object "
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
251 "has been created to provide.",
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
252 NULL,
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
253 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
254
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
255 g_object_class_install_property(gobject_class, PROP_INITIATOR,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
256 g_param_spec_boolean("initiator",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
257 "initiator",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
258 "If the local user initiated the conference.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
259 FALSE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
260 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
261
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
262 g_object_class_install_property(gobject_class, PROP_PRPL_DATA,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
263 g_param_spec_pointer("prpl-data",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
264 "gpointer",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
265 "Data the prpl plugin set on the media session.",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
266 G_PARAM_READWRITE));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
267
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
268 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
269 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
270 g_cclosure_marshal_VOID__STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
271 G_TYPE_NONE, 1, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
272 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
273 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
274 purple_smarshal_VOID__STRING_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
275 G_TYPE_NONE, 2, G_TYPE_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
276 G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
277 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
278 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
279 g_cclosure_marshal_VOID__STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
280 G_TYPE_NONE, 1, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
281 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
282 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
283 purple_smarshal_VOID__STRING_STRING_DOUBLE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
284 G_TYPE_NONE, 3, G_TYPE_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
285 G_TYPE_STRING, G_TYPE_DOUBLE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
286 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
287 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
288 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
289 G_TYPE_NONE, 3, G_TYPE_POINTER,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
290 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
291 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
292 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
293 purple_smarshal_VOID__ENUM_STRING_STRING,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
294 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
295 G_TYPE_STRING, G_TYPE_STRING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
296 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
297 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
298 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
299 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
300 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
301 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
302 }
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
305 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
306 purple_media_init (PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
307 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
308 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
309 memset(media->priv, 0, sizeof(*media->priv));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
310 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
311
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
312 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
313 purple_media_stream_free(PurpleMediaStream *stream)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
314 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
315 if (stream == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
316 return;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
317
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
318 /* Remove the connected_cb timeout */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
319 if (stream->connected_cb_id != 0)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
320 purple_timeout_remove(stream->connected_cb_id);
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 g_free(stream->participant);
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 if (stream->local_candidates)
29559
cb843608e183 Store local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29557
diff changeset
325 purple_media_candidate_list_free(stream->local_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
326 if (stream->remote_candidates)
29560
18571ea6e44a Store remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29559
diff changeset
327 purple_media_candidate_list_free(stream->remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
328
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
329 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
330 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
331 stream->active_local_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
332 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
333 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
334 stream->active_remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
335
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
336 g_free(stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
337 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
338
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
339 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
340 purple_media_session_free(PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
341 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
342 if (session == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
343 return;
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_free(session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
346 g_free(session);
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
349 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
350 purple_media_dispose(GObject *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
351 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
352 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
353 GList *iter = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
354
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
355 purple_debug_info("media","purple_media_dispose\n");
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 purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
358
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
359 if (priv->backend) {
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
360 g_object_unref(priv->backend);
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
361 priv->backend = NULL;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
362 }
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 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
365 PurpleMediaStream *stream = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
366 if (stream->stream) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
367 g_object_unref(stream->stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
368 stream->stream = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
369 }
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
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
372 if (priv->gst_bus_handler_id != 0) {
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
373 GstElement *pipeline = purple_media_manager_get_pipeline(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
374 priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
375 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
376 g_signal_handler_disconnect(bus, priv->gst_bus_handler_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
377 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
378 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
379 }
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
380
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
381 if (priv->manager) {
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
382 g_object_unref(priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
383 priv->manager = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
384 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
385
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
386 G_OBJECT_CLASS(parent_class)->dispose(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
387 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
388
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
389 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
390 purple_media_finalize(GObject *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
391 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
392 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
393 purple_debug_info("media","purple_media_finalize\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
394
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
395 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
396 purple_media_stream_free(priv->streams->data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
397
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
398 if (priv->sessions) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
399 GList *sessions = g_hash_table_get_values(priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
400 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
401 purple_media_session_free(sessions->data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
402 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
403 g_hash_table_destroy(priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
404 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
405
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
406 G_OBJECT_CLASS(parent_class)->finalize(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
407 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
408
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
409 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
410 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
411 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
412 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
413 g_return_if_fail(PURPLE_IS_MEDIA(object));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
414
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
415 media = PURPLE_MEDIA(object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
416
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
417 switch (prop_id) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
418 case PROP_MANAGER:
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
419 media->priv->manager = g_value_dup_object(value);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
420 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
421 case PROP_ACCOUNT:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
422 media->priv->account = g_value_get_pointer(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
423 break;
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
424 #ifndef PURPLE_DISABLE_DEPRECATED
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
425 case PROP_CONFERENCE: {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
426 if (media->priv->conference)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
427 gst_object_unref(media->priv->conference);
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
428 media->priv->conference = g_value_dup_object(value);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
429 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
430 }
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
431 #endif
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
432 case PROP_CONFERENCE_TYPE:
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
433 media->priv->conference_type =
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
434 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
435 /* 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
436 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
437 PURPLE_TYPE_MEDIA_BACKEND_FS2,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
438 "conference-type",
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
439 media->priv->conference_type,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
440 "media", media,
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
441 NULL);
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
442 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
443 "active-candidate-pair",
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
444 G_CALLBACK(
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
445 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
446 media);
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
447 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
448 "candidates-prepared",
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
449 G_CALLBACK(
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
450 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
451 media);
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
452 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
453 "codecs-changed",
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
454 G_CALLBACK(
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
455 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
456 media);
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
457 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
458 "new-candidate",
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
459 G_CALLBACK(
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
460 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
461 media);
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
462 break;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
463 case PROP_INITIATOR:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
464 media->priv->initiator = g_value_get_boolean(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
465 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
466 case PROP_PRPL_DATA:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
467 media->priv->prpl_data = g_value_get_pointer(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
468 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
469 default:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
470 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
471 break;
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 }
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 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
476 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
477 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
478 PurpleMedia *media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
479 g_return_if_fail(PURPLE_IS_MEDIA(object));
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 media = PURPLE_MEDIA(object);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
482
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
483 switch (prop_id) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
484 case PROP_MANAGER:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
485 g_value_set_object(value, media->priv->manager);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
486 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
487 case PROP_ACCOUNT:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
488 g_value_set_pointer(value, media->priv->account);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
489 break;
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
490 #ifndef PURPLE_DISABLE_DEPRECATED
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
491 case PROP_CONFERENCE:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
492 g_value_set_object(value, media->priv->conference);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
493 break;
29550
846a475a1573 Deprecate the conference property of PurpleMedia.
maiku@pidgin.im
parents: 29549
diff changeset
494 #endif
29545
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
495 case PROP_CONFERENCE_TYPE:
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
496 g_value_set_string(value,
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
497 media->priv->conference_type);
30e8ab2a4bc2 Add a conference-type parameter to PurpleMedia.
maiku@pidgin.im
parents: 29538
diff changeset
498 break;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
499 case PROP_INITIATOR:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
500 g_value_set_boolean(value, media->priv->initiator);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
501 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
502 case PROP_PRPL_DATA:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
503 g_value_set_pointer(value, media->priv->prpl_data);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
504 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
505 default:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
506 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
507 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
508 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
509
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
512 static FsMediaType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
513 purple_media_to_fs_media_type(PurpleMediaSessionType type)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
514 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
515 if (type & PURPLE_MEDIA_AUDIO)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
516 return FS_MEDIA_TYPE_AUDIO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
517 else if (type & PURPLE_MEDIA_VIDEO)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
518 return FS_MEDIA_TYPE_VIDEO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
519 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
520 return 0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
521 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
522
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
523 static FsStreamDirection
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
524 purple_media_to_fs_stream_direction(PurpleMediaSessionType type)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
525 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
526 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
527 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
528 return FS_DIRECTION_BOTH;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
529 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
530 (type & PURPLE_MEDIA_SEND_VIDEO))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
531 return FS_DIRECTION_SEND;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
532 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
533 (type & PURPLE_MEDIA_RECV_VIDEO))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
534 return FS_DIRECTION_RECV;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
535 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
536 return FS_DIRECTION_NONE;
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
539 static PurpleMediaSessionType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
540 purple_media_from_fs(FsMediaType type, FsStreamDirection direction)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
541 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
542 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
543 if (type == FS_MEDIA_TYPE_AUDIO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
544 if (direction & FS_DIRECTION_SEND)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
545 result |= PURPLE_MEDIA_SEND_AUDIO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
546 if (direction & FS_DIRECTION_RECV)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
547 result |= PURPLE_MEDIA_RECV_AUDIO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
548 } else if (type == FS_MEDIA_TYPE_VIDEO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
549 if (direction & FS_DIRECTION_SEND)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
550 result |= PURPLE_MEDIA_SEND_VIDEO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
551 if (direction & FS_DIRECTION_RECV)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
552 result |= PURPLE_MEDIA_RECV_VIDEO;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
553 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
554 return result;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
555 }
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 static PurpleMediaSession*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
558 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
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 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
561 return (PurpleMediaSession*) (media->priv->sessions) ?
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
562 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
563 }
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 static PurpleMediaStream*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
566 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
567 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
568 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
569
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
570 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
571
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
572 streams = media->priv->streams;
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 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
575 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
576 if (!strcmp(stream->session->id, session) &&
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
577 !strcmp(stream->participant, participant))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
578 return stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
579 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
580
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
581 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
582 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
583
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
584 static GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
585 purple_media_get_streams(PurpleMedia *media, const gchar *session,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
586 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
587 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
588 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
589 GList *ret = NULL;
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 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
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 streams = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
594
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
595 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
596 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
597 if ((session == NULL ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
598 !strcmp(stream->session->id, session)) &&
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
599 (participant == NULL ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
600 !strcmp(stream->participant, participant)))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
601 ret = g_list_append(ret, stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
602 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
603
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
604 return ret;
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
607 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
608 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
609 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
610 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
611 g_return_if_fail(session != NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
612
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
613 if (!media->priv->sessions) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
614 purple_debug_info("media", "Creating hash table for sessions\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
615 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
616 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
617 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
618 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
619
29568
d9d0674dfbb3 Silence warning.
maiku@pidgin.im
parents: 29567
diff changeset
620 #if 0
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
621 static gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
622 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
623 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
624 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
625 return g_hash_table_remove(media->priv->sessions, session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
626 }
29568
d9d0674dfbb3 Silence warning.
maiku@pidgin.im
parents: 29567
diff changeset
627 #endif
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
628
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
629 static PurpleMediaStream *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
630 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
631 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
632 PurpleMediaStream *media_stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
633
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
634 g_return_val_if_fail(session != NULL, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
635
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
636 media_stream = g_new0(PurpleMediaStream, 1);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
637 media_stream->stream = stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
638 media_stream->participant = g_strdup(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
639 media_stream->session = session;
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 session->media->priv->streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
642 g_list_append(session->media->priv->streams, media_stream);
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 return media_stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
645 }
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 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
648 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
649 PurpleMediaCandidate *candidate)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
650 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
651 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
652
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
653 g_return_if_fail(session != NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
654
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
655 stream = purple_media_get_stream(session->media, session->id, name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
656 stream->local_candidates = g_list_append(stream->local_candidates, candidate);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
657 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
658 #endif
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 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
661 purple_media_get_session_ids(PurpleMedia *media)
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 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
664 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
665 return media->priv->sessions != NULL ?
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
666 g_hash_table_get_keys(media->priv->sessions) : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
667 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
668 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
669 #endif
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
672 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
673 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
674 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src)
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 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
677 GstPad *sinkpad;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
678 GstPad *srcpad;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
679
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
680 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
681 g_return_if_fail(GST_IS_ELEMENT(src));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
682
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
683 session = purple_media_get_session(media, sess_id);
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 if (session == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
686 purple_debug_warning("media", "purple_media_set_src: trying"
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
687 " to set src on non-existent session\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
688 return;
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
691 if (session->src)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
692 gst_object_unref(session->src);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
693 session->src = src;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
694 gst_element_set_locked_state(session->src, TRUE);
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 session->tee = gst_element_factory_make("tee", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
697 gst_bin_add(GST_BIN(session->media->priv->confbin), session->tee);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
698
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
699 /* This supposedly isn't necessary, but it silences some warnings */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
700 if (GST_ELEMENT_PARENT(session->media->priv->confbin)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
701 == GST_ELEMENT_PARENT(session->src)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
702 GstPad *pad = gst_element_get_static_pad(session->tee, "sink");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
703 GstPad *ghost = gst_ghost_pad_new(NULL, pad);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
704 gst_object_unref(pad);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
705 gst_pad_set_active(ghost, TRUE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
706 gst_element_add_pad(session->media->priv->confbin, ghost);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
707 }
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 gst_element_set_state(session->tee, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
710 gst_element_link(session->src, session->media->priv->confbin);
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 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
713 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
714 gchar *name = g_strdup_printf("volume_%s", session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
715 GstElement *level;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
716 GstElement *volume = gst_element_factory_make("volume", name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
717 double input_volume = purple_prefs_get_int(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
718 "/purple/media/audio/volume/input")/10.0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
719 g_free(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
720 name = g_strdup_printf("sendlevel_%s", session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
721 level = gst_element_factory_make("level", name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
722 g_free(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
723 gst_bin_add(GST_BIN(session->media->priv->confbin), volume);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
724 gst_bin_add(GST_BIN(session->media->priv->confbin), level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
725 gst_element_set_state(level, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
726 gst_element_set_state(volume, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
727 gst_element_link(volume, level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
728 gst_element_link(session->tee, volume);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
729 srcpad = gst_element_get_static_pad(level, "src");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
730 g_object_set(volume, "volume", input_volume, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
731 } else {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
732 srcpad = gst_element_get_request_pad(session->tee, "src%d");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
733 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
734 purple_debug_info("media", "connecting pad: %s\n",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
735 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
736 ? "success" : "failure");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
737 gst_element_set_locked_state(session->src, FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
738 gst_object_unref(session->src);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
739 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
740 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
741
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
742 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
743 GstElement *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
744 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
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 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
747 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
748 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
749 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
750 return (session != NULL) ? session->src : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
751 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
752 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
753 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
754 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
755 #endif /* USE_GSTREAMER */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
756
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
757 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
758 static gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
759 media_bus_call(GstBus *bus, GstMessage *msg, PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
760 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
761 switch(GST_MESSAGE_TYPE(msg)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
762 case GST_MESSAGE_ELEMENT: {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
763 if (g_signal_has_handler_pending(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
764 purple_media_signals[LEVEL], 0, FALSE)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
765 && gst_structure_has_name(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
766 gst_message_get_structure(msg), "level")) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
767 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
768 gchar *name;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
769 gchar *participant = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
770 PurpleMediaSession *session = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
771 gdouble rms_db;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
772 gdouble percent;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
773 const GValue *list;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
774 const GValue *value;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
775
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
776 if (!PURPLE_IS_MEDIA(media) ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
777 GST_ELEMENT_PARENT(src) !=
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
778 media->priv->confbin)
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 name = gst_element_get_name(src);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
782 if (!strncmp(name, "sendlevel_", 10)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
783 session = purple_media_get_session(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
784 media, name+10);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
785 } else {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
786 GList *iter = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
787 for (; iter; iter = g_list_next(iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
788 PurpleMediaStream *stream = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
789 if (stream->level == src) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
790 session = stream->session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
791 participant = stream->participant;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
792 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
793 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
794 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
795 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
796 g_free(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
797 if (!session)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
798 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
799
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
800 list = gst_structure_get_value(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
801 gst_message_get_structure(msg), "rms");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
802 value = gst_value_list_get_value(list, 0);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
803 rms_db = g_value_get_double(value);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
804 percent = pow(10, rms_db / 20) * 5;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
805 if(percent > 1.0)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
806 percent = 1.0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
807
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
808 g_signal_emit(media, purple_media_signals[LEVEL],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
809 0, session->id, participant, percent);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
810 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
811 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
812 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
813 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
814 default:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
815 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
816 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
817
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
818 return TRUE;
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 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
821
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
822 PurpleAccount *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
823 purple_media_get_account(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
824 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
825 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
826 PurpleAccount *account;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
827 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
828 g_object_get(G_OBJECT(media), "account", &account, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
829 return account;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
830 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
831 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
832 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
833 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
834
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
835 gpointer
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
836 purple_media_get_prpl_data(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
837 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
838 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
839 gpointer prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
840 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
841 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
842 return prpl_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
843 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
844 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
845 #endif
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
848 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
849 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
850 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
851 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
852 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
853 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
854 #endif
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
857 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
858 purple_media_error(PurpleMedia *media, const gchar *error, ...)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
859 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
860 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
861 va_list args;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
862 gchar *message;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
863
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
864 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
865
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
866 va_start(args, error);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
867 message = g_strdup_vprintf(error, args);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
868 va_end(args);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
869
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
870 purple_debug_error("media", "%s\n", message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
871 g_signal_emit(media, purple_media_signals[S_ERROR], 0, message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
872
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
873 g_free(message);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
874 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
875 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
876
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
877 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
878 purple_media_end(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
879 const gchar *session_id, const gchar *participant)
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 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
882 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
883 if (session_id == NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
884 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
885 0, PURPLE_MEDIA_STATE_END,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
886 NULL, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
887 g_object_unref(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
888 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
889 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
890 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
891
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
892 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
893 purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
894 const gchar *session_id, const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
895 gboolean local)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
896 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
897 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
898 g_return_if_fail(PURPLE_IS_MEDIA(media));
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 if (type == PURPLE_MEDIA_INFO_ACCEPT) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
901 GList *streams;
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
905 streams = purple_media_get_streams(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
906 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
907
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
908 for (; streams; streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
909 g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
910 PurpleMediaStream *stream = streams->data;
29576
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29575
diff changeset
911
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
912 stream->accepted = TRUE;
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 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
915 type == PURPLE_MEDIA_INFO_UNMUTE)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
916 GList *sessions;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
917 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
918
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
919 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
920
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
921 if (session_id == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
922 sessions = g_hash_table_get_values(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
923 media->priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
924 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
925 sessions = g_list_prepend(NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
926 purple_media_get_session(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
927 media, session_id));
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 purple_debug_info("media", "Turning mute %s\n",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
930 active ? "on" : "off");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
931
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
932 for (; sessions; sessions = g_list_delete_link(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
933 sessions, sessions)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
934 PurpleMediaSession *session = sessions->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
935 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
936 gchar *name = g_strdup_printf("volume_%s",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
937 session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
938 GstElement *volume = gst_bin_get_by_name(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
939 GST_BIN(session->media->
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
940 priv->confbin), name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
941 g_free(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
942 g_object_set(volume, "mute", active, NULL);
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 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
945 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
946 type == PURPLE_MEDIA_INFO_UNPAUSE)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
947 gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
948 GList *streams = purple_media_get_streams(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
949 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
950 for (; streams; streams = g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
951 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
952 if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
953 g_object_set(stream->stream, "direction",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
954 purple_media_to_fs_stream_direction(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
955 stream->session->type & ((active) ?
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
956 ~PURPLE_MEDIA_SEND_VIDEO :
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
957 PURPLE_MEDIA_VIDEO)), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
958 }
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 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
961
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
962 g_signal_emit(media, purple_media_signals[STREAM_INFO],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
963 0, type, session_id, participant, local);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
964
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
965 if (type == PURPLE_MEDIA_INFO_HANGUP ||
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
966 type == PURPLE_MEDIA_INFO_REJECT) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
967 purple_media_end(media, session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
968 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
969 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
970 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
971
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
972 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
973 static void
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
974 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
975 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
976 PurpleMediaCandidate *candidate, PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
977 {
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
978 PurpleMediaSession *session =
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
979 purple_media_get_session(media, sess_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
980
29554
2460e6774e08 Move handling Farsight 2's new-local-candidate signal in Fs2 media backend.
maiku@pidgin.im
parents: 29553
diff changeset
981 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
982 purple_media_candidate_copy(candidate));
29534
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 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
985 0, session->id, participant, candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
986 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
987
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
988 static void
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
989 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
990 const gchar *sess_id, const gchar *name, PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
991 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
992 PurpleMediaStream *stream_data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
993
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
994 g_return_if_fail(PURPLE_IS_MEDIA(media));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
995
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
996 stream_data = purple_media_get_stream(media, sess_id, name);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
997 stream_data->candidates_prepared = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
998
29557
1fdc75c94c22 Move Farsight 2's local-candidates-prepared signal to the Fs2 media backend.
maiku@pidgin.im
parents: 29556
diff changeset
999 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
1000 0, sess_id, name);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1001 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1002
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1003 /* callback called when a pair of transport candidates (local and remote)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1004 * has been established */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1005 static void
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1006 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
1007 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
1008 PurpleMediaCandidate *local_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1009 PurpleMediaCandidate *remote_candidate,
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1010 PurpleMedia *media)
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1011 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1012 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1013 GList *iter;
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1014 guint id;
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1015
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1016 g_return_if_fail(PURPLE_IS_MEDIA(media));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1017
29556
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1018 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
1019 id = purple_media_candidate_get_component_id(local_candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1020
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1021 iter = stream->active_local_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1022 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
1023 PurpleMediaCandidate *c = iter->data;
7713312c4ab0 Store active_local_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29560
diff changeset
1024 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
1025 g_object_unref(c);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1026 stream->active_local_candidates =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1027 g_list_delete_link(iter, iter);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1028 stream->active_local_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1029 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
1030 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
1031 local_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1032 break;
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 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1035 if (iter == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1036 stream->active_local_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1037 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
1038 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
1039 local_candidate));
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1040
74e75fc3481e Move Farsight 2's new-active-candidate-pair into the Fs2 media backend.
maiku@pidgin.im
parents: 29555
diff changeset
1041 id = purple_media_candidate_get_component_id(local_candidate);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1042
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1043 iter = stream->active_remote_candidates;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1044 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
1045 PurpleMediaCandidate *c = iter->data;
1156bf88b4d3 Store active_remote_candidates in PurpleMedia as a GList of PurpleMediaCandidate's.
maiku@pidgin.im
parents: 29561
diff changeset
1046 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
1047 g_object_unref(c);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1048 stream->active_remote_candidates =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1049 g_list_delete_link(iter, iter);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1050 stream->active_remote_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1051 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
1052 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
1053 remote_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1054 break;
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 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1057 if (iter == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1058 stream->active_remote_candidates = g_list_prepend(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1059 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
1060 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
1061 remote_candidate));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1062
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1063 purple_debug_info("media", "candidate pair established\n");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1064 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1065
29555
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
1066 static void
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
1067 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
1068 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
1069 {
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
1070 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
1071 }
cc978a1a4bd1 Move handling Farsight 2's codecs-changed signal into the Fs2 media backend.
maiku@pidgin.im
parents: 29554
diff changeset
1072
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1073 static gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1074 purple_media_connected_cb(PurpleMediaStream *stream)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1075 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1076 g_return_val_if_fail(stream != NULL, FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1077
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1078 stream->connected_cb_id = 0;
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 purple_media_manager_create_output_window(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1081 stream->session->media->priv->manager,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1082 stream->session->media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1083 stream->session->id, stream->participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1084
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1085 g_signal_emit(stream->session->media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1086 purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1087 0, PURPLE_MEDIA_STATE_CONNECTED,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1088 stream->session->id, stream->participant);
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 }
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 static void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1093 purple_media_src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1094 FsCodec *codec, PurpleMediaStream *stream)
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 PurpleMediaPrivate *priv;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1097 GstPad *sinkpad;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1098
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1099 g_return_if_fail(FS_IS_STREAM(fsstream));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1100 g_return_if_fail(stream != NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1101
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1102 priv = stream->session->media->priv;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1103
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1104 if (stream->src == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1105 GstElement *sink = NULL;
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 if (codec->media_type == FS_MEDIA_TYPE_AUDIO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1108 GstElement *queue = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1109 double output_volume = purple_prefs_get_int(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1110 "/purple/media/audio/volume/output")/10.0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1111 /*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1112 * Should this instead be:
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1113 * audioconvert ! audioresample ! liveadder !
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1114 * audioresample ! audioconvert ! realsink
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1115 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1116 queue = gst_element_factory_make("queue", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1117 stream->volume = gst_element_factory_make(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1118 "volume", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1119 g_object_set(stream->volume, "volume",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1120 output_volume, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1121 stream->level = gst_element_factory_make(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1122 "level", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1123 stream->src = gst_element_factory_make(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1124 "liveadder", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1125 sink = purple_media_manager_get_element(priv->manager,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1126 PURPLE_MEDIA_RECV_AUDIO,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1127 stream->session->media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1128 stream->session->id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1129 stream->participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1130 gst_bin_add(GST_BIN(priv->confbin), queue);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1131 gst_bin_add(GST_BIN(priv->confbin), stream->volume);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1132 gst_bin_add(GST_BIN(priv->confbin), stream->level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1133 gst_bin_add(GST_BIN(priv->confbin), sink);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1134 gst_element_set_state(sink, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1135 gst_element_set_state(stream->level, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1136 gst_element_set_state(stream->volume, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1137 gst_element_set_state(queue, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1138 gst_element_link(stream->level, sink);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1139 gst_element_link(stream->volume, stream->level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1140 gst_element_link(queue, stream->volume);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1141 sink = queue;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1142 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1143 stream->src = gst_element_factory_make(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1144 "fsfunnel", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1145 sink = gst_element_factory_make(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1146 "fakesink", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1147 g_object_set(G_OBJECT(sink), "async", FALSE, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1148 gst_bin_add(GST_BIN(priv->confbin), sink);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1149 gst_element_set_state(sink, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1150 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1151 stream->tee = gst_element_factory_make("tee", NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1152 gst_bin_add_many(GST_BIN(priv->confbin),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1153 stream->src, stream->tee, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1154 gst_element_set_state(stream->tee, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1155 gst_element_set_state(stream->src, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1156 gst_element_link_many(stream->src, stream->tee, sink, NULL);
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
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1159 sinkpad = gst_element_get_request_pad(stream->src, "sink%d");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1160 gst_pad_link(srcpad, sinkpad);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1161 gst_object_unref(sinkpad);
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 stream->connected_cb_id = purple_timeout_add(0,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1164 (GSourceFunc)purple_media_connected_cb, stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1165 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1166 #endif /* USE_VV */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1167
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1168 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1169 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1170 const gchar *who, PurpleMediaSessionType type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1171 gboolean initiator, const gchar *transmitter,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1172 guint num_params, GParameter *params)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1173 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1174 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1175 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1176 FsParticipant *participant = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1177 PurpleMediaStream *stream = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1178 FsMediaType media_type = purple_media_to_fs_media_type(type);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1179 FsStreamDirection type_direction =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1180 purple_media_to_fs_stream_direction(type);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1181
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1182 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1183
29551
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1184 if (media->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
1185 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1186 purple_media_manager_get_pipeline(
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1187 purple_media_manager_get())));
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1188 media->priv->gst_bus_handler_id =
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1189 g_signal_connect(G_OBJECT(bus), "message",
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1190 G_CALLBACK(media_bus_call), media);
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1191 gst_object_unref(bus);
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1192 }
e85df0170905 Decouple the media_bus_call from the backend. It will still be needed even
maiku@pidgin.im
parents: 29550
diff changeset
1193
29549
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1194 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
1195 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
1196 num_params, params)) {
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1197 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
1198 return FALSE;
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1199 }
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1200
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1201 /* XXX: Temporary call while integrating with backend */
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1202 if (media->priv->conference == NULL) {
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1203 media->priv->conference =
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1204 purple_media_backend_fs2_get_conference(
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1205 PURPLE_MEDIA_BACKEND_FS2(
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1206 media->priv->backend));
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1207 media->priv->confbin = GST_ELEMENT_PARENT(
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1208 media->priv->conference);
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1209 }
41ae97b7e97e Start to use the media backend code in PurpleMedia and PurpleMediaManager.
maiku@pidgin.im
parents: 29545
diff changeset
1210
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1211 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1212
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1213 if (!session) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1214 PurpleMediaSessionType session_type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1215 GstElement *src = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1216
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1217 session = g_new0(PurpleMediaSession, 1);
29553
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29552
diff changeset
1218 session->session = purple_media_backend_fs2_get_session(
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29552
diff changeset
1219 PURPLE_MEDIA_BACKEND_FS2(media->priv->backend),
efeb21092ed2 Begin transferring FsSession over to the Farsight 2 media backend.
maiku@pidgin.im
parents: 29552
diff changeset
1220 sess_id);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1221 session->id = g_strdup(sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1222 session->media = media;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1223 session->type = type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1224 session->initiator = initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1225
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1226 purple_media_add_session(media, session);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1227 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1228 0, PURPLE_MEDIA_STATE_NEW,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1229 session->id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1230
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1231 if (type_direction & FS_DIRECTION_SEND) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1232 session_type = purple_media_from_fs(media_type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1233 FS_DIRECTION_SEND);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1234 src = purple_media_manager_get_element(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1235 media->priv->manager, session_type,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1236 media, session->id, who);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1237 if (!GST_IS_ELEMENT(src)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1238 purple_debug_error("media",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1239 "Error creating src for session %s\n",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1240 session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1241 purple_media_end(media, session->id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1242 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1243 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1244
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1245 purple_media_set_src(media, session->id, src);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1246 gst_element_set_state(session->src, GST_STATE_PLAYING);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1247 purple_media_manager_create_output_window(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1248 media->priv->manager,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1249 session->media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1250 session->id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1251 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1252 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1253
29565
eef5ec04a5bf Remove the list of participants from PurpleMedia and use the Fs2 backend's.
maiku@pidgin.im
parents: 29562
diff changeset
1254 participant = purple_media_backend_fs2_get_participant(
eef5ec04a5bf Remove the list of participants from PurpleMedia and use the Fs2 backend's.
maiku@pidgin.im
parents: 29562
diff changeset
1255 PURPLE_MEDIA_BACKEND_FS2(media->priv->backend), who);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1256
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1257 stream = purple_media_get_stream(media, sess_id, who);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1258
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1259 if (!stream) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1260 FsStream *fsstream = NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1261
29566
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29565
diff changeset
1262 fsstream = purple_media_backend_fs2_get_stream(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29565
diff changeset
1263 PURPLE_MEDIA_BACKEND_FS2(
f600903f7811 Transfer creating Farsight 2 streams to the Fs2 media backend.
maiku@pidgin.im
parents: 29565
diff changeset
1264 media->priv->backend), sess_id, who);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1265
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1266 stream = purple_media_insert_stream(session, who, fsstream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1267 stream->initiator = initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1268
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1269 /* callback for source pad added (new stream source ready) */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1270 g_signal_connect(G_OBJECT(fsstream),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1271 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), stream);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1272
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1273 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1274 0, PURPLE_MEDIA_STATE_NEW,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1275 session->id, who);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1276 } else {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1277 if (purple_media_to_fs_stream_direction(stream->session->type)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1278 != type_direction) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1279 /* change direction */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1280 g_object_set(stream->stream, "direction",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1281 type_direction, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1282 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1283 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1284
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1285 return TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1286 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1287 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1288 #endif /* USE_VV */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1289 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1290
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1291 PurpleMediaManager *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1292 purple_media_get_manager(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1293 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1294 PurpleMediaManager *ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1295 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1296 g_object_get(media, "manager", &ret, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1297 return ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1298 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1299
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1300 PurpleMediaSessionType
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1301 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1302 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1303 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1304 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1305 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
1306 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1307 return session->type;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1308 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1309 return PURPLE_MEDIA_NONE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1310 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1311 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1312 /* 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
1313 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1314 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1315 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1316 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1317 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1318
29569
9c1810122f21 Transfer get_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29568
diff changeset
1319 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
1320 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1321 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1322 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1323 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1324
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1325 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1326 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1327 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1328 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1329 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1330 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
1331
f0966e90ec44 Move get_local_candidates functionality over to the Fs2 media backend.
maiku@pidgin.im
parents: 29569
diff changeset
1332 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
1333 sess_id, participant);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1334 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1335 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1336 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1337 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1338
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1339 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1340 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1341 const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1342 GList *remote_candidates)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1343 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1344 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1345 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1346
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1347 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1348 stream = purple_media_get_stream(media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1349
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1350 if (stream == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1351 purple_debug_error("media",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1352 "purple_media_add_remote_candidates: "
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1353 "couldn't find stream %s %s.\n",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1354 sess_id ? sess_id : "(null)",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1355 participant ? participant : "(null)");
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1356 return;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1357 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1358
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1359 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
1360 purple_media_candidate_list_copy(remote_candidates));
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1361
29576
a27e41f373db Handle part of accepting a stream in the Fs2 media backend.
maiku@pidgin.im
parents: 29575
diff changeset
1362 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
1363 sess_id, participant, remote_candidates);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1364 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1365 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1366
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1367 #if 0
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1368 /*
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1369 * 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
1370 * until they are needed. If they ever are.
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1371 */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1372
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1373 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1374 purple_media_get_active_local_candidates(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1375 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1376 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1377 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1378 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1379 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1380 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
1381 return purple_media_candidate_list_copy(
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1382 stream->active_local_candidates);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1383 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1384 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1385 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1386 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1387
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1388 GList *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1389 purple_media_get_active_remote_candidates(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1390 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1391 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1392 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1393 PurpleMediaStream *stream;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1394 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1395 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
1396 return purple_media_candidate_list_copy(
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1397 stream->active_remote_candidates);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1398 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1399 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1400 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1401 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1402 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1403
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1404 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1405 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1406 const gchar *participant, GList *codecs)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1407 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1408 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1409 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1410
29573
a39696686dd6 Move set_remote_codecs functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29571
diff changeset
1411 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
1412 sess_id, participant, codecs);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1413 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1414 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1415 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1416 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1417
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1418 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1419 purple_media_candidates_prepared(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1420 const gchar *session_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1421 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1422 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1423 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1424 gboolean prepared = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1425
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1426 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1427
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1428 streams = purple_media_get_streams(media, session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1429
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1430 for (; streams; streams = g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1431 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1432 if (stream->candidates_prepared == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1433 g_list_free(streams);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1434 prepared = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1435 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1436 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1437 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1438
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1439 return prepared;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1440 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1441 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1442 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1443 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1444
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1445 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1446 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
1447 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1448 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1449 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1450
29575
ec5ed142f551 Move set_remote_codec functionality to the Fs2 media backend.
maiku@pidgin.im
parents: 29573
diff changeset
1451 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
1452 media->priv->backend, sess_id, codec);
29534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1453 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1454 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1455 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1456 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1457
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1458 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1459 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1460 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1461 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1462 gboolean ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1463
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1464 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1465
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1466 if (sess_id != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1467 PurpleMediaSession *session;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1468 session = purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1469
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1470 if (session == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1471 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1472 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1473 PURPLE_MEDIA_SEND_VIDEO))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1474 g_object_get(session->session,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1475 "codecs-ready", &ret, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1476 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1477 ret = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1478 } else {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1479 GList *values = g_hash_table_get_values(media->priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1480 for (; values; values = g_list_delete_link(values, values)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1481 PurpleMediaSession *session = values->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1482 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1483 PURPLE_MEDIA_SEND_VIDEO))
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1484 g_object_get(session->session,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1485 "codecs-ready", &ret, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1486 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1487 ret = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1488
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1489 if (ret == FALSE)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1490 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1491 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1492 if (values != NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1493 g_list_free(values);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1494 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1495 return ret;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1496 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1497 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1498 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1499 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1500
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1501 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1502 purple_media_is_initiator(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1503 const gchar *sess_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1504 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1505 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1506 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1507
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1508 if (sess_id == NULL && participant == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1509 return media->priv->initiator;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1510 else if (sess_id != NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1511 PurpleMediaSession *session =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1512 purple_media_get_session(media, sess_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1513 return session != NULL ? session->initiator : FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1514 } else if (sess_id != NULL && participant != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1515 PurpleMediaStream *stream = purple_media_get_stream(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1516 media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1517 return stream != NULL ? stream->initiator : FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1518 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1519 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1520 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1521 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1522
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1523 gboolean
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1524 purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1525 const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1526 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1527 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1528 gboolean accepted = TRUE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1529
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1530 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1531
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1532 if (sess_id == NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1533 GList *streams = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1534
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1535 for (; streams; streams = g_list_next(streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1536 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1537 if (stream->accepted == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1538 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1539 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1540 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1541 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1542 } else if (sess_id != NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1543 GList *streams = purple_media_get_streams(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1544 media, sess_id, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1545 for (; streams; streams =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1546 g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1547 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1548 if (stream->accepted == FALSE) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1549 g_list_free(streams);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1550 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1551 break;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1552 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1553 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1554 } else if (sess_id != NULL && participant != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1555 PurpleMediaStream *stream = purple_media_get_stream(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1556 media, sess_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1557 if (stream == NULL || stream->accepted == FALSE)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1558 accepted = FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1559 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1560
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1561 return accepted;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1562 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1563 return FALSE;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1564 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1565 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1566
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1567 void purple_media_set_input_volume(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1568 const gchar *session_id, double level)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1569 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1570 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1571 GList *sessions;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1572
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1573 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1574
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1575 purple_prefs_set_int("/purple/media/audio/volume/input", level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1576
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1577 if (session_id == NULL)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1578 sessions = g_hash_table_get_values(media->priv->sessions);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1579 else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1580 sessions = g_list_append(NULL,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1581 purple_media_get_session(media, session_id));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1582
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1583 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1584 PurpleMediaSession *session = sessions->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1585
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1586 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1587 gchar *name = g_strdup_printf("volume_%s",
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1588 session->id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1589 GstElement *volume = gst_bin_get_by_name(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1590 GST_BIN(session->media->priv->confbin),
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1591 name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1592 g_free(name);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1593 g_object_set(volume, "volume", level/10.0, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1594 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1595 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1596 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1597 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1598
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1599 void purple_media_set_output_volume(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1600 const gchar *session_id, const gchar *participant,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1601 double level)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1602 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1603 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1604 GList *streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1605
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1606 g_return_if_fail(PURPLE_IS_MEDIA(media));
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1607
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1608 purple_prefs_set_int("/purple/media/audio/volume/output", level);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1609
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1610 streams = purple_media_get_streams(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1611 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1612
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1613 for (; streams; streams = g_list_delete_link(streams, streams)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1614 PurpleMediaStream *stream = streams->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1615
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1616 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1617 && GST_IS_ELEMENT(stream->volume)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1618 g_object_set(stream->volume, "volume", level/10.0, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1619 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1620 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1621 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1622 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1623
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1624 gulong
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1625 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1626 const gchar *participant, gulong window_id)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1627 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1628 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1629 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1630
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1631 return purple_media_manager_set_output_window(media->priv->manager,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1632 media, session_id, participant, window_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1633 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1634 return 0;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1635 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1636 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1637
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1638 void
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1639 purple_media_remove_output_windows(PurpleMedia *media)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1640 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1641 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1642 GList *iter = media->priv->streams;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1643 for (; iter; iter = g_list_next(iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1644 PurpleMediaStream *stream = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1645 purple_media_manager_remove_output_windows(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1646 media->priv->manager, media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1647 stream->session->id, stream->participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1648 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1649
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1650 iter = purple_media_get_session_ids(media);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1651 for (; iter; iter = g_list_delete_link(iter, iter)) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1652 gchar *session_name = iter->data;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1653 purple_media_manager_remove_output_windows(
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1654 media->priv->manager, media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1655 session_name, NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1656 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1657 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1658 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1659
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1660 #ifdef USE_GSTREAMER
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1661 GstElement *
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1662 purple_media_get_tee(PurpleMedia *media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1663 const gchar *session_id, const gchar *participant)
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1664 {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1665 #ifdef USE_VV
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1666 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1667
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1668 if (session_id != NULL && participant == NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1669 PurpleMediaSession *session =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1670 purple_media_get_session(media, session_id);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1671 return (session != NULL) ? session->tee : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1672 } else if (session_id != NULL && participant != NULL) {
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1673 PurpleMediaStream *stream =
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1674 purple_media_get_stream(media,
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1675 session_id, participant);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1676 return (stream != NULL) ? stream->tee : NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1677 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1678 g_return_val_if_reached(NULL);
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1679 #else
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1680 return NULL;
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1681 #endif
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1682 }
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1683 #endif /* USE_GSTREAMER */
fb2c0674e828 Move media.c into libpurple/media/.
maiku@pidgin.im
parents:
diff changeset
1684