Mercurial > pidgin.yaz
annotate libpurple/mediamanager.c @ 26482:84d09c6499f1
Hide the easy structs in mediamanager.c.
author | Mike Ruprecht <maiku@soc.pidgin.im> |
---|---|
date | Wed, 01 Apr 2009 19:01:31 +0000 |
parents | 9c671fc1b351 |
children | 081a819bc710 |
rev | line source |
---|---|
25546 | 1 /** |
25552 | 2 * @file mediamanager.c Media Manager API |
25546 | 3 * @ingroup core |
25715
b8a73b6dc0a4
* Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
4 */ |
b8a73b6dc0a4
* Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
5 |
b8a73b6dc0a4
* Added documentation to media.h and mediamanager.h
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25706
diff
changeset
|
6 /* purple |
25546 | 7 * |
8 * Purple is the legal property of its developers, whose names are too numerous | |
9 * to list here. Please refer to the COPYRIGHT file distributed with this | |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
25 */ | |
26 | |
25552 | 27 #include "internal.h" |
28 | |
25546 | 29 #include "connection.h" |
26006
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
30 #include "debug.h" |
25723
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
31 #include "marshallers.h" |
26431
1ae3af12095a
Move GStreamer related media functions into its own header.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26389
diff
changeset
|
32 #include "media.h" |
1ae3af12095a
Move GStreamer related media functions into its own header.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26389
diff
changeset
|
33 #include "media-gst.h" |
25546 | 34 #include "mediamanager.h" |
35 | |
25654
cbe97caec684
Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25651
diff
changeset
|
36 #ifdef USE_VV |
25546 | 37 |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25560
diff
changeset
|
38 #include <gst/farsight/fs-conference-iface.h> |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
39 #include <gst/interfaces/xoverlay.h> |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
40 |
26482
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
41 /** @copydoc _PurpleMediaManagerPrivate */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
42 typedef struct _PurpleMediaManagerPrivate PurpleMediaManagerPrivate; |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
43 /** @copydoc _PurpleMediaOutputWindow */ |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
44 typedef struct _PurpleMediaOutputWindow PurpleMediaOutputWindow; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
45 |
26482
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
46 /** The media manager class. */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
47 struct _PurpleMediaManagerClass |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
48 { |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
49 GObjectClass parent_class; /**< The parent class. */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
50 }; |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
51 |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
52 /** The media manager's data. */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
53 struct _PurpleMediaManager |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
54 { |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
55 GObject parent; /**< The parent of this manager. */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
56 PurpleMediaManagerPrivate *priv; /**< Private data for the manager. */ |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
57 }; |
84d09c6499f1
Hide the easy structs in mediamanager.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26474
diff
changeset
|
58 |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
59 struct _PurpleMediaOutputWindow |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
60 { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
61 gulong id; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
62 PurpleMedia *media; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
63 gchar *session_id; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
64 gchar *participant; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
65 gulong window_id; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
66 GstElement *sink; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
67 }; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
68 #endif |
25546 | 69 |
70 struct _PurpleMediaManagerPrivate | |
71 { | |
26196
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
72 GstElement *pipeline; |
26472
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
73 PurpleMediaCaps ui_caps; |
25546 | 74 GList *medias; |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
75 GList *elements; |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
76 GList *output_windows; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
77 gulong next_output_window_id; |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
78 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
79 PurpleMediaElementInfo *video_src; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
80 PurpleMediaElementInfo *video_sink; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
81 PurpleMediaElementInfo *audio_src; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
82 PurpleMediaElementInfo *audio_sink; |
25546 | 83 }; |
84 | |
85 #define PURPLE_MEDIA_MANAGER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), PURPLE_TYPE_MEDIA_MANAGER, PurpleMediaManagerPrivate)) | |
86 | |
87 static void purple_media_manager_class_init (PurpleMediaManagerClass *klass); | |
88 static void purple_media_manager_init (PurpleMediaManager *media); | |
89 static void purple_media_manager_finalize (GObject *object); | |
90 | |
91 static GObjectClass *parent_class = NULL; | |
92 | |
93 | |
94 | |
95 enum { | |
25548
70cdff43ec76
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents:
25547
diff
changeset
|
96 INIT_MEDIA, |
25546 | 97 LAST_SIGNAL |
98 }; | |
99 static guint purple_media_manager_signals[LAST_SIGNAL] = {0}; | |
100 | |
101 enum { | |
102 PROP_0, | |
103 PROP_FARSIGHT_SESSION, | |
104 PROP_NAME, | |
105 PROP_CONNECTION, | |
106 PROP_MIC_ELEMENT, | |
107 PROP_SPEAKER_ELEMENT, | |
108 }; | |
109 | |
110 GType | |
111 purple_media_manager_get_type() | |
112 { | |
113 static GType type = 0; | |
114 | |
115 if (type == 0) { | |
116 static const GTypeInfo info = { | |
117 sizeof(PurpleMediaManagerClass), | |
118 NULL, | |
119 NULL, | |
120 (GClassInitFunc) purple_media_manager_class_init, | |
121 NULL, | |
122 NULL, | |
123 sizeof(PurpleMediaManager), | |
124 0, | |
25560
750d700098c1
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25552
diff
changeset
|
125 (GInstanceInitFunc) purple_media_manager_init, |
750d700098c1
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25552
diff
changeset
|
126 NULL |
25546 | 127 }; |
128 type = g_type_register_static(G_TYPE_OBJECT, "PurpleMediaManager", &info, 0); | |
129 } | |
130 return type; | |
131 } | |
132 | |
133 | |
134 static void | |
135 purple_media_manager_class_init (PurpleMediaManagerClass *klass) | |
136 { | |
137 GObjectClass *gobject_class = (GObjectClass*)klass; | |
138 parent_class = g_type_class_peek_parent(klass); | |
139 | |
140 gobject_class->finalize = purple_media_manager_finalize; | |
141 | |
25548
70cdff43ec76
You can actually receive Google Talk voice calls with crappy UI now
Sean Egan <seanegan@gmail.com>
parents:
25547
diff
changeset
|
142 purple_media_manager_signals[INIT_MEDIA] = g_signal_new ("init-media", |
25546 | 143 G_TYPE_FROM_CLASS (klass), |
144 G_SIGNAL_RUN_LAST, | |
145 0, NULL, NULL, | |
26059
18b71033ea6e
Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26026
diff
changeset
|
146 purple_smarshal_BOOLEAN__OBJECT_POINTER_STRING, |
18b71033ea6e
Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26026
diff
changeset
|
147 G_TYPE_BOOLEAN, 3, PURPLE_TYPE_MEDIA, |
18b71033ea6e
Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26026
diff
changeset
|
148 G_TYPE_POINTER, G_TYPE_STRING); |
25547 | 149 g_type_class_add_private(klass, sizeof(PurpleMediaManagerPrivate)); |
25546 | 150 } |
151 | |
152 static void | |
153 purple_media_manager_init (PurpleMediaManager *media) | |
154 { | |
155 media->priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); | |
25547 | 156 media->priv->medias = NULL; |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
157 media->priv->next_output_window_id = 1; |
25546 | 158 } |
159 | |
160 static void | |
161 purple_media_manager_finalize (GObject *media) | |
162 { | |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
163 PurpleMediaManagerPrivate *priv = PURPLE_MEDIA_MANAGER_GET_PRIVATE(media); |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
164 for (; priv->medias; priv->medias = |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
165 g_list_delete_link(priv->medias, priv->medias)) { |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
166 g_object_unref(priv->medias->data); |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
167 } |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
168 for (; priv->elements; priv->elements = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
169 g_list_delete_link(priv->elements, priv->elements)); |
25546 | 170 parent_class->finalize(media); |
171 } | |
172 | |
173 PurpleMediaManager * | |
174 purple_media_manager_get() | |
175 { | |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
176 #ifdef USE_VV |
25546 | 177 static PurpleMediaManager *manager = NULL; |
178 | |
179 if (manager == NULL) | |
180 manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL)); | |
181 return manager; | |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
182 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
183 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
184 #endif |
25546 | 185 } |
186 | |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
187 #ifdef USE_VV |
26196
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
188 static gboolean |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
189 pipeline_bus_call(GstBus *bus, GstMessage *msg, PurpleMediaManager *manager) |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
190 { |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
191 switch(GST_MESSAGE_TYPE(msg)) { |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
192 case GST_MESSAGE_EOS: |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
193 purple_debug_info("mediamanager", "End of Stream\n"); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
194 break; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
195 case GST_MESSAGE_ERROR: { |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
196 gchar *debug = NULL; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
197 GError *err = NULL; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
198 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
199 gst_message_parse_error(msg, &err, &debug); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
200 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
201 purple_debug_error("mediamanager", |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
202 "gst pipeline error: %s\n", |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
203 err->message); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
204 g_error_free(err); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
205 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
206 if (debug) { |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
207 purple_debug_error("mediamanager", |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
208 "Debug details: %s\n", debug); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
209 g_free (debug); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
210 } |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
211 break; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
212 } |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
213 default: |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
214 break; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
215 } |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
216 return TRUE; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
217 } |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
218 #endif |
26196
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
219 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
220 GstElement * |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
221 purple_media_manager_get_pipeline(PurpleMediaManager *manager) |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
222 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
223 #ifdef USE_VV |
26196
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
224 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
225 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
226 if (manager->priv->pipeline == NULL) { |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
227 GstBus *bus; |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
228 manager->priv->pipeline = gst_pipeline_new(NULL); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
229 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
230 bus = gst_pipeline_get_bus( |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
231 GST_PIPELINE(manager->priv->pipeline)); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
232 gst_bus_add_signal_watch(GST_BUS(bus)); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
233 g_signal_connect(G_OBJECT(bus), "message", |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
234 G_CALLBACK(pipeline_bus_call), manager); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
235 gst_bus_set_sync_handler(bus, |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
236 gst_bus_sync_signal_handler, NULL); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
237 gst_object_unref(bus); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
238 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
239 gst_element_set_state(manager->priv->pipeline, |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
240 GST_STATE_PLAYING); |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
241 } |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
242 |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
243 return manager->priv->pipeline; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
244 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
245 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
246 #endif |
26196
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
247 } |
730e760ca39f
Move pipeline creation into the media manager.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26189
diff
changeset
|
248 |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25560
diff
changeset
|
249 PurpleMedia * |
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25560
diff
changeset
|
250 purple_media_manager_create_media(PurpleMediaManager *manager, |
25546 | 251 PurpleConnection *gc, |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25560
diff
changeset
|
252 const char *conference_type, |
26063
c7d4b67b3332
Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26061
diff
changeset
|
253 const char *remote_user, |
c7d4b67b3332
Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26061
diff
changeset
|
254 gboolean initiator) |
25546 | 255 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
256 #ifdef USE_VV |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
257 PurpleMedia *media; |
25647
e1c8ec1259de
Updates voice and video to use Farsight 2, gets XMPP voice conferences
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25560
diff
changeset
|
258 FsConference *conference = FS_CONFERENCE(gst_element_factory_make(conference_type, NULL)); |
25706
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
259 GstStateChangeReturn ret; |
25723
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
260 gboolean signal_ret; |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
261 |
26006
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
262 if (conference == NULL) { |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
263 purple_conv_present_error(remote_user, |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
264 purple_connection_get_account(gc), |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
265 _("Error creating conference.")); |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
266 purple_debug_error("media", "Conference == NULL\n"); |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
267 return NULL; |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
268 } |
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
269 |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
270 media = PURPLE_MEDIA(g_object_new(purple_media_get_type(), |
26189
76104100cb87
Use the media manager that created the media session in media.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26165
diff
changeset
|
271 "manager", manager, |
26203
7738f530a967
Added the connection property back to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26199
diff
changeset
|
272 "connection", gc, |
26061
ee2a2a9dda01
Rename "fs-conference" to "conference".
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26060
diff
changeset
|
273 "conference", conference, |
26063
c7d4b67b3332
Add initiator property to PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26061
diff
changeset
|
274 "initiator", initiator, |
25651
43b3b9ff6028
Added better Farsight error handling. Fixes several crash bugs related
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25647
diff
changeset
|
275 NULL)); |
25706
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
276 |
26152
7be8c88d630c
Have all media sessions use a single pipeline.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26063
diff
changeset
|
277 ret = gst_element_set_state(GST_ELEMENT(conference), GST_STATE_PLAYING); |
25706
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
278 |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
279 if (ret == GST_STATE_CHANGE_FAILURE) { |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
280 purple_conv_present_error(remote_user, |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
281 purple_connection_get_account(gc), |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
282 _("Error creating conference.")); |
26006
0baeafee93be
Gracefully handle missing the fsrtpconference GStreamer plugin.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25727
diff
changeset
|
283 purple_debug_error("media", "Failed to start conference.\n"); |
25706
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
284 g_object_unref(media); |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
285 return NULL; |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
286 } |
1c68f78414b7
Set the media pipeline to PLAYING immediately after initialization
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25654
diff
changeset
|
287 |
25723
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
288 g_signal_emit(manager, purple_media_manager_signals[INIT_MEDIA], 0, |
26059
18b71033ea6e
Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26026
diff
changeset
|
289 media, gc, remote_user, &signal_ret); |
25723
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
290 |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
291 if (signal_ret == FALSE) { |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
292 g_object_unref(media); |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
293 return NULL; |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
294 } |
1d9a2296d5d2
Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25715
diff
changeset
|
295 |
25546 | 296 manager->priv->medias = g_list_append(manager->priv->medias, media); |
297 return media; | |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
298 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
299 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
300 #endif |
25546 | 301 } |
302 | |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
303 GList * |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
304 purple_media_manager_get_media(PurpleMediaManager *manager) |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
305 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
306 #ifdef USE_VV |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
307 return manager->priv->medias; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
308 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
309 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
310 #endif |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
311 } |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
312 |
26205
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
313 GList * |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
314 purple_media_manager_get_media_by_connection(PurpleMediaManager *manager, |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
315 PurpleConnection *pc) |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
316 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
317 #ifdef USE_VV |
26205
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
318 GList *media = NULL; |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
319 GList *iter; |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
320 |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
321 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
322 |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
323 iter = manager->priv->medias; |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
324 for (; iter; iter = g_list_next(iter)) { |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
325 if (purple_media_get_connection(iter->data) == pc) { |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
326 media = g_list_prepend(media, iter->data); |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
327 } |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
328 } |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
329 |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
330 return media; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
331 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
332 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
333 #endif |
26205
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
334 } |
75a02ffb0139
Added purple_media_manager_get_media_by_connection.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26203
diff
changeset
|
335 |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
336 void |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
337 purple_media_manager_remove_media(PurpleMediaManager *manager, |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
338 PurpleMedia *media) |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
339 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
340 #ifdef USE_VV |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
341 GList *list = g_list_find(manager->priv->medias, media); |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
342 if (list) |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
343 manager->priv->medias = |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
344 g_list_delete_link(manager->priv->medias, list); |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
345 #endif |
25727
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
346 } |
f10e0ac24595
* Added input/output volume preferences for voice conversations.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
25723
diff
changeset
|
347 |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
348 #ifdef USE_VV |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
349 static void |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
350 request_pad_unlinked_cb(GstPad *pad, GstPad *peer, gpointer user_data) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
351 { |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
352 GstElement *parent = GST_ELEMENT_PARENT(pad); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
353 GstIterator *iter; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
354 GstPad *remaining_pad; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
355 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
356 gst_element_release_request_pad(GST_ELEMENT_PARENT(pad), pad); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
357 iter = gst_element_iterate_pads(parent); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
358 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
359 if (gst_iterator_next(iter, (gpointer)&remaining_pad) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
360 == GST_ITERATOR_DONE) { |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
361 gst_element_set_locked_state(parent, TRUE); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
362 gst_element_set_state(parent, GST_STATE_NULL); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
363 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(parent)), parent); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
364 } |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
365 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
366 gst_iterator_free(iter); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
367 } |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
368 #endif |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
369 |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
370 GstElement * |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
371 purple_media_manager_get_element(PurpleMediaManager *manager, |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
372 PurpleMediaSessionType type, PurpleMedia *media, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
373 const gchar *session_id, const gchar *participant) |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
374 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
375 #ifdef USE_VV |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
376 GstElement *ret = NULL; |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
377 PurpleMediaElementInfo *info = NULL; |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
378 |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
379 if (type & PURPLE_MEDIA_SEND_AUDIO) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
380 info = manager->priv->audio_src; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
381 else if (type & PURPLE_MEDIA_RECV_AUDIO) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
382 info = manager->priv->audio_sink; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
383 else if (type & PURPLE_MEDIA_SEND_VIDEO) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
384 info = manager->priv->video_src; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
385 else if (type & PURPLE_MEDIA_RECV_VIDEO) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
386 info = manager->priv->video_sink; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
387 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
388 if (info == NULL) |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
389 return NULL; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
390 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
391 if (info->type & PURPLE_MEDIA_ELEMENT_UNIQUE && |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
392 info->type & PURPLE_MEDIA_ELEMENT_SRC) { |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
393 GstElement *tee; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
394 GstPad *pad; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
395 GstPad *ghost; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
396 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
397 ret = gst_bin_get_by_name(GST_BIN( |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
398 purple_media_manager_get_pipeline( |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
399 manager)), info->id); |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
400 |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
401 if (ret == NULL) { |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
402 GstElement *bin, *fakesink; |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
403 ret = info->create(media, session_id, participant); |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
404 bin = gst_bin_new(info->id); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
405 tee = gst_element_factory_make("tee", "tee"); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
406 gst_bin_add_many(GST_BIN(bin), ret, tee, NULL); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
407 gst_element_link(ret, tee); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
408 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
409 /* |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
410 * This shouldn't be necessary, but it stops it from |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
411 * giving a not-linked error upon destruction |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
412 */ |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
413 fakesink = gst_element_factory_make("fakesink", NULL); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
414 g_object_set(fakesink, "sync", FALSE, NULL); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
415 gst_bin_add(GST_BIN(bin), fakesink); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
416 gst_element_link(tee, fakesink); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
417 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
418 ret = bin; |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
419 gst_element_set_locked_state(ret, TRUE); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
420 gst_object_ref(ret); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
421 gst_bin_add(GST_BIN(purple_media_manager_get_pipeline( |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
422 manager)), ret); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
423 } |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
424 |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
425 tee = gst_bin_get_by_name(GST_BIN(ret), "tee"); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
426 pad = gst_element_get_request_pad(tee, "src%d"); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
427 gst_object_unref(tee); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
428 ghost = gst_ghost_pad_new(NULL, pad); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
429 gst_object_unref(pad); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
430 g_signal_connect(GST_PAD(ghost), "unlinked", |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
431 G_CALLBACK(request_pad_unlinked_cb), NULL); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
432 gst_pad_set_active(ghost, TRUE); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
433 gst_element_add_pad(ret, ghost); |
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
434 } else { |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
435 ret = info->create(media, session_id, participant); |
26463
6bcf5ad967ea
Make sharing sources between media sessions work.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26432
diff
changeset
|
436 } |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
437 |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
438 if (ret == NULL) |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
439 purple_debug_error("media", "Error creating source or sink\n"); |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
440 |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
441 return ret; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
442 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
443 return NULL; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
444 #endif |
26026
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
445 } |
431c59a6959d
Add purple_media_manager_get_element.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26006
diff
changeset
|
446 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
447 PurpleMediaElementInfo * |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
448 purple_media_manager_get_element_info(PurpleMediaManager *manager, |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
449 const gchar *id) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
450 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
451 #ifdef USE_VV |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
452 GList *iter; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
453 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
454 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
455 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
456 iter = manager->priv->elements; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
457 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
458 for (; iter; iter = g_list_next(iter)) { |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
459 PurpleMediaElementInfo *info = iter->data; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
460 if (!strcmp(info->id, id)) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
461 return info; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
462 } |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
463 #endif |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
464 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
465 return NULL; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
466 } |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
467 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
468 gboolean |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
469 purple_media_manager_register_element(PurpleMediaManager *manager, |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
470 PurpleMediaElementInfo *info) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
471 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
472 #ifdef USE_VV |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
473 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
474 g_return_val_if_fail(info != NULL, FALSE); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
475 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
476 if (purple_media_manager_get_element_info(manager, info->id) != NULL) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
477 return FALSE; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
478 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
479 manager->priv->elements = |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
480 g_list_prepend(manager->priv->elements, info); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
481 return TRUE; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
482 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
483 return FALSE; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
484 #endif |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
485 } |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
486 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
487 gboolean |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
488 purple_media_manager_unregister_element(PurpleMediaManager *manager, |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
489 const gchar *id) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
490 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
491 #ifdef USE_VV |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
492 PurpleMediaElementInfo *info; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
493 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
494 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
495 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
496 info = purple_media_manager_get_element_info(manager, id); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
497 |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
498 if (info == NULL) |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
499 return FALSE; |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
500 |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
501 if (manager->priv->audio_src == info) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
502 manager->priv->audio_src = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
503 if (manager->priv->audio_sink == info) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
504 manager->priv->audio_sink = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
505 if (manager->priv->video_src == info) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
506 manager->priv->video_src = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
507 if (manager->priv->video_sink == info) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
508 manager->priv->video_sink = NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
509 |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
510 manager->priv->elements = g_list_remove( |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
511 manager->priv->elements, info); |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
512 return TRUE; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
513 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
514 return FALSE; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
515 #endif |
26163
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
516 } |
521366dfd8db
Implement functions to register and unregister media elements for use in
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26152
diff
changeset
|
517 |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
518 gboolean |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
519 purple_media_manager_set_active_element(PurpleMediaManager *manager, |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
520 PurpleMediaElementInfo *info) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
521 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
522 #ifdef USE_VV |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
523 gboolean ret = FALSE; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
524 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
525 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
526 g_return_val_if_fail(info != NULL, FALSE); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
527 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
528 if (purple_media_manager_get_element_info(manager, info->id) == NULL) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
529 purple_media_manager_register_element(manager, info); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
530 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
531 if (info->type & PURPLE_MEDIA_ELEMENT_SRC) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
532 if (info->type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
533 manager->priv->audio_src = info; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
534 ret = TRUE; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
535 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
536 if (info->type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
537 manager->priv->video_src = info; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
538 ret = TRUE; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
539 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
540 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
541 if (info->type & PURPLE_MEDIA_ELEMENT_SINK) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
542 if (info->type & PURPLE_MEDIA_ELEMENT_AUDIO) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
543 manager->priv->audio_sink = info; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
544 ret = TRUE; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
545 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
546 if (info->type & PURPLE_MEDIA_ELEMENT_VIDEO) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
547 manager->priv->video_sink = info; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
548 ret = TRUE; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
549 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
550 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
551 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
552 return ret; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
553 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
554 return FALSE; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
555 #endif |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
556 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
557 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
558 PurpleMediaElementInfo * |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
559 purple_media_manager_get_active_element(PurpleMediaManager *manager, |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
560 PurpleMediaElementType type) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
561 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
562 #ifdef USE_VV |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
563 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), NULL); |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
564 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
565 if (type & PURPLE_MEDIA_ELEMENT_SRC) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
566 if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
567 return manager->priv->audio_src; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
568 else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
569 return manager->priv->video_src; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
570 } else if (type & PURPLE_MEDIA_ELEMENT_SINK) { |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
571 if (type & PURPLE_MEDIA_ELEMENT_AUDIO) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
572 return manager->priv->audio_sink; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
573 else if (type & PURPLE_MEDIA_ELEMENT_VIDEO) |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
574 return manager->priv->video_sink; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
575 } |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
576 #endif |
26165
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
577 |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
578 return NULL; |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
579 } |
0e8814c437b2
Add active elements to PurpleMediaManager. These are the elements that
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26163
diff
changeset
|
580 |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
581 #ifdef USE_VV |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
582 static void |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
583 window_id_cb(GstBus *bus, GstMessage *msg, PurpleMediaOutputWindow *ow) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
584 { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
585 if (GST_MESSAGE_TYPE(msg) != GST_MESSAGE_ELEMENT || |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
586 !gst_structure_has_name(msg->structure, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
587 "prepare-xwindow-id")) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
588 return; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
589 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
590 if (GST_ELEMENT_PARENT(GST_MESSAGE_SRC(msg)) == ow->sink) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
591 g_signal_handlers_disconnect_matched(bus, G_SIGNAL_MATCH_FUNC |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
592 | G_SIGNAL_MATCH_DATA, 0, 0, NULL, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
593 window_id_cb, ow); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
594 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
595 gst_x_overlay_set_xwindow_id(GST_X_OVERLAY( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
596 GST_MESSAGE_SRC(msg)), ow->window_id); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
597 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
598 } |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
599 #endif |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
600 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
601 gboolean |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
602 purple_media_manager_create_output_window(PurpleMediaManager *manager, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
603 PurpleMedia *media, const gchar *session_id, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
604 const gchar *participant) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
605 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
606 #ifdef USE_VV |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
607 GList *iter; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
608 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
609 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
610 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
611 iter = manager->priv->output_windows; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
612 for(; iter; iter = g_list_next(iter)) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
613 PurpleMediaOutputWindow *ow = iter->data; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
614 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
615 if (ow->sink == NULL && ow->media == media && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
616 ((participant != NULL && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
617 ow->participant != NULL && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
618 !strcmp(participant, ow->participant)) || |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
619 (participant == ow->participant)) && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
620 !strcmp(session_id, ow->session_id)) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
621 GstBus *bus; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
622 GstElement *queue; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
623 GstElement *tee = purple_media_get_tee(media, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
624 session_id, participant); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
625 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
626 if (tee == NULL) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
627 continue; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
628 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
629 queue = gst_element_factory_make( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
630 "queue", NULL); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
631 ow->sink = purple_media_manager_get_element( |
26474
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
632 manager, PURPLE_MEDIA_RECV_VIDEO, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
633 ow->media, ow->session_id, |
9c671fc1b351
Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26472
diff
changeset
|
634 ow->participant); |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
635 |
26389
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
636 if (participant == NULL) { |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
637 /* aka this is a preview sink */ |
26389
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
638 GObjectClass *klass = |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
639 G_OBJECT_GET_CLASS(ow->sink); |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
640 if (g_object_class_find_property(klass, |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
641 "sync")) |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
642 g_object_set(G_OBJECT(ow->sink), |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
643 "sync", "FALSE", NULL); |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
644 if (g_object_class_find_property(klass, |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
645 "async")) |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
646 g_object_set(G_OBJECT(ow->sink), |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
647 "async", FALSE, NULL); |
5ee7e8f209bb
Silence warning about videotestsrc not having two properties.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26205
diff
changeset
|
648 } |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
649 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
650 gst_bin_add_many(GST_BIN(GST_ELEMENT_PARENT(tee)), |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
651 queue, ow->sink, NULL); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
652 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
653 bus = gst_pipeline_get_bus(GST_PIPELINE( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
654 manager->priv->pipeline)); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
655 g_signal_connect(bus, "sync-message::element", |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
656 G_CALLBACK(window_id_cb), ow); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
657 gst_object_unref(bus); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
658 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
659 gst_element_sync_state_with_parent(ow->sink); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
660 gst_element_link(queue, ow->sink); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
661 gst_element_sync_state_with_parent(queue); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
662 gst_element_link(tee, queue); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
663 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
664 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
665 return TRUE; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
666 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
667 return FALSE; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
668 #endif |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
669 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
670 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
671 gulong |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
672 purple_media_manager_set_output_window(PurpleMediaManager *manager, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
673 PurpleMedia *media, const gchar *session_id, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
674 const gchar *participant, gulong window_id) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
675 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
676 #ifdef USE_VV |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
677 PurpleMediaOutputWindow *output_window; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
678 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
679 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
680 g_return_val_if_fail(PURPLE_IS_MEDIA(media), FALSE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
681 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
682 output_window = g_new0(PurpleMediaOutputWindow, 1); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
683 output_window->id = manager->priv->next_output_window_id++; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
684 output_window->media = media; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
685 output_window->session_id = g_strdup(session_id); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
686 output_window->participant = g_strdup(participant); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
687 output_window->window_id = window_id; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
688 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
689 manager->priv->output_windows = g_list_prepend( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
690 manager->priv->output_windows, output_window); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
691 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
692 if (purple_media_get_tee(media, session_id, participant) != NULL) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
693 purple_media_manager_create_output_window(manager, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
694 media, session_id, participant); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
695 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
696 return output_window->id; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
697 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
698 return 0; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
699 #endif |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
700 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
701 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
702 gboolean |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
703 purple_media_manager_remove_output_window(PurpleMediaManager *manager, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
704 gulong output_window_id) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
705 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
706 #ifdef USE_VV |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
707 PurpleMediaOutputWindow *output_window = NULL; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
708 GList *iter; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
709 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
710 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), FALSE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
711 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
712 iter = manager->priv->output_windows; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
713 for (; iter; iter = g_list_next(iter)) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
714 PurpleMediaOutputWindow *ow = iter->data; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
715 if (ow->id == output_window_id) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
716 manager->priv->output_windows = g_list_delete_link( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
717 manager->priv->output_windows, iter); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
718 output_window = ow; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
719 break; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
720 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
721 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
722 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
723 if (output_window == NULL) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
724 return FALSE; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
725 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
726 if (output_window->sink != NULL) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
727 GstPad *pad = gst_element_get_static_pad( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
728 output_window->sink, "sink"); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
729 GstPad *peer = gst_pad_get_peer(pad); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
730 GstElement *queue = GST_ELEMENT_PARENT(peer); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
731 gst_object_unref(pad); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
732 pad = gst_element_get_static_pad(queue, "sink"); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
733 peer = gst_pad_get_peer(pad); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
734 gst_object_unref(pad); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
735 gst_element_release_request_pad(GST_ELEMENT_PARENT(peer), peer); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
736 gst_element_set_locked_state(queue, TRUE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
737 gst_element_set_state(queue, GST_STATE_NULL); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
738 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(queue)), queue); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
739 gst_element_set_locked_state(output_window->sink, TRUE); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
740 gst_element_set_state(output_window->sink, GST_STATE_NULL); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
741 gst_bin_remove(GST_BIN(GST_ELEMENT_PARENT(output_window->sink)), |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
742 output_window->sink); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
743 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
744 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
745 g_free(output_window->session_id); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
746 g_free(output_window->participant); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
747 g_free(output_window); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
748 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
749 return TRUE; |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
750 #else |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
751 return FALSE; |
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
752 #endif |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
753 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
754 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
755 void |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
756 purple_media_manager_remove_output_windows(PurpleMediaManager *manager, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
757 PurpleMedia *media, const gchar *session_id, |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
758 const gchar *participant) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
759 { |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
760 #ifdef USE_VV |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
761 GList *iter; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
762 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
763 g_return_if_fail(PURPLE_IS_MEDIA(media)); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
764 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
765 iter = manager->priv->output_windows; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
766 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
767 for (; iter;) { |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
768 PurpleMediaOutputWindow *ow = iter->data; |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
769 iter = g_list_next(iter); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
770 |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
771 if (media == ow->media && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
772 ((session_id != NULL && ow->session_id != NULL && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
773 !strcmp(session_id, ow->session_id)) || |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
774 (session_id == ow->session_id)) && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
775 ((participant != NULL && ow->participant != NULL && |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
776 !strcmp(participant, ow->participant)) || |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
777 (participant == ow->participant))) |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
778 purple_media_manager_remove_output_window( |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
779 manager, ow->id); |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
780 } |
26432
064657db29c4
Properly wrap media functions so the API doesn't disappear when USE_VV
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26431
diff
changeset
|
781 #endif |
26199
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
782 } |
6cf36f68033c
Only create output windows once there's data to be output.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26196
diff
changeset
|
783 |
26472
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
784 void |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
785 purple_media_manager_set_ui_caps(PurpleMediaManager *manager, |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
786 PurpleMediaCaps caps) |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
787 { |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
788 #ifdef USE_VV |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
789 g_return_if_fail(PURPLE_IS_MEDIA_MANAGER(manager)); |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
790 manager->priv->ui_caps = caps; |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
791 #endif |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
792 } |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
793 |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
794 PurpleMediaCaps |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
795 purple_media_manager_get_ui_caps(PurpleMediaManager *manager) |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
796 { |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
797 #ifdef USE_VV |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
798 g_return_val_if_fail(PURPLE_IS_MEDIA_MANAGER(manager), |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
799 PURPLE_MEDIA_CAPS_NONE); |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
800 return manager->priv->ui_caps; |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
801 #else |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
802 return PURPLE_CAPS_NONE; |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
803 #endif |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
804 } |
507d2366d329
Add purple_media_manager_{get,set}_ui_caps.
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
26463
diff
changeset
|
805 |