annotate libpurple/media.c @ 23846:86f05fa8a90a

Clarify the scope of two variables.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 28 Jun 2008 17:42:31 +0000
parents 13936e4405b7
children a1a1f44cdecc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
2 * @file media.c Media API
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 * @ingroup core
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * purple
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 * Purple is the legal property of its developers, whose names are too numerous
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * source distribution.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * (at your option) any later version.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * GNU General Public License for more details.
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 *
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 */
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
26 #include <string.h>
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
27
23766
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
28 #include "internal.h"
f0e32b734ef7 Cosmetics.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23762
diff changeset
29
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "connection.h"
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #include "media.h"
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
32 #include "marshallers.h"
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
34 #include "debug.h"
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
35
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
36 #ifdef USE_VV
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
38 #include <gst/interfaces/propertyprobe.h>
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
39 #include <gst/farsight/fs-conference-iface.h>
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
41 struct _PurpleMediaSession
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
42 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
43 gchar *id;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
44 PurpleMedia *media;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
45 GstElement *src;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
46 GstElement *sink;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
47 FsSession *session;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
48 GHashTable *streams; /* FsStream list map to participant's name */
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
49 PurpleMediaStreamType type;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
50 GHashTable *local_candidates; /* map to participant's name? */
23846
86f05fa8a90a Clarify the scope of two variables.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23845
diff changeset
51
86f05fa8a90a Clarify the scope of two variables.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23845
diff changeset
52 /*
86f05fa8a90a Clarify the scope of two variables.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23845
diff changeset
53 * These will need to be per stream when sessions with multiple
86f05fa8a90a Clarify the scope of two variables.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23845
diff changeset
54 * streams are supported.
86f05fa8a90a Clarify the scope of two variables.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23845
diff changeset
55 */
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
56 FsCandidate *local_candidate;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
57 FsCandidate *remote_candidate;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
58 };
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
59
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 struct _PurpleMediaPrivate
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 {
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
62 FsConference *conference;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
64 char *name;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 PurpleConnection *connection;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
66
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
67 GHashTable *sessions; /* PurpleMediaSession table */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
68 GHashTable *participants; /* FsParticipant table */
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
69
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
70 GstElement *pipeline;
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 #define PURPLE_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA, PurpleMediaPrivate))
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 static void purple_media_class_init (PurpleMediaClass *klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 static void purple_media_init (PurpleMedia *media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 static void purple_media_finalize (GObject *object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 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
79 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
80
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 static GObjectClass *parent_class = NULL;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 enum {
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
86 READY,
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
87 WAIT,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
88 ACCEPTED,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
89 HANGUP,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
90 REJECT,
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
91 GOT_REQUEST,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
92 GOT_HANGUP,
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
93 GOT_ACCEPT,
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
94 NEW_CANDIDATE,
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
95 CANDIDATES_PREPARED,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
96 CANDIDATE_PAIR,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 LAST_SIGNAL
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 static guint purple_media_signals[LAST_SIGNAL] = {0};
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 enum {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 PROP_0,
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
103 PROP_FS_CONFERENCE,
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 PROP_NAME,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 PROP_CONNECTION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 GType
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 purple_media_get_type()
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 static GType type = 0;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 if (type == 0) {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 static const GTypeInfo info = {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 sizeof(PurpleMediaClass),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 (GClassInitFunc) purple_media_class_init,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 NULL,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 sizeof(PurpleMedia),
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 0,
23772
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
123 (GInstanceInitFunc) purple_media_init,
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23766
diff changeset
124 NULL
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 };
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMedia", &info, 0);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 return type;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 purple_media_class_init (PurpleMediaClass *klass)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 GObjectClass *gobject_class = (GObjectClass*)klass;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 parent_class = g_type_class_peek_parent(klass);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 gobject_class->finalize = purple_media_finalize;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 gobject_class->set_property = purple_media_set_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 gobject_class->get_property = purple_media_get_property;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
141 g_object_class_install_property(gobject_class, PROP_FS_CONFERENCE,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
142 g_param_spec_object("farsight-conference",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
143 "Farsight conference",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
144 "The FsConference associated with this media.",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
145 FS_TYPE_CONFERENCE,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
146 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 g_object_class_install_property(gobject_class, PROP_NAME,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 g_param_spec_string("screenname",
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 "Screenname",
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 "The screenname of the remote user",
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 NULL,
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
153 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 g_object_class_install_property(gobject_class, PROP_CONNECTION,
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 g_param_spec_pointer("connection",
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 "Connection",
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 "The PurpleConnection associated with this session",
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
159 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
160
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
161 purple_media_signals[READY] = g_signal_new("ready", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
162 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
163 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
164 G_TYPE_NONE, 0);
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
165 purple_media_signals[WAIT] = g_signal_new("wait", G_TYPE_FROM_CLASS(klass),
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
166 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
167 g_cclosure_marshal_VOID__VOID,
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
168 G_TYPE_NONE, 0);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
169 purple_media_signals[ACCEPTED] = g_signal_new("accepted", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
170 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
171 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
172 G_TYPE_NONE, 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
173 purple_media_signals[HANGUP] = g_signal_new("hangup", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
174 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
175 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
176 G_TYPE_NONE, 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
177 purple_media_signals[REJECT] = g_signal_new("reject", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
178 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
179 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
180 G_TYPE_NONE, 0);
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
181 purple_media_signals[GOT_REQUEST] = g_signal_new("got-request", G_TYPE_FROM_CLASS(klass),
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
182 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
183 g_cclosure_marshal_VOID__VOID,
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
184 G_TYPE_NONE, 0);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
185 purple_media_signals[GOT_HANGUP] = g_signal_new("got-hangup", G_TYPE_FROM_CLASS(klass),
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
186 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
187 g_cclosure_marshal_VOID__VOID,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
188 G_TYPE_NONE, 0);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
189 purple_media_signals[GOT_ACCEPT] = g_signal_new("got-accept", G_TYPE_FROM_CLASS(klass),
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
190 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
191 g_cclosure_marshal_VOID__VOID,
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
192 G_TYPE_NONE, 0);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
193 purple_media_signals[NEW_CANDIDATE] = g_signal_new("new-candidate", G_TYPE_FROM_CLASS(klass),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
194 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
195 purple_smarshal_VOID__POINTER_POINTER_OBJECT,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
196 G_TYPE_NONE, 3, G_TYPE_POINTER,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
197 G_TYPE_POINTER, FS_TYPE_CANDIDATE);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
198 purple_media_signals[CANDIDATES_PREPARED] = g_signal_new("candidates-prepared", G_TYPE_FROM_CLASS(klass),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
199 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
200 g_cclosure_marshal_VOID__VOID,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
201 G_TYPE_NONE, 0);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
202 purple_media_signals[CANDIDATE_PAIR] = g_signal_new("candidate-pair", G_TYPE_FROM_CLASS(klass),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
203 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
204 purple_smarshal_VOID__BOXED_BOXED,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
205 G_TYPE_NONE, 2, FS_TYPE_CANDIDATE, FS_TYPE_CANDIDATE);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
206
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
207 g_type_class_add_private(klass, sizeof(PurpleMediaPrivate));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
210
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 purple_media_init (PurpleMedia *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 media->priv = PURPLE_MEDIA_GET_PRIVATE(media);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
215 memset(media->priv, 0, sizeof(media->priv));
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 purple_media_finalize (GObject *media)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 {
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
221 PurpleMediaPrivate *priv = PURPLE_MEDIA_GET_PRIVATE(media);
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
222 purple_debug_info("media","purple_media_finalize\n");
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
223
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
224 g_free(priv->name);
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
225
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
226 if (priv->pipeline) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
227 gst_element_set_state(priv->pipeline, GST_STATE_NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
228 gst_object_unref(priv->pipeline);
23811
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
229 }
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
230
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
231 gst_object_unref(priv->conference);
d048100a43ab Free the PurpleMedia object when the media session ends and fix ending
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
232
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 parent_class->finalize(media);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 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
238 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 g_return_if_fail(PURPLE_IS_MEDIA(object));
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
241
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 switch (prop_id) {
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
245 case PROP_FS_CONFERENCE:
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
246 if (media->priv->conference)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
247 g_object_unref(media->priv->conference);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
248 media->priv->conference = g_value_get_object(value);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
249 g_object_ref(media->priv->conference);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 case PROP_NAME:
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
252 g_free(media->priv->name);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
253 media->priv->name = g_value_dup_string(value);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 case PROP_CONNECTION:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 media->priv->connection = g_value_get_pointer(value);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 static void
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 purple_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 {
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 PurpleMedia *media;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 g_return_if_fail(PURPLE_IS_MEDIA(object));
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 media = PURPLE_MEDIA(object);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 switch (prop_id) {
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
273 case PROP_FS_CONFERENCE:
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
274 g_value_set_object(value, media->priv->conference);
23760
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 case PROP_NAME:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 g_value_set_string(value, media->priv->name);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 case PROP_CONNECTION:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 g_value_set_pointer(value, media->priv->connection);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 default:
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 break;
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 }
5150d8b576be Missed files
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
289 FsMediaType
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
290 purple_media_to_fs_media_type(PurpleMediaStreamType type)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
291 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
292 if (type & PURPLE_MEDIA_AUDIO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
293 return FS_MEDIA_TYPE_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
294 else if (type & PURPLE_MEDIA_VIDEO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
295 return FS_MEDIA_TYPE_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
296 else
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
297 return FS_MEDIA_TYPE_APPLICATION;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
298 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
299
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
300 FsStreamDirection
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
301 purple_media_to_fs_stream_direction(PurpleMediaStreamType type)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
302 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
303 if ((type & PURPLE_MEDIA_AUDIO) == PURPLE_MEDIA_AUDIO ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
304 (type & PURPLE_MEDIA_VIDEO) == PURPLE_MEDIA_VIDEO)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
305 return FS_DIRECTION_BOTH;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
306 else if ((type & PURPLE_MEDIA_SEND_AUDIO) ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
307 (type & PURPLE_MEDIA_SEND_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
308 return FS_DIRECTION_SEND;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
309 else if ((type & PURPLE_MEDIA_RECV_AUDIO) ||
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
310 (type & PURPLE_MEDIA_RECV_VIDEO))
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
311 return FS_DIRECTION_RECV;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
312 else
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
313 return FS_DIRECTION_NONE;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
314 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
315
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
316 PurpleMediaStreamType
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
317 purple_media_from_fs(FsMediaType type, FsStreamDirection direction)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
318 {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
319 PurpleMediaStreamType result = PURPLE_MEDIA_NONE;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
320 if (type == FS_MEDIA_TYPE_AUDIO) {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
321 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
322 result |= PURPLE_MEDIA_SEND_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
323 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
324 result |= PURPLE_MEDIA_RECV_AUDIO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
325 } else if (type == FS_MEDIA_TYPE_VIDEO) {
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
326 if (direction & FS_DIRECTION_SEND)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
327 result |= PURPLE_MEDIA_SEND_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
328 if (direction & FS_DIRECTION_RECV)
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
329 result |= PURPLE_MEDIA_RECV_VIDEO;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
330 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
331 return result;
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
332 }
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
333
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
334 PurpleMediaStreamType
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
335 purple_media_get_overall_type(PurpleMedia *media)
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
336 {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
337 GList *values = g_hash_table_get_values(media->priv->sessions);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
338 PurpleMediaStreamType type = PURPLE_MEDIA_NONE;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
339
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
340 for (; values; values = values->next) {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
341 PurpleMediaSession *session = values->data;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
342 type |= session->type;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
343 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
344
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
345 g_list_free(values);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
346 return type;
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
347 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
348
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
349 static PurpleMediaSession*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
350 purple_media_get_session(PurpleMedia *media, const gchar *sess_id)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
351 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
352 return (PurpleMediaSession*) (media->priv->sessions) ?
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
353 g_hash_table_lookup(media->priv->sessions, sess_id) : NULL;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
354 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
355
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
356 static FsParticipant*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
357 purple_media_get_participant(PurpleMedia *media, const gchar *name)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
358 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
359 return (FsParticipant*) (media->priv->participants) ?
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
360 g_hash_table_lookup(media->priv->participants, name) : NULL;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
361 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
362
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
363 static FsStream*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
364 purple_media_session_get_stream(PurpleMediaSession *session, const gchar *name)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
365 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
366 return (FsStream*) (session->streams) ?
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
367 g_hash_table_lookup(session->streams, name) : NULL;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
368 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
369
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
370 static GList*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
371 purple_media_session_get_local_candidates(PurpleMediaSession *session, const gchar *name)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
372 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
373 return (GList*) (session->local_candidates) ?
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
374 g_hash_table_lookup(session->local_candidates, name) : NULL;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
375 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
376
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
377 static void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
378 purple_media_add_session(PurpleMedia *media, PurpleMediaSession *session)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
379 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
380 if (!media->priv->sessions) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
381 purple_debug_info("media", "Creating hash table for sessions\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
382 media->priv->sessions = g_hash_table_new(g_str_hash, g_str_equal);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
383 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
384 g_hash_table_insert(media->priv->sessions, g_strdup(session->id), session);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
385 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
386
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
387 static gboolean
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
388 purple_media_remove_session(PurpleMedia *media, PurpleMediaSession *session)
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
389 {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
390 return g_hash_table_remove(media->priv->sessions, session->id);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
391 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
392
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
393 static FsParticipant *
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
394 purple_media_add_participant(PurpleMedia *media, const gchar *name)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
395 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
396 FsParticipant *participant = purple_media_get_participant(media, name);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
397 GError *err = NULL;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
398
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
399 if (participant)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
400 return participant;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
401
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
402 participant = fs_conference_new_participant(media->priv->conference,
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
403 g_strdup(name), &err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
404
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
405 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
406 purple_debug_error("media", "Error creating participant: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
407 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
408 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
409 return NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
410 }
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
411
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
412 if (!media->priv->participants) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
413 purple_debug_info("media", "Creating hash table for participants\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
414 media->priv->participants = g_hash_table_new(g_str_hash, g_str_equal);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
415 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
416
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
417 g_hash_table_insert(media->priv->participants, g_strdup(name), participant);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
418
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
419 return participant;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
420 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
421
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
422 static void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
423 purple_media_insert_stream(PurpleMediaSession *session, const gchar *name, FsStream *stream)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
424 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
425 if (!session->streams) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
426 purple_debug_info("media", "Creating hash table for streams\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
427 session->streams = g_hash_table_new(g_str_hash, g_str_equal);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
428 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
429
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
430 g_hash_table_insert(session->streams, g_strdup(name), stream);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
431 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
432
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
433 static void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
434 purple_media_insert_local_candidate(PurpleMediaSession *session, const gchar *name,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
435 FsCandidate *candidate)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
436 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
437 GList *candidates = purple_media_session_get_local_candidates(session, name);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
438
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
439 candidates = g_list_append(candidates, candidate);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
440
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
441 if (!session->local_candidates) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
442 purple_debug_info("media", "Creating hash table for local candidates\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
443 session->local_candidates = g_hash_table_new(g_str_hash, g_str_equal);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
444 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
445
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
446 g_hash_table_insert(session->local_candidates, g_strdup(name), candidates);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
447 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
448
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
449 GList *
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
450 purple_media_get_session_names(PurpleMedia *media)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
451 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
452 return g_hash_table_get_keys(media->priv->sessions);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
453 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
454
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
455 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
456 purple_media_get_elements(PurpleMedia *media, GstElement **audio_src, GstElement **audio_sink,
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
457 GstElement **video_src, GstElement **video_sink)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
458 {
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
459 GList *values = g_hash_table_get_values(media->priv->sessions);
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
460
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
461 for (; values; values = values->next) {
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
462 PurpleMediaSession *session = (PurpleMediaSession*)values->data;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
463
23844
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
464 if (session->type & PURPLE_MEDIA_SEND_AUDIO && audio_src)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
465 *audio_src = session->src;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
466 if (session->type & PURPLE_MEDIA_RECV_AUDIO && audio_sink)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
467 *audio_sink = session->sink;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
468 if (session->type & PURPLE_MEDIA_SEND_VIDEO && video_src)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
469 *video_src = session->src;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
470 if (session->type & PURPLE_MEDIA_RECV_VIDEO && video_sink)
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
471 *video_sink = session->sink;
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
472 }
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
473
72e738dac5f7 Wait to set up the voice and video GUI until the responder has accepted the session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23842
diff changeset
474 g_list_free(values);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
475 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
476
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
477 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
478 purple_media_set_src(PurpleMedia *media, const gchar *sess_id, GstElement *src)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
479 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
480 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
481 GstPad *sinkpad;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
482 GstPad *srcpad;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
483
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
484 if (session->src)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
485 gst_object_unref(session->src);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
486 session->src = src;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
487 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
488 session->src);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
489
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
490 g_object_get(session->session, "sink-pad", &sinkpad, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
491 srcpad = gst_element_get_static_pad(src, "ghostsrc");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
492 purple_debug_info("media", "connecting pad: %s\n",
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
493 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
494 ? "success" : "failure");
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
495 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
496
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
497 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
498 purple_media_set_sink(PurpleMedia *media, const gchar *sess_id, GstElement *sink)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
499 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
500 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
501 if (session->sink)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
502 gst_object_unref(session->sink);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
503 session->sink = sink;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
504 gst_bin_add(GST_BIN(purple_media_get_pipeline(media)),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
505 session->sink);
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
506 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
507
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
508 GstElement *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
509 purple_media_get_src(PurpleMedia *media, const gchar *sess_id)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
510 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
511 return purple_media_get_session(media, sess_id)->src;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
512 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
513
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
514 GstElement *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
515 purple_media_get_sink(PurpleMedia *media, const gchar *sess_id)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
516 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
517 return purple_media_get_session(media, sess_id)->src;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
518 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
519
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
520 static gboolean
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
521 media_bus_call(GstBus *bus, GstMessage *msg, gpointer media)
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
522 {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
523 switch(GST_MESSAGE_TYPE(msg)) {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
524 case GST_MESSAGE_EOS:
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
525 purple_debug_info("media", "End of Stream\n");
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
526 break;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
527 case GST_MESSAGE_ERROR: {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
528 gchar *debug = NULL;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
529 GError *err = NULL;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
530
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
531 gst_message_parse_error(msg, &err, &debug);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
532
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
533 purple_debug_error("media", "gst pipeline error: %s\n", err->message);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
534 g_error_free(err);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
535
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
536 if (debug) {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
537 purple_debug_error("media", "Debug details: %s\n", debug);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
538 g_free (debug);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
539 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
540 break;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
541 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
542 case GST_MESSAGE_ELEMENT: {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
543 if (gst_structure_has_name(msg->structure, "farsight-error")) {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
544 gint error_no;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
545 gst_structure_get_int(msg->structure, "error-no", &error_no);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
546 purple_debug_error("media", "farsight-error: %i: %s\n", error_no,
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
547 gst_structure_get_string(msg->structure, "error-msg"));
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
548 } else {
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
549 gchar *name, *str;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
550 name = gst_object_get_name(GST_MESSAGE_SRC (msg));
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
551 purple_debug_info("media", "element name: %s\n", name);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
552 g_free(name);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
553
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
554 str = gst_structure_to_string(msg->structure);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
555 purple_debug_info("media", "structure: %s\n", str);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
556 g_free(str);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
557 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
558 break;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
559 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
560 default:
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
561 purple_debug_info("media", "gst message type: %s\n",
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
562 GST_MESSAGE_TYPE_NAME(msg));
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
563 return TRUE;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
564 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
565
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
566 return TRUE;
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
567 }
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
568
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
569 GstElement *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
570 purple_media_get_pipeline(PurpleMedia *media)
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
571 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
572 if (!media->priv->pipeline) {
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
573 GstBus *bus;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
574 media->priv->pipeline = gst_pipeline_new(media->priv->name);
23842
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
575 bus = gst_pipeline_get_bus(GST_PIPELINE(media->priv->pipeline));
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
576 gst_bus_add_signal_watch(GST_BUS(bus));
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
577 gst_bus_add_watch(bus, media_bus_call, media);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
578 gst_object_unref(bus);
19e077a4cb62 Move the main voice and video pipeline into media.c and display more debug info.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23837
diff changeset
579
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
580 gst_bin_add(GST_BIN(media->priv->pipeline), GST_ELEMENT(media->priv->conference));
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
581 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
582
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
583 return media->priv->pipeline;
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
584 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
585
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
586 PurpleConnection *
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
587 purple_media_get_connection(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
588 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
589 PurpleConnection *gc;
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
590 g_object_get(G_OBJECT(media), "connection", &gc, NULL);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
591 return gc;
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
592 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
593
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
594 const char *
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
595 purple_media_get_screenname(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
596 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
597 const char *ret;
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
598 g_object_get(G_OBJECT(media), "screenname", &ret, NULL);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
599 return ret;
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
600 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
601
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
602 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
603 purple_media_ready(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
604 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
605 g_signal_emit(media, purple_media_signals[READY], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
606 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
607
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
608 void
23793
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
609 purple_media_wait(PurpleMedia *media)
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
610 {
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
611 g_signal_emit(media, purple_media_signals[WAIT], 0);
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
612 }
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
613
befeece4dd48 Change a few things:
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23787
diff changeset
614 void
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
615 purple_media_accept(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
616 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
617 g_signal_emit(media, purple_media_signals[ACCEPTED], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
618 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
619
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
620 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
621 purple_media_hangup(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
622 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
623 g_signal_emit(media, purple_media_signals[HANGUP], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
624 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
625
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
626 void
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
627 purple_media_reject(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
628 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
629 g_signal_emit(media, purple_media_signals[REJECT], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
630 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
631
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
632 void
23837
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
633 purple_media_got_request(PurpleMedia *media)
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
634 {
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
635 g_signal_emit(media, purple_media_signals[GOT_REQUEST], 0);
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
636 }
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
637
ddbea813862e Notify the user which type of media session the remote user wants to initiate.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23836
diff changeset
638 void
23762
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
639 purple_media_got_hangup(PurpleMedia *media)
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
640 {
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
641 g_signal_emit(media, purple_media_signals[GOT_HANGUP], 0);
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
642 }
70cdff43ec76 You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents: 23760
diff changeset
643
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
644 void
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
645 purple_media_got_accept(PurpleMedia *media)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
646 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
647 g_signal_emit(media, purple_media_signals[GOT_ACCEPT], 0);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
648 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
649
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
650 gchar*
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
651 purple_media_get_device_name(GstElement *element, GValue *device)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
652 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
653 gchar *name;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
654
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
655 GstElementFactory *factory = gst_element_get_factory(element);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
656 GstElement *temp = gst_element_factory_create(factory, "tmp_src");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
657
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
658 g_object_set_property (G_OBJECT (temp), "device", device);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
659 g_object_get (G_OBJECT (temp), "device-name", &name, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
660 gst_object_unref(temp);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
661
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
662 return name;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
663 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
664
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
665 GList*
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
666 purple_media_get_devices(GstElement *element)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
667 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
668 GObjectClass *klass;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
669 GstPropertyProbe *probe;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
670 const GParamSpec *pspec;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
671
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
672 const gchar *longname = NULL;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
673
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
674 GstElementFactory *factory =
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
675 gst_element_get_factory(element);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
676
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
677 GList *ret = NULL;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
678
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
679 longname = gst_element_factory_get_longname(factory);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
680 klass = G_OBJECT_GET_CLASS(element);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
681
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
682 if (!g_object_class_find_property (klass, "device") ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
683 !GST_IS_PROPERTY_PROBE (element) ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
684 !(probe = GST_PROPERTY_PROBE (element)) ||
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
685 !(pspec = gst_property_probe_get_property (probe, "device"))) {
23799
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
686 purple_debug_info("media", "Found source '%s' (%s) - no device\n",
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
687 longname, GST_PLUGIN_FEATURE (factory)->name);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
688 } else {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
689 gint n;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
690 gchar *name;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
691 GValueArray *array;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
692
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
693 purple_debug_info("media", "Found devices\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
694
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
695 /* Set autoprobe[-fps] to FALSE to avoid delays when probing. */
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
696 if (g_object_class_find_property (klass, "autoprobe")) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
697 g_object_set (G_OBJECT (element), "autoprobe", FALSE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
698 if (g_object_class_find_property (klass, "autoprobe-fps")) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
699 g_object_set (G_OBJECT (element), "autoprobe-fps", FALSE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
700 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
701 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
702
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
703 array = gst_property_probe_probe_and_get_values (probe, pspec);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
704 if (array != NULL) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
705
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
706 for (n = 0 ; n < array->n_values ; n++) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
707 GValue *device = g_value_array_get_nth (array, n);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
708 gst_element_set_state (element, GST_STATE_NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
709
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
710 ret = g_list_append(ret, device);
23799
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
711
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
712 name = purple_media_get_device_name(GST_ELEMENT(element), device);
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
713 purple_debug_info("media", "Found source '%s' (%s) - device '%s' (%s)\n",
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
714 longname, GST_PLUGIN_FEATURE (factory)->name,
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
715 name, g_value_get_string(device));
6bf2dfb350c0 Fix video plugin/device preference and preview.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
716 g_free(name);
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
717 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
718 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
719 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
720
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
721 return ret;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
722 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
723
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
724 void
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
725 purple_media_element_set_device(GstElement *element, GValue *device)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
726 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
727 g_object_set_property(G_OBJECT(element), "device", device);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
728 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
729
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
730 GValue *
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
731 purple_media_element_get_device(GstElement *element)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
732 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
733 GValue *device;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
734 g_object_get(G_OBJECT(element), "device", &device, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
735 return device;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
736 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
737
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
738 GstElement *
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
739 purple_media_get_element(const gchar *factory_name)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
740 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
741 GstElementFactory *factory = gst_element_factory_find(factory_name);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
742 GstElement *element = gst_element_factory_create(factory, "video_src");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
743 gst_object_unref(factory);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
744 return element;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
745 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
746
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
747 void
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
748 purple_media_audio_init_src(GstElement **sendbin, GstElement **sendlevel)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
749 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
750 GstElement *src;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
751 GstPad *pad;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
752 GstPad *ghost;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
753 const gchar *audio_device = purple_prefs_get_string("/purple/media/audio/device");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
754
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
755 purple_debug_info("media", "purple_media_audio_init_src\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
756
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
757 *sendbin = gst_bin_new("purplesendaudiobin");
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
758 src = gst_element_factory_make("alsasrc", "asrc");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
759 *sendlevel = gst_element_factory_make("level", "sendlevel");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
760 gst_bin_add_many(GST_BIN(*sendbin), src, *sendlevel, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
761 gst_element_link(src, *sendlevel);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
762 pad = gst_element_get_pad(*sendlevel, "src");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
763 ghost = gst_ghost_pad_new("ghostsrc", pad);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
764 gst_element_add_pad(*sendbin, ghost);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
765 g_object_set(G_OBJECT(*sendlevel), "message", TRUE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
766
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
767 /* set current audio device on "src"... */
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
768 if (audio_device) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
769 GList *devices = purple_media_get_devices(src);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
770 GList *dev = devices;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
771 purple_debug_info("media", "Setting device of GstElement src to %s\n",
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
772 audio_device);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
773 for (; dev ; dev = dev->next) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
774 GValue *device = (GValue *) dev->data;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
775 char *name = purple_media_get_device_name(src, device);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
776 if (strcmp(name, audio_device) == 0) {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
777 purple_media_element_set_device(src, device);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
778 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
779 g_free(name);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
780 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
781 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
782 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
783
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
784 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
785 purple_media_video_init_src(GstElement **sendbin)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
786 {
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
787 GstElement *src, *tee, *queue, *local_sink;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
788 GstPad *pad;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
789 GstPad *ghost;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
790 const gchar *video_plugin = purple_prefs_get_string("/purple/media/video/plugin");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
791 const gchar *video_device = purple_prefs_get_string("/purple/media/video/device");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
792
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
793 purple_debug_info("media", "purple_media_video_init_src\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
794
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
795 *sendbin = gst_bin_new("purplesendvideobin");
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
796 src = gst_element_factory_make(video_plugin, "purplevideosource");
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
797 gst_bin_add(GST_BIN(*sendbin), src);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
798
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
799 tee = gst_element_factory_make("tee", NULL);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
800 gst_bin_add(GST_BIN(*sendbin), tee);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
801 gst_element_link(src, tee);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
802
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
803 queue = gst_element_factory_make("queue", NULL);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
804 gst_bin_add(GST_BIN(*sendbin), queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
805 gst_element_link(tee, queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
806
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
807 if (!strcmp(video_plugin, "videotestsrc")) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
808 /* unless is-live is set to true it doesn't throttle videotestsrc */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
809 g_object_set (G_OBJECT(src), "is-live", TRUE, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
810 }
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
811
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
812 pad = gst_element_get_pad(queue, "src");
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
813 ghost = gst_ghost_pad_new("ghostsrc", pad);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
814 gst_element_add_pad(*sendbin, ghost);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
815
23836
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
816 queue = gst_element_factory_make("queue", NULL);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
817 gst_bin_add(GST_BIN(*sendbin), queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
818 gst_element_link(tee, queue);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
819
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
820 local_sink = gst_element_factory_make("autovideosink", "purplelocalvideosink");
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
821 gst_bin_add(GST_BIN(*sendbin), local_sink);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
822 gst_element_link(queue, local_sink);
3bf9748fdef0 Preliminary video embedded in the conversation window. It's still kind of buggy.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23830
diff changeset
823
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
824 /* set current video device on "src"... */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
825 if (video_device) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
826 GList *devices = purple_media_get_devices(src);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
827 GList *dev = devices;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
828 purple_debug_info("media", "Setting device of GstElement src to %s\n",
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
829 video_device);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
830 for (; dev ; dev = dev->next) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
831 GValue *device = (GValue *) dev->data;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
832 char *name = purple_media_get_device_name(src, device);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
833 if (strcmp(name, video_device) == 0) {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
834 purple_media_element_set_device(src, device);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
835 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
836 g_free(name);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
837 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
838 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
839 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
840
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
841 void
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
842 purple_media_audio_init_recv(GstElement **recvbin, GstElement **recvlevel)
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
843 {
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
844 GstElement *sink;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
845 GstPad *pad, *ghost;
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
846
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
847 purple_debug_info("media", "purple_media_audio_init_recv\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
848
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
849 *recvbin = gst_bin_new("pidginrecvaudiobin");
23787
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
850 sink = gst_element_factory_make("alsasink", "asink");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
851 g_object_set(G_OBJECT(sink), "sync", FALSE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
852 *recvlevel = gst_element_factory_make("level", "recvlevel");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
853 gst_bin_add_many(GST_BIN(*recvbin), sink, *recvlevel, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
854 gst_element_link(*recvlevel, sink);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
855 pad = gst_element_get_pad(*recvlevel, "sink");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
856 ghost = gst_ghost_pad_new("ghostsink", pad);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
857 gst_element_add_pad(*recvbin, ghost);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
858 g_object_set(G_OBJECT(*recvlevel), "message", TRUE, NULL);
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
859
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
860 purple_debug_info("media", "purple_media_audio_init_recv end\n");
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
861 }
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23772
diff changeset
862
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
863 void
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
864 purple_media_video_init_recv(GstElement **recvbin)
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
865 {
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
866 GstElement *sink;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
867 GstPad *pad, *ghost;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
868
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
869 purple_debug_info("media", "purple_media_video_init_recv\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
870
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
871 *recvbin = gst_bin_new("pidginrecvvideobin");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
872 sink = gst_element_factory_make("autovideosink", "purplevideosink");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
873 gst_bin_add(GST_BIN(*recvbin), sink);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
874 pad = gst_element_get_pad(sink, "sink");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
875 ghost = gst_ghost_pad_new("ghostsink", pad);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
876 gst_element_add_pad(*recvbin, ghost);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
877
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
878 purple_debug_info("media", "purple_media_video_init_recv end\n");
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
879 }
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
880
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
881 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
882 purple_media_new_local_candidate_cb(FsStream *stream,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
883 FsCandidate *local_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
884 PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
885 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
886 gchar *name;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
887 FsParticipant *participant;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
888 purple_debug_info("media", "got new local candidate: %s\n", local_candidate->candidate_id);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
889 g_object_get(stream, "participant", &participant, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
890 g_object_get(participant, "cname", &name, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
891 g_object_unref(participant);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
892
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
893 purple_media_insert_local_candidate(session, name, fs_candidate_copy(local_candidate));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
894
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
895 g_signal_emit(session->media, purple_media_signals[NEW_CANDIDATE],
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
896 0, session->id, name, fs_candidate_copy(local_candidate));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
897
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
898 g_free(name);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
899 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
900
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
901 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
902 purple_media_candidates_prepared_cb(FsStream *stream, PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
903 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
904 gchar *name;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
905 FsParticipant *participant;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
906 g_object_get(stream, "participant", &participant, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
907 g_object_get(participant, "cname", &name, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
908 g_object_unref(participant);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
909 g_signal_emit(session->media, purple_media_signals[CANDIDATES_PREPARED], 0);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
910 g_free(name);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
911 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
912
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
913 /* callback called when a pair of transport candidates (local and remote)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
914 * has been established */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
915 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
916 purple_media_candidate_pair_established_cb(FsStream *stream,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
917 FsCandidate *native_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
918 FsCandidate *remote_candidate,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
919 PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
920 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
921 session->local_candidate = fs_candidate_copy(native_candidate);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
922 session->remote_candidate = fs_candidate_copy(remote_candidate);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
923
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
924 purple_debug_info("media", "candidate pair established\n");
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
925 g_signal_emit(session->media, purple_media_signals[CANDIDATE_PAIR], 0,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
926 session->local_candidate,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
927 session->remote_candidate);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
928 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
929
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
930 static void
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
931 purple_media_src_pad_added_cb(FsStream *stream, GstPad *srcpad,
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
932 FsCodec *codec, PurpleMediaSession *session)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
933 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
934 GstElement *pipeline = purple_media_get_pipeline(session->media);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
935 GstPad *sinkpad = gst_element_get_static_pad(session->sink, "ghostsink");
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
936 purple_debug_info("media", "connecting new src pad: %s\n",
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
937 gst_pad_link(srcpad, sinkpad) == GST_PAD_LINK_OK ? "success" : "failure");
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
938 gst_element_set_state(pipeline, GST_STATE_PLAYING);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
939 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
940
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
941 static gboolean
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
942 purple_media_add_stream_internal(PurpleMedia *media, const gchar *sess_id,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
943 const gchar *who, FsMediaType type,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
944 FsStreamDirection type_direction,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
945 const gchar *transmitter)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
946 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
947 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
948 FsParticipant *participant = NULL;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
949 FsStream *stream = NULL;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
950 FsStreamDirection *direction = NULL;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
951
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
952 if (!session) {
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
953 GError *err = NULL;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
954 GList *codec_conf;
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
955
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
956 session = g_new0(PurpleMediaSession, 1);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
957
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
958 session->session = fs_conference_new_session(media->priv->conference, type, &err);
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
959
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
960 if (err != NULL) {
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
961 purple_debug_error("media", "Error creating session: %s\n", err->message);
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
962 g_error_free(err);
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
963 purple_conv_present_error(who,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
964 purple_connection_get_account(purple_media_get_connection(media)),
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
965 _("Error creating session."));
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
966 g_free(session);
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
967 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
968 }
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
969
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
970 /*
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
971 * None of these three worked for me. THEORA is known to
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
972 * not work as of at least Farsight2 0.0.2
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
973 */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
974 codec_conf = g_list_prepend(NULL, fs_codec_new(FS_CODEC_ID_DISABLE,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
975 "THEORA", FS_MEDIA_TYPE_VIDEO, 90000));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
976 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_DISABLE,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
977 "MPV", FS_MEDIA_TYPE_VIDEO, 90000));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
978 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_DISABLE,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
979 "H264", FS_MEDIA_TYPE_VIDEO, 90000));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
980
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
981 /* XXX: SPEEX has a latency of 5 or 6 seconds for me */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
982 #if 0
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
983 /* SPEEX is added through the configuration */
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
984 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
985 "SPEEX", FS_MEDIA_TYPE_AUDIO, 8000));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
986 codec_conf = g_list_prepend(codec_conf, fs_codec_new(FS_CODEC_ID_ANY,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
987 "SPEEX", FS_MEDIA_TYPE_AUDIO, 16000));
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
988 #endif
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
989
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
990 g_object_set(G_OBJECT(session->session), "local-codecs-config",
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
991 codec_conf, NULL);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
992
23826
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
993 /*
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
994 * Temporary fix to remove a 5-7 second delay before
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
995 * receiving the src-pad-added signal.
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
996 * Only works for one-to-one sessions.
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
997 * Specific to FsRtpSession.
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
998 */
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
999 g_object_set(G_OBJECT(session->session), "no-rtcp-timeout", 0, NULL);
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
1000
157b30b530f4 Temporary fix to remove a 5-7 second delay when initiating a media session.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23824
diff changeset
1001
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1002 fs_codec_list_destroy(codec_conf);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1003
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1004 session->id = g_strdup(sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1005 session->media = media;
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1006 session->type = purple_media_from_fs(type, type_direction);
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1007
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1008 purple_media_add_session(media, session);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1009 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1010
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1011 if (!(participant = purple_media_add_participant(media, who))) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1012 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1013 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1014 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1015 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1016
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1017 stream = purple_media_session_get_stream(session, who);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1018
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1019 if (!stream) {
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1020 GError *err = NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1021
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1022 stream = fs_session_new_stream(session->session, participant,
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1023 type_direction, transmitter, 0,
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1024 NULL, &err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1025
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1026 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1027 purple_debug_error("media", "Error creating stream: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1028 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1029 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1030 g_object_unref(participant);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1031 purple_media_remove_session(media, session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1032 g_free(session);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1033 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1034 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1035
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1036 purple_media_insert_stream(session, who, stream);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1037 /* callback for new local candidate (new local candidate retreived) */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1038 g_signal_connect(G_OBJECT(stream),
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1039 "new-local-candidate", G_CALLBACK(purple_media_new_local_candidate_cb), session);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1040 /* callback for source pad added (new stream source ready) */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1041 g_signal_connect(G_OBJECT(stream),
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1042 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), session);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1043 /* callback for local candidates prepared (local candidates ready to send) */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1044 g_signal_connect(G_OBJECT(stream),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1045 "local-candidates-prepared",
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1046 G_CALLBACK(purple_media_candidates_prepared_cb), session);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1047 /* callback for new active candidate pair (established connection) */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1048 g_signal_connect(G_OBJECT(stream),
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1049 "new-active-candidate-pair",
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1050 G_CALLBACK(purple_media_candidate_pair_established_cb), session);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1051 } else if (*direction != type_direction) {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1052 /* change direction */
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1053 g_object_set(stream, "direction", type_direction, NULL);
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1054 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1055
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1056 return TRUE;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1057 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1058
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1059 gboolean
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1060 purple_media_add_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who,
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1061 PurpleMediaStreamType type,
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1062 const gchar *transmitter)
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1063 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1064 FsStreamDirection type_direction;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1065
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1066 if (type & PURPLE_MEDIA_AUDIO) {
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1067 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_AUDIO);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1068
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1069 if (!purple_media_add_stream_internal(media, sess_id, who,
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1070 FS_MEDIA_TYPE_AUDIO, type_direction,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1071 transmitter)) {
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1072 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1073 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1074 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1075 if (type & PURPLE_MEDIA_VIDEO) {
23824
bfaad8393463 Added some utility functions to convert PurpleMediaStreamType
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
1076 type_direction = purple_media_to_fs_stream_direction(type & PURPLE_MEDIA_VIDEO);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1077
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1078 if (!purple_media_add_stream_internal(media, sess_id, who,
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1079 FS_MEDIA_TYPE_VIDEO, type_direction,
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1080 transmitter)) {
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1081 return FALSE;
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1082 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1083 }
23801
43b3b9ff6028 Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23799
diff changeset
1084 return TRUE;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1085 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1086
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1087 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1088 purple_media_remove_stream(PurpleMedia *media, const gchar *sess_id, const gchar *who)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1089 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1090
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1091 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1092
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1093 PurpleMediaStreamType
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1094 purple_media_get_session_type(PurpleMedia *media, const gchar *sess_id)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1095 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1096 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1097 return session->type;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1098 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1099
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1100 GList *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1101 purple_media_get_local_codecs(PurpleMedia *media, const gchar *sess_id)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1102 {
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1103 GList *codecs;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1104 g_object_get(G_OBJECT(purple_media_get_session(media, sess_id)->session),
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1105 "local-codecs", &codecs, NULL);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1106 return codecs;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1107 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1108
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1109 GList *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1110 purple_media_get_local_candidates(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1111 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1112 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1113 return purple_media_session_get_local_candidates(session, name);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1114 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1115
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1116 GList *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1117 purple_media_get_negotiated_codecs(PurpleMedia *media, const gchar *sess_id)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1118 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1119 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1120 GList *codec_intersection;
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1121 g_object_get(session->session, "negotiated-codecs", &codec_intersection, NULL);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1122 return codec_intersection;
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1123 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1124
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1125 void
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1126 purple_media_add_remote_candidates(PurpleMedia *media, const gchar *sess_id,
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1127 const gchar *name, GList *remote_candidates)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1128 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1129 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1130 FsStream *stream = purple_media_session_get_stream(session, name);
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1131 GList *candidates = remote_candidates;
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1132 for (; candidates; candidates = candidates->next) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1133 GError *err = NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1134 fs_stream_add_remote_candidate(stream, candidates->data, &err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1135
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1136 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1137 purple_debug_error("media", "Error adding remote candidate: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1138 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1139 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1140 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1141 }
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1142 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1143
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1144 FsCandidate *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1145 purple_media_get_local_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1146 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1147 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1148 return session->local_candidate;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1149 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1150
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1151 FsCandidate *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1152 purple_media_get_remote_candidate(PurpleMedia *media, const gchar *sess_id, const gchar *name)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1153 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1154 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1155 return session->remote_candidate;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1156 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1157
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1158 gboolean
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1159 purple_media_set_remote_codecs(PurpleMedia *media, const gchar *sess_id, const gchar *name, GList *codecs)
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1160 {
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1161 PurpleMediaSession *session = purple_media_get_session(media, sess_id);
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23811
diff changeset
1162 FsStream *stream = purple_media_session_get_stream(session, name);
23845
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1163 GError *err = NULL;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1164
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1165 fs_stream_set_remote_codecs(stream, codecs, &err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1166
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1167 if (err) {
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1168 purple_debug_error("media", "Error setting remote codecs: %s\n",
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1169 err->message);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1170 g_error_free(err);
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1171 return FALSE;
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1172 }
13936e4405b7 Added better Farsight error handling.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23844
diff changeset
1173 return TRUE;
23797
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1174 }
e1c8ec1259de Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23793
diff changeset
1175
23830
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1176 gboolean
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1177 purple_media_candidates_prepared(PurpleMedia *media, const gchar *name)
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1178 {
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1179 GList *sessions = purple_media_get_session_names(media);
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1180
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1181 for (; sessions; sessions = sessions->next) {
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1182 const gchar *session = sessions->data;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1183 if (!purple_media_get_local_candidate(media, session, name) ||
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1184 !purple_media_get_remote_candidate(media, session, name))
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1185 return FALSE;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1186 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1187
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1188 return TRUE;
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1189 }
b5a00ddb7077 Jingle sessions now keep track of their transaction state to a degree.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23826
diff changeset
1190
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23801
diff changeset
1191 #endif /* USE_VV */