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