annotate libpurple/media.c @ 28930:362d787f0b87

merge of '4a72c5feaab572105b4902609836cd509328aa6d' and '89ddd80c4cd11b79fbcb649bba819ecce526312c'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 01 Feb 2010 21:51:20 +0000
parents f1437342cc0e
children 0629b6814963 cb8b53a6f238
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 */
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
27 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
28
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
29 #include "account.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "media.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"
26050
ae3d25465d0f Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents: 26047
diff changeset
32 #include "network.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
34 #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
35
26546
e7861a7978dc Fix build with --disable-vv --enable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26539
diff changeset
36 #ifdef USE_GSTREAMER
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
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
43 #include <gst/farsight/fs-conference-iface.h>
26997
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
44 #include <gst/farsight/fs-element-added-notifier.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
46 /** @copydoc _PurpleMediaSession */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
47 typedef struct _PurpleMediaSession PurpleMediaSession;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
48 /** @copydoc _PurpleMediaStream */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
49 typedef struct _PurpleMediaStream PurpleMediaStream;
26407
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
50 /** @copydoc _PurpleMediaClass */
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
51 typedef struct _PurpleMediaClass PurpleMediaClass;
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
52 /** @copydoc _PurpleMediaPrivate */
440e999c27ca Hide these typedefs too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26406
diff changeset
53 typedef struct _PurpleMediaPrivate PurpleMediaPrivate;
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
54 /** @copydoc _PurpleMediaCandidateClass */
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
55 typedef struct _PurpleMediaCandidateClass PurpleMediaCandidateClass;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
56 /** @copydoc _PurpleMediaCandidatePrivate */
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
57 typedef struct _PurpleMediaCandidatePrivate PurpleMediaCandidatePrivate;
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
58 /** @copydoc _PurpleMediaCodecClass */
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
59 typedef struct _PurpleMediaCodecClass PurpleMediaCodecClass;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
60 /** @copydoc _PurpleMediaCodecPrivate */
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
61 typedef struct _PurpleMediaCodecPrivate PurpleMediaCodecPrivate;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
62
26399
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
63 /** The media class */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
64 struct _PurpleMediaClass
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
65 {
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
66 GObjectClass parent_class; /**< The parent class. */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
67 };
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
68
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
69 /** The media class's private data */
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
70 struct _PurpleMedia
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
71 {
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
72 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
73 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
74 };
341864c1d1f9 Hide the easy structs in media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26393
diff changeset
75
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
76 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
77 {
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
78 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
79 PurpleMedia *media;
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
80 GstElement *src;
26115
9b0761b77218 Handle the session tee in the session rather than the src bin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
81 GstElement *tee;
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
82 FsSession *session;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
83
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
84 PurpleMediaSessionType type;
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
85 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
86 };
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
87
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
88 struct _PurpleMediaStream
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
89 {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
90 PurpleMediaSession *session;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
91 gchar *participant;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
92 FsStream *stream;
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
93 GstElement *src;
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
94 GstElement *tee;
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
95 GstElement *volume;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
96 GstElement *level;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
97
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
98 GList *local_candidates;
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
99 GList *remote_candidates;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
100
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
101 gboolean initiator;
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
102 gboolean accepted;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
103 gboolean candidates_prepared;
28400
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
104 gboolean held;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
105 gboolean paused;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
106
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
107 GList *active_local_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
108 GList *active_remote_candidates;
26053
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
109
26118
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
110 guint connected_cb_id;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
111 };
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
112 #endif
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
113
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 struct _PurpleMediaPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
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
116 #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
117 PurpleMediaManager *manager;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
118 PurpleAccount *account;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
119 FsConference *conference;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
120 gboolean initiator;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
121 gpointer prpl_data;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
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
123 GHashTable *sessions; /* PurpleMediaSession table */
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
124 GHashTable *participants; /* FsParticipant table */
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
125
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
126 GList *streams; /* PurpleMediaStream table */
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
127
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
128 GstElement *confbin;
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
129 #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
130 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
131 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133
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
134 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
136 #define PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_CANDIDATE, PurpleMediaCandidatePrivate))
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
137 #define PURPLE_MEDIA_CODEC_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_CODEC, PurpleMediaCodecPrivate))
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 static void purple_media_class_init (PurpleMediaClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 static void purple_media_init (PurpleMedia *media);
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
141 static void purple_media_dispose (GObject *object);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142 static void purple_media_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 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
144 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
145
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
146 static void purple_media_new_local_candidate_cb(FsStream *stream,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
147 FsCandidate *local_candidate, PurpleMediaSession *session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
148 static void purple_media_candidates_prepared_cb(FsStream *stream,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
149 PurpleMediaSession *session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
150 static void purple_media_candidate_pair_established_cb(FsStream *stream,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
151 FsCandidate *native_candidate, FsCandidate *remote_candidate,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
152 PurpleMediaSession *session);
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
153 static gboolean media_bus_call(GstBus *bus,
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
154 GstMessage *msg, PurpleMedia *media);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
155
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 enum {
27709
60aab59fb35a Make media.c compilable on Windows following guidance from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 26999
diff changeset
161 S_ERROR,
26298
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
162 CANDIDATES_PREPARED,
26059
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
163 CODECS_CHANGED,
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
164 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
165 NEW_CANDIDATE,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
166 STATE_CHANGED,
26320
8b4394e84633 Add stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26319
diff changeset
167 STREAM_INFO,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 static guint purple_media_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 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
174 PROP_MANAGER,
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
175 PROP_ACCOUNT,
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
176 PROP_CONFERENCE,
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
177 PROP_INITIATOR,
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
178 PROP_PRPL_DATA,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 };
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
180 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
182
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
183 /*
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
184 * PurpleMediaElementType
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
185 */
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
186
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
187 GType
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
188 purple_media_session_type_get_type()
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
189 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
190 static GType type = 0;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
191 if (type == 0) {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
192 static const GFlagsValue values[] = {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
193 { PURPLE_MEDIA_NONE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
194 "PURPLE_MEDIA_NONE", "none" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
195 { PURPLE_MEDIA_RECV_AUDIO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
196 "PURPLE_MEDIA_RECV_AUDIO", "recv-audio" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
197 { PURPLE_MEDIA_SEND_AUDIO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
198 "PURPLE_MEDIA_SEND_AUDIO", "send-audio" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
199 { PURPLE_MEDIA_RECV_VIDEO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
200 "PURPLE_MEDIA_RECV_VIDEO", "recv-video" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
201 { PURPLE_MEDIA_SEND_VIDEO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
202 "PURPLE_MEDIA_SEND_VIDEO", "send-audio" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
203 { PURPLE_MEDIA_AUDIO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
204 "PURPLE_MEDIA_AUDIO", "audio" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
205 { PURPLE_MEDIA_VIDEO,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
206 "PURPLE_MEDIA_VIDEO", "video" },
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
207 { 0, NULL, NULL }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
208 };
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
209 type = g_flags_register_static(
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
210 "PurpleMediaSessionType", values);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
211 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
212 return type;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
213 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
214
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 purple_media_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 {
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
218 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 sizeof(PurpleMediaClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 (GClassInitFunc) purple_media_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 sizeof(PurpleMedia),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
231 (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
232 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 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
237 #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
238 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
239 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
242 GType
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
243 purple_media_state_changed_get_type()
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
244 {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
245 static GType type = 0;
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
246 if (type == 0) {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
247 static const GEnumValue values[] = {
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
248 { PURPLE_MEDIA_STATE_NEW,
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
249 "PURPLE_MEDIA_STATE_NEW", "new" },
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
250 { PURPLE_MEDIA_STATE_CONNECTED,
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
251 "PURPLE_MEDIA_STATE_CONNECTED", "connected" },
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
252 { PURPLE_MEDIA_STATE_END,
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
253 "PURPLE_MEDIA_STATE_END", "end" },
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
254 { 0, NULL, NULL }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
255 };
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
256 type = g_enum_register_static("PurpleMediaState", values);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
257 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
258 return type;
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
259 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
260
26327
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
261 GType
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
262 purple_media_info_type_get_type()
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
263 {
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
264 static GType type = 0;
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
265 if (type == 0) {
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
266 static const GEnumValue values[] = {
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
267 { PURPLE_MEDIA_INFO_HANGUP,
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
268 "PURPLE_MEDIA_INFO_HANGUP", "hangup" },
26367
6943d2a41c6e Add some more PurpleMediaInfo values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
269 { PURPLE_MEDIA_INFO_ACCEPT,
6943d2a41c6e Add some more PurpleMediaInfo values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
270 "PURPLE_MEDIA_INFO_ACCEPT", "accept" },
26327
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
271 { PURPLE_MEDIA_INFO_REJECT,
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
272 "PURPLE_MEDIA_INFO_REJECT", "reject" },
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
273 { PURPLE_MEDIA_INFO_MUTE,
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
274 "PURPLE_MEDIA_INFO_MUTE", "mute" },
26367
6943d2a41c6e Add some more PurpleMediaInfo values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
275 { PURPLE_MEDIA_INFO_UNMUTE,
6943d2a41c6e Add some more PurpleMediaInfo values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
276 "PURPLE_MEDIA_INFO_UNMUTE", "unmute" },
27857
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
277 { PURPLE_MEDIA_INFO_PAUSE,
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
278 "PURPLE_MEDIA_INFO_PAUSE", "pause" },
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
279 { PURPLE_MEDIA_INFO_UNPAUSE,
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
280 "PURPLE_MEDIA_INFO_UNPAUSE", "unpause" },
26327
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
281 { PURPLE_MEDIA_INFO_HOLD,
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
282 "PURPLE_MEDIA_INFO_HOLD", "hold" },
26367
6943d2a41c6e Add some more PurpleMediaInfo values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
283 { PURPLE_MEDIA_INFO_UNHOLD,
28399
e0519a0c9f46 Fix unhold string in media info enum.
maiku@pidgin.im
parents: 28267
diff changeset
284 "PURPLE_MEDIA_INFO_UNHOLD", "unhold" },
26327
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
285 { 0, NULL, NULL }
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
286 };
db9d2a760329 Use the right enum for the stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26326
diff changeset
287 type = g_enum_register_static("PurpleMediaInfoType", values);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
288 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
289 return type;
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
290 }
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
291
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
292 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 purple_media_class_init (PurpleMediaClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
299 gobject_class->dispose = purple_media_dispose;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 gobject_class->finalize = purple_media_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 gobject_class->set_property = purple_media_set_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 gobject_class->get_property = purple_media_get_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
303
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
304 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
305 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
306 "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
307 "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
308 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
309 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
310
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
311 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
312 g_param_spec_pointer("account",
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
313 "PurpleAccount",
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
314 "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
315 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
316
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
317 g_object_class_install_property(gobject_class, PROP_CONFERENCE,
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
318 g_param_spec_object("conference",
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
319 "Farsight conference",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
320 "The FsConference associated with this media.",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
321 FS_TYPE_CONFERENCE,
26388
de03cce95e17 Make the conference property write only.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26387
diff changeset
322 G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
324 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
325 g_param_spec_boolean("initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
326 "initiator",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
327 "If the local user initiated the conference.",
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
328 FALSE,
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
329 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
330
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
331 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
332 g_param_spec_pointer("prpl-data",
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
333 "gpointer",
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
334 "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
335 G_PARAM_READWRITE));
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
336
27709
60aab59fb35a Make media.c compilable on Windows following guidance from Maiku
Stu Tomlinson <stu@nosnilmot.com>
parents: 26999
diff changeset
337 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
338 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
339 g_cclosure_marshal_VOID__STRING,
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
340 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
341 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
342 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
343 purple_smarshal_VOID__STRING_STRING,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
344 G_TYPE_NONE, 2, G_TYPE_STRING,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
345 G_TYPE_STRING);
26059
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
346 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
347 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
348 g_cclosure_marshal_VOID__STRING,
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
349 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
350 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
351 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
352 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
353 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
354 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
355 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
356 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
357 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
358 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
359 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
360 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
361 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
362 purple_smarshal_VOID__ENUM_STRING_STRING,
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
363 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
364 G_TYPE_STRING, G_TYPE_STRING);
26320
8b4394e84633 Add stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26319
diff changeset
365 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
366 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
367 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
368 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
369 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
370 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
373
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 purple_media_init (PurpleMedia *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 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
378 memset(media->priv, 0, sizeof(*media->priv));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381 static void
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
382 purple_media_stream_free(PurpleMediaStream *stream)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
383 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
384 if (stream == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
385 return;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
386
26074
1199abde956b Set the purple_media_connected_cb timeout to a high priority and remove
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26073
diff changeset
387 /* Remove the connected_cb timeout */
26118
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
388 if (stream->connected_cb_id != 0)
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
389 purple_timeout_remove(stream->connected_cb_id);
26074
1199abde956b Set the purple_media_connected_cb timeout to a high priority and remove
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26073
diff changeset
390
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
391 g_free(stream->participant);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
392
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
393 if (stream->local_candidates)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
394 fs_candidate_list_destroy(stream->local_candidates);
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
395 if (stream->remote_candidates)
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
396 fs_candidate_list_destroy(stream->remote_candidates);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
397
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
398 if (stream->active_local_candidates)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
399 fs_candidate_list_destroy(stream->active_local_candidates);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
400 if (stream->active_remote_candidates)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
401 fs_candidate_list_destroy(stream->active_remote_candidates);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
402
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
403 g_free(stream);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
404 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
405
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
406 static void
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
407 purple_media_session_free(PurpleMediaSession *session)
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
408 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
409 if (session == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
410 return;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
411
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
412 g_free(session->id);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
413 g_free(session);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
414 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
415
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
416 static void
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
417 purple_media_dispose(GObject *media)
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
418 {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
419 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
420 GList *iter = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
421
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
422 purple_debug_info("media","purple_media_dispose\n");
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
423
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
424 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
425
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
426 if (priv->confbin) {
26306
5906409c4b69 Fix some GStreamer timing issues.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26305
diff changeset
427 gst_element_set_locked_state(priv->confbin, TRUE);
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
428 gst_element_set_state(GST_ELEMENT(priv->confbin),
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
429 GST_STATE_NULL);
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
430 gst_bin_remove(GST_BIN(purple_media_manager_get_pipeline(
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
431 priv->manager)), priv->confbin);
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
432 priv->confbin = NULL;
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
433 priv->conference = NULL;
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
434 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
435
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
436 for (iter = priv->streams; iter; iter = g_list_next(iter)) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
437 PurpleMediaStream *stream = iter->data;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
438 if (stream->stream) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
439 g_object_unref(stream->stream);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
440 stream->stream = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
441 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
442 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
443
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
444 if (priv->sessions) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
445 GList *sessions = g_hash_table_get_values(priv->sessions);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
446 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
447 PurpleMediaSession *session = sessions->data;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
448 if (session->session) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
449 g_object_unref(session->session);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
450 session->session = NULL;
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
451 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
452 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
453 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
454
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
455 if (priv->participants) {
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
456 GList *participants = g_hash_table_get_values(priv->participants);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
457 for (; participants; participants = g_list_delete_link(participants, participants))
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
458 g_object_unref(participants->data);
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
459 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
460
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
461 if (priv->manager) {
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
462 GstElement *pipeline = purple_media_manager_get_pipeline(
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
463 priv->manager);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
464 GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
465 g_signal_handlers_disconnect_matched(G_OBJECT(bus),
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
466 G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA,
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
467 0, 0, 0, media_bus_call, media);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
468 gst_object_unref(bus);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
469
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
470 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
471 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
472 }
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
473
26292
327102f2ce64 Fix copy/paste-o.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26286
diff changeset
474 G_OBJECT_CLASS(parent_class)->dispose(media);
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
475 }
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
476
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
477 static void
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
478 purple_media_finalize(GObject *media)
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 {
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
480 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
481 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
482
24981
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
483 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
484 purple_media_stream_free(priv->streams->data);
584a4f5ce4dc Free Farsight objects better.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24980
diff changeset
485
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
486 if (priv->sessions) {
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
487 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
488 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
489 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
490 }
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
491 g_hash_table_destroy(priv->sessions);
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
492 }
23856
1c68f78414b7 Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23852
diff changeset
493
26005
83704757fa36 Use the dispose method too.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26004
diff changeset
494 G_OBJECT_CLASS(parent_class)->finalize(media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 static void
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
498 purple_media_setup_pipeline(PurpleMedia *media)
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
499 {
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
500 GstBus *bus;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
501 gchar *name;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
502 GstElement *pipeline;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
503
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
504 if (media->priv->conference == NULL || media->priv->manager == NULL)
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
505 return;
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
506
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
507 pipeline = purple_media_manager_get_pipeline(media->priv->manager);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
508
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
509 name = g_strdup_printf("conf_%p",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
510 media->priv->conference);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
511 media->priv->confbin = gst_bin_new(name);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
512 g_free(name);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
513
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
514 bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
515 g_signal_connect(G_OBJECT(bus), "message",
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
516 G_CALLBACK(media_bus_call), media);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
517 gst_object_unref(bus);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
518
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
519 gst_bin_add(GST_BIN(pipeline),
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
520 media->priv->confbin);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
521 gst_bin_add(GST_BIN(media->priv->confbin),
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
522 GST_ELEMENT(media->priv->conference));
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
523 gst_element_set_state(GST_ELEMENT(media->priv->confbin),
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
524 GST_STATE_PLAYING);
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
525 }
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
526
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
527 static void
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
528 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
529 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
531 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
532
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 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
536 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
537 media->priv->manager = g_value_get_object(value);
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
538 g_object_ref(media->priv->manager);
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
539
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
540 purple_media_setup_pipeline(media);
26107
76104100cb87 Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26103
diff changeset
541 break;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
542 case PROP_ACCOUNT:
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
543 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
544 break;
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
545 case PROP_CONFERENCE: {
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
546 if (media->priv->conference)
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
547 gst_object_unref(media->priv->conference);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
548 media->priv->conference = g_value_get_object(value);
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
549 gst_object_ref(media->priv->conference);
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
550
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
551 purple_media_setup_pipeline(media);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 break;
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
553 }
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
554 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
555 media->priv->initiator = g_value_get_boolean(value);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
556 break;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
557 case PROP_PRPL_DATA:
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
558 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
559 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
563 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
566 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
568 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 g_return_if_fail(PURPLE_IS_MEDIA(object));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
571
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 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
575 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
576 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
577 break;
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
578 case PROP_ACCOUNT:
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
579 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
580 break;
24985
ee2a2a9dda01 Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24984
diff changeset
581 case PROP_CONFERENCE:
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
582 g_value_set_object(value, media->priv->conference);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 break;
24987
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
584 case PROP_INITIATOR:
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
585 g_value_set_boolean(value, media->priv->initiator);
c7d4b67b3332 Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24985
diff changeset
586 break;
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
587 case PROP_PRPL_DATA:
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
588 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
589 break;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 }
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
596 #endif
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
598 /*
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
599 * PurpleMediaCandidateType
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
600 */
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
601
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
602 GType
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
603 purple_media_candidate_type_get_type()
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
604 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
605 static GType type = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
606 if (type == 0) {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
607 static const GEnumValue values[] = {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
608 { PURPLE_MEDIA_CANDIDATE_TYPE_HOST,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
609 "PURPLE_MEDIA_CANDIDATE_TYPE_HOST",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
610 "host" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
611 { PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
612 "PURPLE_MEDIA_CANDIDATE_TYPE_SRFLX",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
613 "srflx" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
614 { PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
615 "PURPLE_MEDIA_CANDIDATE_TYPE_PRFLX",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
616 "prflx" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
617 { PURPLE_MEDIA_CANDIDATE_TYPE_RELAY,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
618 "PPURPLE_MEDIA_CANDIDATE_TYPE_RELAY",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
619 "relay" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
620 { PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
621 "PURPLE_MEDIA_CANDIDATE_TYPE_MULTICAST",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
622 "multicast" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
623 { 0, NULL, NULL }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
624 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
625 type = g_enum_register_static("PurpleMediaCandidateType",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
626 values);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
627 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
628 return type;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
629 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
630
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
631 /*
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
632 * PurpleMediaNetworkProtocol
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
633 */
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
634
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
635 GType
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
636 purple_media_network_protocol_get_type()
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
637 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
638 static GType type = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
639 if (type == 0) {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
640 static const GEnumValue values[] = {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
641 { PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
642 "PURPLE_MEDIA_NETWORK_PROTOCOL_UDP",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
643 "udp" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
644 { PURPLE_MEDIA_NETWORK_PROTOCOL_TCP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
645 "PURPLE_MEDIA_NETWORK_PROTOCOL_TCP",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
646 "tcp" },
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
647 { 0, NULL, NULL }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
648 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
649 type = g_enum_register_static("PurpleMediaNetworkProtocol",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
650 values);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
651 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
652 return type;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
653 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
654
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
655 /*
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
656 * PurpleMediaCandidate
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
657 */
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
658
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
659 struct _PurpleMediaCandidateClass
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
660 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
661 GObjectClass parent_class;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
662 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
663
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
664 struct _PurpleMediaCandidate
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
665 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
666 GObject parent;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
667 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
668
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
669 #ifdef USE_VV
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
670 struct _PurpleMediaCandidatePrivate
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
671 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
672 gchar *foundation;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
673 guint component_id;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
674 gchar *ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
675 guint16 port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
676 gchar *base_ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
677 guint16 base_port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
678 PurpleMediaNetworkProtocol proto;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
679 guint32 priority;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
680 PurpleMediaCandidateType type;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
681 gchar *username;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
682 gchar *password;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
683 guint ttl;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
684 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
685
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
686 enum {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
687 PROP_CANDIDATE_0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
688 PROP_FOUNDATION,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
689 PROP_COMPONENT_ID,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
690 PROP_IP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
691 PROP_PORT,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
692 PROP_BASE_IP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
693 PROP_BASE_PORT,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
694 PROP_PROTOCOL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
695 PROP_PRIORITY,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
696 PROP_TYPE,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
697 PROP_USERNAME,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
698 PROP_PASSWORD,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
699 PROP_TTL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
700 };
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
701
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
702 static void
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
703 purple_media_candidate_init(PurpleMediaCandidate *info)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
704 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
705 PurpleMediaCandidatePrivate *priv =
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
706 PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(info);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
707 priv->foundation = NULL;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
708 priv->component_id = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
709 priv->ip = NULL;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
710 priv->port = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
711 priv->base_ip = NULL;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
712 priv->proto = PURPLE_MEDIA_NETWORK_PROTOCOL_UDP;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
713 priv->priority = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
714 priv->type = PURPLE_MEDIA_CANDIDATE_TYPE_HOST;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
715 priv->username = NULL;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
716 priv->password = NULL;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
717 priv->ttl = 0;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
718 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
719
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
720 static void
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
721 purple_media_candidate_finalize(GObject *info)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
722 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
723 PurpleMediaCandidatePrivate *priv =
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
724 PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(info);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
725
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
726 g_free(priv->foundation);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
727 g_free(priv->ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
728 g_free(priv->base_ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
729 g_free(priv->username);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
730 g_free(priv->password);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
731 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
732
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
733 static void
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
734 purple_media_candidate_set_property (GObject *object, guint prop_id,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
735 const GValue *value, GParamSpec *pspec)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
736 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
737 PurpleMediaCandidatePrivate *priv;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
738 g_return_if_fail(PURPLE_IS_MEDIA_CANDIDATE(object));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
739
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
740 priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(object);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
741
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
742 switch (prop_id) {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
743 case PROP_FOUNDATION:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
744 g_free(priv->foundation);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
745 priv->foundation = g_value_dup_string(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
746 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
747 case PROP_COMPONENT_ID:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
748 priv->component_id = g_value_get_uint(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
749 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
750 case PROP_IP:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
751 g_free(priv->ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
752 priv->ip = g_value_dup_string(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
753 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
754 case PROP_PORT:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
755 priv->port = g_value_get_uint(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
756 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
757 case PROP_BASE_IP:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
758 g_free(priv->base_ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
759 priv->base_ip = g_value_dup_string(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
760 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
761 case PROP_BASE_PORT:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
762 priv->base_port = g_value_get_uint(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
763 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
764 case PROP_PROTOCOL:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
765 priv->proto = g_value_get_enum(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
766 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
767 case PROP_PRIORITY:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
768 priv->priority = g_value_get_uint(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
769 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
770 case PROP_TYPE:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
771 priv->type = g_value_get_enum(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
772 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
773 case PROP_USERNAME:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
774 g_free(priv->username);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
775 priv->username = g_value_dup_string(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
776 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
777 case PROP_PASSWORD:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
778 g_free(priv->password);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
779 priv->password = g_value_dup_string(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
780 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
781 case PROP_TTL:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
782 priv->ttl = g_value_get_uint(value);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
783 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
784 default:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
785 G_OBJECT_WARN_INVALID_PROPERTY_ID(
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
786 object, prop_id, pspec);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
787 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
788 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
789 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
790
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
791 static void
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
792 purple_media_candidate_get_property (GObject *object, guint prop_id,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
793 GValue *value, GParamSpec *pspec)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
794 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
795 PurpleMediaCandidatePrivate *priv;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
796 g_return_if_fail(PURPLE_IS_MEDIA_CANDIDATE(object));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
797
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
798 priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(object);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
799
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
800 switch (prop_id) {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
801 case PROP_FOUNDATION:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
802 g_value_set_string(value, priv->foundation);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
803 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
804 case PROP_COMPONENT_ID:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
805 g_value_set_uint(value, priv->component_id);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
806 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
807 case PROP_IP:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
808 g_value_set_string(value, priv->ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
809 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
810 case PROP_PORT:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
811 g_value_set_uint(value, priv->port);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
812 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
813 case PROP_BASE_IP:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
814 g_value_set_string(value, priv->base_ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
815 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
816 case PROP_BASE_PORT:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
817 g_value_set_uint(value, priv->base_port);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
818 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
819 case PROP_PROTOCOL:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
820 g_value_set_enum(value, priv->proto);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
821 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
822 case PROP_PRIORITY:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
823 g_value_set_uint(value, priv->priority);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
824 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
825 case PROP_TYPE:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
826 g_value_set_enum(value, priv->type);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
827 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
828 case PROP_USERNAME:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
829 g_value_set_string(value, priv->username);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
830 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
831 case PROP_PASSWORD:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
832 g_value_set_string(value, priv->password);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
833 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
834 case PROP_TTL:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
835 g_value_set_uint(value, priv->ttl);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
836 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
837 default:
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
838 G_OBJECT_WARN_INVALID_PROPERTY_ID(
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
839 object, prop_id, pspec);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
840 break;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
841 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
842 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
843
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
844 static void
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
845 purple_media_candidate_class_init(PurpleMediaCandidateClass *klass)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
846 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
847 GObjectClass *gobject_class = (GObjectClass*)klass;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
848
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
849 gobject_class->finalize = purple_media_candidate_finalize;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
850 gobject_class->set_property = purple_media_candidate_set_property;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
851 gobject_class->get_property = purple_media_candidate_get_property;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
852
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
853 g_object_class_install_property(gobject_class, PROP_FOUNDATION,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
854 g_param_spec_string("foundation",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
855 "Foundation",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
856 "The foundation of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
857 NULL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
858 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
859
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
860 g_object_class_install_property(gobject_class, PROP_COMPONENT_ID,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
861 g_param_spec_uint("component-id",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
862 "Component ID",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
863 "The component id of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
864 0, G_MAXUINT, 0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
865 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
866
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
867 g_object_class_install_property(gobject_class, PROP_IP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
868 g_param_spec_string("ip",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
869 "IP Address",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
870 "The IP address of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
871 NULL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
872 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
873
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
874 g_object_class_install_property(gobject_class, PROP_PORT,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
875 g_param_spec_uint("port",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
876 "Port",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
877 "The port of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
878 0, G_MAXUINT16, 0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
879 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
880
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
881 g_object_class_install_property(gobject_class, PROP_BASE_IP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
882 g_param_spec_string("base-ip",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
883 "Base IP",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
884 "The internal IP address of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
885 NULL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
886 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
887
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
888 g_object_class_install_property(gobject_class, PROP_BASE_PORT,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
889 g_param_spec_uint("base-port",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
890 "Base Port",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
891 "The internal port of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
892 0, G_MAXUINT16, 0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
893 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
894
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
895 g_object_class_install_property(gobject_class, PROP_PROTOCOL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
896 g_param_spec_enum("protocol",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
897 "Protocol",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
898 "The protocol of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
899 PURPLE_TYPE_MEDIA_NETWORK_PROTOCOL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
900 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
901 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
902
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
903 g_object_class_install_property(gobject_class, PROP_PRIORITY,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
904 g_param_spec_uint("priority",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
905 "Priority",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
906 "The priority of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
907 0, G_MAXUINT32, 0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
908 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
909
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
910 g_object_class_install_property(gobject_class, PROP_TYPE,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
911 g_param_spec_enum("type",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
912 "Type",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
913 "The type of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
914 PURPLE_TYPE_MEDIA_CANDIDATE_TYPE,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
915 PURPLE_MEDIA_CANDIDATE_TYPE_HOST,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
916 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
917
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
918 g_object_class_install_property(gobject_class, PROP_USERNAME,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
919 g_param_spec_string("username",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
920 "Username",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
921 "The username used to connect to the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
922 NULL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
923 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
924
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
925 g_object_class_install_property(gobject_class, PROP_PASSWORD,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
926 g_param_spec_string("password",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
927 "Password",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
928 "The password use to connect to the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
929 NULL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
930 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
931
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
932 g_object_class_install_property(gobject_class, PROP_TTL,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
933 g_param_spec_uint("ttl",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
934 "TTL",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
935 "The TTL of the candidate.",
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
936 0, G_MAXUINT, 0,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
937 G_PARAM_READWRITE));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
938
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
939 g_type_class_add_private(klass, sizeof(PurpleMediaCandidatePrivate));
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
940 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
941
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
942 G_DEFINE_TYPE(PurpleMediaCandidate,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
943 purple_media_candidate, G_TYPE_OBJECT);
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
944 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
945 GType
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
946 purple_media_candidate_get_type()
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
947 {
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
948 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
949 }
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
950 #endif
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
951
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
952 PurpleMediaCandidate *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
953 purple_media_candidate_new(const gchar *foundation, guint component_id,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
954 PurpleMediaCandidateType type,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
955 PurpleMediaNetworkProtocol proto,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
956 const gchar *ip, guint port)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
957 {
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
958 return g_object_new(PURPLE_TYPE_MEDIA_CANDIDATE,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
959 "foundation", foundation,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
960 "component-id", component_id,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
961 "type", type,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
962 "protocol", proto,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
963 "ip", ip,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
964 "port", port, NULL);
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
965 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
966
26315
c0499eb4dd4d Disapprove part of the revision that shouldn't be there.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26314
diff changeset
967 static PurpleMediaCandidate *
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
968 purple_media_candidate_copy(PurpleMediaCandidate *candidate)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
969 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
970 #ifdef USE_VV
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
971 PurpleMediaCandidatePrivate *priv;
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
972 PurpleMediaCandidate *new_candidate;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
973
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
974 if (candidate == NULL)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
975 return NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
976
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
977 priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(candidate);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
978
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
979 new_candidate = purple_media_candidate_new(priv->foundation,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
980 priv->component_id, priv->type, priv->proto,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
981 priv->ip, priv->port);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
982 g_object_set(new_candidate,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
983 "base-ip", priv->base_ip,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
984 "base-port", priv->base_port,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
985 "priority", priv->priority,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
986 "username", priv->username,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
987 "password", priv->password,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
988 "ttl", priv->ttl, NULL);
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
989 return new_candidate;
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
990 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
991 return NULL;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
992 #endif
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
993 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
994
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
995 #ifdef USE_VV
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
996 static FsCandidate *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
997 purple_media_candidate_to_fs(PurpleMediaCandidate *candidate)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
998 {
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
999 PurpleMediaCandidatePrivate *priv;
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1000 FsCandidate *fscandidate;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1001
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1002 if (candidate == NULL)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1003 return NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1004
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1005 priv = PURPLE_MEDIA_CANDIDATE_GET_PRIVATE(candidate);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1006
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1007 fscandidate = fs_candidate_new(priv->foundation,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1008 priv->component_id, priv->type,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1009 priv->proto, priv->ip, priv->port);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1010
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1011 fscandidate->base_ip = g_strdup(priv->base_ip);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1012 fscandidate->base_port = priv->base_port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1013 fscandidate->priority = priv->priority;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1014 fscandidate->username = g_strdup(priv->username);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1015 fscandidate->password = g_strdup(priv->password);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1016 fscandidate->ttl = priv->ttl;
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1017 return fscandidate;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1018 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1019
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1020 static PurpleMediaCandidate *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1021 purple_media_candidate_from_fs(FsCandidate *fscandidate)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1022 {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1023 PurpleMediaCandidate *candidate;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1024
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1025 if (fscandidate == NULL)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1026 return NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1027
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1028 candidate = purple_media_candidate_new(fscandidate->foundation,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1029 fscandidate->component_id, fscandidate->type,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1030 fscandidate->proto, fscandidate->ip, fscandidate->port);
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1031 g_object_set(candidate,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1032 "base-ip", fscandidate->base_ip,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1033 "base-port", fscandidate->base_port,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1034 "priority", fscandidate->priority,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1035 "username", fscandidate->username,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1036 "password", fscandidate->password,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1037 "ttl", fscandidate->ttl, NULL);
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1038 return candidate;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1039 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1040
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1041 static GList *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1042 purple_media_candidate_list_from_fs(GList *candidates)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1043 {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1044 GList *new_list = NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1045
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1046 for (; candidates; candidates = g_list_next(candidates)) {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1047 new_list = g_list_prepend(new_list,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1048 purple_media_candidate_from_fs(
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1049 candidates->data));
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1050 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1051
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1052 new_list = g_list_reverse(new_list);
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1053 return new_list;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1054 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1055
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1056 static GList *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1057 purple_media_candidate_list_to_fs(GList *candidates)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1058 {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1059 GList *new_list = NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1060
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1061 for (; candidates; candidates = g_list_next(candidates)) {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1062 new_list = g_list_prepend(new_list,
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1063 purple_media_candidate_to_fs(
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1064 candidates->data));
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1065 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1066
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1067 new_list = g_list_reverse(new_list);
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1068 return new_list;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1069 }
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
1070 #endif
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1071
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1072 GList *
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1073 purple_media_candidate_list_copy(GList *candidates)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1074 {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1075 GList *new_list = NULL;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1076
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1077 for (; candidates; candidates = g_list_next(candidates)) {
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1078 new_list = g_list_prepend(new_list,
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1079 purple_media_candidate_copy(candidates->data));
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1080 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1081
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1082 new_list = g_list_reverse(new_list);
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1083 return new_list;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1084 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1085
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1086 void
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1087 purple_media_candidate_list_free(GList *candidates)
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1088 {
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1089 for (; candidates; candidates =
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1090 g_list_delete_link(candidates, candidates)) {
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1091 g_object_unref(candidates->data);
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1092 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1093 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1094
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1095 gchar *
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1096 purple_media_candidate_get_foundation(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1097 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1098 gchar *foundation;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1099 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1100 g_object_get(candidate, "foundation", &foundation, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1101 return foundation;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1102 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1103
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1104 guint
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1105 purple_media_candidate_get_component_id(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1106 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1107 guint component_id;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1108 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1109 g_object_get(candidate, "component-id", &component_id, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1110 return component_id;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1111 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1112
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1113 gchar *
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1114 purple_media_candidate_get_ip(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1115 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1116 gchar *ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1117 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1118 g_object_get(candidate, "ip", &ip, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1119 return ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1120 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1121
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1122 guint16
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1123 purple_media_candidate_get_port(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1124 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1125 guint port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1126 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1127 g_object_get(candidate, "port", &port, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1128 return port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1129 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1130
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1131 gchar *
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1132 purple_media_candidate_get_base_ip(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1133 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1134 gchar *base_ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1135 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1136 g_object_get(candidate, "base-ip", &base_ip, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1137 return base_ip;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1138 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1139
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1140 guint16
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1141 purple_media_candidate_get_base_port(PurpleMediaCandidate *candidate)
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1142 {
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1143 guint base_port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1144 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1145 g_object_get(candidate, "base_port", &base_port, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1146 return base_port;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1147 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1148
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1149 PurpleMediaNetworkProtocol
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1150 purple_media_candidate_get_protocol(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1151 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1152 PurpleMediaNetworkProtocol protocol;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1153 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate),
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1154 PURPLE_MEDIA_NETWORK_PROTOCOL_UDP);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1155 g_object_get(candidate, "protocol", &protocol, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1156 return protocol;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1157 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1158
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1159 guint32
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1160 purple_media_candidate_get_priority(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1161 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1162 guint priority;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1163 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1164 g_object_get(candidate, "priority", &priority, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1165 return priority;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1166 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1167
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1168 PurpleMediaCandidateType
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1169 purple_media_candidate_get_candidate_type(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1170 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1171 PurpleMediaCandidateType type;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1172 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate),
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1173 PURPLE_MEDIA_CANDIDATE_TYPE_HOST);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1174 g_object_get(candidate, "type", &type, NULL);
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1175 return type;
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1176 }
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
1177
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1178 gchar *
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1179 purple_media_candidate_get_username(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1180 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1181 gchar *username;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1182 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1183 g_object_get(candidate, "username", &username, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1184 return username;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1185 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1186
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1187 gchar *
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1188 purple_media_candidate_get_password(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1189 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1190 gchar *password;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1191 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1192 g_object_get(candidate, "password", &password, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1193 return password;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1194 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1195
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1196 guint
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1197 purple_media_candidate_get_ttl(PurpleMediaCandidate *candidate)
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1198 {
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1199 guint ttl;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1200 g_return_val_if_fail(PURPLE_IS_MEDIA_CANDIDATE(candidate), 0);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1201 g_object_get(candidate, "ttl", &ttl, NULL);
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1202 return ttl;
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1203 }
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
1204
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
1205 #ifdef USE_VV
26017
b6457b2a8e14 Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26015
diff changeset
1206 static FsMediaType
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
1207 purple_media_to_fs_media_type(PurpleMediaSessionType type)
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1208 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1209 if (type & PURPLE_MEDIA_AUDIO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1210 return FS_MEDIA_TYPE_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1211 else if (type & PURPLE_MEDIA_VIDEO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1212 return FS_MEDIA_TYPE_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1213 else
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1214 return 0;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1215 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1216
26017
b6457b2a8e14 Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26015
diff changeset
1217 static FsStreamDirection
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
1218 purple_media_to_fs_stream_direction(PurpleMediaSessionType type)
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1219 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1220 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1221 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1222 return FS_DIRECTION_BOTH;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1223 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1224 (type & PURPLE_MEDIA_SEND_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1225 return FS_DIRECTION_SEND;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1226 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1227 (type & PURPLE_MEDIA_RECV_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1228 return FS_DIRECTION_RECV;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1229 else
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1230 return FS_DIRECTION_NONE;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1231 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1232
26017
b6457b2a8e14 Make FsStreamDirection and FsMediaType conversion functions static.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26015
diff changeset
1233 static PurpleMediaSessionType
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1234 purple_media_from_fs(FsMediaType type, FsStreamDirection direction)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1235 {
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
1236 PurpleMediaSessionType result = PURPLE_MEDIA_NONE;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1237 if (type == FS_MEDIA_TYPE_AUDIO) {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1238 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1239 result |= PURPLE_MEDIA_SEND_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1240 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1241 result |= PURPLE_MEDIA_RECV_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1242 } else if (type == FS_MEDIA_TYPE_VIDEO) {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1243 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1244 result |= PURPLE_MEDIA_SEND_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1245 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1246 result |= PURPLE_MEDIA_RECV_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1247 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1248 return result;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1249 }
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
1250 #endif
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1251
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1252 /*
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1253 * PurpleMediaCodec
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1254 */
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1255
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1256 struct _PurpleMediaCodecClass
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1257 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1258 GObjectClass parent_class;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1259 };
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1260
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1261 struct _PurpleMediaCodec
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1262 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1263 GObject parent;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1264 };
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1265
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1266 #ifdef USE_VV
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1267 struct _PurpleMediaCodecPrivate
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1268 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1269 gint id;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1270 char *encoding_name;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1271 PurpleMediaSessionType media_type;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1272 guint clock_rate;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1273 guint channels;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1274 GList *optional_params;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1275 };
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1276
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1277 enum {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1278 PROP_CODEC_0,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1279 PROP_ID,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1280 PROP_ENCODING_NAME,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1281 PROP_MEDIA_TYPE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1282 PROP_CLOCK_RATE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1283 PROP_CHANNELS,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1284 PROP_OPTIONAL_PARAMS,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1285 };
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1286
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1287 static void
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1288 purple_media_codec_init(PurpleMediaCodec *info)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1289 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1290 PurpleMediaCodecPrivate *priv =
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1291 PURPLE_MEDIA_CODEC_GET_PRIVATE(info);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1292 priv->encoding_name = NULL;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1293 priv->optional_params = NULL;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1294 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1295
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1296 static void
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1297 purple_media_codec_finalize(GObject *info)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1298 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1299 PurpleMediaCodecPrivate *priv =
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1300 PURPLE_MEDIA_CODEC_GET_PRIVATE(info);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1301 g_free(priv->encoding_name);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1302 for (; priv->optional_params; priv->optional_params =
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1303 g_list_delete_link(priv->optional_params,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1304 priv->optional_params)) {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1305 g_free(priv->optional_params->data);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1306 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1307 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1308
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1309 static void
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1310 purple_media_codec_set_property (GObject *object, guint prop_id,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1311 const GValue *value, GParamSpec *pspec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1312 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1313 PurpleMediaCodecPrivate *priv;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1314 g_return_if_fail(PURPLE_IS_MEDIA_CODEC(object));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1315
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1316 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(object);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1317
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1318 switch (prop_id) {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1319 case PROP_ID:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1320 priv->id = g_value_get_uint(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1321 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1322 case PROP_ENCODING_NAME:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1323 g_free(priv->encoding_name);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1324 priv->encoding_name = g_value_dup_string(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1325 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1326 case PROP_MEDIA_TYPE:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1327 priv->media_type = g_value_get_flags(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1328 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1329 case PROP_CLOCK_RATE:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1330 priv->clock_rate = g_value_get_uint(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1331 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1332 case PROP_CHANNELS:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1333 priv->channels = g_value_get_uint(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1334 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1335 case PROP_OPTIONAL_PARAMS:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1336 priv->optional_params = g_value_get_pointer(value);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1337 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1338 default:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1339 G_OBJECT_WARN_INVALID_PROPERTY_ID(
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1340 object, prop_id, pspec);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1341 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1342 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1343 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1344
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1345 static void
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1346 purple_media_codec_get_property (GObject *object, guint prop_id,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1347 GValue *value, GParamSpec *pspec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1348 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1349 PurpleMediaCodecPrivate *priv;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1350 g_return_if_fail(PURPLE_IS_MEDIA_CODEC(object));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1351
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1352 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(object);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1353
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1354 switch (prop_id) {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1355 case PROP_ID:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1356 g_value_set_uint(value, priv->id);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1357 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1358 case PROP_ENCODING_NAME:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1359 g_value_set_string(value, priv->encoding_name);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1360 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1361 case PROP_MEDIA_TYPE:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1362 g_value_set_flags(value, priv->media_type);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1363 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1364 case PROP_CLOCK_RATE:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1365 g_value_set_uint(value, priv->clock_rate);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1366 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1367 case PROP_CHANNELS:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1368 g_value_set_uint(value, priv->channels);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1369 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1370 case PROP_OPTIONAL_PARAMS:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1371 g_value_set_pointer(value, priv->optional_params);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1372 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1373 default:
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1374 G_OBJECT_WARN_INVALID_PROPERTY_ID(
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1375 object, prop_id, pspec);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1376 break;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1377 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1378 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1379
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1380 static void
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1381 purple_media_codec_class_init(PurpleMediaCodecClass *klass)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1382 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1383 GObjectClass *gobject_class = (GObjectClass*)klass;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1384
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1385 gobject_class->finalize = purple_media_codec_finalize;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1386 gobject_class->set_property = purple_media_codec_set_property;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1387 gobject_class->get_property = purple_media_codec_get_property;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1388
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1389 g_object_class_install_property(gobject_class, PROP_ID,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1390 g_param_spec_uint("id",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1391 "ID",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1392 "The numeric identifier of the codec.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1393 0, G_MAXUINT, 0,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1394 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1395
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1396 g_object_class_install_property(gobject_class, PROP_ENCODING_NAME,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1397 g_param_spec_string("encoding-name",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1398 "Encoding Name",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1399 "The name of the codec.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1400 NULL,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1401 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1402
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1403 g_object_class_install_property(gobject_class, PROP_MEDIA_TYPE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1404 g_param_spec_flags("media-type",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1405 "Media Type",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1406 "Whether this is an audio of video codec.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1407 PURPLE_TYPE_MEDIA_SESSION_TYPE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1408 PURPLE_MEDIA_NONE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1409 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1410
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1411 g_object_class_install_property(gobject_class, PROP_CLOCK_RATE,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1412 g_param_spec_uint("clock-rate",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1413 "Create Callback",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1414 "The function called to create this element.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1415 0, G_MAXUINT, 0,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1416 G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1417
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1418 g_object_class_install_property(gobject_class, PROP_CHANNELS,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1419 g_param_spec_uint("channels",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1420 "Channels",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1421 "The number of channels in this codec.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1422 0, G_MAXUINT, 0,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1423 G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1424 g_object_class_install_property(gobject_class, PROP_OPTIONAL_PARAMS,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1425 g_param_spec_pointer("optional-params",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1426 "Optional Params",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1427 "A list of optional parameters for the codec.",
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1428 G_PARAM_READWRITE));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1429
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1430 g_type_class_add_private(klass, sizeof(PurpleMediaCodecPrivate));
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1431 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1432
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1433 G_DEFINE_TYPE(PurpleMediaCodec,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1434 purple_media_codec, G_TYPE_OBJECT);
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1435 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1436 GType
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1437 purple_media_codec_get_type()
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1438 {
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1439 return G_TYPE_NONE;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1440 }
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1441 #endif
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1442
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1443 guint
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1444 purple_media_codec_get_id(PurpleMediaCodec *codec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1445 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1446 guint id;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1447 g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1448 g_object_get(codec, "id", &id, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1449 return id;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1450 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1451
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1452 gchar *
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1453 purple_media_codec_get_encoding_name(PurpleMediaCodec *codec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1454 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1455 gchar *name;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1456 g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1457 g_object_get(codec, "encoding-name", &name, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1458 return name;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1459 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1460
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1461 guint
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1462 purple_media_codec_get_clock_rate(PurpleMediaCodec *codec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1463 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1464 guint clock_rate;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1465 g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1466 g_object_get(codec, "clock-rate", &clock_rate, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1467 return clock_rate;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1468 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1469
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1470 guint
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1471 purple_media_codec_get_channels(PurpleMediaCodec *codec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1472 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1473 guint channels;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1474 g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), 0);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1475 g_object_get(codec, "channels", &channels, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1476 return channels;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1477 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1478
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1479 GList *
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1480 purple_media_codec_get_optional_parameters(PurpleMediaCodec *codec)
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1481 {
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1482 GList *optional_params;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1483 g_return_val_if_fail(PURPLE_IS_MEDIA_CODEC(codec), NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1484 g_object_get(codec, "optional-params", &optional_params, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1485 return optional_params;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1486 }
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1487
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1488 void
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1489 purple_media_codec_add_optional_parameter(PurpleMediaCodec *codec,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1490 const gchar *name, const gchar *value)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1491 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1492 #ifdef USE_VV
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1493 PurpleMediaCodecPrivate *priv;
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1494 PurpleKeyValuePair *new_param;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1495
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1496 g_return_if_fail(codec != NULL);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1497 g_return_if_fail(name != NULL && value != NULL);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1498
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1499 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1500
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1501 new_param = g_new0(PurpleKeyValuePair, 1);
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1502 new_param->key = g_strdup(name);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1503 new_param->value = g_strdup(value);
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1504 priv->optional_params = g_list_append(
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1505 priv->optional_params, new_param);
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1506 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1507 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1508
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1509 void
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1510 purple_media_codec_remove_optional_parameter(PurpleMediaCodec *codec,
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1511 PurpleKeyValuePair *param)
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1512 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1513 #ifdef USE_VV
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1514 PurpleMediaCodecPrivate *priv;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1515
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1516 g_return_if_fail(codec != NULL && param != NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1517
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1518 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1519
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1520 g_free(param->key);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1521 g_free(param->value);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1522 g_free(param);
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1523
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1524 priv->optional_params =
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1525 g_list_remove(priv->optional_params, param);
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1526 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1527 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1528
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1529 PurpleKeyValuePair *
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1530 purple_media_codec_get_optional_parameter(PurpleMediaCodec *codec,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1531 const gchar *name, const gchar *value)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1532 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1533 #ifdef USE_VV
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1534 PurpleMediaCodecPrivate *priv;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1535 GList *iter;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1536
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1537 g_return_val_if_fail(codec != NULL, NULL);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1538 g_return_val_if_fail(name != NULL, NULL);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1539
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1540 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1541
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1542 for (iter = priv->optional_params; iter; iter = g_list_next(iter)) {
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1543 PurpleKeyValuePair *param = iter->data;
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1544 if (!g_ascii_strcasecmp(param->key, name) &&
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1545 (value == NULL ||
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1546 !g_ascii_strcasecmp(param->value, value)))
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1547 return param;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1548 }
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1549 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1550
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1551 return NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1552 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1553
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1554 PurpleMediaCodec *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1555 purple_media_codec_new(int id, const char *encoding_name,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1556 PurpleMediaSessionType media_type, guint clock_rate)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1557 {
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1558 PurpleMediaCodec *codec =
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1559 g_object_new(PURPLE_TYPE_MEDIA_CODEC,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1560 "id", id,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1561 "encoding_name", encoding_name,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1562 "media_type", media_type,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1563 "clock-rate", clock_rate, NULL);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1564 return codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1565 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1566
26315
c0499eb4dd4d Disapprove part of the revision that shouldn't be there.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26314
diff changeset
1567 static PurpleMediaCodec *
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1568 purple_media_codec_copy(PurpleMediaCodec *codec)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1569 {
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1570 #ifdef USE_VV
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1571 PurpleMediaCodecPrivate *priv;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1572 PurpleMediaCodec *new_codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1573 GList *iter;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1574
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1575 if (codec == NULL)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1576 return NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1577
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1578 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1579
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1580 new_codec = purple_media_codec_new(priv->id, priv->encoding_name,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1581 priv->media_type, priv->clock_rate);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1582 g_object_set(codec, "channels", priv->channels, NULL);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1583
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1584 for (iter = priv->optional_params; iter; iter = g_list_next(iter)) {
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1585 PurpleKeyValuePair *param =
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1586 (PurpleKeyValuePair*)iter->data;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1587 purple_media_codec_add_optional_parameter(new_codec,
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1588 param->key, param->value);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1589 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1590
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1591 return new_codec;
26425
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1592 #else
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1593 return NULL;
90c65a8575bf Make it compile with --disable-vv... again!
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26407
diff changeset
1594 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1595 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1596
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
1597 #ifdef USE_VV
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1598 static FsCodec *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1599 purple_media_codec_to_fs(const PurpleMediaCodec *codec)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1600 {
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1601 PurpleMediaCodecPrivate *priv;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1602 FsCodec *new_codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1603 GList *iter;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1604
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1605 if (codec == NULL)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1606 return NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1607
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1608 priv = PURPLE_MEDIA_CODEC_GET_PRIVATE(codec);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1609
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1610 new_codec = fs_codec_new(priv->id, priv->encoding_name,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1611 purple_media_to_fs_media_type(priv->media_type),
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1612 priv->clock_rate);
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1613 new_codec->channels = priv->channels;
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1614
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1615 for (iter = priv->optional_params; iter; iter = g_list_next(iter)) {
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1616 PurpleKeyValuePair *param = (PurpleKeyValuePair*)iter->data;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1617 fs_codec_add_optional_parameter(new_codec,
26403
f0de2405c2f1 Use PurpleMediaKeyPair. Remove PurpleMediaCodecParameter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26399
diff changeset
1618 param->key, param->value);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1619 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1620
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1621 return new_codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1622 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1623
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1624 static PurpleMediaCodec *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1625 purple_media_codec_from_fs(const FsCodec *codec)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1626 {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1627 PurpleMediaCodec *new_codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1628 GList *iter;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1629
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1630 if (codec == NULL)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1631 return NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1632
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1633 new_codec = purple_media_codec_new(codec->id, codec->encoding_name,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1634 purple_media_from_fs(codec->media_type,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1635 FS_DIRECTION_BOTH), codec->clock_rate);
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1636 g_object_set(new_codec, "channels", codec->channels, NULL);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1637
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1638 for (iter = codec->optional_params; iter; iter = g_list_next(iter)) {
26027
5275c7ef9edf Manipulate optional parameters properly.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26026
diff changeset
1639 FsCodecParameter *param = (FsCodecParameter*)iter->data;
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1640 purple_media_codec_add_optional_parameter(new_codec,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1641 param->name, param->value);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1642 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1643
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1644 return new_codec;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1645 }
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
1646 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1647
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1648 gchar *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1649 purple_media_codec_to_string(const PurpleMediaCodec *codec)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1650 {
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
1651 #ifdef USE_VV
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1652 FsCodec *fscodec = purple_media_codec_to_fs(codec);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1653 gchar *str = fs_codec_to_string(fscodec);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1654 fs_codec_destroy(fscodec);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1655 return str;
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
1656 #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
1657 return g_strdup("");
064657db29c4 Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26349
diff changeset
1658 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1659 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1660
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
1661 #ifdef USE_VV
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1662 static GList *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1663 purple_media_codec_list_from_fs(GList *codecs)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1664 {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1665 GList *new_list = NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1666
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1667 for (; codecs; codecs = g_list_next(codecs)) {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1668 new_list = g_list_prepend(new_list,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1669 purple_media_codec_from_fs(
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1670 codecs->data));
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1671 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1672
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1673 new_list = g_list_reverse(new_list);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1674 return new_list;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1675 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1676
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1677 static GList *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1678 purple_media_codec_list_to_fs(GList *codecs)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1679 {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1680 GList *new_list = NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1681
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1682 for (; codecs; codecs = g_list_next(codecs)) {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1683 new_list = g_list_prepend(new_list,
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1684 purple_media_codec_to_fs(
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1685 codecs->data));
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1686 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1687
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1688 new_list = g_list_reverse(new_list);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1689 return new_list;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1690 }
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
1691 #endif
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1692
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1693 GList *
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1694 purple_media_codec_list_copy(GList *codecs)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1695 {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1696 GList *new_list = NULL;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1697
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1698 for (; codecs; codecs = g_list_next(codecs)) {
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1699 new_list = g_list_prepend(new_list,
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1700 purple_media_codec_copy(codecs->data));
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1701 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1702
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1703 new_list = g_list_reverse(new_list);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1704 return new_list;
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1705 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1706
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1707 void
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1708 purple_media_codec_list_free(GList *codecs)
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1709 {
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1710 for (; codecs; codecs =
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1711 g_list_delete_link(codecs, codecs)) {
26404
217574ec2a34 Hide and gobjectify PurpleMediaCodec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26403
diff changeset
1712 g_object_unref(codecs->data);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1713 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1714 }
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
1715
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
1716 #ifdef USE_VV
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
1717 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
1718 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
1719 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1720 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
1721 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
1722 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
1723 }
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
1724
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
1725 static FsParticipant*
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
1726 purple_media_get_participant(PurpleMedia *media, const gchar *name)
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
1727 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1728 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
1729 return (FsParticipant*) (media->priv->participants) ?
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
1730 g_hash_table_lookup(media->priv->participants, name) : 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
1731 }
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
1732
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1733 static PurpleMediaStream*
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1734 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
1735 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1736 GList *streams;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1737
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1738 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
1739
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1740 streams = media->priv->streams;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1741
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1742 for (; streams; streams = g_list_next(streams)) {
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1743 PurpleMediaStream *stream = streams->data;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1744 if (!strcmp(stream->session->id, session) &&
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1745 !strcmp(stream->participant, participant))
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
1746 return stream;
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1747 }
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1748
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1749 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
1750 }
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
1751
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1752 static GList *
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1753 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
1754 const gchar *participant)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1755 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1756 GList *streams;
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1757 GList *ret = NULL;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1758
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1759 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
1760
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1761 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
1762
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1763 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
1764 PurpleMediaStream *stream = streams->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1765 if ((session == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1766 !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
1767 (participant == NULL ||
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1768 !strcmp(stream->participant, participant)))
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1769 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
1770 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1771
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1772 return ret;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1773 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
1774
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
1775 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
1776 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
1777 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1778 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
1779 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
1780
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
1781 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
1782 purple_debug_info("media", "Creating hash table for sessions\n");
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
1783 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal);
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
1784 }
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
1785 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
1786 }
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
1787
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1788 static gboolean
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1789 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1790 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1791 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
1792 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
1793 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1794
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
1795 static FsParticipant *
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
1796 purple_media_add_participant(PurpleMedia *media, const gchar *name)
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
1797 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1798 FsParticipant *participant;
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1799 GError *err = 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
1800
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1801 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
1802
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1803 participant = purple_media_get_participant(media, name);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1804
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
1805 if (participant)
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
1806 return participant;
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
1807
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1808 participant = fs_conference_new_participant(media->priv->conference,
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1809 (gchar*)name, &err);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1810
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1811 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1812 purple_debug_error("media", "Error creating participant: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1813 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1814 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1815 return NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1816 }
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
1817
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
1818 if (!media->priv->participants) {
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
1819 purple_debug_info("media", "Creating hash table for participants\n");
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1820 media->priv->participants = g_hash_table_new_full(g_str_hash,
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
1821 g_str_equal, 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
1822 }
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
1823
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
1824 g_hash_table_insert(media->priv->participants, g_strdup(name), participant);
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
1825
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
1826 return participant;
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
1827 }
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
1828
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1829 static PurpleMediaStream *
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
1830 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
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
1831 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1832 PurpleMediaStream *media_stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1833
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1834 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
1835
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1836 media_stream = g_new0(PurpleMediaStream, 1);
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1837 media_stream->stream = stream;
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1838 media_stream->participant = g_strdup(name);
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1839 media_stream->session = session;
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
1840
24962
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1841 session->media->priv->streams =
aa50b1f05145 Added PurpleMediaStream to wrap FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24960
diff changeset
1842 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
1843
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
1844 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
1845 }
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
1846
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
1847 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
1848 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
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
1849 FsCandidate *candidate)
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
1850 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1851 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1852
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1853 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
1854
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1855 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
1856 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
1857 }
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
1858 #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
1859
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
1860 GList *
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
1861 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
1862 {
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
1863 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1864 g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
26126
23816d2e380f Silence assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26122
diff changeset
1865 return media->priv->sessions != NULL ?
23816d2e380f Silence assertion.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26122
diff changeset
1866 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
1867 #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
1868 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
1869 #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
1870 }
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
1871
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
1872 #ifdef USE_VV
26332
89002b47a0df Remove purple_media_set_src/sink from the public API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26331
diff changeset
1873 static 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
1874 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
1875 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1876 PurpleMediaSession *session;
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
1877 GstPad *sinkpad;
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
1878 GstPad *srcpad;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1879
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1880 g_return_if_fail(PURPLE_IS_MEDIA(media));
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
1881 g_return_if_fail(GST_IS_ELEMENT(src));
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1882
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1883 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
1884
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1885 if (session == NULL) {
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1886 purple_debug_warning("media", "purple_media_set_src: trying"
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1887 " to set src on non-existent session\n");
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1888 return;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1889 }
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1890
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
1891 if (session->src)
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
1892 gst_object_unref(session->src);
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
1893 session->src = src;
26306
5906409c4b69 Fix some GStreamer timing issues.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26305
diff changeset
1894 gst_element_set_locked_state(session->src, TRUE);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
1895
26115
9b0761b77218 Handle the session tee in the session rather than the src bin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
1896 session->tee = gst_element_factory_make("tee", NULL);
9b0761b77218 Handle the session tee in the session rather than the src bin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
1897 gst_bin_add(GST_BIN(session->media->priv->confbin), session->tee);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1898
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1899 /* This supposedly isn't necessary, but it silences some warnings */
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1900 if (GST_ELEMENT_PARENT(session->media->priv->confbin)
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1901 == GST_ELEMENT_PARENT(session->src)) {
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1902 GstPad *pad = gst_element_get_static_pad(session->tee, "sink");
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1903 GstPad *ghost = gst_ghost_pad_new(NULL, pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1904 gst_object_unref(pad);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1905 gst_pad_set_active(ghost, TRUE);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1906 gst_element_add_pad(session->media->priv->confbin, ghost);
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1907 }
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1908
27885
f77978e6968e Let's keep this working right.
maiku@pidgin.im
parents: 27884
diff changeset
1909 gst_element_set_state(session->tee, GST_STATE_PLAYING);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1910 gst_element_link(session->src, session->media->priv->confbin);
26115
9b0761b77218 Handle the session tee in the session rather than the src bin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26114
diff changeset
1911
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
1912 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1913 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1914 gchar *name = g_strdup_printf("volume_%s", session->id);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1915 GstElement *level;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1916 GstElement *volume = gst_element_factory_make("volume", name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1917 double input_volume = purple_prefs_get_int(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1918 "/purple/media/audio/volume/input")/10.0;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1919 g_free(name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1920 name = g_strdup_printf("sendlevel_%s", session->id);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1921 level = gst_element_factory_make("level", name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1922 g_free(name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1923 gst_bin_add(GST_BIN(session->media->priv->confbin), volume);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1924 gst_bin_add(GST_BIN(session->media->priv->confbin), level);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1925 gst_element_set_state(level, GST_STATE_PLAYING);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1926 gst_element_set_state(volume, GST_STATE_PLAYING);
27885
f77978e6968e Let's keep this working right.
maiku@pidgin.im
parents: 27884
diff changeset
1927 gst_element_link(volume, level);
f77978e6968e Let's keep this working right.
maiku@pidgin.im
parents: 27884
diff changeset
1928 gst_element_link(session->tee, volume);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1929 srcpad = gst_element_get_static_pad(level, "src");
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1930 g_object_set(volume, "volume", input_volume, NULL);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1931 } else {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1932 srcpad = gst_element_get_request_pad(session->tee, "src%d");
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1933 }
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
1934 purple_debug_info("media", "connecting pad: %s\n",
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
1935 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
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
1936 ? "success" : "failure");
26306
5906409c4b69 Fix some GStreamer timing issues.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26305
diff changeset
1937 gst_element_set_locked_state(session->src, FALSE);
26381
6bcf5ad967ea Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26372
diff changeset
1938 gst_object_unref(session->src);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
1939 }
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
1940 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
1941
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
1942 #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
1943 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
1944 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
1945 {
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
1946 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1947 PurpleMediaSession *session;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1948 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
1949 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
1950 return (session != NULL) ? session->src : 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
1951 #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
1952 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
1953 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
1954 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
1955 #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
1956
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
1957 #ifdef USE_VV
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1958 static PurpleMediaSession *
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1959 purple_media_session_from_fs_stream(PurpleMedia *media, FsStream *stream)
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1960 {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1961 FsSession *fssession;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1962 GList *values;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1963
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1964 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
1965 g_return_val_if_fail(FS_IS_STREAM(stream), NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
1966
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1967 g_object_get(stream, "session", &fssession, NULL);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1968
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1969 values = g_hash_table_get_values(media->priv->sessions);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1970
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1971 for (; values; values = g_list_delete_link(values, values)) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1972 PurpleMediaSession *session = values->data;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1973
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1974 if (session->session == fssession) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1975 g_list_free(values);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1976 g_object_unref(fssession);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1977 return session;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1978 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1979 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1980
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1981 g_object_unref(fssession);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1982 return NULL;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1983 }
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
1984
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
1985 static gboolean
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
1986 media_bus_call(GstBus *bus, GstMessage *msg, PurpleMedia *media)
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
1987 {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
1988 switch(GST_MESSAGE_TYPE(msg)) {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
1989 case GST_MESSAGE_ELEMENT: {
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1990 if (g_signal_has_handler_pending(media,
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1991 purple_media_signals[LEVEL], 0, FALSE)
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1992 && gst_structure_has_name(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1993 gst_message_get_structure(msg), "level")) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1994 GstElement *src = GST_ELEMENT(GST_MESSAGE_SRC(msg));
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1995 gchar *name;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1996 gchar *participant = NULL;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1997 PurpleMediaSession *session = NULL;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1998 gdouble rms_db;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
1999 gdouble percent;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2000 const GValue *list;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2001 const GValue *value;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2002
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2003 if (!PURPLE_IS_MEDIA(media) ||
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2004 GST_ELEMENT_PARENT(src) !=
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2005 media->priv->confbin)
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2006 break;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2007
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2008 name = gst_element_get_name(src);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2009 if (!strncmp(name, "sendlevel_", 10)) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2010 session = purple_media_get_session(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2011 media, name+10);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2012 } else {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2013 GList *iter = media->priv->streams;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2014 for (; iter; iter = g_list_next(iter)) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2015 PurpleMediaStream *stream = iter->data;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2016 if (stream->level == src) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2017 session = stream->session;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2018 participant = stream->participant;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2019 break;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2020 }
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2021 }
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2022 }
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2023 g_free(name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2024 if (!session)
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2025 break;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2026
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2027 list = gst_structure_get_value(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2028 gst_message_get_structure(msg), "rms");
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2029 value = gst_value_list_get_value(list, 0);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2030 rms_db = g_value_get_double(value);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2031 percent = pow(10, rms_db / 20) * 5;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2032 if(percent > 1.0)
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2033 percent = 1.0;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2034
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2035 g_signal_emit(media, purple_media_signals[LEVEL],
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2036 0, session->id, participant, percent);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2037 break;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2038 }
26114
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
2039 if (!FS_IS_CONFERENCE(GST_MESSAGE_SRC(msg)) ||
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
2040 !PURPLE_IS_MEDIA(media) ||
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
2041 media->priv->conference !=
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
2042 FS_CONFERENCE(GST_MESSAGE_SRC(msg)))
730e760ca39f Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26109
diff changeset
2043 break;
26070
7be8c88d630c Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26064
diff changeset
2044
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2045 if (gst_structure_has_name(msg->structure, "farsight-error")) {
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2046 FsError error_no;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2047 gst_structure_get_enum(msg->structure, "error-no",
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2048 FS_TYPE_ERROR, (gint*)&error_no);
28104
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2049 switch (error_no) {
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2050 case FS_ERROR_NO_CODECS:
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2051 purple_media_error(media, _("No codecs found. Install some GStreamer codecs found in GStreamer plugins packages."));
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2052 purple_media_end(media, NULL, NULL);
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2053 break;
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2054 case FS_ERROR_NO_CODECS_LEFT:
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2055 purple_media_error(media, _("No codecs left. Your codec preferences in fs-codecs.conf are too strict."));
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2056 purple_media_end(media, NULL, NULL);
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2057 break;
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2058 case FS_ERROR_UNKNOWN_CNAME:
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2059 /*
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2060 * Unknown CName is only a problem for the
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2061 * multicast transmitter which isn't used.
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2062 * It is also deprecated.
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2063 */
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2064 break;
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2065 default:
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2066 purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2067 gst_structure_get_string(msg->structure, "error-msg"));
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2068 break;
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2069 }
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2070
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2071 if (FS_ERROR_IS_FATAL(error_no)) {
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2072 purple_media_error(media, _("A non-recoverable Farsight2 error has occurred."));
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2073 purple_media_end(media, NULL, NULL);
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2074 }
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2075 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2076 "farsight-new-local-candidate")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2077 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2078 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "candidate"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2079 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2080 purple_media_new_local_candidate_cb(stream, local_candidate, session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2081 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2082 "farsight-local-candidates-prepared")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2083 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2084 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2085 purple_media_candidates_prepared_cb(stream, session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2086 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2087 "farsight-new-active-candidate-pair")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2088 FsStream *stream = g_value_get_object(gst_structure_get_value(msg->structure, "stream"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2089 FsCandidate *local_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "local-candidate"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2090 FsCandidate *remote_candidate = g_value_get_boxed(gst_structure_get_value(msg->structure, "remote-candidate"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2091 PurpleMediaSession *session = purple_media_session_from_fs_stream(media, stream);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2092 purple_media_candidate_pair_established_cb(stream, local_candidate, remote_candidate, session);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2093 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2094 "farsight-recv-codecs-changed")) {
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2095 GList *codecs = g_value_get_boxed(gst_structure_get_value(msg->structure, "codecs"));
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2096 FsCodec *codec = codecs->data;
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2097 purple_debug_info("media", "farsight-recv-codecs-changed: %s\n", codec->encoding_name);
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2098
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2099 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2100 "farsight-component-state-changed")) {
26091
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2101 FsStreamState fsstate = g_value_get_enum(gst_structure_get_value(msg->structure, "state"));
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2102 guint component = g_value_get_uint(gst_structure_get_value(msg->structure, "component"));
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2103 const gchar *state;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2104 switch (fsstate) {
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2105 case FS_STREAM_STATE_FAILED:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2106 state = "FAILED";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2107 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2108 case FS_STREAM_STATE_DISCONNECTED:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2109 state = "DISCONNECTED";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2110 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2111 case FS_STREAM_STATE_GATHERING:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2112 state = "GATHERING";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2113 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2114 case FS_STREAM_STATE_CONNECTING:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2115 state = "CONNECTING";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2116 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2117 case FS_STREAM_STATE_CONNECTED:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2118 state = "CONNECTED";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2119 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2120 case FS_STREAM_STATE_READY:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2121 state = "READY";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2122 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2123 default:
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2124 state = "UNKNOWN";
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2125 break;
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2126 }
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2127 purple_debug_info("media", "farsight-component-state-changed: component: %u state: %s\n", component, state);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2128 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2129 "farsight-send-codec-changed")) {
26091
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2130 FsCodec *codec = g_value_get_boxed(gst_structure_get_value(msg->structure, "codec"));
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2131 gchar *codec_str = fs_codec_to_string(codec);
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2132 purple_debug_info("media", "farsight-send-codec-changed: codec: %s\n", codec_str);
58071d9f10b1 Add some debug messages for the remaining Farsight signals.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26090
diff changeset
2133 g_free(codec_str);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2134 } else if (gst_structure_has_name(msg->structure,
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2135 "farsight-codecs-changed")) {
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
2136 GList *sessions = g_hash_table_get_values(PURPLE_MEDIA(media)->priv->sessions);
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
2137 FsSession *fssession = g_value_get_object(gst_structure_get_value(msg->structure, "session"));
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
2138 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
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
2139 PurpleMediaSession *session = sessions->data;
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
2140 if (session->session == fssession) {
26316
bd9fa96c47dc Remove the ready-new signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26314
diff changeset
2141 gchar *session_id = g_strdup(session->id);
26059
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
2142 g_signal_emit(media, purple_media_signals[CODECS_CHANGED], 0, session_id);
1ff5304f6e9d Added codecs-changed signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26058
diff changeset
2143 g_free(session_id);
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
2144 g_list_free(sessions);
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
2145 break;
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
2146 }
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
2147 }
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2148 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2149 break;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2150 }
28078
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2151 case GST_MESSAGE_ERROR: {
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2152 GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(msg));
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2153 GstElement *lastElement = NULL;
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2154 while (!GST_IS_PIPELINE(element)) {
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2155 if (element == media->priv->confbin) {
28267
bb06f05c7159 I can't see why dots should be usefull here:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 28134
diff changeset
2156 purple_media_error(media, _("Conference error"));
28078
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2157 purple_media_end(media, NULL, NULL);
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2158 break;
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2159 }
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2160 lastElement = element;
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2161 element = GST_ELEMENT_PARENT(element);
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2162 }
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2163 if (GST_IS_PIPELINE(element)) {
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2164 GList *sessions = g_hash_table_get_values(media->priv->sessions);
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2165 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2166 PurpleMediaSession *session = sessions->data;
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2167
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2168 if (session->src == lastElement) {
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2169 if (session->type & PURPLE_MEDIA_AUDIO)
28267
bb06f05c7159 I can't see why dots should be usefull here:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 28134
diff changeset
2170 purple_media_error(media, _("Error with your microphone"));
28078
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2171 else
28267
bb06f05c7159 I can't see why dots should be usefull here:
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 28134
diff changeset
2172 purple_media_error(media, _("Error with your webcam"));
28078
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2173 purple_media_end(media, NULL, NULL);
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2174 break;
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2175 }
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2176 }
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2177 g_list_free(sessions);
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2178 }
afa79877d972 Detect that there has been an error in the GStreamer pipeline, output an
maiku@pidgin.im
parents: 28050
diff changeset
2179 }
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2180 default:
23914
d6bda7b63eac Remove a bunch of extraneous GstBus messages from the debug output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23913
diff changeset
2181 break;
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2182 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2183
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2184 return TRUE;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2185 }
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
2186 #endif
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
2187
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
2188 PurpleAccount *
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
2189 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
2190 {
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
2191 #ifdef USE_VV
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26425
diff changeset
2192 PurpleAccount *account;
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
2193 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
2194 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
2195 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
2196 #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
2197 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
2198 #endif
26121
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
2199 }
7738f530a967 Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26118
diff changeset
2200
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2201 gpointer
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2202 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
2203 {
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
2204 #ifdef USE_VV
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2205 gpointer prpl_data;
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2206 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
2207 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
2208 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
2209 #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
2210 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
2211 #endif
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2212 }
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2213
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2214 void
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2215 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
2216 {
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
2217 #ifdef USE_VV
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2218 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
2219 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
2220 #endif
26122
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2221 }
e411aad4346b Add a prpl-data property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26121
diff changeset
2222
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
2223 void
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2224 purple_media_error(PurpleMedia *media, const gchar *error, ...)
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2225 {
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
2226 #ifdef USE_VV
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2227 va_list args;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2228 gchar *message;
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2229
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2230 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
2231
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2232 va_start(args, error);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2233 message = g_strdup_vprintf(error, args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2234 va_end(args);
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2235
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2236 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
2237 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
2238
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2239 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
2240 #endif
24982
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2241 }
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2242
0ad1b8e950d7 Add purple_media_error.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24981
diff changeset
2243 void
26058
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
2244 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
2245 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
2246 {
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
2247 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2248 g_return_if_fail(PURPLE_IS_MEDIA(media));
26063
685c8f5f85c7 Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26061
diff changeset
2249 if (session_id == NULL && participant == NULL) {
26058
ac56e5707a72 Added purple_media_end and removed the purple_media_got_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26057
diff changeset
2250 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
2251 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
2252 NULL, NULL);
26063
685c8f5f85c7 Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26061
diff changeset
2253 g_object_unref(media);
685c8f5f85c7 Separate PidginMedia from PidginConversation.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26061
diff changeset
2254 }
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
2255 #endif
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
2256 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
2257
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2258 void
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2259 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
2260 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
2261 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
2262 {
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2263 #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
2264 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
2265
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2266 if (type == PURPLE_MEDIA_INFO_ACCEPT) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2267 GList *streams;
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2268
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2269 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
2270
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2271 streams = purple_media_get_streams(media,
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2272 session_id, participant);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2273
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2274 for (; streams; streams =
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2275 g_list_delete_link(streams, streams)) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2276 PurpleMediaStream *stream = streams->data;
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2277 g_object_set(G_OBJECT(stream->stream), "direction",
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2278 purple_media_to_fs_stream_direction(
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2279 stream->session->type), NULL);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2280 stream->accepted = TRUE;
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2281
28532
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2282 if (stream->remote_candidates != NULL &&
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2283 stream->initiator == FALSE) {
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2284 GError *err = NULL;
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2285 fs_stream_set_remote_candidates(stream->stream,
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2286 stream->remote_candidates, &err);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2287
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2288 if (err) {
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2289 purple_debug_error("media", "Error adding remote"
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2290 " candidates: %s\n", err->message);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2291 g_error_free(err);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2292 }
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2293 }
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2294 }
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2295 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_MUTE ||
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2296 type == PURPLE_MEDIA_INFO_UNMUTE)) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2297 GList *sessions;
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2298 gboolean active = (type == PURPLE_MEDIA_INFO_MUTE);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2299
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2300 g_return_if_fail(PURPLE_IS_MEDIA(media));
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2301
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2302 if (session_id == NULL)
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2303 sessions = g_hash_table_get_values(
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2304 media->priv->sessions);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2305 else
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2306 sessions = g_list_prepend(NULL,
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2307 purple_media_get_session(
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2308 media, session_id));
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2309
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2310 purple_debug_info("media", "Turning mute %s\n",
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2311 active ? "on" : "off");
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2312
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2313 for (; sessions; sessions = g_list_delete_link(
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2314 sessions, sessions)) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2315 PurpleMediaSession *session = sessions->data;
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2316 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2317 gchar *name = g_strdup_printf("volume_%s",
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2318 session->id);
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2319 GstElement *volume = gst_bin_get_by_name(
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2320 GST_BIN(session->media->
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2321 priv->confbin), name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2322 g_free(name);
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2323 g_object_set(volume, "mute", active, NULL);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2324 }
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2325 }
27857
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2326 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_PAUSE ||
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2327 type == PURPLE_MEDIA_INFO_UNPAUSE)) {
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2328 gboolean active = (type == PURPLE_MEDIA_INFO_PAUSE);
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2329 GList *streams = purple_media_get_streams(media,
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2330 session_id, participant);
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2331 for (; streams; streams = g_list_delete_link(streams, streams)) {
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2332 PurpleMediaStream *stream = streams->data;
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2333 if (stream->session->type & PURPLE_MEDIA_SEND_VIDEO) {
28400
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2334 stream->paused = active;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2335
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2336 if (!stream->held)
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2337 g_object_set(stream->stream, "direction",
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2338 purple_media_to_fs_stream_direction(
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2339 stream->session->type & ((active) ?
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2340 ~PURPLE_MEDIA_SEND_VIDEO :
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2341 PURPLE_MEDIA_VIDEO)), NULL);
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2342 }
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2343 }
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2344 } else if (local == TRUE && (type == PURPLE_MEDIA_INFO_HOLD ||
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2345 type == PURPLE_MEDIA_INFO_UNHOLD)) {
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2346 GList *streams;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2347 gboolean active = (type == PURPLE_MEDIA_INFO_HOLD);
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2348
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2349 g_return_if_fail(PURPLE_IS_MEDIA(media));
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2350
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2351 streams = purple_media_get_streams(media,
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2352 session_id, participant);
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2353 for (; streams; streams = g_list_delete_link(streams, streams)) {
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2354 PurpleMediaStream *stream = streams->data;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2355 stream->held = active;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2356 if (stream->session->type & PURPLE_MEDIA_VIDEO) {
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2357 FsStreamDirection direction;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2358
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2359 direction = ((active) ?
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2360 ~PURPLE_MEDIA_VIDEO :
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2361 PURPLE_MEDIA_VIDEO);
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2362 if (!active && stream->paused)
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2363 direction &= ~PURPLE_MEDIA_SEND_VIDEO;
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2364
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2365 g_object_set(stream->stream, "direction",
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2366 purple_media_to_fs_stream_direction(
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2367 stream->session->type & direction), NULL);
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2368 } else if (stream->session->type & PURPLE_MEDIA_AUDIO) {
27857
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2369 g_object_set(stream->stream, "direction",
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2370 purple_media_to_fs_stream_direction(
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2371 stream->session->type & ((active) ?
28400
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2372 ~PURPLE_MEDIA_AUDIO :
2c4a3703324b Actually emit the PURPLE_MEDIA_INFO_{,UN}HOLD signals.
maiku@pidgin.im
parents: 28399
diff changeset
2373 PURPLE_MEDIA_AUDIO)), NULL);
27857
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2374 }
c1687897825f Add pause capability for local video.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27849
diff changeset
2375 }
26368
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2376 }
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2377
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2378 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
2379 0, type, session_id, participant, local);
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2380
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2381 if (type == PURPLE_MEDIA_INFO_HANGUP ||
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2382 type == PURPLE_MEDIA_INFO_REJECT) {
aab0195f997d Move functionality into purple_media_stream_info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26367
diff changeset
2383 purple_media_end(media, session_id, participant);
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2384 }
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2385 #endif
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2386 }
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26360
diff changeset
2387
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
2388 #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
2389 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2390 purple_media_new_local_candidate_cb(FsStream *stream,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2391 FsCandidate *local_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2392 PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2393 {
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
2394 gchar *name;
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
2395 FsParticipant *participant;
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
2396 PurpleMediaCandidate *candidate;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2397
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2398 g_return_if_fail(FS_IS_STREAM(stream));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2399 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
2400
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2401 purple_debug_info("media", "got new local candidate: %s\n", local_candidate->foundation);
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
2402 g_object_get(stream, "participant", &participant, 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
2403 g_object_get(participant, "cname", &name, 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
2404 g_object_unref(participant);
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
2405
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
2406 purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate));
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
2407
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
2408 candidate = purple_media_candidate_from_fs(local_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
2409 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
2410 0, session->id, name, candidate);
26406
2d332d327a0e Hide and GObjectify PurpleMediaCandidate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26404
diff changeset
2411 g_object_unref(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
2412
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
2413 g_free(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
2414 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2415
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2416 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2417 purple_media_candidates_prepared_cb(FsStream *stream, PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2418 {
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
2419 gchar *name;
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
2420 FsParticipant *participant;
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2421 PurpleMediaStream *stream_data;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2422
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2423 g_return_if_fail(FS_IS_STREAM(stream));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2424 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
2425
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
2426 g_object_get(stream, "participant", &participant, 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
2427 g_object_get(participant, "cname", &name, 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
2428 g_object_unref(participant);
24989
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2429
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2430 stream_data = purple_media_get_stream(session->media, session->id, name);
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2431 stream_data->candidates_prepared = TRUE;
7caa7e2ce870 Implement a new ready signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24987
diff changeset
2432
26298
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
2433 g_signal_emit(session->media,
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
2434 purple_media_signals[CANDIDATES_PREPARED],
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
2435 0, session->id, name);
b892b3cb9dbc Add candidates-prepared signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26292
diff changeset
2436
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
2437 g_free(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
2438 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2439
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2440 /* 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
2441 * 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
2442 static void
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2443 purple_media_candidate_pair_established_cb(FsStream *fsstream,
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2444 FsCandidate *native_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2445 FsCandidate *remote_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
2446 PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2447 {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2448 gchar *name;
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2449 FsParticipant *participant;
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2450 PurpleMediaStream *stream;
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2451 GList *iter;
23877
c48f5c9600c3 Fixed a ton of memory leaks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23876
diff changeset
2452
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2453 g_return_if_fail(FS_IS_STREAM(fsstream));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2454 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
2455
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2456 g_object_get(fsstream, "participant", &participant, NULL);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2457 g_object_get(participant, "cname", &name, NULL);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2458 g_object_unref(participant);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2459
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2460 stream = purple_media_get_stream(session->media, session->id, name);
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2461
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2462 iter = stream->active_local_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2463 for(; iter; iter = g_list_next(iter)) {
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2464 FsCandidate *c = iter->data;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2465 if (native_candidate->component_id == c->component_id) {
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2466 fs_candidate_destroy(c);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2467 stream->active_local_candidates =
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2468 g_list_delete_link(iter, iter);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2469 stream->active_local_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2470 stream->active_local_candidates,
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2471 fs_candidate_copy(native_candidate));
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2472 break;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2473 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2474 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2475 if (iter == NULL)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2476 stream->active_local_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2477 stream->active_local_candidates,
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2478 fs_candidate_copy(native_candidate));
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2479
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2480 iter = stream->active_remote_candidates;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2481 for(; iter; iter = g_list_next(iter)) {
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2482 FsCandidate *c = iter->data;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2483 if (native_candidate->component_id == c->component_id) {
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2484 fs_candidate_destroy(c);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2485 stream->active_remote_candidates =
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2486 g_list_delete_link(iter, iter);
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2487 stream->active_remote_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2488 stream->active_remote_candidates,
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2489 fs_candidate_copy(remote_candidate));
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2490 break;
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2491 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2492 }
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2493 if (iter == NULL)
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2494 stream->active_remote_candidates = g_list_prepend(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2495 stream->active_remote_candidates,
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2496 fs_candidate_copy(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
2497
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2498 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
2499 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2500
26026
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2501 static gboolean
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2502 purple_media_connected_cb(PurpleMediaStream *stream)
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2503 {
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2504 g_return_val_if_fail(stream != NULL, FALSE);
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
2505
26118
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
2506 stream->connected_cb_id = 0;
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
2507
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
2508 purple_media_manager_create_output_window(
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
2509 stream->session->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
2510 stream->session->media,
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
2511 stream->session->id, stream->participant);
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
2512
26026
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2513 g_signal_emit(stream->session->media,
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2514 purple_media_signals[STATE_CHANGED],
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26327
diff changeset
2515 0, PURPLE_MEDIA_STATE_CONNECTED,
26026
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2516 stream->session->id, stream->participant);
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2517 return FALSE;
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2518 }
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2519
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2520 static void
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
2521 purple_media_src_pad_added_cb(FsStream *fsstream, GstPad *srcpad,
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
2522 FsCodec *codec, PurpleMediaStream *stream)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2523 {
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2524 PurpleMediaPrivate *priv;
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2525 GstPad *sinkpad;
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
2526
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2527 g_return_if_fail(FS_IS_STREAM(fsstream));
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2528 g_return_if_fail(stream != NULL);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2529
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2530 priv = stream->session->media->priv;
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2531
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2532 if (stream->src == NULL) {
26134
04b131c4481d Silence warning.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26129
diff changeset
2533 GstElement *sink = NULL;
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2534
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2535 if (codec->media_type == FS_MEDIA_TYPE_AUDIO) {
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2536 GstElement *queue = NULL;
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2537 double output_volume = purple_prefs_get_int(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2538 "/purple/media/audio/volume/output")/10.0;
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2539 /*
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2540 * Should this instead be:
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2541 * audioconvert ! audioresample ! liveadder !
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2542 * audioresample ! audioconvert ! realsink
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2543 */
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2544 queue = gst_element_factory_make("queue", NULL);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2545 stream->volume = gst_element_factory_make(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2546 "volume", NULL);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2547 g_object_set(stream->volume, "volume",
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2548 output_volume, NULL);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2549 stream->level = gst_element_factory_make(
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2550 "level", NULL);
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2551 stream->src = gst_element_factory_make(
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2552 "liveadder", NULL);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2553 sink = purple_media_manager_get_element(priv->manager,
26392
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26389
diff changeset
2554 PURPLE_MEDIA_RECV_AUDIO,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26389
diff changeset
2555 stream->session->media,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26389
diff changeset
2556 stream->session->id,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26389
diff changeset
2557 stream->participant);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2558 gst_bin_add(GST_BIN(priv->confbin), queue);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2559 gst_bin_add(GST_BIN(priv->confbin), stream->volume);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2560 gst_bin_add(GST_BIN(priv->confbin), stream->level);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2561 gst_bin_add(GST_BIN(priv->confbin), sink);
27882
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27857
diff changeset
2562 gst_element_set_state(sink, GST_STATE_PLAYING);
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27857
diff changeset
2563 gst_element_set_state(stream->level, GST_STATE_PLAYING);
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27857
diff changeset
2564 gst_element_set_state(stream->volume, GST_STATE_PLAYING);
27885
f77978e6968e Let's keep this working right.
maiku@pidgin.im
parents: 27884
diff changeset
2565 gst_element_set_state(queue, GST_STATE_PLAYING);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2566 gst_element_link(stream->level, sink);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2567 gst_element_link(stream->volume, stream->level);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2568 gst_element_link(queue, stream->volume);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2569 sink = queue;
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2570 } else if (codec->media_type == FS_MEDIA_TYPE_VIDEO) {
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2571 stream->src = gst_element_factory_make(
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2572 "fsfunnel", NULL);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2573 sink = gst_element_factory_make(
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2574 "fakesink", NULL);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2575 g_object_set(G_OBJECT(sink), "async", FALSE, NULL);
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2576 gst_bin_add(GST_BIN(priv->confbin), sink);
27885
f77978e6968e Let's keep this working right.
maiku@pidgin.im
parents: 27884
diff changeset
2577 gst_element_set_state(sink, GST_STATE_PLAYING);
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2578 }
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2579 stream->tee = gst_element_factory_make("tee", NULL);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2580 gst_bin_add_many(GST_BIN(priv->confbin),
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
2581 stream->src, stream->tee, NULL);
27882
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27857
diff changeset
2582 gst_element_set_state(stream->tee, GST_STATE_PLAYING);
d865064a3104 Switch around some GStreamer linking and state setting.
maiku@pidgin.im
parents: 27857
diff changeset
2583 gst_element_set_state(stream->src, GST_STATE_PLAYING);
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2584 gst_element_link_many(stream->src, stream->tee, sink, NULL);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2585 }
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2586
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2587 sinkpad = gst_element_get_request_pad(stream->src, "sink%d");
26026
71eee5468b9d Fix some crashes from printing debug messages on a separate thread.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26024
diff changeset
2588 gst_pad_link(srcpad, sinkpad);
26109
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2589 gst_object_unref(sinkpad);
fcfb7571515c Have all src_pads for a stream be funneled into the same stream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26107
diff changeset
2590
26118
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
2591 stream->connected_cb_id = purple_timeout_add(0,
0a6f1f796d21 Use purple_timeout_* instead of g_timeout_*.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26117
diff changeset
2592 (GSourceFunc)purple_media_connected_cb, stream);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2593 }
26997
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2594
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2595 static void
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2596 purple_media_element_added_cb(FsElementAddedNotifier *self,
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2597 GstBin *bin, GstElement *element, gpointer user_data)
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2598 {
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2599 /*
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2600 * Hack to make H264 work with Gmail video.
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2601 */
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2602 if (!strncmp(GST_ELEMENT_NAME(element), "x264", 4)) {
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2603 g_object_set(GST_OBJECT(element), "cabac", FALSE, NULL);
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2604 }
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2605 }
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
2606 #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
2607
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
2608 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
2609 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
2610 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
2611 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
2612 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
2613 {
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
2614 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2615 PurpleMediaSession *session;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2616 FsParticipant *participant = NULL;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2617 PurpleMediaStream *stream = NULL;
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
2618 FsMediaType media_type = purple_media_to_fs_media_type(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
2619 FsStreamDirection type_direction =
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
2620 purple_media_to_fs_stream_direction(type);
26305
189ac8d13103 Fix assertion stating FsRawUdpTransmitter doesn't have a relay-info
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26298
diff changeset
2621 gboolean is_nice = !strcmp(transmitter, "nice");
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2622
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2623 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
2624
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2625 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
2626
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
2627 if (!session) {
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2628 GError *err = NULL;
26999
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2629 GList *codec_conf = NULL, *iter = NULL;
24948
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2630 gchar *filename = NULL;
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
2631 PurpleMediaSessionType session_type;
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
2632 GstElement *src = 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
2633
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
2634 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
2635
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
2636 session->session = fs_conference_new_session(
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
2637 media->priv->conference, media_type, &err);
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2638
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2639 if (err != NULL) {
28104
f628e98e6dff Add some extra error strings just in case.
maiku@pidgin.im
parents: 28090
diff changeset
2640 purple_media_error(media, _("Error creating session: %s"), err->message);
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2641 g_error_free(err);
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
2642 g_free(session);
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2643 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2644 }
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2645
24948
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2646 filename = g_build_filename(purple_user_dir(), "fs-codec.conf", NULL);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2647 codec_conf = fs_codec_list_from_keyfile(filename, &err);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2648 g_free(filename);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2649
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2650 if (err != NULL) {
26090
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2651 if (err->code == 4)
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2652 purple_debug_info("media", "Couldn't read "
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2653 "fs-codec.conf: %s\n",
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2654 err->message);
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2655 else
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2656 purple_debug_error("media", "Error reading "
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2657 "fs-codec.conf: %s\n",
8a402c91fe6f Don't output an error if fs-codec.conf doesn't exist.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26084
diff changeset
2658 err->message);
24948
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2659 g_error_free(err);
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2660 }
78c3e991782a Use a key file for Farsight 2 codec configuration.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24938
diff changeset
2661
26999
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2662 /*
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2663 * Add SPEEX if the configuration file doesn't exist or
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2664 * there isn't a speex entry.
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2665 */
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2666 for (iter = codec_conf; iter; iter = g_list_next(iter)) {
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2667 FsCodec *codec = iter->data;
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2668 if (!g_ascii_strcasecmp(codec->encoding_name, "speex"))
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2669 break;
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2670 }
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2671
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2672 if (iter == NULL) {
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2673 codec_conf = g_list_prepend(codec_conf,
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2674 fs_codec_new(FS_CODEC_ID_ANY,
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2675 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2676 codec_conf = g_list_prepend(codec_conf,
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2677 fs_codec_new(FS_CODEC_ID_ANY,
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2678 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2679 }
5a4451b8fe29 Add speex as a default codec.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26997
diff changeset
2680
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2681 fs_session_set_codec_preferences(session->session, codec_conf, 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
2682
24980
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2683 /*
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2684 * Removes a 5-7 second delay before
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2685 * receiving the src-pad-added signal.
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2686 * Only works for non-multicast FsRtpSessions.
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2687 */
26305
189ac8d13103 Fix assertion stating FsRawUdpTransmitter doesn't have a relay-info
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26298
diff changeset
2688 if (is_nice || !strcmp(transmitter, "rawudp"))
24980
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2689 g_object_set(G_OBJECT(session->session),
bcbc62bb2496 Set no-rtcp-timeout to 0 only for nice and rawudp transmitters.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24979
diff changeset
2690 "no-rtcp-timeout", 0, NULL);
23826
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
2691
26997
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2692 /*
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2693 * Hack to make x264 work with Gmail video.
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2694 */
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2695 if (is_nice && !strcmp(sess_id, "google-video")) {
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2696 FsElementAddedNotifier *notifier =
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2697 fs_element_added_notifier_new();
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2698 g_signal_connect(G_OBJECT(notifier), "element-added",
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2699 G_CALLBACK(purple_media_element_added_cb),
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2700 stream);
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2701 fs_element_added_notifier_add(notifier,
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2702 GST_BIN(media->priv->conference));
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2703 }
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2704
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
2705 fs_codec_list_destroy(codec_conf);
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
2706
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
2707 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
2708 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
2709 session->type = type;
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
2710 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
2711
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
2712 purple_media_add_session(media, session);
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2713 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
2714 0, PURPLE_MEDIA_STATE_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2715 session->id, NULL);
26064
4f013819e4e3 Create the media srcs inside PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26063
diff changeset
2716
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2717 if (type_direction & FS_DIRECTION_SEND) {
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2718 session_type = purple_media_from_fs(media_type,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2719 FS_DIRECTION_SEND);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2720 src = purple_media_manager_get_element(
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2721 media->priv->manager, session_type,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2722 media, session->id, who);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2723 if (!GST_IS_ELEMENT(src)) {
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2724 purple_debug_error("media",
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2725 "Error creating src for session %s\n",
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2726 session->id);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2727 purple_media_end(media, session->id, NULL);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2728 return FALSE;
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2729 }
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2730
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2731 purple_media_set_src(media, session->id, src);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2732 gst_element_set_state(session->src, GST_STATE_PLAYING);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2733 purple_media_manager_create_output_window(
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2734 media->priv->manager,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2735 session->media,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
2736 session->id, 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
2737 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2738 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2739
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2740 if (!(participant = purple_media_add_participant(media, who))) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2741 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2742 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2743 return FALSE;
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2744 } else {
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2745 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
2746 0, PURPLE_MEDIA_STATE_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2747 NULL, who);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2748 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2749
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2750 stream = purple_media_get_stream(media, sess_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
2751
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2752 if (!stream) {
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2753 GError *err = NULL;
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2754 FsStream *fsstream = NULL;
26050
ae3d25465d0f Run an asynchronous DNS lookup for the STUN server IP (to set as a property
Marcus Lundblad <ml@update.uu.se>
parents: 26047
diff changeset
2755 const gchar *stun_ip = purple_network_get_stun_ip();
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2756 const gchar *turn_ip = purple_network_get_turn_ip();
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
2757
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2758 if (stun_ip || turn_ip) {
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2759 guint new_num_params =
26305
189ac8d13103 Fix assertion stating FsRawUdpTransmitter doesn't have a relay-info
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26298
diff changeset
2760 (stun_ip && is_nice) && turn_ip ?
189ac8d13103 Fix assertion stating FsRawUdpTransmitter doesn't have a relay-info
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26298
diff changeset
2761 num_params + 2 : num_params + 1;
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2762 guint next_param_index = num_params;
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2763 GParameter *param = g_new0(GParameter, new_num_params);
24933
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
2764 memcpy(param, params, sizeof(GParameter) * num_params);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
2765
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2766 if (stun_ip) {
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2767 purple_debug_info("media",
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2768 "setting property stun-ip on new stream: %s\n", stun_ip);
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
2769
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2770 param[next_param_index].name = "stun-ip";
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2771 g_value_init(&param[next_param_index].value, G_TYPE_STRING);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2772 g_value_set_string(&param[next_param_index].value, stun_ip);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2773 next_param_index++;
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2774 }
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
2775
26305
189ac8d13103 Fix assertion stating FsRawUdpTransmitter doesn't have a relay-info
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26298
diff changeset
2776 if (turn_ip && is_nice) {
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2777 GValueArray *relay_info = g_value_array_new(0);
26057
128a3175668e Removed a couple of warnings
Marcus Lundblad <ml@update.uu.se>
parents: 26056
diff changeset
2778 GValue value;
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2779 gint turn_port =
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2780 purple_prefs_get_int("/purple/network/turn_port");
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2781 const gchar *username =
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2782 purple_prefs_get_string("/purple/network/turn_username");
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2783 const gchar *password =
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2784 purple_prefs_get_string("/purple/network/turn_password");
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2785 GstStructure *turn_setup = gst_structure_new("relay-info",
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2786 "ip", G_TYPE_STRING, turn_ip,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2787 "port", G_TYPE_UINT, turn_port,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2788 "username", G_TYPE_STRING, username,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2789 "password", G_TYPE_STRING, password,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2790 NULL);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
2791
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2792 if (turn_setup) {
26057
128a3175668e Removed a couple of warnings
Marcus Lundblad <ml@update.uu.se>
parents: 26056
diff changeset
2793 memset(&value, 0, sizeof(GValue));
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2794 g_value_init(&value, GST_TYPE_STRUCTURE);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2795 gst_value_set_structure(&value, turn_setup);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2796 relay_info = g_value_array_append(relay_info, &value);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2797 gst_structure_free(turn_setup);
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
2798
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2799 purple_debug_info("media",
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2800 "setting property relay-info on new stream\n");
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2801 param[next_param_index].name = "relay-info";
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2802 g_value_init(&param[next_param_index].value,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2803 G_TYPE_VALUE_ARRAY);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2804 g_value_set_boxed(&param[next_param_index].value,
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2805 relay_info);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2806 g_value_array_free(relay_info);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2807 } else {
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2808 purple_debug_error("media", "Error relay info");
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2809 g_object_unref(participant);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2810 g_hash_table_remove(media->priv->participants, who);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2811 purple_media_remove_session(media, session);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2812 g_free(session);
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2813 return FALSE;
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2814 }
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2815 }
26056
4f0aec6d4ad7 Removed some extra tabs on blank lines
Marcus Lundblad <ml@update.uu.se>
parents: 26055
diff changeset
2816
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2817 fsstream = fs_session_new_stream(session->session,
28532
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2818 participant, initiator == TRUE ?
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2819 type_direction : (type_direction &
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2820 FS_DIRECTION_RECV), transmitter,
26055
c56e8826fed0 Added support to generate relayed candidates (TURN).
Marcus Lundblad <ml@update.uu.se>
parents: 26053
diff changeset
2821 new_num_params, param, &err);
24933
6ab96d5d8ac6 Add params to purple_media_add_stream to allow for different libNice
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24932
diff changeset
2822 g_free(param);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
2823 } else {
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2824 fsstream = fs_session_new_stream(session->session,
28532
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2825 participant, initiator == TRUE ?
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2826 type_direction : (type_direction &
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2827 FS_DIRECTION_RECV), transmitter,
26051
b68a88fb7458 Use the stream's direction to wait to send media.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26050
diff changeset
2828 num_params, params, &err);
23857
001064185ad4 Use the purple STUN server preference with the rawudp Farsight transmitter.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23856
diff changeset
2829 }
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2830
28045
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2831 if (fsstream == NULL) {
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2832 purple_debug_error("media",
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2833 "Error creating stream: %s\n",
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2834 err && err->message ?
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2835 err->message : "NULL");
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2836 if (err)
98d8c11e4937 Gracefully handle failures to create an FsStream. This was caused by
maiku@pidgin.im
parents: 27885
diff changeset
2837 g_error_free(err);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2838 g_object_unref(participant);
24929
5c30047f960e Properly free PurpleMedia when there's an error creating an FsStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23919
diff changeset
2839 g_hash_table_remove(media->priv->participants, who);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2840 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2841 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2842 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2843 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2844
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
2845 stream = purple_media_insert_stream(session, who, fsstream);
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
2846 stream->initiator = initiator;
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2847
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2848 /* callback for source pad added (new stream source ready) */
24963
33fa549f2399 Move variables to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24962
diff changeset
2849 g_signal_connect(G_OBJECT(fsstream),
24976
01df0829f054 Move sink from PurpleMediaSession to PurpleMediaStream.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24974
diff changeset
2850 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), stream);
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2851
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2852 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
2853 0, PURPLE_MEDIA_STATE_NEW,
24993
7d2e06b29f88 Add state-changed signal to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24991
diff changeset
2854 session->id, who);
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
2855 } else {
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
2856 if (purple_media_to_fs_stream_direction(stream->session->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
2857 != type_direction) {
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
2858 /* change direction */
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
2859 g_object_set(stream->stream, "direction",
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
2860 type_direction, NULL);
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
2861 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2862 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2863
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
2864 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
2865 #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
2866 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
2867 #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
2868 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2869
26393
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2870 PurpleMediaManager *
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2871 purple_media_get_manager(PurpleMedia *media)
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2872 {
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2873 PurpleMediaManager *ret;
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2874 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
2875 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
2876 return ret;
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2877 }
462e5c27dbd7 Use purple_media_manager_get_pipeline instead.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
2878
23869
551a462b346a Changed PurpleMediaStreamType to PurpleMediaSessionType.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23865
diff changeset
2879 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
2880 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
2881 {
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
2882 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2883 PurpleMediaSession *session;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2884 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
2885 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
2886 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
2887 #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
2888 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
2889 #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
2890 }
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2891 /* 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
2892 GList *
24960
a5f1804fcb4b Combine get_*_codecs functions to mirror Farsight 2.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24951
diff changeset
2893 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
2894 {
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
2895 #ifdef USE_VV
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
2896 GList *fscodecs;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2897 GList *codecs;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2898 PurpleMediaSession *session;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2899
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2900 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
2901
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2902 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
2903
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2904 if (session == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2905 return NULL;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2906
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2907 g_object_get(G_OBJECT(session->session),
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
2908 "codecs", &fscodecs, NULL);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
2909 codecs = purple_media_codec_list_from_fs(fscodecs);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
2910 fs_codec_list_destroy(fscodecs);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2911 return 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
2912 #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
2913 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
2914 #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
2915 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2916
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2917 GList *
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
2918 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
2919 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
2920 {
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
2921 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2922 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2923 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
2924 stream = purple_media_get_stream(media, sess_id, participant);
26997
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2925 return stream ? purple_media_candidate_list_from_fs(
72bcdcb0629f Add Gmail video support.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26737
diff changeset
2926 stream->local_candidates) : 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
2927 #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
2928 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
2929 #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
2930 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2931
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2932 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
2933 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
2934 const gchar *participant,
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
2935 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
2936 {
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
2937 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2938 PurpleMediaStream *stream;
26052
997bbae7b80f Set remote candidates as soon as they are received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26051
diff changeset
2939 GError *err = NULL;
997bbae7b80f Set remote candidates as soon as they are received.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26051
diff changeset
2940
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2941 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
2942 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
2943
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
2944 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
2945 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
2946 "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
2947 "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
2948 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
2949 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
2950 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
2951 }
5a7fa2093d1e Make Finch not crash if someone requests a session with video with you.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26388
diff changeset
2952
25000
2cf44cc855fe Add candidates instead of replacing them.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24995
diff changeset
2953 stream->remote_candidates = g_list_concat(stream->remote_candidates,
26021
f7cf50180e1d Duplicate FsCandidate to remove it from the public interface.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26020
diff changeset
2954 purple_media_candidate_list_to_fs(remote_candidates));
23915
9632027d3b50 Update to Farsight2 0.0.3.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23914
diff changeset
2955
28532
867438a30bdd Allow the initiator to start connection checks before the remote side accepts.
maiku@pidgin.im
parents: 28400
diff changeset
2956 if (stream->initiator == TRUE || stream->accepted == TRUE) {
28134
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2957 fs_stream_set_remote_candidates(stream->stream,
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2958 stream->remote_candidates, &err);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2959
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2960 if (err) {
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2961 purple_debug_error("media", "Error adding remote"
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2962 " candidates: %s\n", err->message);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2963 g_error_free(err);
614a40c68b88 Wait to set remote candidates until the session has been accepted. This stops
maiku@pidgin.im
parents: 28104
diff changeset
2964 }
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
2965 }
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
2966 #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
2967 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2968
26386
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
2969 #if 0
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
2970 /*
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
2971 * 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
2972 * 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
2973 */
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
2974
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2975 GList *
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2976 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
2977 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
2978 {
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
2979 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2980 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2981 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
2982 stream = purple_media_get_stream(media, sess_id, participant);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2983 return purple_media_candidate_list_from_fs(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2984 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
2985 #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
2986 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
2987 #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
2988 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
2989
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2990 GList *
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2991 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
2992 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
2993 {
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
2994 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2995 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
2996 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
2997 stream = purple_media_get_stream(media, sess_id, participant);
26099
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2998 return purple_media_candidate_list_from_fs(
dcff28a0415c Handle having multiple active candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26091
diff changeset
2999 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
3000 #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
3001 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
3002 #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
3003 }
26386
6d9f4ca72828 Comment out purple_media_get_active_{local,remote}_candidates.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26385
diff changeset
3004 #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
3005
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3006 gboolean
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
3007 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
3008 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
3009 {
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
3010 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3011 PurpleMediaStream *stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3012 FsStream *fsstream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3013 GList *fscodecs;
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3014 GError *err = NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3015
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3016 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE);
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
3017 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
3018
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3019 if (stream == NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3020 return FALSE;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3021
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3022 fsstream = stream->stream;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3023 fscodecs = purple_media_codec_list_to_fs(codecs);
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3024 fs_stream_set_remote_codecs(fsstream, fscodecs, &err);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
3025 fs_codec_list_destroy(fscodecs);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3026
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3027 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3028 purple_debug_error("media", "Error setting remote codecs: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3029 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3030 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3031 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3032 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
3033 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
3034 #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
3035 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
3036 #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
3037 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
3038
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
3039 gboolean
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3040 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
3041 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
3042 {
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
3043 #ifdef USE_VV
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3044 GList *streams;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3045 gboolean prepared = TRUE;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3046
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3047 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
3048
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3049 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
3050
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3051 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
3052 PurpleMediaStream *stream = streams->data;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3053 if (stream->candidates_prepared == FALSE) {
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3054 g_list_free(streams);
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3055 prepared = FALSE;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3056 break;
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3057 }
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
3058 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
3059
26310
17929a84c1fb Change purple_media_candidates_prepared to use wildcards.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26309
diff changeset
3060 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
3061 #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
3062 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
3063 #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
3064 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
3065
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3066 gboolean
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
3067 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
3068 {
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
3069 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3070 PurpleMediaSession *session;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3071 FsCodec *fscodec;
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3072 GError *err = NULL;
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3073
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3074 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
3075
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3076 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
3077
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3078 if (session != NULL)
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3079 return FALSE;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3080
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3081 fscodec = purple_media_codec_to_fs(codec);
26024
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
3082 fs_session_set_send_codec(session->session, fscodec, &err);
ac4d7695dbc7 Wrap FsCodec and remove the Farsight2 include from media.h.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26023
diff changeset
3083 fs_codec_destroy(fscodec);
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3084
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3085 if (err) {
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3086 purple_debug_error("media", "Error setting send codec\n");
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3087 g_error_free(err);
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3088 return FALSE;
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3089 }
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3090 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
3091 #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
3092 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
3093 #endif
23862
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3094 }
3ffe166a355e Set the proper send codec in Farsight.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23857
diff changeset
3095
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
3096 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
3097 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
3098 {
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
3099 #ifdef USE_VV
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
3100 gboolean ret;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3101
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3102 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
3103
26127
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3104 if (sess_id != NULL) {
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3105 PurpleMediaSession *session;
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3106 session = purple_media_get_session(media, sess_id);
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3107
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3108 if (session == NULL)
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3109 return FALSE;
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3110 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3111 PURPLE_MEDIA_SEND_VIDEO))
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3112 g_object_get(session->session,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3113 "codecs-ready", &ret, NULL);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3114 else
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3115 ret = TRUE;
26127
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3116 } else {
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3117 GList *values = g_hash_table_get_values(media->priv->sessions);
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3118 for (; values; values = g_list_delete_link(values, values)) {
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3119 PurpleMediaSession *session = values->data;
27884
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3120 if (session->type & (PURPLE_MEDIA_SEND_AUDIO |
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3121 PURPLE_MEDIA_SEND_VIDEO))
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3122 g_object_get(session->session,
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3123 "codecs-ready", &ret, NULL);
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3124 else
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3125 ret = TRUE;
f5580e1ca4b1 Fix unidirectional media sessions and add a colorspace before the video sink.
maiku@pidgin.im
parents: 27882
diff changeset
3126
26127
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3127 if (ret == FALSE)
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3128 break;
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3129 }
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3130 if (values != NULL)
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3131 g_list_free(values);
df133a5df391 Have purple_media_codecs_ready handle a session wildcard.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26126
diff changeset
3132 }
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
3133 return ret;
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
3134 #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
3135 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
3136 #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
3137 }
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
3138
26061
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
3139 gboolean
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3140 purple_media_is_initiator(PurpleMedia *media,
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3141 const gchar *sess_id, const gchar *participant)
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3142 {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3143 #ifdef USE_VV
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3144 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
3145
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3146 if (sess_id == NULL && participant == NULL)
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3147 return media->priv->initiator;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3148 else if (sess_id != NULL && participant == NULL) {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3149 PurpleMediaSession *session =
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3150 purple_media_get_session(media, sess_id);
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3151 return session != NULL ? session->initiator : FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3152 } else if (sess_id != NULL && participant != NULL) {
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3153 PurpleMediaStream *stream = purple_media_get_stream(
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3154 media, sess_id, participant);
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3155 return stream != NULL ? stream->initiator : FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3156 }
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3157 #endif
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3158 return FALSE;
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3159 }
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3160
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26383
diff changeset
3161 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
3162 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
3163 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
3164 {
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
3165 #ifdef USE_VV
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3166 gboolean accepted = TRUE;
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3167
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3168 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
3169
26309
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3170 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
3171 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
3172
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3173 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
3174 PurpleMediaStream *stream = streams->data;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3175 if (stream->accepted == FALSE) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3176 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3177 break;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3178 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3179 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3180 } 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
3181 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
3182 media, sess_id, NULL);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3183 for (; streams; streams =
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3184 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
3185 PurpleMediaStream *stream = streams->data;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3186 if (stream->accepted == FALSE) {
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3187 g_list_free(streams);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3188 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3189 break;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3190 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3191 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3192 } 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
3193 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
3194 media, sess_id, participant);
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3195 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
3196 accepted = FALSE;
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3197 }
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3198
b7b0513604e6 Make acceptance be per stream rather than per session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26306
diff changeset
3199 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
3200 #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
3201 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
3202 #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
3203 }
f6a98b2b8d92 Add the accepted signal and make the accept button go away immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26060
diff changeset
3204
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3205 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
3206 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
3207 {
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
3208 #ifdef USE_VV
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3209 GList *sessions;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3210
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3211 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
3212
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3213 purple_prefs_set_int("/purple/media/audio/volume/input", level);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3214
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3215 if (session_id == NULL)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3216 sessions = g_hash_table_get_values(media->priv->sessions);
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3217 else
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3218 sessions = g_list_append(NULL,
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3219 purple_media_get_session(media, session_id));
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3220
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3221 for (; sessions; sessions = g_list_delete_link(sessions, sessions)) {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3222 PurpleMediaSession *session = sessions->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3223
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3224 if (session->type & PURPLE_MEDIA_SEND_AUDIO) {
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3225 gchar *name = g_strdup_printf("volume_%s",
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3226 session->id);
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3227 GstElement *volume = gst_bin_get_by_name(
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3228 GST_BIN(session->media->priv->confbin),
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3229 name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3230 g_free(name);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3231 g_object_set(volume, "volume", level/10.0, NULL);
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3232 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3233 }
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
3234 #endif
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3235 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3236
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3237 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
3238 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
3239 double level)
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3240 {
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
3241 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3242 GList *streams;
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3243
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3244 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
3245
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3246 purple_prefs_set_int("/purple/media/audio/volume/output", level);
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3247
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3248 streams = purple_media_get_streams(media,
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3249 session_id, participant);
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3250
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3251 for (; streams; streams = g_list_delete_link(streams, streams)) {
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3252 PurpleMediaStream *stream = streams->data;
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3253
27849
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3254 if (stream->session->type & PURPLE_MEDIA_RECV_AUDIO
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3255 && GST_IS_ELEMENT(stream->volume)) {
c8ff0a9cf8cc Unlink the local audio volume and mute between sessions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27835
diff changeset
3256 g_object_set(stream->volume, "volume", level/10.0, NULL);
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3257 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3258 }
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
3259 #endif
24971
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3260 }
1ce297c8923b Added media functions to set input and output volume.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24968
diff changeset
3261
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3262 gulong
26053
c334a9e17426 Wait to create the sinks until the frames are ready.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26052
diff changeset
3263 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
3264 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
3265 {
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
3266 #ifdef USE_VV
26072
4cbf594b2f17 Added a lot of assertions and error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26070
diff changeset
3267 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
3268
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3269 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
3270 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
3271 #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
3272 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
3273 #endif
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3274 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3275
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3276 void
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3277 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
3278 {
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
3279 #ifdef USE_VV
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3280 GList *iter = media->priv->streams;
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3281 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
3282 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
3283 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
3284 media->priv->manager, media,
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3285 stream->session->id, stream->participant);
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3286 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3287
26733
6543ecbb0717 Distinguish name and participant in PurpleMedia API
Paul Aurich <paul@darkrain42.org>
parents: 26563
diff changeset
3288 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
3289 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
3290 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
3291 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
3292 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
3293 session_name, NULL);
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3294 }
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
3295 #endif
26075
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3296 }
1aed9a92b657 Implement *_remove_output_window and *_remove_output_windows.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26074
diff changeset
3297
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
3298 #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
3299 GstElement *
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3300 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
3301 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
3302 {
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
3303 #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
3304 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
3305
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3306 if (session_id != NULL && participant == NULL) {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3307 PurpleMediaSession *session =
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3308 purple_media_get_session(media, session_id);
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3309 return (session != NULL) ? session->tee : NULL;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3310 } else if (session_id != NULL && participant != NULL) {
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3311 PurpleMediaStream *stream =
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3312 purple_media_get_stream(media,
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3313 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
3314 return (stream != NULL) ? stream->tee : NULL;
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3315 }
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3316 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
3317 #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
3318 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
3319 #endif
26117
6cf36f68033c Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26115
diff changeset
3320 }
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
3321 #endif /* USE_GSTREAMER */
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
3322