annotate libpurple/media.c @ 30530:2e26b90a28dd

Now it compiles again...
author Marcus Lundblad <ml@update.uu.se>
date Wed, 01 Sep 2010 21:23:55 +0000
parents 356a8d472395
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
2 * @file media.c Media API
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup core
23865
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23863
diff changeset
4 */
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23863
diff changeset
5
b8a73b6dc0a4 * Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23863
diff changeset
6 /* purple
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * source distribution.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
28047
8c991e09efcb Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents: 27885
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 */
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
26 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
27
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
28 #include "account.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "media.h"
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
30 #include "media/backend-iface.h"
23876
f10e0ac24595 * Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23873
diff changeset
31 #include "mediamanager.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
33 #include "debug.h"
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
34
26546
e7861a7978dc Fix build with --disable-vv --enable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26539
diff changeset
35 #ifdef USE_GSTREAMER
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
36 #include "media/backend-fs2.h"
26563
75b473f216f2 Include the media API on win32 even though it isn't actually enabled.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 26546
diff changeset
37 #include "marshallers.h"
26546
e7861a7978dc Fix build with --disable-vv --enable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26539
diff changeset
38 #include "media-gst.h"
e7861a7978dc Fix build with --disable-vv --enable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26539
diff changeset
39 #endif
e7861a7978dc Fix build with --disable-vv --enable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26539
diff changeset
40
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
41 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
43 /** @copydoc _PurpleMediaSession */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
44 typedef struct _PurpleMediaSession PurpleMediaSession;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
45 /** @copydoc _PurpleMediaStream */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
46 typedef struct _PurpleMediaStream PurpleMediaStream;
26407
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
47 /** @copydoc _PurpleMediaClass */
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
48 typedef struct _PurpleMediaClass PurpleMediaClass;
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
49 /** @copydoc _PurpleMediaPrivate */
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
50 typedef struct _PurpleMediaPrivate PurpleMediaPrivate;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
51
26399
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
52 /** The media class */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
53 struct _PurpleMediaClass
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
54 {
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
55 GObjectClass parent_class; /**< The parent class. */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
56 };
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
57
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
58 /** The media class's private data */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
59 struct _PurpleMedia
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
60 {
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
61 GObject parent; /**< The parent of this object. */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
62 PurpleMediaPrivate *priv; /**< The private data of this object. */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
63 };
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
64
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
65 struct _PurpleMediaSession
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
66 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
67 gchar *id;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
68 PurpleMedia *media;
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
69 PurpleMediaSessionType type;
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
70 gboolean initiator;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
71 };
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
72
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
73 struct _PurpleMediaStream
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
74 {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
75 PurpleMediaSession *session;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
76 gchar *participant;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
77
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
78 GList *local_candidates;
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
79 GList *remote_candidates;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
80
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
81 gboolean initiator;
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
82 gboolean accepted;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
83 gboolean candidates_prepared;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
84
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
85 GList *active_local_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
86 GList *active_remote_candidates;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
87 };
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
88 #endif
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
89
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 struct _PurpleMediaPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
92 #ifdef USE_VV
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
93 PurpleMediaManager *manager;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
94 PurpleAccount *account;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
95 PurpleMediaBackend *backend;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
96 gchar *conference_type;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
97 gboolean initiator;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
98 gpointer prpl_data;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
100 GHashTable *sessions; /* PurpleMediaSession table */
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
101 GList *participants;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
102 GList *streams; /* PurpleMediaStream table */
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
103 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
104 gpointer dummy;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
105 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
108 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 static void purple_media_class_init (PurpleMediaClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 static void purple_media_init (PurpleMedia *media);
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
113 static void purple_media_dispose (GObject *object);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 static void purple_media_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 static void purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 static void purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
118 static void purple_media_new_local_candidate_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
119 const gchar *sess_id, const gchar *participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
120 PurpleMediaCandidate *candidate, PurpleMedia *media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
121 static void purple_media_candidates_prepared_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
122 const gchar *sess_id, const gchar *name, PurpleMedia *media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
123 static void purple_media_candidate_pair_established_cb(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
124 PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
125 const gchar *sess_id, const gchar *name,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
126 PurpleMediaCandidate *local_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
127 PurpleMediaCandidate *remote_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
128 PurpleMedia *media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
129 static void purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
130 const gchar *sess_id, PurpleMedia *media);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
131
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 enum {
27709
60aab59fb35a Make media.c compilable on Windows following guidance from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 26999
diff changeset
137 S_ERROR,
26298
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
138 CANDIDATES_PREPARED,
26059
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
139 CODECS_CHANGED,
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
140 LEVEL,
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
141 NEW_CANDIDATE,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
142 STATE_CHANGED,
26320
8b4394e84633 Add stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26319
diff changeset
143 STREAM_INFO,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 static guint purple_media_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 PROP_0,
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
150 PROP_MANAGER,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
151 PROP_BACKEND,
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
152 PROP_ACCOUNT,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 PROP_CONFERENCE_TYPE,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
154 PROP_INITIATOR,
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
155 PROP_PRPL_DATA,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 };
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
157 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
159
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 purple_media_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
163 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 sizeof(PurpleMediaClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 (GClassInitFunc) purple_media_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 sizeof(PurpleMedia),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
176 (GInstanceInitFunc) purple_media_init,
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
177 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 return type;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
182 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
183 return G_TYPE_NONE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
184 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
187 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 purple_media_class_init (PurpleMediaClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
194 gobject_class->dispose = purple_media_dispose;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 gobject_class->finalize = purple_media_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 gobject_class->set_property = purple_media_set_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 gobject_class->get_property = purple_media_get_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
199 g_object_class_install_property(gobject_class, PROP_MANAGER,
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
200 g_param_spec_object("manager",
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
201 "Purple Media Manager",
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
202 "The media manager that contains this media session.",
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
203 PURPLE_TYPE_MEDIA_MANAGER,
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
204 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
205
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
206 /*
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
207 * This one should be PURPLE_TYPE_MEDIA_BACKEND, but it doesn't
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
208 * like interfaces because they "aren't GObjects"
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
209 */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
210 g_object_class_install_property(gobject_class, PROP_BACKEND,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
211 g_param_spec_object("backend",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212 "Purple Media Backend",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
213 "The backend object this media object uses.",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
214 G_TYPE_OBJECT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
215 G_PARAM_READABLE));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
216
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
217 g_object_class_install_property(gobject_class, PROP_ACCOUNT,
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
218 g_param_spec_pointer("account",
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
219 "PurpleAccount",
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
220 "The account this media session is on.",
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
221 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
222
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
223 g_object_class_install_property(gobject_class, PROP_CONFERENCE_TYPE,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
224 g_param_spec_string("conference-type",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
225 "Conference Type",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
226 "The type of conference that this media object "
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
227 "has been created to provide.",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
228 NULL,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
229 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
231 g_object_class_install_property(gobject_class, PROP_INITIATOR,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
232 g_param_spec_boolean("initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
233 "initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
234 "If the local user initiated the conference.",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
235 FALSE,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
236 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
237
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
238 g_object_class_install_property(gobject_class, PROP_PRPL_DATA,
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
239 g_param_spec_pointer("prpl-data",
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
240 "gpointer",
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
241 "Data the prpl plugin set on the media session.",
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
242 G_PARAM_READWRITE));
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
243
27709
60aab59fb35a Make media.c compilable on Windows following guidance from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 26999
diff changeset
244 purple_media_signals[S_ERROR] = g_signal_new("error", G_TYPE_FROM_CLASS(klass),
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
245 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
246 g_cclosure_marshal_VOID__STRING,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
247 G_TYPE_NONE, 1, G_TYPE_STRING);
26298
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
248 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
249 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
250 purple_smarshal_VOID__STRING_STRING,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
251 G_TYPE_NONE, 2, G_TYPE_STRING,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
252 G_TYPE_STRING);
26059
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
253 purple_media_signals[CODECS_CHANGED] = g_signal_new("codecs-changed", G_TYPE_FROM_CLASS(klass),
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
254 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
255 g_cclosure_marshal_VOID__STRING,
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
256 G_TYPE_NONE, 1, G_TYPE_STRING);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
257 purple_media_signals[LEVEL] = g_signal_new("level", G_TYPE_FROM_CLASS(klass),
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
258 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
259 purple_smarshal_VOID__STRING_STRING_DOUBLE,
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
260 G_TYPE_NONE, 3, G_TYPE_STRING,
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
261 G_TYPE_STRING, G_TYPE_DOUBLE);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
262 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
263 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
264 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
265 G_TYPE_NONE, 3, G_TYPE_POINTER,
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
266 G_TYPE_POINTER, PURPLE_TYPE_MEDIA_CANDIDATE);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
267 purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass),
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
268 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
269 purple_smarshal_VOID__ENUM_STRING_STRING,
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
270 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
271 G_TYPE_STRING, G_TYPE_STRING);
26320
8b4394e84633 Add stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26319
diff changeset
272 purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass),
8b4394e84633 Add stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26319
diff changeset
273 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
274 purple_smarshal_VOID__ENUM_STRING_STRING_BOOLEAN,
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
275 G_TYPE_NONE, 4, PURPLE_MEDIA_TYPE_INFO_TYPE,
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
276 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
277 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
280
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 purple_media_init (PurpleMedia *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
26286
d8a7c7d9ac8a Zero out the proper size for the PurpleMediaPrivate structure.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26134
diff changeset
285 memset(media->priv, 0, sizeof(*media->priv));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 static void
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
289 purple_media_stream_free(PurpleMediaStream *stream)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
290 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
291 if (stream == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
292 return;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
293
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
294 g_free(stream->participant);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
295
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
296 if (stream->local_candidates)
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
297 purple_media_candidate_list_free(stream->local_candidates);
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
298 if (stream->remote_candidates)
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
299 purple_media_candidate_list_free(stream->remote_candidates);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
300
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
301 if (stream->active_local_candidates)
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
302 purple_media_candidate_list_free(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
303 stream->active_local_candidates);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
304 if (stream->active_remote_candidates)
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
305 purple_media_candidate_list_free(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306 stream->active_remote_candidates);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
307
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
308 g_free(stream);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
309 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
310
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
311 static void
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
312 purple_media_session_free(PurpleMediaSession *session)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
313 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
314 if (session == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
315 return;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
316
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
317 g_free(session->id);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
318 g_free(session);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
319 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
320
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
321 static void
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
322 purple_media_dispose(GObject *media)
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
323 {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
324 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
325
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
326 purple_debug_info("media","purple_media_dispose\n");
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
327
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
328 purple_media_manager_remove_media(priv->manager, PURPLE_MEDIA(media));
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
329
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
330 if (priv->backend) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
331 g_object_unref(priv->backend);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
332 priv->backend = NULL;
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
333 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
334
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
335 if (priv->manager) {
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
336 g_object_unref(priv->manager);
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
337 priv->manager = NULL;
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
338 }
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
339
26292
327102f2ce64 Fix copy/paste-o.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26286
diff changeset
340 G_OBJECT_CLASS(parent_class)->dispose(media);
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
341 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
342
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
343 static void
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
344 purple_media_finalize(GObject *media)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 {
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
346 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
347 purple_debug_info("media","purple_media_finalize\n");
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
348
24981
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
349 for (; priv->streams; priv->streams = g_list_delete_link(priv->streams, priv->streams))
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
350 purple_media_stream_free(priv->streams->data);
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
351
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
352 for (; priv->participants; priv->participants = g_list_delete_link(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
353 priv->participants, priv->participants))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
354 g_free(priv->participants->data);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
355
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
356 if (priv->sessions) {
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
357 GList *sessions = g_hash_table_get_values(priv->sessions);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
358 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
359 purple_media_session_free(sessions->data);
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23852
diff changeset
360 }
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
361 g_hash_table_destroy(priv->sessions);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
362 }
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23852
diff changeset
363
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
364 G_OBJECT_CLASS(parent_class)->finalize(media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 purple_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 g_return_if_fail(PURPLE_IS_MEDIA(object));
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
372
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
373 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 switch (prop_id) {
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
376 case PROP_MANAGER:
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
377 media->priv->manager = g_value_dup_object(value);
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
378 break;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
379 case PROP_ACCOUNT:
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
380 media->priv->account = g_value_get_pointer(value);
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
381 break;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
382 case PROP_CONFERENCE_TYPE:
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
383 media->priv->conference_type =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
384 g_value_dup_string(value);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
385 media->priv->backend = g_object_new(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
386 purple_media_manager_get_backend_type(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
387 purple_media_manager_get()),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
388 "conference-type",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
389 media->priv->conference_type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
390 "media", media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
391 NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
392 g_signal_connect(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
393 "active-candidate-pair",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
394 G_CALLBACK(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
395 purple_media_candidate_pair_established_cb),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
396 media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
397 g_signal_connect(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
398 "candidates-prepared",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
399 G_CALLBACK(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
400 purple_media_candidates_prepared_cb),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
401 media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
402 g_signal_connect(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
403 "codecs-changed",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
404 G_CALLBACK(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
405 purple_media_codecs_changed_cb),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
406 media);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
407 g_signal_connect(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
408 "new-candidate",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
409 G_CALLBACK(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
410 purple_media_new_local_candidate_cb),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
411 media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
412 break;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
413 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
414 media->priv->initiator = g_value_get_boolean(value);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
415 break;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
416 case PROP_PRPL_DATA:
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
417 media->priv->prpl_data = g_value_get_pointer(value);
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
418 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 g_return_if_fail(PURPLE_IS_MEDIA(object));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 switch (prop_id) {
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
434 case PROP_MANAGER:
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
435 g_value_set_object(value, media->priv->manager);
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
436 break;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
437 case PROP_BACKEND:
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
438 g_value_set_object(value, media->priv->backend);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
439 break;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
440 case PROP_ACCOUNT:
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
441 g_value_set_pointer(value, media->priv->account);
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
442 break;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
443 case PROP_CONFERENCE_TYPE:
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
444 g_value_set_string(value,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
445 media->priv->conference_type);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 break;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
447 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
448 g_value_set_boolean(value, media->priv->initiator);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
449 break;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
450 case PROP_PRPL_DATA:
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
451 g_value_set_pointer(value, media->priv->prpl_data);
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
452 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
460 static PurpleMediaSession*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
461 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
462 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
463 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
464 return (PurpleMediaSession*) (media->priv->sessions) ?
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
465 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
466 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
467
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
468 static PurpleMediaStream*
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
469 purple_media_get_stream(PurpleMedia *media, const gchar *session, const gchar *participant)
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
470 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
471 GList *streams;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
472
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
473 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
474
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
475 streams = media->priv->streams;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
476
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
477 for (; streams; streams = g_list_next(streams)) {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
478 PurpleMediaStream *stream = streams->data;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
479 if (!strcmp(stream->session->id, session) &&
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
480 !strcmp(stream->participant, participant))
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
481 return stream;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
482 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
483
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
484 return NULL;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
485 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
486
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
487 static GList *
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
488 purple_media_get_streams(PurpleMedia *media, const gchar *session,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
489 const gchar *participant)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
490 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
491 GList *streams;
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
492 GList *ret = NULL;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
493
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
494 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
495
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
496 streams = media->priv->streams;
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
497
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
498 for (; streams; streams = g_list_next(streams)) {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
499 PurpleMediaStream *stream = streams->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
500 if ((session == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
501 !strcmp(stream->session->id, session)) &&
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
502 (participant == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
503 !strcmp(stream->participant, participant)))
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
504 ret = g_list_append(ret, stream);
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
505 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
506
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
507 return ret;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
508 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
509
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
510 static void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
511 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
512 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
513 g_return_if_fail(PURPLE_IS_MEDIA(media));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
514 g_return_if_fail(session != NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
515
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
516 if (!media->priv->sessions) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
517 purple_debug_info("media", "Creating hash table for sessions\n");
30439
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 29353
diff changeset
518 media->priv->sessions = g_hash_table_new_full(g_str_hash, g_str_equal,
1feb2baeac2d Fix some media code leaks.
jakub.adam@ktknet.cz
parents: 29353
diff changeset
519 g_free, NULL);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
520 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
521 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
522 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
523
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
524 #if 0
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
525 static gboolean
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
526 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
527 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
528 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
529 return g_hash_table_remove(media->priv->sessions, session->id);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
530 }
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
531 #endif
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
532
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
533 static PurpleMediaStream *
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
534 purple_media_insert_stream(PurpleMediaSession *session,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
535 const gchar *name, gboolean initiator)
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
536 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
537 PurpleMediaStream *media_stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
538
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
539 g_return_val_if_fail(session != NULL, NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
540
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
541 media_stream = g_new0(PurpleMediaStream, 1);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
542 media_stream->participant = g_strdup(name);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
543 media_stream->session = session;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
544 media_stream->initiator = initiator;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
545
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
546 session->media->priv->streams =
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
547 g_list_append(session->media->priv->streams, media_stream);
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
548
30524
6d69151fa99b Merge fix.
Marcus Lundblad <ml@update.uu.se>
parents: 30523
diff changeset
549 return media_stream;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
550 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
551
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
552 static void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
553 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
554 PurpleMediaCandidate *candidate)
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
555 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
556 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
557
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
558 g_return_if_fail(session != NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
559
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
560 stream = purple_media_get_stream(session->media, session->id, name);
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
561 stream->local_candidates = g_list_append(stream->local_candidates, candidate);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
562 }
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
563 #endif
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
564
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
565 GList *
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
566 purple_media_get_session_ids(PurpleMedia *media)
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
567 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
568 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
569 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
26126
23816d2e380f Silence assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26122
diff changeset
570 return media->priv->sessions != NULL ?
23816d2e380f Silence assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26122
diff changeset
571 g_hash_table_get_keys(media->priv->sessions) : NULL;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
572 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
573 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
574 #endif
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
575 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
576
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
577 #ifdef USE_GSTREAMER
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
578 GstElement *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
579 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
580 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
581 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
582 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
583
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
584 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
585 return purple_media_backend_fs2_get_src(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
586 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
587 media->priv->backend), sess_id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
588
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
589 g_return_val_if_reached(NULL);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
590 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
591 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
592 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
593 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
594 #endif /* USE_GSTREAMER */
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
595
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
596 PurpleAccount *
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
597 purple_media_get_account(PurpleMedia *media)
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
598 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
599 #ifdef USE_VV
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
600 PurpleAccount *account;
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
601 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
602 g_object_get(G_OBJECT(media), "account", &account, NULL);
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
603 return account;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
604 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
605 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
606 #endif
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
607 }
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
608
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
609 gpointer
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
610 purple_media_get_prpl_data(PurpleMedia *media)
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
611 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
612 #ifdef USE_VV
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
613 gpointer prpl_data;
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
614 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
615 g_object_get(G_OBJECT(media), "prpl-data", &prpl_data, NULL);
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
616 return prpl_data;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
617 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
618 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
619 #endif
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
620 }
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
621
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
622 void
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
623 purple_media_set_prpl_data(PurpleMedia *media, gpointer prpl_data)
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
624 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
625 #ifdef USE_VV
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
626 g_return_if_fail(PURPLE_IS_MEDIA(media));
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
627 g_object_set(G_OBJECT(media), "prpl-data", prpl_data, NULL);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
628 #endif
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
629 }
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
630
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
631 void
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
632 purple_media_error(PurpleMedia *media, const gchar *error, ...)
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
633 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
634 #ifdef USE_VV
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
635 va_list args;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
636 gchar *message;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
637
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
638 g_return_if_fail(PURPLE_IS_MEDIA(media));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
639
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
640 va_start(args, error);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
641 message = g_strdup_vprintf(error, args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
642 va_end(args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
643
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
644 purple_debug_error("media", "%s\n", message);
27709
60aab59fb35a Make media.c compilable on Windows following guidance from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 26999
diff changeset
645 g_signal_emit(media, purple_media_signals[S_ERROR], 0, message);
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
646
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
647 g_free(message);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
648 #endif
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
649 }
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
650
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
651 void
26058
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
652 purple_media_end(PurpleMedia *media,
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
653 const gchar *session_id, const gchar *participant)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
654 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
655 #ifdef USE_VV
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
656 GList *iter, *sessions = NULL, *participants = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
657
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
658 g_return_if_fail(PURPLE_IS_MEDIA(media));
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
659
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
660 iter = purple_media_get_streams(media, session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
661
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
662 /* Free matching streams */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
663 for (; iter; iter = g_list_delete_link(iter, iter)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
664 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
665
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
666 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
667 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
668 stream->session->id, stream->participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
669
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
670 media->priv->streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
671 g_list_remove(media->priv->streams, stream);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
672
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
673 if (g_list_find(sessions, stream->session) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
674 sessions = g_list_prepend(sessions, stream->session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
675
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
676 if (g_list_find_custom(participants, stream->participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
677 (GCompareFunc)strcmp) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
678 participants = g_list_prepend(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
679 g_strdup(stream->participant));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
680
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
681 purple_media_stream_free(stream);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
682 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
683
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
684 iter = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
685
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
686 /* Reduce to list of sessions to remove */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
687 for (; iter; iter = g_list_next(iter)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
688 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
689
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
690 sessions = g_list_remove(sessions, stream->session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
691 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
692
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
693 /* Free sessions with no streams left */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
694 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
695 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
696
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
697 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
698 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
699 session->id, NULL);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
700
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
701 g_hash_table_remove(media->priv->sessions, session->id);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
702 purple_media_session_free(session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
703 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
704
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
705 iter = media->priv->streams;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
706
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
707 /* Reduce to list of participants to remove */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
708 for (; iter; iter = g_list_next(iter)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
709 PurpleMediaStream *stream = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
710 GList *tmp;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
711
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
712 tmp = g_list_find_custom(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
713 stream->participant, (GCompareFunc)strcmp);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
714
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
715 if (tmp != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
716 g_free(tmp->data);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
717 participants = g_list_delete_link(participants, tmp);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
718 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
719 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
720
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
721 /* Remove participants with no streams left (just emit the signal) */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
722 for (; participants; participants =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
723 g_list_delete_link(participants, participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
724 gchar *participant = participants->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
725 GList *link = g_list_find_custom(media->priv->participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
726 participant, (GCompareFunc)strcmp);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
727
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
728 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
729 0, PURPLE_MEDIA_STATE_END,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
730 NULL, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
731
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
732 if (link != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
733 g_free(link->data);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
734 media->priv->participants = g_list_delete_link(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
735 media->priv->participants, link);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
736 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
737
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
738 g_free(participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
739 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
740
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
741 /* Free the conference if no sessions left */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
742 if (media->priv->sessions != NULL &&
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
743 g_hash_table_size(media->priv->sessions) == 0) {
26058
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
744 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
745 0, PURPLE_MEDIA_STATE_END,
26058
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
746 NULL, NULL);
26063
685c8f5f85c7 Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26061
diff changeset
747 g_object_unref(media);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
748 return;
26063
685c8f5f85c7 Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26061
diff changeset
749 }
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
750 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
751 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
752
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
753 void
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
754 purple_media_stream_info(PurpleMedia *media, PurpleMediaInfoType type,
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
755 const gchar *session_id, const gchar *participant,
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
756 gboolean local)
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
757 {
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
758 #ifdef USE_VV
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
759 g_return_if_fail(PURPLE_IS_MEDIA(media));
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
760
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
761 if (type == PURPLE_MEDIA_INFO_ACCEPT) {
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
762 GList *streams, *sessions = NULL, *participants = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
763
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
764 g_return_if_fail(PURPLE_IS_MEDIA(media));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
765
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
766 streams = purple_media_get_streams(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
767 session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
768
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
769 /* Emit stream acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
770 for (; streams; streams =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
771 g_list_delete_link(streams, streams)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
772 PurpleMediaStream *stream = streams->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
773
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
774 stream->accepted = TRUE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
775
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
776 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
777 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
778 0, type, stream->session->id,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
779 stream->participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
780
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
781 if (g_list_find(sessions, stream->session) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
782 sessions = g_list_prepend(sessions,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
783 stream->session);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
784
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
785 if (g_list_find_custom(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
786 stream->participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
787 (GCompareFunc)strcmp) == NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
788 participants = g_list_prepend(participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
789 g_strdup(stream->participant));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
790 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
791
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
792 /* Emit session acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
793 for (; sessions; sessions =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
794 g_list_delete_link(sessions, sessions)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
795 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
796
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
797 if (purple_media_accepted(media, session->id, NULL))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
798 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
799 STREAM_INFO], 0,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
800 PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
801 session->id, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
802 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
803
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
804 /* Emit participant acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
805 for (; participants; participants = g_list_delete_link(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
806 participants, participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
807 gchar *participant = participants->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
808
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
809 if (purple_media_accepted(media, NULL, participant))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
810 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
811 STREAM_INFO], 0,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
812 PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
813 NULL, participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
814
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
815 g_free(participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
816 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
817
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
818 /* Emit conference acceptance */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
819 if (purple_media_accepted(media, NULL, NULL))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
820 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
821 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
822 0, PURPLE_MEDIA_INFO_ACCEPT,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
823 NULL, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
824
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
825 return;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
826 } else if (type == PURPLE_MEDIA_INFO_HANGUP ||
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
827 type == PURPLE_MEDIA_INFO_REJECT) {
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
828 GList *streams;
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
829
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
830 g_return_if_fail(PURPLE_IS_MEDIA(media));
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
831
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
832 streams = purple_media_get_streams(media,
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
833 session_id, participant);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
834
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
835 /* Emit for stream */
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
836 for (; streams; streams =
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
837 g_list_delete_link(streams, streams)) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
838 PurpleMediaStream *stream = streams->data;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
839
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
840 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
841 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
842 0, type, stream->session->id,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
843 stream->participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
844 }
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
845
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
846 if (session_id != NULL && participant != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
847 /* Everything that needs to be emitted has been */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
848 } else if (session_id == NULL && participant == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
849 /* Emit for everything in the conference */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
850 GList *sessions = NULL;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
851 GList *participants = media->priv->participants;
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
852
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
853 if (media->priv->sessions != NULL)
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
854 sessions = g_hash_table_get_values(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
855 media->priv->sessions);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
856
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
857 /* Emit for sessions */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
858 for (; sessions; sessions = g_list_delete_link(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
859 sessions, sessions)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
860 PurpleMediaSession *session = sessions->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
861
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
862 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
863 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
864 session->id, NULL, local);
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
865 }
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
866
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
867 /* Emit for participants */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
868 for (; participants; participants =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
869 g_list_next(participants)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
870 gchar *participant = participants->data;
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
871
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
872 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
873 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
874 NULL, participant, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
875 }
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
876
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
877 /* Emit for conference */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
878 g_signal_emit(media,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
879 purple_media_signals[STREAM_INFO],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
880 0, type, NULL, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
881 } else if (session_id != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
882 /* Emit just the specific session */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
883 PurpleMediaSession *session =
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
884 purple_media_get_session(
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
885 media, session_id);
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
886
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
887 if (session == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
888 purple_debug_warning("media",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
889 "Couldn't find session"
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
890 " to hangup/reject.\n");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
891 } else {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
892 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
893 STREAM_INFO], 0, type,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
894 session->id, NULL, local);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
895 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
896 } else if (participant != NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
897 /* Emit just the specific participant */
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
898 if (!g_list_find_custom(media->priv->participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
899 participant, (GCompareFunc)strcmp)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
900 purple_debug_warning("media",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
901 "Couldn't find participant"
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
902 " to hangup/reject.\n");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
903 } else {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
904 g_signal_emit(media, purple_media_signals[
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
905 STREAM_INFO], 0, type, NULL,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
906 participant, local);
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
907 }
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
908 }
28400
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
909
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
910 purple_media_end(media, session_id, participant);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
911 return;
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
912 }
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
913
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
914 g_signal_emit(media, purple_media_signals[STREAM_INFO],
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
915 0, type, session_id, participant, local);
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
916 #endif
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
917 }
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
918
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
919 #ifdef USE_VV
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
920 static void
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
921 purple_media_new_local_candidate_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
922 const gchar *sess_id, const gchar *participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
923 PurpleMediaCandidate *candidate, PurpleMedia *media)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
924 {
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
925 PurpleMediaSession *session =
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
926 purple_media_get_session(media, sess_id);
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
927
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
928 purple_media_insert_local_candidate(session, participant,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
929 purple_media_candidate_copy(candidate));
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
930
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
931 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
932 0, session->id, participant, candidate);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
933 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
934
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
935 static void
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
936 purple_media_candidates_prepared_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
937 const gchar *sess_id, const gchar *name, PurpleMedia *media)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
938 {
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
939 PurpleMediaStream *stream_data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
940
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
941 g_return_if_fail(PURPLE_IS_MEDIA(media));
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
942
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
943 stream_data = purple_media_get_stream(media, sess_id, name);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
944 stream_data->candidates_prepared = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
945
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
946 g_signal_emit(media, purple_media_signals[CANDIDATES_PREPARED],
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
947 0, sess_id, name);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
948 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
949
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
950 /* callback called when a pair of transport candidates (local and remote)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
951 * has been established */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
952 static void
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
953 purple_media_candidate_pair_established_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
954 const gchar *sess_id, const gchar *name,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
955 PurpleMediaCandidate *local_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
956 PurpleMediaCandidate *remote_candidate,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
957 PurpleMedia *media)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
958 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
959 PurpleMediaStream *stream;
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
960 GList *iter;
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
961 guint id;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
962
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
963 g_return_if_fail(PURPLE_IS_MEDIA(media));
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
964
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
965 stream = purple_media_get_stream(media, sess_id, name);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
966 id = purple_media_candidate_get_component_id(local_candidate);
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
967
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
968 iter = stream->active_local_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
969 for(; iter; iter = g_list_next(iter)) {
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
970 PurpleMediaCandidate *c = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
971 if (id == purple_media_candidate_get_component_id(c)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
972 g_object_unref(c);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
973 stream->active_local_candidates =
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
974 g_list_delete_link(iter, iter);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
975 stream->active_local_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
976 stream->active_local_candidates,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
977 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
978 local_candidate));
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
979 break;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
980 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
981 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
982 if (iter == NULL)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
983 stream->active_local_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
984 stream->active_local_candidates,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
985 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
986 local_candidate));
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
987
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
988 id = purple_media_candidate_get_component_id(local_candidate);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
989
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
990 iter = stream->active_remote_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
991 for(; iter; iter = g_list_next(iter)) {
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
992 PurpleMediaCandidate *c = iter->data;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
993 if (id == purple_media_candidate_get_component_id(c)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
994 g_object_unref(c);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
995 stream->active_remote_candidates =
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
996 g_list_delete_link(iter, iter);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
997 stream->active_remote_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
998 stream->active_remote_candidates,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
999 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1000 remote_candidate));
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1001 break;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1002 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1003 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1004 if (iter == NULL)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1005 stream->active_remote_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1006 stream->active_remote_candidates,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1007 purple_media_candidate_copy(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1008 remote_candidate));
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1009
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1010 purple_debug_info("media", "candidate pair established\n");
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1011 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1012
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1013 static void
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1014 purple_media_codecs_changed_cb(PurpleMediaBackend *backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1015 const gchar *sess_id, PurpleMedia *media)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1016 {
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1017 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, sess_id);
26997
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
1018 }
26385
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1019 #endif /* USE_VV */
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1020
26385
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1021 gboolean
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1022 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id,
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1023 const gchar *who, PurpleMediaSessionType type,
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1024 gboolean initiator, const gchar *transmitter,
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1025 guint num_params, GParameter *params)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1026 {
26385
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1027 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1028 PurpleMediaSession *session;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1029 PurpleMediaStream *stream = NULL;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1030
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1031 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1032
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1033 if (!purple_media_backend_add_stream(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1034 sess_id, who, type, initiator, transmitter,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1035 num_params, params)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1036 purple_debug_error("media", "Error adding stream.\n");
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1037 return FALSE;
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1038 }
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1039
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1040 session = purple_media_get_session(media, sess_id);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1041
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1042 if (!session) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1043 session = g_new0(PurpleMediaSession, 1);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1044 session->id = g_strdup(sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1045 session->media = media;
26385
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1046 session->type = type;
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1047 session->initiator = initiator;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1048
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1049 purple_media_add_session(media, session);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1050 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
1051 0, PURPLE_MEDIA_STATE_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1052 session->id, NULL);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1053 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1054
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1055 if (!g_list_find_custom(media->priv->participants,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1056 who, (GCompareFunc)strcmp)) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1057 media->priv->participants = g_list_prepend(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1058 media->priv->participants, g_strdup(who));
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
1059
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1060 g_signal_emit_by_name(media, "state-changed",
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1061 PURPLE_MEDIA_STATE_NEW, NULL, who);
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1062 }
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
1063
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1064 if (purple_media_get_stream(media, sess_id, who) == NULL) {
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1065 stream = purple_media_insert_stream(session, who, initiator);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1066
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1067 g_signal_emit(media, purple_media_signals[STATE_CHANGED],
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
1068 0, PURPLE_MEDIA_STATE_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
1069 session->id, who);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1070 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1071
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1072 return TRUE;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1073 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1074 return FALSE;
26385
8bc4b9094913 Get rid of the purple_media_add_stream wrapper as it isn't useful.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
1075 #endif /* USE_VV */
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1076 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1077
26393
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1078 PurpleMediaManager *
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1079 purple_media_get_manager(PurpleMedia *media)
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1080 {
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1081 PurpleMediaManager *ret;
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1082 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1083 g_object_get(media, "manager", &ret, NULL);
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1084 return ret;
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1085 }
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
1086
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
1087 PurpleMediaSessionType
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1088 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1089 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1090 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1091 PurpleMediaSession *session;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1092 g_return_val_if_fail(PURPLE_IS_MEDIA(media), PURPLE_MEDIA_NONE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1093 session = purple_media_get_session(media, sess_id);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1094 return session->type;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1095 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1096 return PURPLE_MEDIA_NONE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1097 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1098 }
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1099 /* XXX: Should wait until codecs-ready is TRUE before using this function */
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1100 GList *
24960
a5f1804fcb4b Combine get_*_codecs functions to mirror Farsight 2.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24951
diff changeset
1101 purple_media_get_codecs(PurpleMedia *media, const gchar *sess_id)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1102 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1103 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1104 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1105
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1106 return purple_media_backend_get_codecs(media->priv->backend, sess_id);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1107 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1108 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1109 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1110 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1111
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1112 GList *
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1113 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id,
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1114 const gchar *participant)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1115 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1116 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1117 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1118
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1119 return purple_media_backend_get_local_candidates(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1120 sess_id, participant);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1121 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1122 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1123 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1124 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1125
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1126 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1127 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1128 const gchar *participant,
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1129 GList *remote_candidates)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1130 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1131 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1132 PurpleMediaStream *stream;
26052
997bbae7b80f Set remote candidates as soon as they are received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26051
diff changeset
1133
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1134 g_return_if_fail(PURPLE_IS_MEDIA(media));
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1135 stream = purple_media_get_stream(media, sess_id, participant);
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1136
26389
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1137 if (stream == NULL) {
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1138 purple_debug_error("media",
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1139 "purple_media_add_remote_candidates: "
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1140 "couldn't find stream %s %s.\n",
27712
813f2eb3fdc8 Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 27709
diff changeset
1141 sess_id ? sess_id : "(null)",
813f2eb3fdc8 Fixes for some potential printf("%s", NULL) type of problems from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 27709
diff changeset
1142 participant ? participant : "(null)");
26389
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1143 return;
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1144 }
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
1145
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
1146 stream->remote_candidates = g_list_concat(stream->remote_candidates,
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1147 purple_media_candidate_list_copy(remote_candidates));
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
1148
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1149 purple_media_backend_add_remote_candidates(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1150 sess_id, participant, remote_candidates);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1151 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1152 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1153
26386
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1154 #if 0
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1155 /*
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1156 * These two functions aren't being used and I'd rather not lock in the API
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1157 * until they are needed. If they ever are.
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1158 */
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1159
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1160 GList *
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1161 purple_media_get_active_local_candidates(PurpleMedia *media,
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1162 const gchar *sess_id, const gchar *participant)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1163 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1164 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1165 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1166 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1167 stream = purple_media_get_stream(media, sess_id, participant);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1168 return purple_media_candidate_list_copy(
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1169 stream->active_local_candidates);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1170 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1171 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1172 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1173 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1174
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1175 GList *
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1176 purple_media_get_active_remote_candidates(PurpleMedia *media,
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1177 const gchar *sess_id, const gchar *participant)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1178 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1179 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1180 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1181 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1182 stream = purple_media_get_stream(media, sess_id, participant);
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1183 return purple_media_candidate_list_copy(
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
1184 stream->active_remote_candidates);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1185 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1186 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1187 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1188 }
26386
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
1189 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1190
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1191 gboolean
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1192 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id,
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1193 const gchar *participant, GList *codecs)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1194 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1195 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1196 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1197
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1198 return purple_media_backend_set_remote_codecs(media->priv->backend,
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1199 sess_id, participant, codecs);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1200 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1201 return FALSE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1202 #endif
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1203 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1204
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1205 gboolean
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1206 purple_media_candidates_prepared(PurpleMedia *media,
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1207 const gchar *session_id, const gchar *participant)
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1208 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1209 #ifdef USE_VV
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1210 GList *streams;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1211 gboolean prepared = TRUE;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1212
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1213 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1214
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1215 streams = purple_media_get_streams(media, session_id, participant);
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1216
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1217 for (; streams; streams = g_list_delete_link(streams, streams)) {
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1218 PurpleMediaStream *stream = streams->data;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1219 if (stream->candidates_prepared == FALSE) {
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1220 g_list_free(streams);
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1221 prepared = FALSE;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1222 break;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1223 }
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1224 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1225
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
1226 return prepared;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1227 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1228 return FALSE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1229 #endif
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1230 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1231
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1232 gboolean
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1233 purple_media_set_send_codec(PurpleMedia *media, const gchar *sess_id, PurpleMediaCodec *codec)
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1234 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1235 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1236 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1237
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1238 return purple_media_backend_set_send_codec(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1239 media->priv->backend, sess_id, codec);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1240 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1241 return FALSE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1242 #endif
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1243 }
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
1244
24937
5a774d0817d8 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24935
diff changeset
1245 gboolean
5a774d0817d8 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24935
diff changeset
1246 purple_media_codecs_ready(PurpleMedia *media, const gchar *sess_id)
5a774d0817d8 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24935
diff changeset
1247 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1248 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1249 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1250
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1251 return purple_media_backend_codecs_ready(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1252 media->priv->backend, sess_id);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1253 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1254 return FALSE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1255 #endif
24937
5a774d0817d8 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24935
diff changeset
1256 }
5a774d0817d8 Wait for Farsight 2's codecs-ready property to be TRUE before using codecs.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24935
diff changeset
1257
26061
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1258 gboolean
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1259 purple_media_is_initiator(PurpleMedia *media,
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1260 const gchar *sess_id, const gchar *participant)
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1261 {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1262 #ifdef USE_VV
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1263 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1264
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1265 if (sess_id == NULL && participant == NULL)
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1266 return media->priv->initiator;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1267 else if (sess_id != NULL && participant == NULL) {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1268 PurpleMediaSession *session =
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1269 purple_media_get_session(media, sess_id);
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1270 return session != NULL ? session->initiator : FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1271 } else if (sess_id != NULL && participant != NULL) {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1272 PurpleMediaStream *stream = purple_media_get_stream(
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1273 media, sess_id, participant);
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1274 return stream != NULL ? stream->initiator : FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1275 }
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1276 #endif
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1277 return FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1278 }
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1279
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
1280 gboolean
26061
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1281 purple_media_accepted(PurpleMedia *media, const gchar *sess_id,
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1282 const gchar *participant)
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1283 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1284 #ifdef USE_VV
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1285 gboolean accepted = TRUE;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1286
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1287 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1288
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1289 if (sess_id == NULL && participant == NULL) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1290 GList *streams = media->priv->streams;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1291
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1292 for (; streams; streams = g_list_next(streams)) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1293 PurpleMediaStream *stream = streams->data;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1294 if (stream->accepted == FALSE) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1295 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1296 break;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1297 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1298 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1299 } else if (sess_id != NULL && participant == NULL) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1300 GList *streams = purple_media_get_streams(
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1301 media, sess_id, NULL);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1302 for (; streams; streams =
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1303 g_list_delete_link(streams, streams)) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1304 PurpleMediaStream *stream = streams->data;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1305 if (stream->accepted == FALSE) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1306 g_list_free(streams);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1307 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1308 break;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1309 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1310 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1311 } else if (sess_id != NULL && participant != NULL) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1312 PurpleMediaStream *stream = purple_media_get_stream(
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1313 media, sess_id, participant);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1314 if (stream == NULL || stream->accepted == FALSE)
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1315 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1316 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1317
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
1318 return accepted;
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1319 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1320 return FALSE;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1321 #endif
26061
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1322 }
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
1323
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1324 void purple_media_set_input_volume(PurpleMedia *media,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1325 const gchar *session_id, double level)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1326 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1327 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1328 g_return_if_fail(PURPLE_IS_MEDIA(media));
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1329 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1330
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1331 purple_media_backend_fs2_set_input_volume(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1332 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1333 media->priv->backend),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1334 session_id, level);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1335 #endif
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1336 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1337
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1338 void purple_media_set_output_volume(PurpleMedia *media,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1339 const gchar *session_id, const gchar *participant,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1340 double level)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1341 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1342 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1343 g_return_if_fail(PURPLE_IS_MEDIA(media));
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1344 g_return_if_fail(PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend));
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1345
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1346 purple_media_backend_fs2_set_output_volume(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1347 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1348 media->priv->backend),
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1349 session_id, participant, level);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1350 #endif
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1351 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1352
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1353 gulong
26053
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
1354 purple_media_set_output_window(PurpleMedia *media, const gchar *session_id,
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
1355 const gchar *participant, gulong window_id)
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
1356 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1357 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1358 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
26053
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
1359
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1360 return purple_media_manager_set_output_window(media->priv->manager,
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1361 media, session_id, participant, window_id);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1362 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1363 return 0;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1364 #endif
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1365 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1366
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1367 void
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1368 purple_media_remove_output_windows(PurpleMedia *media)
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1369 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1370 #ifdef USE_VV
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1371 GList *iter = media->priv->streams;
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1372 for (; iter; iter = g_list_next(iter)) {
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1373 PurpleMediaStream *stream = iter->data;
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1374 purple_media_manager_remove_output_windows(
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1375 media->priv->manager, media,
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1376 stream->session->id, stream->participant);
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1377 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1378
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1379 iter = purple_media_get_session_ids(media);
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1380 for (; iter; iter = g_list_delete_link(iter, iter)) {
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1381 gchar *session_name = iter->data;
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1382 purple_media_manager_remove_output_windows(
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1383 media->priv->manager, media,
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1384 session_name, NULL);
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1385 }
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1386 #endif
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1387 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
1388
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
1389 #ifdef USE_GSTREAMER
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1390 GstElement *
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1391 purple_media_get_tee(PurpleMedia *media,
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1392 const gchar *session_id, const gchar *participant)
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1393 {
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1394 #ifdef USE_VV
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1395 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1396
29352
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1397 if (PURPLE_IS_MEDIA_BACKEND_FS2(media->priv->backend))
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1398 return purple_media_backend_fs2_get_tee(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1399 PURPLE_MEDIA_BACKEND_FS2(
419415a431e1 Move libpurple/media/media.c to libpurple/media.c.
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1400 media->priv->backend),
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1401 session_id, participant);
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1402 g_return_val_if_reached(NULL);
26350
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1403 #else
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1404 return NULL;
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1405 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
1406 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
1407 #endif /* USE_GSTREAMER */
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
1408