annotate libpurple/media.c @ 28157:bf7039a638b7

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